我正在使用本教程:https://github.com/BradLarson/GPUImage在 iOS 中创建视频捕获应用程序。
应用程序已启动并正在运行。我有一个问题...
我们使用此代码启动实时视频捕获 session :
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];
}
}
}
曝光和焦点正在锁定,但过了一段时间就卡住了...
正在努力。
关于iphone - 使用 'tap-to-focus' 和曝光控制的 GPUImage 视频捕获,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17986661/