• Create Account

### #ActualL. Spiro

Posted 06 October 2012 - 06:15 AM

This is related to computer vision, which is actually an AI problem, not a graphics problem.

I will explain some of the procedure but there is too much to explain in one post and you will have to Google some words I will present on your own.

Firstly, there are a few things you need to know about the cameras used to take the images.
#1: The focal length of the cameras (which should be identical). f.
#2: How far apart the cameras were. Used to calculate the baseline B.

In order to calculate the depth for any given pixel you also need to know where it is in space relative to each camera (but only in 1D (X), since the depth component is still unknown and the vertical component Y is the same for both cameras (since it is assumed the cameras were horizontally aligned)).
However, this assumes you know where each pixel is for each camera. That is, for any given pixel, you need to know its X relative to camera 0 and also to camera 1.
Taking 2 images and figuring out this information is called Correspondence.

This is the research you need to do on your own, as it is not practical to explain on a forum post, at least when you include SSD (sum of square distance) errors for determining best matches when there are multiple choices to make and when you account for the recovery of lost data.
Note that due to loss in information between images, it is not always possible to determine depth for a given pixel. Your best bet in that case would be to average the depths of nearby pixels in which correct depth information was able to be determined.

Once you have used Correspondence to determine where a single pixel is in relation to each camera, you can determine the depth by doing the following:
Project the pixel onto the back plane of camera 0 by a distance of f, and do the same for camera 1.
The results are x0 and x1.

Knowing the focal length f and the baseline B, the equation to find the depth Z is:
(x1 - x0) / f = (B / Z)
or:
Z = fB / (x1 - x0)

Another useful term would be “Stereovision”.

L. Spiro

### #1L. Spiro

Posted 06 October 2012 - 06:06 AM

This is related to computer vision, which is actually an AI problem, not a graphics problem.

I will explain some of the procedure but there is too much to explain in one post and you will have to Google some words I will present on your own.

Firstly, there are a few things you need to know about the cameras used to take the images.
#1: The focal length of the cameras (which should be identical). f.
#2: How far apart the cameras were. Used to calculate the baseline B.

In order to calculate the depth for any given pixel you also need to know where it is in space relative to each camera (but only in 1D (X), since the depth component is still unknown and the vertical component Y is the same for both cameras (since it is assumed the cameras were horizontally aligned)).
However, this assumes you know where each pixel is for each camera. That is, for any given pixel, you need to know its X relative to camera 0 and also to camera 1.
Taking 2 images and figuring out this information is called Correspondence.

This is the research you need to do on your own, as it is not practical to explain on a forum post, at least when you include SSD (sum of square distance) errors for determining best matches when there are multiple choices to make and when you account for the recovery of lost data.
Note that due to loss in information between images, it is not always possible to determine depth for a given pixel. Your best bet in that case would be to average the depths of nearby pixels in which correct depth information was able to be determined.

Once you have used Correspondence to determine where a single pixel is in relation to each camera, you can determine the depth by doing the following:
Project the pixel onto the back plane of camera 0 by a distance of f, and do the same for camera 1.
The results are x0 and x1.

Knowing the focal length f and the baseline B, the equation to find the depth Z is:
(x1 - x0) / f = (B / Z)
or:
Z = fB / (x1 - x0)

L. Spiro

PARTNERS