OpenCV2.1 BUG
今天在VS2008中使用OpenCV2.1,发现使用cvLoadImage读大图片文件时内存访问越界,网上搜了一下原来是BUG。
网上修改方法如下:
patch for file:
src/highgui/grfmt_bmp.cpp (line 198)
change from:
AutoBuffer
if( (m_bpp != 24 || !color) )
_src.allocate(src_pitch + 32);
to:
AutoBuffer
// bug fix, otherwise memcpy in getBytes in file bitstrm.cpp will
crash
if ( 4096 < src_pitch)
{
_src.allocate( src_pitch + (8 * nch) );
_bgr.allocate( src_pitch + (8 * nch) );
}
if( (m_bpp != 24 || !color) )
_src.allocate(src_pitch + 32);