Write A Program To Generate Histogram For An Image and To Perform Histogram Equalization.
Write A Program To Generate Histogram For An Image and To Perform Histogram Equalization.
2
Objective: Write a program to generate Histogram for an Image and to
perform Histogram Equalization.
Software Used: MATLAB R2010a About the Experiment: Histogram techniques allow us to analyze the
distribution of gray levels in image. In this experiment we will study histogram, histogram normalization and histogram equalization. Theory:
Histograms:
A histogram is a plot showing the distribution of values within a data set. To create a histogram, the range of values within the data set is divided into evenly spaced bins, and the number of data values falling into each bin is determined. The resulting count can then be plotted as a function of bin number. The standard MATLAB histogram function is hist. The forms of this function are shown here. hist(y) Histogram equalization: In histogram equalization we are trying to maximize the image contrast by applying a gray level transform which tries to flatten the resulting histogram. It turns out that the gray level transform that we are seeking is simply a scaled version of the original image's cumulative histogram.
histeq(i);
Histogram Specification: Here we want to convert the image so that it has a particular histogram as specified.
MATLAB Program:
clear all; close all; i=imread('pout.tif'); subplot(3,2,1); imshow(i);title ('Input Image'); subplot(3,2,2); imhist(i);title ('Histogram of Input Image'); i1=histeq(i); subplot(3,2,3); imshow(i1);title('Equalized Image');
subplot(3,2,4); imhist(i1);title ('Histogram of Equalized Image'); i2=0:255; i3=histeq(i,i2); subplot(3,2,5); imshow(i3);title('Specified Image'); subplot(3,2,6); imhist(i3);title ('Histogram of Specified Image');
Result: