def getDisparity(stereo, img1, img2, mapx1, mapy1, mapx2, mapy2):
dst1 = cv2.remap(img1, mapx1, mapy1, cv2.INTER_LINEAR)
dst2 = cv2.remap(img2, mapx2, mapy2, cv2.INTER_LINEAR)
gray1 = cv2.cvtColor(dst1, cv2.COLOR_BGR2GRAY)
gray2 = cv2.cvtColor(dst2, cv2.COLOR_BGR2GRAY)
disparity = stereo.compute(gray1, gray2)/16
# disparity = cv2.medianBlur(disparity, 5)
return disparity
评论列表
文章目录