2013-08-01 47 views
3

我使用本教程:https://github.com/BradLarson/GPUImage在iOS中創建視頻捕獲應用程序。GPUImage具有「點對焦」和曝光控制的視頻捕獲

該應用程序已啓動並正在運行。我有一個查詢...

我們使用此代碼啓動一個實時視頻捕獲會話:

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

但如何啓用「圖片選擇」風格「聚焦啓動抽頭」和曝光校正挖掘功能到這個框架。

可能嗎?你能否指點我正確的方向。

請幫忙。

在此先感謝。

回答

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

} 

曝光和對焦被鎖,但一段時間後凍結...

它的工作。

+0

使用AVCaptureExposureModeAutoExpose凍結輸入視頻。 – metsburg

+3

好吧......讓它工作......你不能直接給觸摸點自動曝光......你需要將它轉換爲0-1的比例。 – metsburg

+0

你能分享你的代碼嗎?你支持所有的方向嗎?我似乎無法讓它在Landscape中工作。 – kanso

相關問題