Ask Your Question
0

StereoBM_create.compute() with different images shape

asked 2017-07-01 19:36:05 -0600

swiss_knight gravatar image

updated 2017-07-02 03:40:50 -0600

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: disparity map
Created so: stereo = cv2.StereoBM_create(numDisparities=16, blockSize=21)


(I run cv2 on Python 2.7)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-07-02 03:50:04 -0600

berak gravatar image

updated 2017-07-02 03:58:34 -0600

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".
edit flag offensive delete link more

Comments

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?

swiss_knight gravatar imageswiss_knight ( 2017-07-02 05:05:12 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 1,483 times

Last updated: Jul 02 '17