Ask Your Question
0

Stitching images from 2 overlapping cameras stationary relative to each-other

asked 2014-07-16 04:14:07 -0600

RonM gravatar image

Hi all, I'm new to CV, and trying to stitch together a video of two cameras which are stationary one relative to the other. The details:

The cameras are one beside the other and I can adjust the rotation angle between them. The cameras will be moving with respect to the world, so the scene will be changing.

The amount of frames to be stitched is roughly 300 (each frame is composed of two pictures, one from each camera).

I don't need to do the stitching in real time, but I want to do it as fast as possible using the fact that I know the relative positions of the cameras. Resolution of each picture is relatively high, around 900x600.

Right now I'm at the stage where I have code to stitch 2 single pictures, courtesy of http://ramsrigoutham.com/2012/11/22/panorama-image-stitching-in-opencv/

The main stages are:

  1. Using SURF detector to find SURF descriptor in both images
  2. matching the SURF descriptor using FLANN Matcher
  3. Postprocessing matches to find good matches
  4. Using RANSAC to estimate the Homography matrix using the matched SURF descriptors
  5. Warping the images based on the homography matrix

My question is: How can I optimize the process based on the fact that I already know the camera positions?

Ideally I would like to do some initial calculation once to find the transform between the camera perspectives, and then reuse it. But not sure with my rudimentary CV knowledge if this is indeed possible, and what transform I could use if so.

I understand that calculating the homography matrix once and reusing it won't work, since the scene is changing.

Two other possibilities:

  1. I found a similar case (but stationary scene) where the transform is computed once and reused. Which transform is this, and could it work in my case?

  2. The other possibility I found is to use the initial knowledge to find the overlapping region between two pictures, and ignore the rest of the pictures to save time. Relevant thread

Any help would be greatly appreciated!
Ron

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-07-16 04:35:47 -0600

Witek gravatar image

The code you are using is the "old" manual approach to stitching. The effects are not as nice as with the new Stitcher class, which has exposure compensation, seam blending and various projections etc. For a start you could continue using the code you have. If your cameras are really stationary and your scene is feature-rich, you can easily compute the transformation once for the first image pair and subsequent pairs you simply warp with this transformation. So, for the first pair, you go all the way until

 Mat H = findHomography( obj, scene, CV_RANSAC );

You have found the transformation. From now on, you just load a pair of images and you warp them WITHOUT finding SURF keypoints, matching them and calculating the homography. This should go very fast.

For better results, you should do the same with the new Stitcher class. It will be much more difficult (at least for me), but the result should be perfect.

edit flag offensive delete link more

Comments

@RonM, did you ever try the solution suggested above?

thealse gravatar imagethealse ( 2016-12-22 02:25:50 -0600 )edit

Question Tools

Stats

Asked: 2014-07-16 04:14:07 -0600

Seen: 3,642 times

Last updated: Jul 16 '14