stitch function is not stitching all the input images

asked 2017-06-26 00:52:46 -0600

updated 2020-10-08 10:24:02 -0600

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.

image description image description image description image description image description image description

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

image description Please help me to fix this problem.Thanks in advance.

edit retag flag offensive close merge delete

Comments

1

try setPanoConfidenceThresh(0.3)

LBerger gravatar imageLBerger ( 2017-06-26 02:23:13 -0600 )edit

leaveBiggestComponent() is designed to do this. try setPanoConfidenceThresh

jsxyhelu gravatar imagejsxyhelu ( 2017-06-26 09:44:56 -0600 )edit