试了下传说中的近距离感应器,但好像只有0.0和5.0两个值,而且感应的是屏幕那一侧。我需要的是检测摄像头和被拍摄物体之间的距离。各位大神能否指点一下思路????

解决方案 »

  1.   

    ...先通过了解距离和对焦过程之间的关系 写个Rom改下对焦函数?
    = =
      

  2.   

    恩 您提醒的思路很对!google搜遍了 这方便的资料很少啊!!!几乎没有。唉 难道要一点一点看google的api
      

  3.   

    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,奶奶的真坑爹!  看来是测不出了
      

  4.   

    哥们是准备做物体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
      

  5.   

    好的 谢谢哥们啦! 我项目需要确定被拍摄物体在空间中的位置,要求多次拍摄被拍摄物体在空间中位置尽量保持不练,平面(x,y)里采用这种屏幕上画关键点,关键点与物体的关键点重合实现。还需要一个z分量,就是距离。