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

Показать описание
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:
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?
2. Human Visual System and Elements of Digital Image Processing
3. Fundamental steps in Digital Image Processing
4. Image Sensing and Acquisition
5. Relationship between Pixels in Digital Image Processing: Neighborhood, Adjacency & Distance measures
6. Image Sampling and Quantization
7. Spatial and Intensity resolution in Digital Image Processing and its Implementation in MATLAB
8. Basics of intensity transformations and spatial filtering and implementation in MATLAB
9. Image negatives, Log and Power-Law transformations for DIP and implementation in MATLAB
10. Piecewise linear transformation function: Contrast Stretching in DIP & implementation in MATLAB
11. Piecewise linear transformation function: Intensity-level slicing in DIP and implementation in MATLAB
12. Piecewise linear transformation function: Bit-plane slicing in DIP and implementation in MATLAB
% Matlab program for Histogram showing and Histogram equilization
close all;
clear all;
clc
warning off;
%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
% 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');
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:
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?
2. Human Visual System and Elements of Digital Image Processing
3. Fundamental steps in Digital Image Processing
4. Image Sensing and Acquisition
5. Relationship between Pixels in Digital Image Processing: Neighborhood, Adjacency & Distance measures
6. Image Sampling and Quantization
7. Spatial and Intensity resolution in Digital Image Processing and its Implementation in MATLAB
8. Basics of intensity transformations and spatial filtering and implementation in MATLAB
9. Image negatives, Log and Power-Law transformations for DIP and implementation in MATLAB
10. Piecewise linear transformation function: Contrast Stretching in DIP & implementation in MATLAB
11. Piecewise linear transformation function: Intensity-level slicing in DIP and implementation in MATLAB
12. Piecewise linear transformation function: Bit-plane slicing in DIP and implementation in MATLAB
% Matlab program for Histogram showing and Histogram equilization
close all;
clear all;
clc
warning off;
%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
% 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');
Комментарии