Measuring distance between objects in an image

Discussion related to "under the hood" OpenMV topics.
skylin008
Posts: 48
Joined: Mon Mar 13, 2017 10:18 pm

Measuring distance between objects in an image

Postby skylin008 » Tue Aug 01, 2017 1:46 am

Hello everyone! Openmv3 is a appreciation project .I had read the source code .I had a issue, How to Measuring distance between objects in an image with openmv3.Thanks !
User avatar
kwagyeman
Posts: 1935
Joined: Sun May 24, 2015 2:10 pm

Re: Measuring distance between objects in an image

Postby kwagyeman » Tue Aug 01, 2017 12:31 pm

Count the number of pixels between two detections...

Please describe you project, setup, etc. In detail. Like two 5 sentence paragraphs. There are a lot of ways to detect objects. Given those ways, you can then just count the number of pixels between the two detections.
Nyamekye,
skylin008
Posts: 48
Joined: Mon Mar 13, 2017 10:18 pm

Re: Measuring distance between objects in an image

Postby skylin008 » Tue Aug 01, 2017 10:28 pm

Thank you kwagyeman. I had used the haarcascade way to vehicle detection in road . I need the measuring or predicting the distance between vehicle and openmv3 camera .Thank you very much!
User avatar
kwagyeman
Posts: 1935
Joined: Sun May 24, 2015 2:10 pm

Re: Measuring distance between objects in an image

Postby kwagyeman » Wed Aug 02, 2017 1:11 am

I wouldn't use the OpenMV Cam in any safety critical application right now...

Anyway, can you detect cars and get their bounds box well enough? Someone fixed the haar cascade importer script recently so you should be able to use any haar you'd like now.
Nyamekye,
skylin008
Posts: 48
Joined: Mon Mar 13, 2017 10:18 pm

Re: Measuring distance between objects in an image

Postby skylin008 » Wed Aug 02, 2017 5:34 am

Thank you kwagyeman ! The openmv3 be used in ADAS.The distance measuring no be very accurately! Had any method can be come true? Thank you very much!
User avatar
kwagyeman
Posts: 1935
Joined: Sun May 24, 2015 2:10 pm

Re: Measuring distance between objects in an image

Postby kwagyeman » Wed Aug 02, 2017 10:37 am

Hi, the size of an object you see roughly corelates to the size the distance it is away from you. You have to make your own lookup table to map object size to distance.
Nyamekye,
User avatar
iabdalkader
Posts: 463
Joined: Sun May 24, 2015 3:53 pm

Re: Measuring distance between objects in an image

Postby iabdalkader » Thu Aug 03, 2017 8:45 pm

If you use the camera matrix (intrinsic and extrinsic stuff) you should be able to make pixels to real world. I can't help with the math though you'll have to figure it out.
SARAVANABAVAN
Posts: 32
Joined: Thu May 10, 2018 12:19 am
Location: Karaikal

Re: Measuring distance between objects in an image

Postby SARAVANABAVAN » Wed May 30, 2018 7:08 am

Hello all,
I need to find the distance between the OpenMV CAM M4 to the object which was placed against to it... What is the procedure to calculate the distance between the camera and the object ???
User avatar
kwagyeman
Posts: 1935
Joined: Sun May 24, 2015 2:10 pm

Re: Measuring distance between objects in an image

Postby kwagyeman » Thu May 31, 2018 12:57 am

Hi, without some type of exact reference like an OpenMV Cam a camera can't really tell you this from one perspective. It's not a distance sensor. However, there's a correlation between the size of an object and it's distance from the camera. So, if you use find_blobs()... then using the blobs .pixels() count you can infer the distance of the object by using a conversion function hand you hand calculate. I.e. you measure the distance and then the number of pixels() in the image and compare the two values. Write down a large number of readings for different distances... and then you make a piece wise model function. Note that pixels() and the distance are related in an 1/r^2 fashion so it's not going to be a linear relationship. You'll get better distance readings the closer you are to the object.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest