OpenCV image stitching does not work properly

♀尐吖头ヾ 提交于 2019-12-02 14:31:29

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.

Figured out the problem. Had to reduce the resolution of my image. I guess the stitcher got confused with the excess of information when the resolution was too high. Also the order in which the photos are given to the program matters. I have to sometimes have to flip the order.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!