A problem on multi images registration

Hi guys, I am using OpenCV2.4.8 on VisualStudio2010 for multi-image registration (resolution is 3648*2736 for each). But it overflows when registering for many images.

First, I use

Mat panorama;
Stitcher stitcher = Stitcher::createDefault(false);
Stitcher::Status status = stitcher.stitch(imgVector, panorama);


But it shows "StitchPanoroma.exe has stopped working" when more than two images works as input.

Then I write my own code, assuming the sequence of the images are known. But the same error occurs. I define a function to detect the SURF feature, and use Flann for matching. Then use the basic distance method to achieve good matching.

I think the error is because of the size of the image. Specifically, when several images (i.e. 7) are registered, the result image has a large size. Then when the eighth image is registering, the program overflows.

You can see in the below. In the first method, the program can register for 5 images, while the second method can register for 8. The reason is that the size of the second method result is smaller than that of the first.

Mat homography= cv::findHomography(cv::Mat(goodkeypoints0), cv::Mat(goodkeypoints1), inliers, CV_RANSAC, 1);
//FirstMethod
warpPerspective(imgIntermediate, imgWarp, homography, cv::Size(pow(1.17, counter)*imgIntermediate.cols, pow(1.02, counter)*imgIntermediate.rows));
//SecondMethod
warpPerspective(imgIntermediate, imgWarp, homography, cv::Size(imgIntermediate.cols+1200, imgIntermediate.rows+50));
Mat half;
half = imgWarp(cv::Rect(0,0,imgColor1.cols,imgColor1.rows));
imgColor1.copyTo(half);


Could you guys please me some suggestions for this problem? Many thanks.

Alex

edit retag close merge delete