Ask Your Question

arbitraryname's profile - activity

2019-03-08 02:46:49 -0500 received badge  Popular Question (source)
2015-12-19 04:30:14 -0500 received badge  Scholar (source)
2015-12-19 04:30:12 -0500 received badge  Supporter (source)
2015-12-19 03:44:02 -0500 asked a question StereoBM compute does not take in CV_8UC1 python ndarray?

Here is my code:

v1 = cv2.VideoCapture(1)
v2 = cv2.VideoCapture(2)
stereo = cv2.StereoBM_create(numDisparities=16, blockSize=15)

ret, frame1 = v1.read()
ret, frame2 = v2.read()
frame1_new = cv2.cvtColor(frame1, cv2.CV_8UC1)
frame2_new = cv2.cvtColor(frame2, cv2.CV_8UC1)
disparities = stereo.compute(frame2_new, frame1_new)

Running this code gets me the error:

cv2.error: ...opencv\modules\clib3d\src\stereobm.cpp:1047: error: (-210) Both input images must have CV_8UC1 in function cv::StereoBMImpl::compute

I've tried different color mappings to see if it needed a different color, but none of them have worked. What am I doing wrong here?

I am using OpenCV 3.0.0.