利用 opencv2.4 修改图片指定区域图片颜色

	// 去除黑边
	int channel = srcImgMat.channels();
	int height = srcImgMat.rows; //行数
	int width = srcImgMat.cols; // 列数
	for (int row = 0; row < height; row++)
	{
		for (int col = 0; col < width; col++)
		{
			if ((row <= 9 || row >= height-9) || (0 <= col && col <= 100) || (375 <= col && col < width))
			{
				if (channel == 1)
				{
					srcImgMat.at<uchar>(row, col) = 255;
				}
				else if (channel == 3)
				{
					srcImgMat.at<cv::Vec3b>(row, col)[0] = 255;
					srcImgMat.at<cv::Vec3b>(row, col)[1] = 255;
					srcImgMat.at<cv::Vec3b>(row, col)[2] = 255;
				}
			}
		}
	}

你可能感兴趣的:(QT)