1 Assume an image contains very bright pixels Design a mappi
1. Assume an image contains very bright pixels. Design a mapping function to enhance the contrast of this image.
Solution
Below fucntion will use histogram for adjusting contrast of image
===============================================================================
function h = histogram(imgname) //Get Histogram of image
img = imread(imgname); //Read image
figure; imshow(img);
img = double(img);
h = zeros(256,1);
for i=1:M,
for j=1:N,
f = img(i,j);
h(f+1) = h(f+1) + 1;
end
end