C++ 无法读取内存

vs2012调试程序时又遇到一个新问题,“无法读取内存”,找了半天终于找到,哭死:

errors:OpenCV Error: Assertion failed (dims <= 2 && data && (unsigned)i0 < (unsigned)size.p[0] && (unsigned)(i1*DataType<_Tp>::channels) < (unsigned)(size.p[1]*channels()) && ((((sizeof(size_t)<<28)|0x8442211) >> ((DataType<_Tp>::depth) & ((1 << 3) - 1))*4) & 15) == elemSize1()) in cv::Mat::at, file d:\opencv vs\build\include\opencv2\core\mat.hpp, line 538

正确访问图像的第h行第w列像素值方式是:

//竖着的是高,横着的是宽,访问图像像素时是先高再宽

int height=src.rows; //高

int width=src.cols; //宽 

for(int i=0;i

{
        for(int j=0;j< width;j++)

      {

        //.....

      }

}

 

你可能感兴趣的:(内存问题)