OpenCV2.1 BUG

     今天在VS2008中使用OpenCV2.1,发现使用cvLoadImage读大图片文件时内存访问越界,网上搜了一下原来是BUG。
 
网上修改方法如下:

patch for file:
src/highgui/grfmt_bmp.cpp (line 198)

change from:
AutoBuffer _src, _bgr;

if( (m_bpp != 24 || !color) )
_src.allocate(src_pitch + 32);

to:

AutoBuffer _src, _bgr;

// 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);

修改后要重新编译OpenCV,才能使用正常。
之前使用2.1版本做Mean Shift分割测试也发现有BUG,还是开始使用OpenCV2.2了
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值