android如何测摄像头和被拍摄物体之间的距离??

yanzi1225627
博客专家认证
2012-09-02 08:19:23
试了下传说中的近距离感应器,但好像只有0.0和5.0两个值,而且感应的是屏幕那一侧。我需要的是检测摄像头和被拍摄物体之间的距离。各位大神能否指点一下思路????
...全文
1352 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
Kate_BEN 2015-04-08
  • 打赏
  • 举报
回复
唉,我也在做这个,一点头绪都没有。。。顶一个!
小小小雨 2013-08-26
  • 打赏
  • 举报
回复
顶lz一下 想问问楼主一年了 解决了没有?小弟想请教请教楼主
luxj 2013-04-09
  • 打赏
  • 举报
回复
楼主有用贴 顶一下···
yanzi1225627 2012-09-04
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 的回复:]
哥们是准备做物体3D姿态估计吧 如果是的话OpenCV里面有http://www.opencv.org.cn/index.php/Cv%E7%85%A7%E7%9B%B8%E6%9C%BA%E5%AE%9A%E6%A0%87%E5%92%8C%E4%B8%89%E7%BB%B4%E9%87%8D%E5%BB%BA#POSIT
[/Quote]好的 谢谢哥们啦! 我项目需要确定被拍摄物体在空间中的位置,要求多次拍摄被拍摄物体在空间中位置尽量保持不练,平面(x,y)里采用这种屏幕上画关键点,关键点与物体的关键点重合实现。还需要一个z分量,就是距离。
MacroWH 2012-09-03
  • 打赏
  • 举报
回复
哥们是准备做物体3D姿态估计吧 如果是的话OpenCV里面有http://www.opencv.org.cn/index.php/Cv%E7%85%A7%E7%9B%B8%E6%9C%BA%E5%AE%9A%E6%A0%87%E5%92%8C%E4%B8%89%E7%BB%B4%E9%87%8D%E5%BB%BA#POSIT
yanzi1225627 2012-09-02
  • 打赏
  • 举报
回复
http://pastebin.com/w3vDGZ2F
查了一圈,很多国外的程序猿也在研究这个,也没个所以然来。
目前唯一的线索就是焦距到底是多少!
google的api也找到了,public void getFocusDistances (float[] output)

Since: API Level 9
Gets the distances from the camera to where an object appears to be in focus. The object is sharpest at the optimal focus distance. The depth of field is the far focus distance minus near focus distance.

Focus distances may change after calling autoFocus(AutoFocusCallback), cancelAutoFocus(), or startPreview(). Applications can call getParameters() and this method anytime to get the latest focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS_VIDEO, focus distances may change from time to time.

This method is intended to estimate the distance between the camera and the subject. After autofocus, the subject distance may be within near and far focus distance. However, the precision depends on the camera hardware, autofocus algorithm, the focus area, and the scene. The error can be large and it should be only used as a reference.

Far focus distance >= optimal focus distance >= near focus distance. If the focus distance is infinity, the value will be Float.POSITIVE_INFINITY.

Parameters
output focus distances in meters. output must be a float array with three elements. Near focus distance, optimal focus distance, and far focus distance will be filled in the array.
See Also
FOCUS_DISTANCE_NEAR_INDEX
FOCUS_DISTANCE_OPTIMAL_INDEX
FOCUS_DISTANCE_FAR_INDEX
得到的数据一直是infinite,奶奶的真坑爹! 看来是测不出了
yanzi1225627 2012-09-02
  • 打赏
  • 举报
回复
貌似 现在手机上都没有红外了! 有红外的话还能自己控制发送接收自己算出个距离!
yanzi1225627 2012-09-02
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]
...先通过了解距离和对焦过程之间的关系 写个Rom改下对焦函数?
= =
[/Quote]恩 您提醒的思路很对!google搜遍了 这方便的资料很少啊!!!几乎没有。唉 难道要一点一点看google的api
CuGBabyBeaR 2012-09-02
  • 打赏
  • 举报
回复
我只知道通过人的双眼和方位传感器 可以估算距离...
CuGBabyBeaR 2012-09-02
  • 打赏
  • 举报
回复
...先通过了解距离和对焦过程之间的关系 写个Rom改下对焦函数?
= =

80,471

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧