Python cv2 模块,StereoBM_create() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用cv2.StereoBM_create()

项目:cvcalib    作者:Algomorph    | 项目源码 | 文件源码
def disparity(self):
        matcher = cv2.StereoBM_create(1024, 7)
        disparity = matcher.compute(cv2.cvtColor(self.images[0], cv2.COLOR_BGR2GRAY),
                                    cv2.cvtColor(self.images[1], cv2.COLOR_BGR2GRAY))
        self.process_output(disparity)
项目:Smart-Car    作者:jimchenhub    | 项目源码 | 文件源码
def readyStereoBM(roi1, roi2):
    stereobm = cv2.StereoBM_create(numDisparities=112, blockSize=31)
    stereobm.setPreFilterSize(31)#41
    stereobm.setPreFilterType(cv2.STEREO_BM_PREFILTER_NORMALIZED_RESPONSE)
    stereobm.setPreFilterCap(31)
    stereobm.setTextureThreshold(10)
    stereobm.setMinDisparity(0)
    stereobm.setSpeckleWindowSize(100)
    stereobm.setSpeckleRange(64)
    stereobm.setUniquenessRatio(0)
    stereobm.setROI1(roi1)
    stereobm.setROI1(roi2)
    return stereobm