0

I'm trying to tell the camera in my app (which is build around OpenFrameworks) to auto focus. After reading this SO post I read through the AV Foundation Programming Guide on how to set the focus mode. The code they give as an example is:

if ([currentDevice isExposureModeSupported:AVCaptureExposureModeContinuousAutoExposure]) {
    CGPoint exposurePoint = CGPointMake(0.5f, 0.5f);
    [currentDevice setExposurePointOfInterest:exposurePoint];
    [currentDevice setExposureMode:AVCaptureExposureModeContinuousAutoExposure];
}

I haven't been able to figure out how to initialize currentDevice outside the if statement, and it's not in the documentation. How should it be initialized/what type is it? Thanks.

Community
  • 1
  • 1
Matthew Herbst
  • 29,477
  • 23
  • 85
  • 128

1 Answers1

1

You can read more about the AVCaptureDevice Class Reference

It refers to front or the back side camera. And don't forget to import the AVFoundation.framework

Desdenova
  • 5,326
  • 8
  • 37
  • 45