Finding the real-world distance of object from pixel coordinates

asked 2018-03-18 05:26:34 -0500

charles1208 gravatar image

updated 2018-03-18 05:27:33 -0500

I have a picture of a supermarket shelf, with its top-most and bottom most row detected (as blue lines).

I know the height (say 2.5 meters) of the shelf, and that it is a fixed value throughout the entire shelf (this also implies that the 2 blue lines are always parallel in the real world). The pixel coordinates of the blue lines are known.

I have marked out a point (in green), with pixel coordinates only. This point will always be in between the top - bottom most rows.

image description

In this case, given the above information, is there a way to calculate the distance (in meters) of the green point (in the real environment) to the top-most shelf?

I am thinking of using information such as the vanishing point, but I can't figure out how to do that.

edit retag flag offensive close merge delete


@berak unfortunately i do not know the distance to the camera; i only know the actual distance between the 2 blue lines.

charles1208 gravatar imagecharles1208 ( 2018-03-18 06:34:09 -0500 )edit

well, you'll have to calibrate your camera somehow, that was more for showing a cheap way to do so.

berak gravatar imageberak ( 2018-03-18 07:09:05 -0500 )edit
LBerger gravatar imageLBerger ( 2018-03-18 08:14:34 -0500 )edit