How to implement this plateau limit histogram equalization algorithm
5 views (last 30 days)
Show older comments
Hi,
i would like to implement and simple alghoritm. i compare my result's histogram with original result's histogram and there is always a huge difference.
i reviewed my code again and again. but i couldn't see what is the problem. can you take a look to my code, please?
histogram_of_image = imhist(input_image);
modified_histogram = zeros(1,256);
modified_histogram(1:256) = (log(histogram_of_image(1:256)+(a))).^(beta);
these_elements_are_not_zero = modified_histogram~= 0;
sum2 = sum(modified_histogram(these_elements_are_not_zero));
cnt2 = size(these_elements_are_not_zero,2);
tcl = sum2/cnt2;
clipped_histogram = zeros(1,256);
for i=1:256
if((modified_histogram(i)) >= tcl)
clipped_histogram(i) = tcl;
else
clipped_histogram(i) = (modified_histogram(i));
end
end
PDa = zeros(1,256);
PDa = clipped_histogram / (sum(clipped_histogram));
CDa = zeros(1,256); %create CDa in formula
CDa(1) = PDa(1) ;
for i=2:256
CDa(i) = PDa(i) + CDa(i-1);
end
value_after_enhancement = zeros(1,256);
value_after_enhancement = (255 * CDa);
b=uint8(0);
output_image=zeros(width,height);
output_image = value_after_enhancement(input_image+1);
figure;imshow(uint8(output_image));
original_result=imread('testsonuc.bmp');
original_result=double(rgb2gray(original_result));
image_of_dif= zeros(width,height);
figure;imshow(uint8(original_result));
2 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!