每个像素点 g(i,j) = α⋅f(i,j) + β:
Mat::convertTo()
double alpha = 2;
int beta = 50;
Mat src = imread("img/7.jpg");
Mat dst = Mat::zeros(src.size(), src.type());
Mat dst2 = Mat::zeros(src.size(), src.type());
for (int x = 0; x < src.rows; x++)
{
for (int y = 0; y < src.cols; y++)
{
//bgr三通道
dst.at<Vec3b>(x, y)[0] = saturate_cast<uchar>(alpha*src.at<Vec3b>(x, y)[0] + beta);
dst.at<Vec3b>(x, y)[1] = saturate_cast<uchar>(alpha*src.at<Vec3b>(x, y)[1] + beta);
dst.at<Vec3b>(x, y)[2] = saturate_cast<uchar>(alpha*src.at<Vec3b>(x, y)[2] + beta);
}
}
src.convertTo(dst2, -1, alpha, beta);
imshow("Normal", src);
imshow("End",dst);
imshow("End2", dst2);