Can I get distance to an object using single camera

Is there anyway I can find the distance to an object from a camera image? actual size of object,and perpendicular distance between camera and object is also known. (object-->on ground & camera-->above ground). I went through all the previous questions and their answers.No clear cut solution was found. Please help me...

 採用された回答

Image Analyst
Image Analyst 2015 年 6 月 10 日

1 投票

Depends on the camera. If it's a Lytro/lightfield camera or some other kind of multi-lens camera, or a Kinect camera, then yes. Otherwise no. If I have a photo of the moon, how do I know if it's the real moon that you snapped through a telescope, or a photo you took of a poster of the moon on your office wall? You don't.

6 件のコメント

Image Analyst
Image Analyst 2015 年 6 月 10 日
If you have multiple images taken from different angles, then you can find the distances using the camera calibration capabilities of the Computer Vision System Toolbox.
Ashmil Mohammed
Ashmil Mohammed 2015 年 6 月 10 日
Thanks for the reply :)
I know the real dimensions of everything. the camera is mounted 2m above ground. Is there anyway by calibrating the ordinary camera? I heard so... Sorry if this is a wrong question.
Image Analyst
Image Analyst 2015 年 6 月 10 日
Only if you have something of known dimension in the field of view. If you have a foot long ruler in the image, then you know the dimensions of the scene and you will also know it's a poster on your wall and not the real moon. See my spatial calibration demo, attached.
Ashmil Mohammed
Ashmil Mohammed 2015 年 6 月 11 日
Thanks for your time and reply sir. In the given image ,I know the dimension of the ball , say 6cm , using the code you provided, the length of the mobile phone is 11.6 while actually it is around 13. Error in measuring seem to be very large when the reference object and object to be measured are even farther.
  • My actual setup will be a camera mounted around 2.5 metre above ground and objects will be on the ground.
  • The system will monitor a 220x150 rectangular area
Image Analyst
Image Analyst 2015 年 6 月 11 日
Yes. It just gives you the measurement for the actual distances you measure. For that phone, you could probably pick a variety of places to measure between and get a variety of lengths. Also, if your objects are not in same plane, the spatial calibration will be different. For example that panel on the wall is only half as wide (in pixels in the image) as the 6 cm ball but I know from contextual knowledge that it is not 3 cm wide. So for 3D you need multiple angles. The camera calibration in the Computer Vision System Toolbox can help with that.
Ashmil Mohammed
Ashmil Mohammed 2015 年 6 月 11 日
Thanks a lot! I will now move on to camera calibration toolboox.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB Support Package for USB Webcams についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by