Python Stereo map. error: (-209) All the images must have the same size in function cv::findStereoCorrespondenceBM

asked 2014-05-18 13:03:34 -0600

updated 2019-12-09 08:03:59 -0600

Akhil Patel gravatar image

Hi, im new to python and open CV .I was trying out stereo vision. Here is my code

'import numpy as np
import cv2
import PIL
from matplotlib import pyplot as plt
import cv2.cv as cv


imgL = cv2.imread('l.png',0)
imgR = cv2.imread('2.png',0)


stereo = cv2.StereoBM(cv2.STEREO_BM_BASIC_PRESET,ndisparities=16, SADWindowSize=16)
disparity = stereo.compute(imgL,imgR)
plt.imshow(disparity,'gray')
plt.show()

'

When i run this code, i get following error:

================================ Traceback (most recent call last):

File "F:/Python programs/python ocv/OpenCV 3D rendering/depthmap.py", line 13, in <module>
    disparity = stereo.compute(imgL,imgR)
error: ..\..\..\..\opencv\modules\calib3d\src\stereobm.cpp:783: error: (-209) All the images must have the same size in function cv::findStereoCorrespondenceBM

both the images im loading are 400x500 , and i couldnt really find any dimensional constraints for stereoBM. What does the error really mean?

edit retag flag offensive close merge delete

Comments

Are you sure that the image are loaded properly? Because usually it means that images aren't properly loaded. I suggest you to verify that first ;)

HYPEREGO gravatar imageHYPEREGO ( 2019-04-08 05:19:16 -0600 )edit