1

Traceback (most recent call last): File "F:/4th Year/project/CFP/Reconstruction/disparity.py", line 204, in points_3D = cv2.reprojectImageTo3D(disparity_map, Q2) cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-71670poj\opencv\modules\calib3d\src\calibration.cpp:2990: error: (-215:Assertion failed) stype == CV_8UC1 || stype == CV_16SC1 || stype == CV_32SC1 || stype == CV_32FC1 in function 'cv::reprojectImageTo3D'

disparity_map = wls_filter.filter(displ, rimg1, None, dispr) / 16.0

Q = np.float32([[1,0,0,-w/2.0],
                    [0,-1,0,h/2.0],
                    [0,0,0,-focal_length],
                    [0,0,1,0]])
    
points_3D = cv2.reprojectImageTo3D(disparity_map, Q)

I'm trying to create 3D points by using a disparity map please let me know a way to fix this error, as my understanding this is about some data type/format issue.

Ocean
  • 21
  • 4
  • The assertion says that the source image (`disparity_map`) must be a single-channel image of one of those types. This is confirmed in the [documentation](https://docs.opencv.org/4.4.0/d9/d0c/group__calib3d.html#ga1bc1152bd57d63bc524204f21fde6e02) which says that `disparity` must be a "single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit floating-point disparity image". Apparently it is not. – beaker Nov 23 '20 at 15:54

0 Answers0