# OpenCV Mapa de profundidad de dos cámaras calibradas que forman un sistema estereoscópico

I would like some help in continuing my code using openCV library in order to find the depth values of objects seen in the cameras.

I have already done the calibration and found the dispaity map, i can't find a clear help of how to calculate the depth values of each pixel seen in the two photos taken by the cameras.

¿Alguien puede ayudarme? Gracias

preguntado el 24 de agosto de 12 a las 08:08

## 2 Respuestas

Here is a link for your problem including a simple algorithm for depth estimation: http://www.epixea.com/research/multi-view-coding-thesisse13.html

Respondido 24 ago 12, 08:08

thank you so much, but my problem is that i want to continue the code that i used for the calibration. I have used the code given by: blog.martinperis.com/2011/01/… and i have reached the final step, but i have no idea what is : d = pointRightImage.X - pointLeftImage.X; So i though maybe someone could have an easier way to calculate the depth in openCV... - Rita M.

I don't think the blogpost that you linked will be useful anymore at this point. BTW, if you're working on Computer Vision, don't get scared by mathematical explanations because you need to learn and gain mathematical insight of what you do. - Sección Savasçı

Yess i agree, i think that's where my problem is, if i knew mathematically what did he mean by "d = pointRightImage.X - pointLeftImage.X" i could create my own code. Thank you so much for your advice, ill probably work on that - Rita M.

You can use these formula to calculate point cloud 3D coordinates:

``````Z = fB/D
X = (col-w/2)*Z/f
Y = (h/2-row)*Z/f
``````

where X, Y, Z are world coordinates, f - focal length of the camera in pixels after calibration, B is a base line or camera separation and D is disparity; col, row represent the column and row coordinates of a pixel in the image with dimensions h, w.

However, if you managed to calibrate your cameras and get a disparity map you have to already know this. Calibration and disparity map calculation is an order of magnitude more complex task than above mentioned calculations.

Respondido 26 Feb 14, 08:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.