Question: The following code performs histogram equalization in order to increase the contrast in a given image. Your task is to run this code and try
The following code performs "histogram equalization" in order to increase the contrast in a given image. Your task is to run this code and try to understand what each line is doing by explaining it in your own words. Matlab Code: A = imread('tire.jpg'): if(size(A, 3)) == 3 A = rgb2gray(A): end figure, imshow(A): %Specify the bin range[0 255] bin = 255: %Find the histogram of the image. Val = reshape(A, [], 1): Val = double(Val): I = hist(Val, 0: bin): %Divide the result by number of pixels Output = Iumel(A): %Calculate the Cumlative sum CSum = cumsum(Output): %Perform the transformation S = T(R) where S and R in the range [0 1] Him = CSum(A + 1): %Convert the image into uint8 Him = uint8(HIm*bin): figure, imshow(HIm)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
