내 IOS 응용 프로그램 중 하나에서 바코드 스캐너를 사용하려고합니다. 바코드 스캐너를 성공적으로 구현했습니다.AVFoundation을 사용하여 스캐닝 경계를 설정하는 방법
현재 바코드 스캐닝은 전체 화면으로 만 표시됩니다. 하지만 내가 원하는 것은 비디오를 전체 화면으로보아야하고 바코드는 특정 부분에서만 스캔해야한다는 것입니다. 즉, 해당 부분에 바코드가 있으면 그 부분 만 표시해야합니다. 당신이 무엇을
session=[[AVCaptureSession alloc]init];
device=[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error=nil;
input=[AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
if (input) {
[session addInput:input];
}
else{
NSLog(@"Errod : %@",error);
}
output=[[AVCaptureMetadataOutput alloc]init];
[output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
[session addOutput:output];
output.metadataObjectTypes=[output availableMetadataObjectTypes];
prevLayer=[AVCaptureVideoPreviewLayer layerWithSession:session];
[prevLayer setFrame:self.view.bounds];
[prevLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
[self.view.layer addSublayer:prevLayer];
[session startRunning];
[self.view bringSubviewToFront:self.lblCode];
[self.view bringSubviewToFront:self.imgShade1];
[self.view bringSubviewToFront:self.imgShade2];
어디에서 해결할 수 있습니까? – SergioM