2015-09-28 69 views
0

我使用iPhone相机捕捉iOS应用程序中的图像。 AVCaptureVideoDataOutputSampleBufferDelegate用于从iPhone摄像头获取图像。 程序的一部分如下所示。是否可以自动调整iPhone中的图像亮度?

 AVCaptureDevice *videoDevice = [AVCamViewController deviceWithMediaType:AVMediaTypeVideo preferringPosition:AVCaptureDevicePositionBack]; 


     AVCaptureDeviceInput *videoDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error]; 

     if (error) 
     { 
      NSLog(@"%@", error); 
     } 

     if ([session canAddInput:videoDeviceInput]) 
     { 
      [session addInput:videoDeviceInput]; 
      [self setVideoDeviceInput:videoDeviceInput]; 

      dispatch_async(dispatch_get_main_queue(), ^{ 
       // Why are we dispatching this to the main queue? 
       // Because AVCaptureVideoPreviewLayer is the backing layer for AVCamPreviewView and UIView can only be manipulated on main thread. 
       // Note: As an exception to the above rule, it is not necessary to serialize video orientation changes on the AVCaptureVideoPreviewLayer’s connection with other session manipulation. 
       //[self previewView] layer 
       [[(AVCaptureVideoPreviewLayer *)[[self previewView] layer] connection] setVideoOrientation:(AVCaptureVideoOrientation)[self interfaceOrientation]]; 
      }); 
     } 

有时候,环境有点暗。在iPhone相机应用程序中,它可以通过在较暗部分点按iPhone屏幕来使图像变亮。但我不喜欢这样的女人的参与。 我检查RGB强度,一旦我意识到亮度不够,我喜欢通过调整我的程序中的相机参数(如相机曝光等)来使图像变亮。 iPhone编程有可能吗? 谢谢

回答

0

我还没有在AVFoundation工作很多,但你可以找到更多的细节here。 我希望这会对你有用。

相关问题