It seems that you need gamma correction.
Take a look here:
http://subokita.com/2013/06/18/simple-and-fast-gamma-correction-on-opencv/
and the source of link above (with source/result pictures):
Question
I am trying to achieve this result
but what I am trying is
Mat out = imread ("F:\\image.jpg");
Mat img2 = Mat(out.size(),out.type());
cv_Gamma(out,image ,0.7);
blending_overlay(image , out , image);
and this give me the following result
and the original image is
It looks that there is a lack of brightness in my image but when I increase the brightness it still not give the required result
Edit Blending Overlay
void blending_overlay(Mat& img1 , Mat& img2 , Mat& out)
{
Mat result(img1.size(), CV_32FC3);
for(int i = 0; i < img1.size().height; ++i){
for(int j = 0; j < img1.size().width; ++j){
for (int c=0 ; c<img1.channels();c++){
float target = (float)img1.at<uchar>(i, 3*j+c)/255.0 ;
float blend = (float)img2.at<uchar>(i, 3*j+c)/255.0 ;
if(target > 0.5){
result.at<float>(i, 3*j+c) = ((1 - (1-2*(target-0.5)) * (1-blend)));
}
else{
result.at<float>(i, 3*j+c) = ((2*target) * blend);
}
}
}
}
result.convertTo(out,CV_8UC3,255);
}
In fact I have tried every blending mode, what I understand about this is that I may multiply with a linear gradient which come from yellow to white, but how to make that gradient is not understandable for me. Any algorithm
regarding this scenario would also be appreciated.
Solution
It seems that you need gamma correction.
Take a look here:
http://subokita.com/2013/06/18/simple-and-fast-gamma-correction-on-opencv/
and the source of link above (with source/result pictures):