Stitching 2 image with findHomography
Hi, i have troubles to stitching two image using findHomography and warpPerspective, my code is the next one:
Mat H = findHomography(obj, scene, CV_RANSAC);
Mat warpImage2;
warpPerspective(im2, warpImage2, H, Size(im2.cols, im2.rows), INTER_CUBIC, BORDER_TRANSPARENT);
Mat final(Size(im2.cols * 2 , im2.rows), CV_8UC3);
Mat roi1(final, Rect(0, 0, im.cols, im.rows));
Mat roi2(final, Rect(im.cols, 0, im2.cols, im2.rows));
warpImage2.copyTo(roi2);
im.copyTo(roi1);
imshow("final", final);
the problem is that the result is the next one:
I can move my roi manually and try and try untill stitching both but when i'll use that function for other image will not work.
There a form to stitching them without move de roi manually?
Thanks.
Hello guy, You want to cut the two images by size.I have this function.
{ int maior_x, maior_y, menor_x, menor_y;
menor_x = maior_x = menor_y = maior_y = 900;
for(int rows = 900; rows < ent.rows; rows++) { for(int cols = 900; cols < ent.cols; cols++) { if(ent.at<vec3b>(rows, cols)[0] != 0 && ent.at<vec3b>(rows, cols)[1] != 0 && ent.at<vec3b>(rows, cols)[2] != 0 ) { if(rows < menor_y) { menor_y = rows; }
}
Mmmm i think you don't understand me xD
I want a result similar to the class stitcher.
I don't need cut, the warpPerspective function with my homography cut my image correctly but i don't know how to stitch both without doing a roi like that:
Try and error say me that im.cols-77 is the position correct for my warpImage2 but i want put that without i have to create a function for all the images.
I hope undertand me or if i misundertand you excuse me.