为什么我设置焦距没有效果

  • Post author:
  • Post category:其他
我不是用的系统照相机,我想做系统照相机一样可以调正焦距。

代码如下:

-(void) focus:(UIGestureRecognizer *)gesture

{

    CGPoint point = [gesture locationInView:self.videoCamera.gpuImageView];

    point.x /= self.videoCamera.gpuImageView.frame.size.width;

    point.y /= self.videoCamera.gpuImageView.frame.size.height;

    originPoint = point;

    if ([self.videoCamera.inputCamera isFocusPointOfInterestSupported] && [self.videoCamera.inputCamera isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus])

    {

NSError *error;

        [self.videoCamera.inputCamera lockForConfiguration:&error];

        NSLog(@”orign:%f,%f”,self.videoCamera.inputCamera.focusPointOfInterest.x,self.videoCamera.inputCamera.focusPointOfInterest.y);

        if (self.videoCamera.inputCamera.adjustingFocus)

        {

           NSLog(@”YES”);

           [self.videoCamera.inputCamera setFocusPointOfInterest:point];

           [self.videoCamera.inputCamera setFocusMode:AVCaptureFocusModeContinuousAutoFocus];

            NSLog(@”new:%f,%f”,self.videoCamera.inputCamera.focusPointOfInterest.x,self.videoCamera.inputCamera.focusPointOfInterest.y);

        }

        else

        {

            NSLog(@”NO”);

        }

       

        [self.videoCamera.inputCamera unlockForConfiguration];

       

    }

    _focusProgress.hidden = NO;

}

.focusPointOfInterest变了,但是为什么没有效果呢?还是说,还有其它什么需要设置的?

各位大侠,帮忙看下,谢啦!


版权声明:本文为suwanshen6136原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。