samedi 30 août 2014

Tap to focus square indicator


Vote count:

0




I am using an AVCaptureSession to have a live camera preview and my tap to focus indicator wont work I have found Tap-to-focus square visual indicator shows up on iOS4 but not iOS5 however the question was not answered. I need to have a visual indicator show up when I tap an area to focus and I have the focus fully working. Here is my code:



- (void) tapSent:(UITapGestureRecognizer *)sender {

if (_capturedView.image == nil) {
CGPoint aPoint = [sender locationInView:_liveView];
if (_myDevice != nil) {
if([_myDevice isFocusPointOfInterestSupported] &&
[_myDevice isFocusModeSupported:AVCaptureFocusModeAutoFocus]) {
double pX = aPoint.x / _liveView.bounds.size.width;
double pY = aPoint.y / _liveView.bounds.size.height;
double focusX = pY;
double focusY = 1 - pX;
if([_myDevice isFocusPointOfInterestSupported] && [_myDevice isFocusModeSupported:AVCaptureFocusModeAutoFocus]) {
if([_myDevice lockForConfiguration:nil]) {
[_myDevice setFocusPointOfInterest:CGPointMake(focusX, focusY)];
[_myDevice setFocusMode:AVCaptureFocusModeAutoFocus];
[_myDevice setExposurePointOfInterest:CGPointMake(focusX, focusY)];
[_myDevice setExposureMode:AVCaptureExposureModeContinuousAutoExposure];
}
[_myDevice unlockForConfiguration];
}
}
}
}
}


asked 40 secs ago







Tap to focus square indicator

Aucun commentaire:

Enregistrer un commentaire