# Create stitched image from known calibrated points

Hello

I'm starting to work with image stitching for the first time.

I'm working on a setup in which two depth sensors are aligned looking down onto a table. In the image above, you see the two infra-red images from both cameras side by side.

The sensors FoV overlap a bit in the middle, and in this overlapping area I glued 10 black squares. I can know the positions of each of this black squares through a calibration process.

My goal is to stitch these two images so I end up with one full image that is consistent with my scenario. I looked a lot into the stitching classes, but everything I could find assumes that I'm going to find keypoints in color image to stitch, whereas in this case I can use calibrated points.

Can anyone give me some hints of how to proceed?

edit retag close merge delete

Have you tried just using the standard stitching algorithms? I understand that you want to explicitly use these calibration points, but I think the usual algorithm will also find them just fine as they are very characteristic.

( 2017-07-13 12:41:12 -0500 )edit

If the black squares lie on the same plane, you can estimate the homography using the 2D image coordinates. If not but you know the 3D object coordinates, you can estimate the camera displacement and after get the homography.

( 2017-07-14 05:51:44 -0500 )edit

@KjMag, there would be no need to compute them, it would be a waste of CPU resources since in my scenario I can calibrate the.

@Eduardo . Yes, I can compute homography from this points, but how do I go from the homography matrix to the stitched image?

( 2017-07-14 08:25:01 -0500 )edit

@KjMag, there would be no need to compute them, it would be a waste of CPU resources since in my scenario I can calibrate them.

@Eduardo . Yes, I can compute homography from this points, but how do I go from the homography matrix to the stitched image?

( 2017-07-14 08:26:01 -0500 )edit

I guess I have to transform one of the images to the others "perspective" using the homography matrix, is that it?

( 2017-07-14 09:29:25 -0500 )edit
1

I know it would be a waste of resources in theory, but unless you care about performance very much it might just be easier to implement, and in some cases ease of implementation > performance. Depends on the requirements and constraints - don't know what are yours.

( 2017-07-14 16:03:44 -0500 )edit

You should be able to use warpPerspective() for that. Maybe there is a way with the stitching module to reuse the transformation and perform only the warping / blending?

Correction for my first comment: homography from the camera displacement needs the plane equation (see here). In both cases, we assume that the homography transformation can be applied under the assumption of a planar scene.

( 2017-07-14 16:57:32 -0500 )edit

These are my first results using warpPerspective() to apply transformation on the image to the right. The results are not very good, but I guess I can do a more careful work in selecting points. I'll add more points and try to get a better result.

( 2017-07-17 05:49:34 -0500 )edit