# StereoBM_create.compute() with different images shape

I would like to find the depth or disparity map for an image pair, but the images don't have the exactly same dimensions...

So I have this (strange) error:

error: /..../opencv/modules/calib3d/src/stereobm.cpp:1069: error: (-209) All the images must have the same size in function compute


From this points, three questions:

1. Is it possible to run StereoBM_create.compute() on images with different sizes?
2. Does it make sense to reshape one image to fit the smaller?
3. Is there any other tool to perform a depth computation that could work on image with different sizes?

I also have some really weird results:
Created so: stereo = cv2.StereoBM_create(numDisparities=16, blockSize=21)

(I run cv2 on Python 2.7)

edit retag close merge delete

Sort by » oldest newest most voted

first, you're supposed to run blockmatching on images from a calibrated stereo pair (and also, that you undistort the images, using the params from the calibration), it seems, you're not doing so. using arbitrary, "found" images won't give you any accuracy here, unfortunately.

1. no, not possible (just believe the error msg.)
2. no, not a valid idea , either. whatever you do to the images, it will change the relative position captured in them, and make the disparity worse, again see the comment above.
3. ofc. there are alternative ways to acquire depth images of some sort, use specialized cameras (kinect, etc), images from multiple poses (structure from motion), if you can control the lighting, and you're focussed on fairly small, indoor objects, also "structured light / threephase" and "photogrammetric stereo".
more

In fact those images are old archive images, I can only make the same assumption for all of them which result in a synthetic intrinsic matrix (I do know the focal for each image, but center is taken at the center of the image) and distortion coeffs are set to zero. Two images which can show some stereo may then have been taken from two different very old cameras. So I guess it's not possible to find a stereo map with the pairs?

( 2017-07-02 05:05:12 -0500 )edit

Official site

GitHub

Wiki

Documentation

## Stats

Asked: 2017-07-01 19:36:05 -0500

Seen: 793 times

Last updated: Jul 02 '17