gpt4 book ai didi

c++ - 拼接中的 OpenCV 断言错误

转载 作者:太空宇宙 更新时间:2023-11-03 23:02:06 24 4
gpt4 key购买 nike

我正在对两张图片进行拼接,在调试时出现了这个错误(编译成功但运行时中断):

在未知函数中断言失败 ==CV_8Uc3>。

代码如下:

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;
}

我没能在这段代码中找到错误。并且链接库是正确的(使用D版本,如opencv_core244d.libopencv_stitching244d.lib

最佳答案

我认为sgarizvi是的,加载颜色为我解决了类似的问题:

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

关于c++ - 拼接中的 OpenCV 断言错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15018337/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com