# 3D Stereotriangulation Using Parallel Cameras

1. Aug 1, 2011

### tsa256

Hello everyone,

I recently began a project which using 2 parallel cameras in order to determine the 3D spacial positioning of a red ball relative to the left camera.

Here is my current setup;
Two cameras that lie on the same plane with parallel optical axis. (http://www.dis.uniroma1.it/~iocchi/ster [Broken] ... triang.gif from this webpage http://www.dis.uniroma1.it/~iocchi/stereo/triang.html)
Distance between cameras is 317mm
Resolution of images is 960x720
Effective focal length for both cameras is 2mm. (But the cameras are equipped with an auto focus feature and although not active during acquisition the cameras are set to a constant focus setting before acquisition. Would this change the focal length, also there are no units on the focus setting so I am unsure of how much I have change the focal length if at all?)
X, Y, and Z locations are in mm and relative to the left camera

and here is my math, ( assuming I have already calculated the X and Y of the red ball in each image)
Z_red=(((317*2)/((X_Position_of_Circle_in_Left_Camera_Image-0.5*960)-(X_Position_of_Circle_in_Right_Image-0.5*960))))
X_red=(((X_Position_of_Circle_in_Left_Image-0.5*960)*Z_red)/2)
Y_red=(((Y_Position_of_Circle_in_left_Image-0.5*720)*Z_red)/2)

Unfortunately the math does not work. I have tested it numerous time by placing the red ball a known distance from the left camera and it does not output the correct distance. Why could that be? I would greatly appreciate any help, if someone could post correct equations that would be phenomenal.

A friend of mine recommended adding constants to the calculations in order to scale the values to the correct position. This does produce better results however I am unsure of whether it is mathematically correct.
Z_red=(((317*2)/((X_Position_of_Circle_in_Left_Camera_Image-0.5*960)-(X_Position_of_Circle_in_Right_Image-0.5*960))))*kz
X_red=(((X_Position_of_Circle_in_Left_Image-0.5*960)*Z_red)/2)*kx
Y_red=(((Y_Position_of_Circle_in_left_Image-0.5*720)*Z_red)/2)*ky

Any help would be greatly appreciated.
Thanks,

Taylor Amarel

Last edited by a moderator: May 5, 2017