OpenCV image stitching does not work properly

前端 未结 2 1318
盖世英雄少女心
盖世英雄少女心 2021-01-29 12:46

I\'m a beginner programmer and just started using OpenCV. I want to stitch together 2 images using OpenCV\'s stitching.cpp Sample program When I attempt to stitch the images, I

2条回答
  •  情歌与酒
    2021-01-29 13:14

    My guess after looking at above images is that the images which you have captured are too difficult to infer reliable matching. As you may know, stitching consists of:

    1. Finding keypoints
    2. Matching keypoints by calculating distance between its corresponding descriptors
    3. Some outlier detection process like RANSAC
    4. Once you get matched keypoints, get homography. To get homography, you should at least have 8 pairs of matched keypoints. In reality, you may require more, since some outliers may not get removed.

    You are getting wrongly stitched images in one case, and the stitching is perfect for another pair of images, indicates that you have got the homography wrong. Homography depends on matched keypoints, thus that is where the real fault lies.

    In the first set of images you have posted, both consist of keyboard. I would not be surprised if a keypoint detection and matching algorithm like SIFT matches the right-shift in the first image with the left-shift of the second computer in the second image. This is totally wrong and will mess up the homography. Similarly, the screen in the first image can be matched with the screen of the right side computer in the second image (it should have been matched with the left-side computer).

    All of the above are my guesses, though I believe they are correct. Good way to confirm these would be to visualize matchings. Your image should not have a lot of repetitive and ambiguous patterns. For example, keyboard keys, small text on screen etc.

提交回复
热议问题