简体   繁体   English

拼接中的OpenCV断言错误

[英]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. 断言失败== CV_8Uc3>在未知函数中。

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 并且链接器库是正确的(使用D版本,例如opencv_core244d.libopencv_stitching244d.lib等)

I think sgarizvi is right, loading in color solved a similar problem for me: 我认为sgarizvi是正确的,在颜色中加载对我来说解决了类似的问题:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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