我正在使用本教程:https://github.com/BradLarson/GPUImage在iOS中创建视频捕获应用程序。
应用程序已启动并正在运行。我有一个问题。。。
我们使用此代码启动实时视频捕获会话:
GPUImageVideoCamera *videoCamera = [[GPUImageVideoCamera alloc]
initWithSessionPreset:AVCaptureSessionPreset640x480
cameraPosition:AVCaptureDevicePositionBack];
videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
GPUImageFilter *customFilter = [[GPUImageFilter alloc]
initWithFragmentShaderFromFile:@"CustomShader"];
GPUImageView *filteredVideoView = [[GPUImageView alloc] initWithFrame:CGRectMake(0.0,
0.0, viewWidth, viewHeight)];
[videoCamera addTarget:customFilter];
[customFilter addTarget:filteredVideoView];
[videoCamera startCameraCapture];
但是如何在这个框架中启用"图像拾取"风格的"点击即聚焦"和点击即曝光校正功能。
有可能吗?你能告诉我正确的方向吗。
请帮忙。
提前谢谢。
得到了,部分:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView:self.view];
if([videoCamera.inputCamera isFocusPointOfInterestSupported]&&[videoCamera.inputCamera isFocusModeSupported:AVCaptureFocusModeAutoFocus])
{
if([videoCamera.inputCamera lockForConfiguration :nil])
{
[videoCamera.inputCamera setFocusPointOfInterest :touchPoint];
[videoCamera.inputCamera setFocusMode :AVCaptureFocusModeLocked];
if([videoCamera.inputCamera isExposurePointOfInterestSupported])
{
[videoCamera.inputCamera setExposurePointOfInterest:touchPoint];
[videoCamera.inputCamera setExposureMode:AVCaptureExposureModeLocked];
}
[videoCamera.inputCamera unlockForConfiguration];
}
}
}
曝光和焦点被锁定,但一段时间后就会冻结。。。
正在处理它。