Ask Your Question

StereoBM in OpenCV 3 (Python) missing module

asked 2015-04-14 01:34:39 -0500

techfort gravatar image

StereoBM is normally in the cv2 module but it appears to be missing. Has it been moved to a submodule or does anybody know the way to create a stereobm in opencv 3.0.0 Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-04-14 02:11:47 -0500

berak gravatar image

you will have to use the 'create' function:

>>> help(cv2.StereoBM_create)
Help on built-in function StereoBM_create:

    StereoBM_create([, numDisparities[, blockSize]]) -> retval

>>> help(cv2.StereoSGBM_create)
Help on built-in function StereoSGBM_create:

    StereoSGBM_create(minDisparity, numDisparities, blockSize[, P1[, P2[, disp12MaxDiff[, preFilterCap[, uniquenessRatio[, speckleWindowSize[, speckleRange[, mode]]]]]]]]) -> retval
edit flag offensive delete link more



Thanks for the answer, it worked. Would you be so kind as to point me to some official documentation about this? The Python tutorials for OpenCV 3.0.0 still show the old createStereoBM()

techfort gravatar imagetechfort ( 2015-04-14 03:30:16 -0500 )edit

yea, that needs to be changed ;)

at least samples/python2/ has it correct.

berak gravatar imageberak ( 2015-04-14 04:54:14 -0500 )edit

actually no, it doesn't :/ AttributeError: 'module' object has no attribute 'StereoSGBM' . This is from a build based on mid-february commits because the python bindings were broken on opencv_contrib see this

techfort gravatar imagetechfort ( 2015-04-14 09:18:54 -0500 )edit

what's exactly wrong now ?

berak gravatar imageberak ( 2015-04-14 09:46:28 -0500 )edit

this line stereo = cv2.StereoSGBM(minDisparity = min_disp, calls StereoSGBM which python complains it's not an attribute of cv2. Maybe the method signature has changed?

techfort gravatar imagetechfort ( 2015-04-15 11:49:20 -0500 )edit

dear, look at the answer again, please ;)

berak gravatar imageberak ( 2015-04-15 13:10:16 -0500 )edit

Of course. Silly me, apologies! I will point out though that still has the old signature :)

techfort gravatar imagetechfort ( 2015-04-16 00:57:31 -0500 )edit
berak gravatar imageberak ( 2015-04-16 00:59:35 -0500 )edit

Ok apologies again. My checkout of OpenCV 3 was about 4 months old.

techfort gravatar imagetechfort ( 2015-04-17 07:25:21 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-04-14 01:34:39 -0500

Seen: 10,030 times

Last updated: Apr 14 '15