I need to compute the depth of a 2D points from stereo pictures. But weirdly, when I'm computing it it gets wrong at a distance it should not be (the computing depth is okay at 40cm, and gets noisy starting at 60cm – being higher than the expected value - , whereas my baseline between cameras is 6cm).
I've found different ways to compute the depth thanks to stereo capture, why ?
1) z = (baseline * focal) / (disparity)
2) z = (baseline * focal) / (disparity + doffs)
3) z = (baseline * focal) / (disparity * p)
Where :
baseline = 60mm
doffs is c_x1-c_x0 (the difference between pixel centers of both images)
p is the pixel constant
I suppose the 1st one is most used than the 2nd because the doffs is most of the time 0, but what about the 3rd one ? How can I get the value of this pixel constant (sometimes called pixel size) ? I didn't find any information about that...
I could try with the 1st and the 2nd formula, by using the focal value from my camera matrix (obtained after stereo calibration ; interesting fact : I obtained a slightly different value for left and right eye : 2.13 and 2.10). I also tried a focal value computed thanks to the disparity obtained at a known distance (at 42cm, I have disparity=33) : f = (z*(disparity+doffs))/baseline
But with all tries it worked when my camera is <=40cm from the target, and gets higher than the expected depth when the camera is 60cm+ far away...
I'm completely frozen :( Thanks a lot for your help !
Thibaut