I am using stitch function to stitch all the overlapped images to create a panorama view.But only some images are getting stitched, not all.
The code is: bool try_use_gpu = false; vector<mat> imgs; string result_name = "field.jpg";
int parseCmdArgs(int argc, char** argv) { if (argc == 1) { return -1; } for (int i = 1; i < argc; ++i) {
{
Mat img = imread(argv[i]);
if (img.empty())
{
cout << "Can't read image '" << argv[i] << "'\n";
return -1;
}
imgs.push_back(img);
}
}
return 0;
}
int main(int argc, char* argv[]) { int retval = parseCmdArgs(argc, argv); if (retval) return -1;
Mat pano;
Stitcher stitcher = Stitcher::createDefault(try_use_gpu);
stitcher.setRegistrationResol(-1); /// 0.6
stitcher.setSeamEstimationResol(-1); /// 0.1
stitcher.setCompositingResol(-1); //1
stitcher.setPanoConfidenceThresh(-1); //1
stitcher.setWaveCorrection(true);
stitcher.setWaveCorrectKind(detail::WAVE_CORRECT_HORIZ);
Stitcher::Status status = stitcher.stitch(imgs, pano);
if (status != Stitcher::OK)
{
cout << "Can't stitch images, error code = " << status << endl;
return -1;
}
imwrite(result_name, pano);
return 0;
}
The output i am getting is
Please help me to fix this problem.Thanks in advance.