Ask Your Question

Revision history [back]

Depth map shows everything grey! OpenCV- Python

Hello! My code:

import cv2
import numpy as np

imgL = cv2.imread('Blender_Suzanne1.jpg')
img1 = cv2.cvtColor(imgL, cv2.COLOR_BGR2GRAY)
imgR = cv2.imread('Blender_Suzanne2.jpg')
img2 = cv2.cvtColor(imgR, cv2.COLOR_BGR2GRAY)

stereo = cv2.StereoBM_create(numDisparities = 16, blockSize = 17)
disparity = stereo.compute(img2, img1)

cv2.imshow('DepthMap', disparity)
cv2.waitKey()
cv2.destroyAllWindows()

When I run it, I see a window which is all grey? I think it is wrong. I used this code from the OpenCV docs website. Can anyone help?