How to stitch 100s of images using OpenCV/JavaCV? Most of the current solutions leads to artifacts

邮差的信 提交于 2019-12-04 06:09:56

问题


I am trying to stitch a large number of images which have good amount overlap like these: ExampleImage1 and ExampleImage2.

Firstly, i want a 1D line of a grass patch. Something like this: Result. This is a screenshot of the original result, the original picture is more than 2MB. Hence couldnt upload it. This was achieved by breaking down 300 images into small sets and stitching them. Like this example but in a larger scale with more heirarchies - 0.jpg,1.jpg,2.jpg images in stitch1.jpg, 2,3,4 in stitch2.jpg and later stitching stitch1.jpg and stitch2.jpg together

Now i want to get the same result by stitching images like: 0.jpg + 1.jpg = result.jpg, result.jpg + 2.jpg = result.jpg ..... and so on.

I am using the region of interest concept to make sure that the overlapping region is more than 20% all the time.The code looks like below. The code is the body of a for loop. It only explains the core part of the algorithm and not the exact code.

After running this, i am getting an artifact such as: Result2. This looks like because the post processing of the stitching pipeline is not observed in the whole image because of the region of interest concept which is used.

Can anyone tell me how to tackle this problem?

Also, is there a way to see the detected features in opencv stitching pipeline?

for (int j = 4; j < 100; j = j + 1) {
    image2 = imread("result.jpg");                                  // result of stitching 0.jpg, 1.jpg,2.jpg and 3.jpg
    image1 = imread(j + ".jpg");

    Rect rect2 = new Rect(0,0, (int)(image1.cols()*0.5),image2.rows());
    Rect rect1 = new Rect(0,0,(int)(image1.cols()*0.5),image1.rows());

    imgs.resize(imgs.size() + 1);
    imgs.put(imgs.size() - 1, image2);
    Roi.push_back(new RectVector(rect2));
    imgs.resize(imgs.size() + 1);
    imgs.put(imgs.size() - 1, image1);
    Roi.push_back(new RectVector(rect1));

    int status = stitcher.stitch(imgs, Roi, pano);
}

来源:https://stackoverflow.com/questions/53669581/how-to-stitch-100s-of-images-using-opencv-javacv-most-of-the-current-solutions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!