Adjusts brighness and contrasts of a gray scale image
y = bricontra(x,m,s)
y = bricontra(x,m,s,o)
A matrix representing a gray scale image.
A positive number representing the brighness of the adjusted image.
A positive number representing the constrast of the adjusted image.
An optional parameter of character constant 'm' to specify mean absolute deviation method.
A matrix representing the gray level image with new brightness and contrast specified respectively in the 2nd and 3rd parameters.
It adjust the brightness and constrast of a given gray scale image. The desired brightness and contrast levels are given as positive numbers in the 2nd and 3rd parameters. If only the first three parameter are given, then the birghtness and contrasts are adjusted using the means and standard deviation method. If fourth parameter is given and is 'm', the brightness and contrast adjustment is performed based on median and mean absolute deviation method.
x=imread('lena.png'); x=rgb2gray(x); x=double(x); // brightness and contrast adjustment using mean and standard deviation ax=bricontra(x,120,100); // displaying the adjusted image imshow(uint8(ax)) // brightness and contrast adjustment using median and mean absolute deviation bx=bricontra(x,120,100,'m'); // displaying the adjusted image imshow(uint8(bx)) // displaying the difference imshow(uint8(floor(mat2gray(abs(ax-bx))*255))) | ![]() | ![]() |