简体   繁体   English

适用于Android的OpenCV:自动对焦本机摄像头

[英]OpenCV for Android: Autofocus native camera

Is it possible to control autofocus feature of Android camera, using OpenCV's libnative_camera*.so ? 是否可以使用OpenCV的libnative_camera * .so控制Android相机的自动对焦功能?

Or maybe it's possible to manually set focus distance? 还是可以手动设置焦距?

Is there alternative approach (May be, it's better to use Android API to control camera and then grab frame in onPreview events and pass it to native code)? 是否有其他方法(可能是,最好使用Android API控制摄像机,然后在onPreview事件中捕获帧并将其传递给本机代码)?

If your intention is to control the camera on your own, then Android Camera APIs suck. 如果您打算自己控制相机,那么Android Camera API很烂。 As such Android APIs suck when it comes to offering your hardware camera device number to JavaCV native camera library. 因此,在向JavaCV本机相机库提供硬件相机设备编号时,Android API很烂。 Without a native device number, JavaCV would be clueless to connect to the appropriate camera (Front or Back). 没有本机设备号,JavaCV将无法连接到适当的摄像机(正面或背面)。

If your intention is only to perform object detection and stuff, well Android Camera APIs coupled with JavaCV should work. 如果您仅打算执行对象检测和填充,那么结合JavaCV的Android Camera API应该可以正常工作。 Setup a callbackBuffer of sufficient size, setPreviewCallbackWithBuffer, setup sufficient preview frame-rate, and once you start getting preview-frames in ImageFormat.NV21 format (mind you!!, this is the only format supported for preview-frames even in ICS), pass them off to JavaCV for performing object detection. 设置一个足够大的callbackBuffer,setPreviewCallbackWithBuffer,设置足够的预览帧率,并且一旦开始获取ImageFormat.NV21格式的预览帧(请注意,这是即使在ICS中也是唯一支持预览帧的格式),将它们传递给JavaCV以执行对象检测。

AutoFocus on Android Camera APIs suck big time. Android Camera API上的AutoFocus占用大量时间。 I have been researching for over a month for feasible solutions. 我已经研究了一个多月的可行解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM