質問

I want to find the distance of an object from camera. Note here I am using single camera. Camera autofocuses to focus on planes at particular distance from camera.

Is there a way I can find this focus distance?

役に立ちましたか?

解決

I think you are looking for z-direction information even though the image from a camera only gives x-direction and y-direction information. What you have embarked upon is considerably tricky.

At your current stage of investigation I would recommend that you go through chapter 4 and 5 of Programming Computer Vision with Python. Then try an algorithm, if your code is giving you errors then someone at SO can help you.

Even if you have never worked with Python the codes in that book will still be understandable because they have lots of explanation. Essentially, you could get the algorithm and pseudocode you need for your problem.

Alternatively, cameras output metadata which is available when you save an image from the camera. This could be another way for you to investigate your problem; find out if the particular model of your camera outputs metadata and how to access it. The metadata may include information about diopter, exposure, aperture, etc. from the diopter you could find the focal length which would roughly tell you what the camera was focusing on.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top