C++ and opencv get the image pixel value

  • I have a problem. Take notes

  • when i use the method of at to get the pixel value,an abnormal interrupt process has occurred.I find that thresh.at<uchar>(i, j) is  abnormal.Here's what surprises me,Some images are normal.so,I use this i < thresh.rows &&j < thresh.cols ,not i <= thresh.rows &&j <= thresh.cols.It is ok.

vector<int> White_Pixel_Y_Cut_2;
for (int i = Variable_Table_Black_Lines_okay_Y[Variable_Table_Black_Lines_okay_Y.size() - 1] + 5; i < Variable_Table_Black_Lines_okay_Y[Variable_Table_Black_Lines_okay_Y.size() - 1] + vertical_spacing*0.75 - 5; i++)//thresh.rows
{
	for (int j = Max_Variable_Table_Black_Lines_okay_X[0] - 5; j < Max_Variable_Table_Black_Lines_okay_X[0] + 5; j++)
	{
		if(i >= 0 && i < thresh.rows &&j < thresh.cols && j>=0)
		{
			//qDebug() << i << j;
			value = thresh.at<uchar>(i, j);
			if (value == 255)
			{
				White_Pixel_Y_Cut_2.push_back(i);
			}
		}
	}
}

I hope I can help you,If you have any questions, please  comment on this blog or send me a private message. I will reply in my free time.

展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 创作都市 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读