【问题标题】:OpenCV Unhandled exception when writing a file写入文件时OpenCV未处理的异常
【发布时间】:2012-11-21 15:40:03
【问题描述】:

尝试不同的方法后,我的程序在保存图像时总是崩溃。它可以很好地读取图像,我可以将其可视化,但我无法保存文件(它出现在我使用 imwrite 时使用 OpenCV 制作的所有程序中)。它在使用 OpenCV 2.1 在 Visual Studio 10.0 中调试时发生:

Unhandled exception at 0x67570fcd in SR.exe: 0xC0000005: Access violation reading location 0x00000000.

代码如下:

Mat imLow;

imLow=imread("Cameraman256.png",0);
if(!imLow.data)                             
{
    std::cout<<  "Could not open or find the image" << std::endl ;
    return -1;
}
imwrite( "image.png", imLow);

谁能告诉我如何解决这个问题?谢谢

更新:这似乎是PNG和JPEG格式的问题,因为该行在保存为BMP格式时有效。

【问题讨论】:

    标签: c++ opencv


    【解决方案1】:

    BMP 文件保存是内置的,IIRC .PGM 也是内置的,其他文件由 3rd 方库提供,具体取决于您的操作系统。

    您自己构建了 openCV 吗?什么操作系统?

    【讨论】:

    • 我直接从他们的网站下载了二进制文件。视窗 7
    猜你喜欢
    • 1970-01-01
    • 2021-03-08
    • 1970-01-01
    • 2011-08-08
    • 2021-12-02
    • 2011-12-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多