5,337
edits
Line 13: | Line 13: | ||
Disparity is related to depth by the following formula: | Disparity is related to depth by the following formula: | ||
<math display="block">disparity = baseline * focal / depth</math> | <math display="block">disparity = baseline * focal / depth</math> | ||
* <math display="inline">focal</math> is the focal length in pixels. This is | * <math display="inline">focal</math> is the focal length in pixels. This is the distance to your image in pixels. | ||
*: This can be calculated as <code>(height/2) * cot(fov_h/2)</code> | *: This can be calculated as <code>(height/2) * cot(fov_h/2)</code>. | ||
*: You can't imagine focal length as a depth since if the image is ''closer'' then the ''pixel sizes'' will be smaller and thus the distance to the image stays the same. | |||
*: In the formula, this term acts as a correction factor for the resolution of the disparity. | |||
* <math display="inline">baseline</math> is the distance between the camera positions. This should be in the same units as your depth. | * <math display="inline">baseline</math> is the distance between the camera positions. This should be in the same units as your depth. | ||