【发布时间】: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格式时有效。
【问题讨论】: