This method takes the image name, c and gamma as arguments and apply the transformation
s = cr^gamma to each of the pixels and produce the output.
You can note that for gamma > 1, wide range of dark input pixels are mapped into narrow range of output pixels, image will be darkened. Opposite is true for gamma < 1.
Matlab Code
function gammaCorrection(name, c, gamma)
r = imread (name);
r=im2double(r);
r=rgb2gray(r);
s = c * (r .^ gamma);
subplot (1 ,2 ,1)
imshow(r);
title('Original');
subplot (1 ,2 ,2)
imshow(s)
title(sprintf('Gamma: %0.1f',gamma));
end
Output
what is the meaning of c parameter?
ReplyDeletethnx :)
ReplyDeletewhat is c????
ReplyDelete