Adaptation of OpenCV stitcher

asked 2012-10-01 08:08:43 -0500

ktj gravatar image

I'm working on a project where an image stitcher is required. The camera is fixed (no rotation and no translation), and the object is translating on a plane about 60-70 mm below the camera. The image plane is not quite parallel to the object plane. I know the exact translation between successive images in the object plane. I've successfully calibrated the camera using OpenCV:s calibrateCamera.

Now I would like to adapt the stitching library to fit my application. One idea is to bypass the feature matching etc and go straight to the composePanorama-function (as I know the translation). Of course this means I would have to add methods to access the various members such as the camera data structure. It seems the PlaneWarper takes both a rotation matrix and a translation vector, so perhaps that could be used.

Any ideas about this approach? Is there a better approach?


edit retag flag offensive close merge delete


You could look at the stitching detailed example, where each step of the pipeline is explicit. You have to skip estimating homographies and instead set all camera pose to [I|0]. You can calibrate the camera initially and set those values in CameraParams. I also found that PlaneWarper has an API slightly different from all other warpers. It accepts translation as well, although I am not sure what it exactly means. In my scenario I want it to tell that the camera is moving. In your scenario your camera is not moving, but your basically simulating a moving camera by moving the scene. So algorithmically you should pretend that your camera is moving and set the translation of the camera to the translation that you know.

Duffycola gravatar imageDuffycola ( 2014-07-30 04:52:47 -0500 )edit

Hello. I am working exactly on the same and have made some progresss but I am now stuck in the Blending step. I have made a new homography class estimation both rotation and translation.The PlaneWarper effectively takes translation into account after this (check the code).

But the Blender doesn't and crashes most of the time due to bad memory allocation or bad image limits computation (all due to not taking translation into account). Did you have some progress since tour question?

manatttta gravatar imagemanatttta ( 2014-10-03 08:10:15 -0500 )edit

Hi Manatttta, it would be great to catch up on progress. I also did some changes to estimate 1) a fundamental matrix F instead of a homography in the first place, 2) extract the essential matrix E from F, 3) extract rotation and translation from E. Unfortunately something is still wrong, but I am sure this is the way to go. It would be interesting to catch up, but I don't know how to contact you.

Duffycola gravatar imageDuffycola ( 2014-10-22 06:10:59 -0500 )edit

Duffycola, manatttta, I'm in the same situation, trying to use PlaneWarper with translation, how did you make it work?

lucasfranco gravatar imagelucasfranco ( 2016-10-18 13:55:19 -0500 )edit