0% found this document useful (0 votes)
38 views6 pages

Experiment # 6: Objective: Resource Required

This document describes an experiment on histogram equalization in MATLAB. The objective is to introduce histograms, histogram calculation, and equalization. The resource required is the MATLAB R2009a software. The exercise demonstrates calculating a histogram by a custom function and the in-built command, then performing histogram equalization on an image without using in-built commands. It displays the original and equalized images and histograms. The learning outcome is an extended understanding of image processing concepts including histograms and equalization.

Uploaded by

Dipti Ranjan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views6 pages

Experiment # 6: Objective: Resource Required

This document describes an experiment on histogram equalization in MATLAB. The objective is to introduce histograms, histogram calculation, and equalization. The resource required is the MATLAB R2009a software. The exercise demonstrates calculating a histogram by a custom function and the in-built command, then performing histogram equalization on an image without using in-built commands. It displays the original and equalized images and histograms. The learning outcome is an extended understanding of image processing concepts including histograms and equalization.

Uploaded by

Dipti Ranjan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Experiment # 6

Objective:

Introduction to histogram, histogram calculation and equalization

in MATLAB.

Resource Required:

MATLAB R2009a software.

Exercise:

%EXPERIMENT 6
%histogram equalization
function [count] =myhist(b)
b=imread('image.jpg');
x=rgb2gray(b);
xmin=(min(min(x)));
xmax=max(max(x));
count=(zeros(1,256));
for i= xmin:xmax
count(i+1)=sum(sum(x==i));
end
figure(1);
subplot(1,2,1);
bar(0:255,count)
title('histogram by function')
subplot(1,2,2);
imhist(x)
title('histogram by command')

OUTPUT:

%histogram equalization
[count]=myhist(x)
[row col] = size(x);
N=length(x(:));
xmin=min(min(x));
xmax=max(max(x));

%cdf
c=cumsum(count);
M=min(c);

%equalization
y=zeros(size(x));
for j=1:256
%find(x1==j)
for i=1:row
for m= 1:col
if x(i,m)==j
y(i,m)=ceil(((c(j)-M)/(N-M))*255);
end
end
end
end
figure(1);
subplot(1,2,1);
imshow(uint8(y))
title ('equalized image');
subplot(1,2,2);
imshow(x)
title('original image');
figure (2);
subplot(1,2,1);
imhist(uint8(y));
title('equalized histogram');
subplot(1,2,2);
imhist(x)
title('original histogram');

OUTPUT:

Learning Outcome:

In this lab we have learnt extended concept of image

processing as Introduction to histogram, histogram calculation and equalization. Here we


have done Histogram equalization without using MATLAB in-built command and further we
have verified that by using in-built MATLAB command.

You might also like