ingenuitas/SimpleCV — pull request #348 by jayrambhia (2013-03-28 12:19:48+00:00)
Title: Depth Image support added

`reprojectImageTo3D` support added. Gives 3D depth image using Disparity Map and Disparity to Depth (Q) Matrix. Added support in `StereoImage` and `StereoCamera`.

### Usage:

#### StereoImage

cam1 = Camera(1)
cam2 = Camera(2)
l = cam1.getImage()
r = cam2.getImage()
s = StereoImage(l, r)
Q=cv.Load("Q_mat.yml")
img = s.get3DImage(Q)
img.show()

-------------------------------------------

cam1 = Camera(1)
cam2 = Camera(2)
l = cam1.getImage()
r = cam2.getImage()
s = StereoImage(l, r)
disp = s.findDisparityMap()
Q=cv.Load("Q_mat.yml")
img = s.get3DImageFromDisparity(Q)
img.show()

#### StereoCamera

stereo = StereoCamera()
Q=cv.Load("Q_mat.yml")
stereo.get3DImage(1, 2, Q).show()

Left Image

![stereol](https://f.cloud.github.com/assets/1256649/313147/3691b790-97a1-11e2-8981-e6e513884245.jpg)

Right Image

![stereor](https://f.cloud.github.com/assets/1256649/313148/3ea5c1ce-97a1-11e2-97b4-418a1316bd78.jpg)

3D Dpeth Image

![stereo3d](https://f.cloud.github.com/assets/1256649/313149/49c027ac-97a1-11e2-9be0-db7a5a457bc9.jpg)

Depth is a bit off due to normalization and 8U compression.

`stereo.3DImage` gives cv2 image with depth 32F.

Q_mat.yml

%YAML:1.0
Q: !!opencv-matrix
rows: 4
cols: 4
dt: d
data: [ 1., 0., 0., -1.8628233337402344e+02, 0., 1., 0.,
-1.9385565948486328e+02, 0., 0., 0., 4.3360491974417982e+02, 0.,
0., 3.3826077861557735e-01, 2.2522528455670571e+01 ]