Ask Your Question
0

StereoBM in OpenCV 3 (Python) missing module

asked Apr 14 '15

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.

Preview: (hide)

1 answer

Sort by » oldest newest most voted
4

answered Apr 14 '15

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
Preview: (hide)

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 (Apr 14 '15)edit

yea, that needs to be changed ;)

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

berak gravatar imageberak (Apr 14 '15)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 (Apr 14 '15)edit

what's exactly wrong now ?

berak gravatar imageberak (Apr 14 '15)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 (Apr 15 '15)edit

dear, look at the answer again, please ;)

berak gravatar imageberak (Apr 15 '15)edit

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

techfort gravatar imagetechfort (Apr 16 '15)edit
berak gravatar imageberak (Apr 16 '15)edit

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

techfort gravatar imagetechfort (Apr 17 '15)edit

Question Tools

1 follower

Stats

Asked: Apr 14 '15

Seen: 10,983 times

Last updated: Apr 14 '15