2

I want to stitch 2 images using opencv(i don't want to use stitcher class), so far i've done keypoint detection, description, matching and warping

there are input images:

left right

myOutput

stitcherClassOutput

here is my code after finding good matches with surf algorithm:

for (int j = 0; j < good_matches.size(); j++)
{
    //-- Get the keypoints from the good matches
    obj.push_back(keypoints1[good_matches[j].queryIdx].pt);
    scene.push_back(keypoints2[good_matches[j].trainIdx].pt);
}

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


cv::Mat result;
warpPerspective(image2, result, H, cv::Size(image2.cols + image1.cols, image2.rows*2), INTER_CUBIC);

Mat final(Size(image2.cols * 2 + image2.cols, image2.rows * 2), CV_8UC3);

Mat roi1(final, Rect(0, 0, image1.cols, image1.rows));
Mat roi2(final, Rect(0, 0, result.cols, result.rows));

result.copyTo(roi2);
image1.copyTo(roi1);

imshow("Result", final);

so my question is, what should i add to my code for my output to look more like the one from stitcher class

Boris Sliz
  • 21
  • 2
  • 1
    Read the diagram (if possible the provided research paper as well) in the following link to best understand how the stitcher class works. https://docs.opencv.org/3.3.0/d1/d46/group__stitching.html – zindarod Oct 28 '17 at 16:05
  • thanks @Zindarod, this helped me, but i have another question, do you know if i can implement some part of the stitcher class on my own and let the class do the rest? for example i would find and match keypoints and for the rest i would use stitcher class – Boris Sliz Oct 28 '17 at 16:56
  • I don't think Stitcher class provides such functionality. You can implement a research paper by yourself, if you're interested in image stitching. – zindarod Oct 28 '17 at 17:06

0 Answers0