'**SUMMARY**
This method returns the 3D depth image using reprojectImageTo3D method.
**PARAMETERS**
* *leftIndex* - Index of left camera
* *rightIndex* - Index of right camera
* *Q* - reprojection Matrix (disparity to depth matrix)
* *method* - Stereo Correspondonce method to be used.
- "BM" - Stereo BM
- "SGBM" - Stereo SGBM
* *state* - dictionary corresponding to parameters of
stereo correspondonce.
SADWindowSize - odd int
nDisparity - int
minDisparity  - int
preFilterCap - int
preFilterType - int (only BM)
speckleRange - int
speckleWindowSize - int
P1 - int (only SGBM)
P2 - int (only SGBM)
fullDP - Bool (only SGBM)
uniquenessRatio - int
textureThreshold - int (only BM)
**RETURNS**
SimpleCV.Image representing 3D depth Image
also StereoCamera.Image3D gives OpenCV 3D Depth Image of CV_32F type.
**EXAMPLE**
>>> lImage = Image("l.jpg")
>>> rImage = Image("r.jpg")
>>> stereo = StereoCamera()
>>> Q = cv.Load("Q.yml")
>>> stereo.get3DImage(1, 2, Q).show()
>>> state = {"SADWindowSize":9, "nDisparity":112, "minDisparity":-39}
>>> stereo.get3DImage(1, 2, Q, "BM", state).show()
>>> stereo.get3DImage(1, 2, Q, "SGBM", state).show()'

def get3DImage(self, leftIndex, rightIndex, Q, method='BM', state=None):

    cv2flag = True
    try:
        import cv2
    except ImportError:
        cv2flag = False
        import cv2.cv as cv
    if cv2flag:
        camLeft = cv2.VideoCapture(leftIndex)
        camRight = cv2.VideoCapture(rightIndex)
        if camLeft.isOpened():
            (_, imgLeft) = camLeft.read()
        else:
            warnings.warn('Unable    to    open    left    camera')
            return None
        if camRight.isOpened():
            (_, imgRight) = camRight.read()
        else:
            warnings.warn('Unable    to    open    right    camera')
            return None
        imgLeft = Image(imgLeft, cv2image=True)
        imgRight = Image(imgRight, cv2image=True)
    else:
        camLeft = cv.CaptureFromCAM(leftIndex)
        camRight = cv.CaptureFromCAM(rightIndex)
        imgLeft = cv.QueryFrame(camLeft)
        if (imgLeft is None):
            warnings.warn('Unable    to    open    left    camera')
            return None
        imgRight = cv.QueryFrame(camRight)
        if (imgRight is None):
            warnings.warn('Unable    to    open    right    camera')
            return None
        imgLeft = Image(imgLeft, cv2image=True)
        imgRight = Image(imgRight, cv2image=True)
    del camLeft
    del camRight
    stereoImages = StereoImage(imgLeft, imgRight)
    Image3D_normalize = stereoImages.get3DImage(Q, method, state)
    self.Image3D = stereoImages.Image3D
    return Image3D_normalize
