4

I Have two images( left and right ) I want to measure the real distance on image? When I click on the image, ı ll get real distance to clicked point to camera.

Left Image:

enter image description here

Right Image:

enter image description here

I have calibrated the two images. I want to use EmguCV to get distance from image.

Is this possible ?

Sabuncu
  • 4,529
  • 4
  • 37
  • 75
CbsHs
  • 73
  • 9
  • There is a page on OpenCV (with this exact same image). It also refers to a python script as an example. https://docs.opencv.org/3.4/dd/d53/tutorial_py_depthmap.html I know this does not answer on using EmguCV You have probably already seen this. I am adding it for reference for other readers. – Mike de Klerk Aug 20 '18 at 12:00

1 Answers1

1

While I do not know the specifics of EmguCV, I can tell you the concept behind how stereo depth perception works, and hopefully you can then implement some sort of fix.

Essentially, the first step is to segment and match parts of the image. What you are trying to accomplish here is to identify the parts of the image that are the "same" in each. For instance, you want to be able to identify the center of the lamp in each image. The feature set you use to do this is up to you, but one basic one that may help is by using an edge detector (like the canny method) and trying to match contours with similar shapes. Additionally, another technique that is common is breaking up the image into smaller blocks and matching features in those blocks. The method you use is up to you.

Next, you are able to calculate the distance of the matched objects from the center of your camera in both images. You will need to do this both for the x and y directions. We will call this your x and y disparity.

Now, you need to know the distance between the centers of the cameras that took the picture. Once you have this, there is some simple trig that you can do to solve for distance. There is a rather simple explanation of this here

Again, this is all conceptual, but it is important to know how the algorithms you are applying work. The first step to understanding the solution to a problem is to understand the problem itself. Once you have a full understanding of the problem, and the procedure for solving it, implementing that procedure with any library should become much easier. Good luck!

bstadt
  • 136
  • 11