Distance calculation

General discussion about topics related to OpenMV.
SARAVANABAVAN
Posts: 32
Joined: Thu May 10, 2018 12:19 am
Location: Karaikal

Distance calculation

Is there any possibility to determine the distance of the object from the camera ??? And also I need to know the values of the X,Y,Z coordinate values of the object which was placed opposite at the frame of the image ??? Someone please help me...
Last edited by SARAVANABAVAN on Fri Jun 01, 2018 12:52 am, edited 1 time in total.
kwagyeman
Posts: 3048
Joined: Sun May 24, 2015 2:10 pm

Re: Distance calculation

Hi, please stop creating new threads asking the same thing. I answered your previous question in your last thread. However, as I understand, you just want code that does the thing.

The only method that can calculate this right out of the box is find_apriltags() which does this based on AprilTag sizes. However, you have not defined how you want to track the object you want to track... Not what said object is. I need to know what you want to track.
Nyamekye,
SARAVANABAVAN
Posts: 32
Joined: Thu May 10, 2018 12:19 am
Location: Karaikal

Re: Distance calculation

sorry for asking again and again..we need to track the white colour object and to find the distance between the camera and object. By using open mv cam M4 we can find the x and y co ordinates and for z co ordinates we are going to use sharp IR range sensor to find distance.Is sharp IR range sensor is better or shall we use TOF laser sensor ?? we need to pick that white colour object using cutting tool.

one more clarification if we track the red colour means it shows the exact x and y co ordinates values but in case of white colour object it shows different values of x and y co ordinates [ i.e) for the first time it shows exact values and for the second time it shows incorrect values of x and y co ordinates].please help us to solve this problem..

thanks
kwagyeman
Posts: 3048
Joined: Sun May 24, 2015 2:10 pm

Re: Distance calculation

>> one more clarification if we track the red colour means it shows the exact x and y co ordinates values but in case of white colour object it shows different values of x and y co ordinates [ i.e) for the first time it shows exact values and for the second time it shows incorrect values of x and y co ordinates].please help us to solve this problem..

Sure, however, please think about how you want me to answer your question when you ask it. I don't actually have enough information with the above request to help you. You have to put a little more work in to describe the problem in detail enough for me to know what's wrong.

...

Anyway, yes, using a Sharp IR sensor for the distance will give you the best reading. Otherwise, the best you can do is to make a piece-wise lookup table based on the pixel count.
Nyamekye,
SARAVANABAVAN
Posts: 32
Joined: Thu May 10, 2018 12:19 am
Location: Karaikal

Re: Distance calculation

Hi sir,
We are getting the values of x and y coordinates in the openMV IDE. But the problem is that the values of x and y are changing in continuously... So that we cannot able to find the exact distance (i.e We cannot able to find the correct value because it is changing its value by second to second)... Why it's so ???
kwagyeman
Posts: 3048
Joined: Sun May 24, 2015 2:10 pm

Re: Distance calculation

Hi, can you provide example code? Also, the values just around slightly, but, they should not jump around too much. Do you have an example I can see?
Nyamekye,