简体   繁体   中英

OpenCV Assertion Error in Stitching

I'm doing stitching on two images, and has this error while debugging(compile successfully but when run it breaks):

Assertion failed ==CV_8Uc3> in unknown function.

And here is the code:

int main(int argc, char ** argv)
{
    Mat im1=imread("panorama_image1.jpg", CV_LOAD_IMAGE_GRAYSCALE);
    Mat im2=imread("panorama_image2.jpg", CV_LOAD_IMAGE_GRAYSCALE);

    Mat result;
    vector<Mat> imgs;
    imgs.push_back(im1);
    imgs.push_back(im2);
    cv::Stitcher stitcher=cv::Stitcher::createDefault(false);
    stitcher.stitch(imgs,result);

    namedWindow("Mosaic", CV_WINDOW_AUTOSIZE);
    imshow("Mosaic",result);
    waitKey(0);

    return 0;
}

I've not been able to find an error in this code. And the linker libraries are correct(use D version such as opencv_core244d.lib , opencv_stitching244d.lib etc

I think sgarizvi is right, loading in color solved a similar problem for me:

Mat im1=imread("panorama_image1.jpg", CV_LOAD_IMAGE_COLOR);
Mat im2=imread("panorama_image2.jpg", CV_LOAD_IMAGE_COLOR);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM