如何计算 AVCaptureDevice 的 focusPointOfInterest?
如何计算给定 AVCaptureDevice 的 focusPointOfInterest(0,0 和 1,1 之间的 CGPoint 值)?
我一直在关注最新 WWDC 的代码示例,但我真的不明白如何进行计算。另外,我的应用程序处于横向与纵向(如示例中所示)...因此,除了不了解如何计算事物之外,我不确定需要进行哪些调整才能考虑横向方向。
任何帮助将不胜感激。
谢谢-wg
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据 http://developer.apple。 com/library/ios/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/03_MediaCapture.html:
According to http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/03_MediaCapture.html:
如果您有 AVCaptureVideoPreviewLayer ,则可以使用
captureDevicePointOfInterestForPoint
以便转换通过点击手势获得的CGPoint
。这样您就不必担心方向问题。
If you have an
AVCaptureVideoPreviewLayer
, you can usecaptureDevicePointOfInterestForPoint
in order to convert theCGPoint
you get with a tap gesture.That way you just don't have to worry about orientation.
您可以通过执行以下操作将点从屏幕坐标旋转到相机坐标:(焦点从 0,0 到 1,1)
You can rotate the point from screen coordinate to camera coordinate by doing this: (focusPoint is from 0,0 to 1,1)