【发布时间】:2014-12-12 19:41:32
【问题描述】:
我有一个GPUImageStillCamera,我正在用它来构建一个相机,然后我将它裁剪成一个正方形
stillCamera = [[GPUImageStillCamera alloc] initWithSessionPreset:AVCaptureSessionPreset1280x720 cameraPosition:AVCaptureDevicePositionBack];
stillCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
//Creating a square crop filter
cropFilter = [[GPUImageCropFilter alloc] initWithCropRegion:CGRectMake(0.f, (720.0f/1280.0f)/2.0f, 1.f, (720.0f/1280.0f))];
我想让用户点击来调整焦点和曝光控制,而当我点击时,相机确实会尝试调整焦点和曝光,但只有大约 30% 的时间是正确的。我想也许我需要发送未裁剪相机的焦点(因为相对点会有所不同),但我得到了相同的体验。用户单击焦点和曝光调整,但它没有在触摸点上聚焦或设置适当的曝光。有什么想法吗?
-(void)imageTouch:(UITapGestureRecognizer *)recognizer{
//Focus point relative to the square
//CGPoint translation = [recognizer locationInView:cameraImagePreview];
//CGPoint focusPoint = CGPointMake(translation.x/cameraHolder.frame.size.width, translation.y/cameraHolder.frame.size.height);
//Focus point relative to the uncropped camera
CGPoint translation = [recognizer locationInView:fullCameraFocusPoint];
CGPoint focusPoint = CGPointMake(translation.x/fullCameraFocusPoint.frame.size.width, translation.y/fullCameraFocusPoint.frame.size.height);
//Set the focus point of the camera
if (stillCamera.inputCamera.isFocusPointOfInterestSupported && [stillCamera.inputCamera isFocusModeSupported:AVCaptureFocusModeAutoFocus]) {
[stillCamera.inputCamera lockForConfiguration:nil];
stillCamera.inputCamera.focusPointOfInterest = focusPoint;
stillCamera.inputCamera.focusMode = AVCaptureFocusModeAutoFocus;
if (stillCamera.inputCamera.exposurePointOfInterestSupported && [stillCamera.inputCamera isExposureModeSupported:AVCaptureExposureModeAutoExpose]) {
stillCamera.inputCamera.exposurePointOfInterest = focusPoint;
stillCamera.inputCamera.exposureMode = AVCaptureExposureModeAutoExpose;
}
[stillCamera.inputCamera unlockForConfiguration];
}
【问题讨论】:
标签: avfoundation gpuimage avcapturesession avcapturedevice