Xcode iOS相机曝光区域

时间:2013-01-02 21:36:45

标签: objective-c xcode

有没有办法将iPhone相机上的曝光区域限制在指定的方格,而不仅仅是中心点?我感兴趣的区域之外的明亮或黑暗区域正在影响整体曝光。现在我正在使用exposurePointOfInterest,但这只允许指定一个中心点。

1 个答案:

答案 0 :(得分:0)

看起来你可以将CGPoint传递给方法。

示例:

- (void) focusAtPoint:(CGPoint)point
{
    AVCaptureDevice *device = [[self videoInput] device];
    if ([device isFocusPointOfInterestSupported] && [device isFocusModeSupported:AVCaptureFocusModeAutoFocus]) {
        NSError *error;
        if ([device lockForConfiguration:&error]) {
            [device setFocusPointOfInterest:point];
              [device exposurePointOfInterest:location];
            [device setFocusMode:AVCaptureFocusModeAutoFocus];
            [device unlockForConfiguration];
        } else {
            id delegate = [self delegate];
            if ([delegate respondsToSelector:@selector(acquiringDeviceLockFailedWithError:)]) {
                [delegate acquiringDeviceLockFailedWithError:error];
            }

        }        

    }

}

http://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html#//apple_ref/occ/instp/AVCaptureDevice/exposurePointOfInterestSupported