OpenCV imwrite params读取访问冲突 [英] OpenCV imwrite params read access violation
本文介绍了OpenCV imwrite params读取访问冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
一个非常简单的问题...为什么我收到此代码的读取访问冲突错误?
A very simple question...why am I getting a read access violation error with this code?
cv::Mat laserSpeckle = Mat::zeros(100,100,CV_8UC1);
imwrite( "C://testimage.jpg", laserSpeckle );
当我附加调试器并进一步查看它时,它会在 grfmt.cpp 中的此代码段中引发异常.
When i attach a debugger and look into it further, it throws the exception at this snippet in grfmt.cpp.
if( params[i] == CV_IMWRITE_JPEG_QUALITY )
{
quality = params[i+1];
quality = MIN(MAX(quality, 0), 100);
}
它也会出现在 .png 和 .tiff 中.我是 OpenCV 新手,如果这真的很简单,我很抱歉.我使用 Qt 是为了它的价值.
It occurs with .png and .tiff too. Im an OpenCV newbie, my apologies if this is something really simple. I am using Qt for what its worth.
推荐答案
您自己构建 OpenCV 吗?如果是,请确保在配置构建文件时启用选项 WITH_JPEG
:
Do you build OpenCV yourself? If yes, make sure that the option WITH_JPEG
is enabled when you configure your build files:
cmake ... -DWITH_JPEG=ON ...
这篇关于OpenCV imwrite params读取访问冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文