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:
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