图像亮度对比度调整
读写像素
读一个GRAY像素点的像素值(CV_8UC1)
1//方式一
2Scalar intensity = img.at<uchar>(y, x);
3//方式二
4Scalar intensity = img.at<uchar>(Point(x, y));
读一个BGR像素点的像素值
1//读取整形
2Vec3b intensity = src.at<Vec3b>(x, y);
3int b = intensity [0];
4int g = intensity [1];
5int r = intensity [2];
6//读取浮点型
7Vec3f intensity = img.at<Vec3f>(y, x);
8float blue = intensity.val[0];
9float green = intensity.val[1];
10float red = intensity.val[2];
Vec3b与Vec3F
- Vec3b对应三通道的顺序是blue、green、red的uchar类型数据。
- Vec3f对应三通道的float类型数据
- 把CV_8UC1转换到CV32F1实现如下:
src.convertTo(dst, CV_32F);