我将OpenCV与Python一起用于深度映射测试。我找到了this教程,并使用this视频片段进行了测试。
这是我的单帧代码:
cap = cv2.VideoCapture('test1.mp4')
ret, frame = cap.read()
plt.imshow(cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY))
plt.show()
left = cv2.cvtColor(frame[0:720, 0:640], cv2.COLOR_BGR2GRAY)
right = cv2.cvtColor(frame[0:720, 640:1280], cv2.COLOR_BGR2GRAY)
stereo = cv2.StereoBM_create(numDisparities=16, blockSize=15)
disparity = stereo.compute(left,right)
norm_image = cv2.normalize(disparity, None, alpha = 0, beta = 1, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_32F)
plt.grid(False)
plt.imshow(norm_image)
plt.show()
cap.release()
results非常糟糕。我该怎么办?