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 landsc开发者_开发技巧ape 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
If you have an AVCaptureVideoPreviewLayer
, you can use captureDevicePointOfInterestForPoint
in order to convert the CGPoint
you get with a tap gesture.
That way you just don't have to worry about orientation.
According to http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/03_MediaCapture.html:
You pass a CGPoint where {0,0} represents the top left of the picture area, and {1,1} represents the bottom right in landscape mode with the home button on the right—this applies even if the device is in portrait mode.
精彩评论