Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate focusPointOfInterest for AVCaptureDevice?

How do you calculate the focusPointOfInterest (a CGPoint value between 0,0 and 1,1) for an given AVCaptureDevice?

I've been following the code samples from the latest WWDC but I really don't understand how to calculation is being made. Also, my application is sitting in landscape vs. portrait (as in the sample) ... so in addition to not understanding how things are being calculated, I'm not sure what adjustments I need to make in order to account for landscape orientation.

Any help would be appreciated.

Thanks - wg

like image 627
wgpubs Avatar asked Aug 16 '10 18:08

wgpubs


1 Answers

If you have an AVCaptureVideoPreviewLayer, you can use captureDevicePointOfInterestForPoint in order to convert the CGPointyou get with a tap gesture.

That way you just don't have to worry about orientation.

like image 101
HHK Avatar answered Sep 20 '22 06:09

HHK