Ask Your Question
0

StereoBM in OpenCV 3 (Python) missing module

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

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
4

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

berak gravatar image

you will have to use the 'create' function:

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

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

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

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

Comments

1

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 -0600 )edit

yea, that needs to be changed ;)

at least samples/python2/stereo_match.py has it correct.

berak gravatar imageberak ( 2015-04-14 04:54:14 -0600 )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 -0600 )edit

what's exactly wrong now ?

berak gravatar imageberak ( 2015-04-14 09:46:28 -0600 )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 -0600 )edit

dear, look at the answer again, please ;)

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

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

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

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

techfort gravatar imagetechfort ( 2015-04-17 07:25:21 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 10,814 times

Last updated: Apr 14 '15