Python Stereo map. error: (-209) All the images must have the same size in function cv::findStereoCorrespondenceBM
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?
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 ;)