Distance to an object
Mostrar comentarios más antiguos
Hi. I have a kinect v1 camera. Will like ti know the steps to take to calculate the distance to an object. Also, I acquire a tyre wheel picture using the rgb camera. I used the imfindcircle to locate the centre of the wheel as well as the radius and I got some values (which I guess they are pixels). How do I convert this to metres or mm as the case maybe? Attached is the located circle. The centre and radius as returned on the command line is
center =
379.4851 377.5351
radius =
50.9897

4 comentarios
Julie
el 4 de Jul. de 2019
What distance do you want? To an edge? To another object that you have already located?
To convert to m/mm you need to have a known distance in the image. Then you can come up with a conversion factor between pixels and real measuments.
Gideon Oladipupo
el 4 de Jul. de 2019
Julie
el 4 de Jul. de 2019
So, getting the distance to an object not shown in the image is very diffrent than getting the distance between 2 objects in an image. I have no idea how to do it, other than maybe taking pictures of the wheel at various known distances and using the sizes of the central hub to estimate distance. There is probably a better way, but it is not something I have worked with.
Gideon Oladipupo
el 4 de Jul. de 2019
Respuestas (2)
Image Analyst
el 4 de Jul. de 2019
I assume you have a distance image from the Kinect camera as well as the optical RGB image. So just use the centroid you got from the optical image to read the value from the distance image.
column = centers(1); % x
row = centers(2); % y
distanceToCenter = distanceImage(row, column) % Read distance from distance image (not optical RGB image)
6 comentarios
Gideon Oladipupo
el 4 de Jul. de 2019
Image Analyst
el 4 de Jul. de 2019
I don't have a kinect so I don't know what units the pixels are in. For optical images, the units are pixels and gray levels, but for the distance image, I don't know what the values represent. I don't think they're intensity (gray levels) - the values will mean some real world distance, like in cm or meters or inches or whatever. Consult your Kinect manual for the answer. But you may just want to calibrate yourself by putting objects (like a book) at different, known distances and see what it (the distance image) reports the value as.
Can you attach both your optical image, and the distance image along with the MATLAB code to read the distance image (which I guess is some special format)?
Gideon Oladipupo
el 4 de Jul. de 2019
Gideon Oladipupo
el 5 de Jul. de 2019
Gideon Oladipupo
el 5 de Jul. de 2019
Image Analyst
el 5 de Jul. de 2019
Kinect gives you two images. You forgot to attach the distance image - the other image (NOT the optical RGB image) where the values are the distance from the Kinect camera to objects in the scene. Please attach it. But anyway, my original answer gave you the code for getting the distance.
Categorías
Más información sobre Kinect For Windows Sensor en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


