擅长:python、mysql、java
<p>你必须计算出你的距离和作为模型的给定距离之间的比率。例如眼睛之间的距离。在</p>
<p>关于你的问题,为了正确估计照片中的真实距离,你应该有一个已知长度的物体与相机保持相同的距离。通过这种方式,您可以通过执行如下伪代码获得真正的度量值</p>
<pre><code>fakeDistance = 5
realLengthOfKnownObject = 10
apparentLengthOfKnownObject = 8
ratio = realLengthOfKnownObject/apparentLengthOfKnownObject
realDistance = fakeDistance * ratio
</code></pre>
<p>很明显这是很难得到的。在</p>
<p>我发现<a href="https://www.pyimagesearch.com/2015/01/19/find-distance-camera-objectmarker-using-python-opencv/" rel="nofollow noreferrer">this article</a>可能会有帮助。
祝你好运。在</p>