通过“点击对焦”和曝光控制进行GPUImage视频捕捉

时间:2013-08-01 06:28:38

标签: iphone ios video-capture gpuimage

我正在使用本教程: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];

但是如何在此框架中启用“图像选择器”样式“聚焦点击”和点击功能上的曝光校正。

有可能吗?能不能指出我正确的方向。

请帮忙。

提前致谢。

1 个答案:

答案 0 :(得分:5)

得到它,部分:

 - (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];
}
}

}

曝光和焦点被锁定,但一段时间后冻结......

正在努力。