opencv 代码帮看看,谢谢
opencv吧
全部回复
仅看楼主
level 1
opencv 3.1.0,vs2015
2016年04月02日 01点04分 1
level 1
temp.create(nr, nl, CV_8UC1);
back.create(nr, nl, CV_8UC3);
for (i = 0; i < nr; i++)
for (j = 0; j < nl; j++)
{
Vec3b intensity = img.at<Vec3b>(i, j);
temp.at<uchar>(i, j) = (intensity.val[0] + intensity.val[1] + intensity.val[2]) / 3;
}
报错大概在第一个内for循环第一次结束时候,
中断地点
CV_DbgAssert((unsigned)(i1 * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()));这是mat。at方法里面的
2016年04月02日 01点04分 2
level 1
_Tp& Mat::at(int i0, int i1)
{
CV_DbgAssert(dims <= 2);
CV_DbgAssert(data);
CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
CV_DbgAssert((unsigned)(i1 * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()));
CV_DbgAssert(CV_ELEM_SIZE1(DataType<_Tp>::depth) == elemSize1());
return ((_Tp*)(data + step.p[0] * i0))[i1];
}
第四行。
单步调试时候,i=0, j从1跑到若干都没事,
2016年04月02日 01点04分 3
level 1
搞定了吗?怎么搞定的?
2017年08月07日 08点08分 4
1