1
votes

I'm not able to use reprojectImageTo3D() using python in the latest openCV version. I keep getting "TypeError: disparity is not a numpy array". It's an iplImage of course.

disparityImg = CreateImage( (320,240), IPL_DEPTH_32F, 1)
depthMapImg = CreateImage( (320,240), IPL_DEPTH_32F, 3)
depthMapImg = reprojectImageTo3D(disparityImg, Q)

But if I use an array for depthMapImg instead of an iplImage, I get "OpenCV Error: Assertion failed (stype == CV_8UC1 || stype == CV_16SC1 || stype == CV_32SC1 || stype == CV_32FC1) in reprojectImageTo3D,..."

This latter error makes me think the data types aren't matching between the array and reprojectImageTo3D().

Neither works, what am i to do?

official reprojectImageTo3D() doc here: http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#void%20reprojectImageTo3D%28InputArray%20disparity,%20OutputArray%20_3dImage,%20InputArray%20Q,%20bool%20handleMissingValues,%20int%20ddepth%29

1

1 Answers

1
votes

take a sharp look : it's cv2.reprojectImageTo3D (or, cv.Reproject...)

seems, you're trying to mix the old (deprecated) cv api with the newer cv2 one. don't !

cv is using wrapped IplImages, cv2 is using numpy arrays

so, discard the old cv api, as it won't be supported in future versions. avoid any code, that's using iplimages