Histogram equalization without built-in function | MATLAB

Published: 21 June 2020
on channel: Knowledge Amplifier
4,035
40

Code:


clc
clear all
close all
warning off;
x=imread('tire.tif');
subplot(3,2,1);
imshow(x);
title('Original Image');
subplot(3,2,2);
imhist(x);
title('Histogram of Original Image using built in function');
axis tight;
h=zeros(1,256);
[r c]=size(x);
totla_no_of_pixels=r*c;
n=0:255;
%%
j=histeq(x);
subplot(3,2,3);
imshow(j);
title('Histogram Equalization using built in function');
subplot(3,2,4);
imhist(j);
axis tight;
title('Histogram Equalization using built in function');
%%
%Calculating Histogram without built-in function
for i=1:r
for j=1:c
h(x(i,j)+1)=h(x(i,j)+1)+1;
end
end
%%
%Calculating Probability
for i=1:256
h(i)=h(i)/totla_no_of_pixels;
end
%%
%Calculating Cumulative Probability
temp=h(1);
for i=2:256
temp=temp+h(i);
h(i)=temp;
end
%%
%Mapping
for i=1:r
for j=1:c
x(i,j)=round(h(x(i,j)+1)*255);
end
end
subplot(3,2,5);
imshow(x);
title('Histogram Equalized image using own code');
subplot(3,2,6);
imhist(x);
axis tight;
title('Histogram Equalization using own code');

Prerequisite:
When ENTROPY is MAX??(Intuitive Idea)
   • When ENTROPY is MAX??(Intuitive Idea)  
Learn Digital Image Processing using MATLAB :
   • Add two Images | MATLAB (Complete cod...  

#DigitalImageProcessing #MATLAB #DIP #DSP #SignalProcessing


On this page of the site you can watch the video online Histogram equalization without built-in function | MATLAB with a duration of hours minute second in good quality, which was uploaded by the user Knowledge Amplifier 21 June 2020, share the link with friends and acquaintances, this video has already been watched 4,035 times on youtube and it was liked by 40 viewers. Enjoy your viewing!