好象是亮度调整那里出错了,可是不知道怎么改
int main(){
Mat re_src_image;
Mat src_image = imread("/home/zn/桌面/13740146-f01b848b12b93174.png",1);
if(! src_image.data){
cout << "Couldn't find the image!\n";
return false;
}
else {
resize(src_image, re_src_image, Size(640, 480));
vector<Mat> channels;
split(re_src_image, channels);
re_src_image = channels.at(2);
}
//亮度调整
int ContrastValue = 100;
int BrightValue = 0;
Mat light_image = Mat::zeros(re_src_image.size(), re_src_image.type());
for (int y = 0; y < re_src_image.rows; y++)
{
for (int x = 0; x < re_src_image.cols; x++)
{
for (int c = 0; c < 3; c++){
light_image.at<Vec3b>(y, x)[c] = (ContrastValue*0.01)*(re_src_image.at<Vec3b>(y, x)[c]) + BrightValue;
}
}
}
imshow("a",re_src_image);
while(1){
if(waitKey(0)==27)
break;
}
return 0;
}