Histogram equalization/processing in Digital Image Processing with example and perform in MATLAB|DIP

Published: 21 August 2021
on channel: Study with Dr. Dafda
12,252
159

Video lecture series on Digital Image Processing, Lecture: 13,
Histogram Equalization in DIP and its implementation in MATLAB
What is Histogram?
What is histogram equalization/processing?
Example of histogram plotting.
Example of histogram equalization of an image.
How can histogram plotting/showing and equalization/processing/modelling can be implemented in MATLAB?
How to perform histogram showing and histogram equalization without imhist( ) and histeq( ) command in MATLAB
What is spatial domain image processing?
Is histogram equalization always good? If not what is the solution?
Digital Image Processing (DIP) using/in MATLAB

Link to download ppts/lecture notes:
https://drive.google.com/drive/folder...

MATLAB code used in the video is present at the end in the Description
#DIP
#DIPwithMATLAB
#DigitalImageProcessing
#StudywithDrDafda

Links of other lectures in the series:

1. What is Digital Image Processing?
   • What is Digital Image Processing || Introd...  

2. Human Visual System and Elements of Digital Image Processing
   • Human Visual System and  Elements of Digit...  

3. Fundamental steps in Digital Image Processing
   • Fundamental steps in Digital Image Process...  

4. Image Sensing and Acquisition
   • Image Sensing and Acquisition in Digital I...  

5. Relationship between Pixels in Digital Image Processing: Neighborhood, Adjacency & Distance measures
   • Relationship between Pixels in Digital Ima...  

6. Image Sampling and Quantization
   • Image Sampling and Quantization in Digital...  

7. Spatial and Intensity resolution in Digital Image Processing and its Implementation in MATLAB
   • Spatial and Intensity Resolution in Digita...  

8. Basics of intensity transformations and spatial filtering and implementation in MATLAB
   • Basics of Intensity transformations and Sp...  

9. Image negatives, Log and Power-Law transformations for DIP and implementation in MATLAB
   • Intensity (Image negatives, Log and Power-...  

10. Piecewise linear transformation function: Contrast Stretching in DIP & implementation in MATLAB
   • Piecewise linear transformation function: ...  

11. Piecewise linear transformation function: Intensity-level slicing in DIP and implementation in MATLAB
   • Piecewise linear transformation function: ...  

12. Piecewise linear transformation function: Bit-plane slicing in DIP and implementation in MATLAB
   • Piecewise linear transformation function: ...  

% Matlab program for Histogram showing and Histogram equilization
close all;
clear all;
clc
warning off;
%I=imread('Maulik.png');
%I=imread('pout.tif');
I=imread('Cameraman.tif');
%I=rgb2gray(I);
figure
subplot(1,2,1);
imshow(I);title('Original image');
subplot(1,2,2)
imhist(I); title('Histogram');
J = histeq(I);
figure
subplot(1,2,1);
imshow(J); title('Histogram equalized image');
subplot(1,2,2);
imhist(J); title('Histogram');

%MATLAB Program for histogram equilization without histeq
close all;
clear all;
clc
warning off;
% Read the image
a=imread('Maulik.png');
%a=imread('pout.tif');
% Convert to grayscale incase it is color
a = rgb2gray(a);
b=size(a);
a=double(a);

% Loop for Getting the Histogram of the Original image
freq_counts = zeros(1,256);
for i=1:b(1)
for j=1:b(2)
for k=0:255
if a(i,j)==k
freq_counts(k+1)=freq_counts(k+1)+1;
end
end
end
end

%Generating PDF out of histogram by diving by total no. of pixels
pdf=(1/(b(1)*b(2)))*freq_counts;

%Generating CDF out of PDF
cdf = zeros(1,256);
cdf(1)=pdf(1);
for i=2:256
cdf(i)=cdf(i-1)+pdf(i);
end
cdf = round(255*cdf);
% histogram equilized image
ep = zeros(b);
for i=1:b(1) %loop tracing the rows of image
for j=1:b(2) %loop tracing thes columns of image
t=(a(i,j)+1); %pixel values in image
ep(i,j)=cdf(t); %Making the ouput image using cdf as the transformation function
end
end

% Loop for Getting the Histogram of the Equalized image
hist2 = zeros(1,256);
for i=1:b(1)
for j=1:b(2)
for k=0:255
if ep(i,j)==k
hist2(k+1)=hist2(k+1)+1;
end
end
end
end

subplot(2,2,1);
imshow(uint8(a));title('Original image');
subplot(2,2,3);
imshow(uint8(ep));title('Histogram equilized image');
subplot(2,2,2);
stem(freq_counts);title('Histogram of original image');
subplot(2,2,4);
stem(hist2);title('Histogram of equilized image');


On this page of the site you can watch the video online Histogram equalization/processing in Digital Image Processing with example and perform in MATLAB|DIP with a duration of hours minute second in good quality, which was uploaded by the user Study with Dr. Dafda 21 August 2021, share the link with friends and acquaintances, this video has already been watched 12,252 times on youtube and it was liked by 159 viewers. Enjoy your viewing!