Digital Image Processing Lab.
Digital Image Processing Lab.
Submitted To:
Naveen Bansal
Page. 1
INDEX
S. No. Experiments
1. Image Processing Concept.
2. Histogram equalization image
3. Averaging filter in spatial domain.
4. Opening and Closing of the image.
5. Region of Interest for the image.
6. Edge detection algorithm
Page. 2
Program 1.
THEORY: Digital images play an important role both in daily life applications as well as in the
areas of research technology. The digital image processing refers to the manipulation of an
image by means of processor. The different elements of an image processing system include
image acquisition, image storage, image processing and display
An image is two dimensional function that represent a message of sum characteristics such as
brightness or color of viewed scene in the first mat lab program the command used from mat
lab is incomplement.
PROGRAM:
% Program to study the image processing concept I=imread('pout.tif');
J=imcomplement(I);
figure,imshow(I) figure,imshow(J)
K=imadjust(I,[0;0.4],[0.5;1]) figure,imshow(K)
Result:
Page. 3
Original Image
Complement Image
Conclusion: Thus we have studied the how to obtain complement image from the original
image.
Page. 4
Program 2.
Histogram equalization image
PROGRAM:
% Program to obtain histogram equalization concept
I=imread('trees.tif');
J=imcomplement(I);
imhist(J,100); imshow(I);
title('original');
figure,imshow(J);
title('complement');
I=histeq(I);
figure,imhist(I,64);
title('equilized');
figure,imhist(J,64);
title('histogram');
n=numel(I); p=imhist(I)/n;
figure,plot(p);
title('normalized');
K=imadjust(I,[0;1],[0.4;1],0.5);
figure,imshow(K); title('adjusted
image');
T=maketform('affine',[.3 0 0;.5 1 0;0 1 1]);
tformfwd([0,0],T);
I2=imtransform(I,T);
figure,imshow(I2); title('forward Image’);
Page. 5
Result :
Original Histogram
Equalized Histogram
Conclusion: This we have obtained the Equalized Histogram from the original Histogram.
Page. 6
Program 3.
Averaging filter in spatial domain.
PROGRAM:
Page. 7
Result :
Conclusion: This we have performed the smoothing or averaging filter operation on the
Page. 8
Program 4.
Together with closing, the opening serves in computer vision and image processing as a basic
workhorse of morphological noise removal. Opening removes small objects from the foreground
(usually taken as the bright pixels) of an image, placing them in the background, while closing
removes small holes in the foreground, changing small islands ofbackground into foreground. These
techniques can also be used to find specific shapes in an image. Opening can be used to find things
into which a specific structuring element can fit (edges, corners, ...).
In mathematical morphology, the closing of a set (binary image) A by a structuring element B is the
erosion of the dilation of that set. In image processing, closing is, togetherwith opening, the basic
workhorse of morphological image removal. Opening removes small objects, while closing
removes small holes.
PROGRAM:
f=imread('coins.png');
se=strel('square',20);
fo=imopen(f,se); figure,imshow(f)
title('input image');
figure,imshow(fo) title('opening of
input image');fc=imclose(f,se);
figure,imshow(fc) title('opening of
input image');foc=imclose(fo,se);
figure,imshow(foc)
title('closing of opened input image');
Page. 9
Result:
Conclusion: This we have obtained the opened image and closed image from the originalImage.
Page. 10
Program 5.
THEORY: A region of interest (often abbreviated ROI), are samples within a data set identified
for a particular purpose. The concept of a ROI is commonly used in many application areas. For
example, in medical imaging, the boundaries of a tumor may be defined on an image or in a
volume, for the purpose of measuring its size. The endo cardial border may be defined on an
image, perhaps during different phases of the cardiac cycle, for example, end-systole and end-
diastole, for the purpose of assessing cardiac function. In geographical information systems(GIS),
a ROI can be taken literally as a polygonal selection from a 2D map. In computer vision and
optical character recognition, the ROI defines the borders of an object under consideration. In
many applications, symbolic (textual) labels are added to a ROI, to describe its content in a
compact manner. Within a ROI may lie individual points of interest (POIs).
PROGRAM:
Page. 11
Result:
Original Image
Output Image
Conclusion: This we have filled the interested region in the original image.
Page. 12
Program 6.
THEORY: The Canny edge detector is an edge detection operator that uses a multistage
algorithm to detect a wide range of edges in images. It was developed by John F. Canny in 1986.
Canny also produced a computational theory of edge detection explaining why the technique
works.
The Process of Canny edge detection algorithm can be broken down to 5 different steps:
1. Apply Gaussian filter to smooth the image in order to remove the noise
2. Find the intensity gradients of the image
3. Apply non-maximum suppression to get rid of spurious response to edge detection
4. Apply double threshold to determine potential edges
5. Track edges by hypothesis: Finalize the detection of edges by suppressing all the
other edges that are weak and not connected to strong edges.
PROGRAM:
%Program for edge detection algorithm
I=imread('coins.png'); figure,imshow(I)
title ('figure 1 original image');
h=ones(5,5)/25; b=imfilter(I,h);
figure,imshow(b)
title ('figure 2 filtered image');
c=edge(b,'sobel'); figure,imshow(c)
title ('figure 3 edge detected output by sobel operator');
d=edge(b,'prewitt'); figure,imshow(d)
title ('figure 4 edge detected output by prewitt operator');
e=edge(b,'robert'); figure,imshow(e)
title ('figure 5 edge detected output by robert operator');
f=edge(b,'canny'); figure,imshow(f)
title ('figure 6 edge detected output by canny operator');
Page. 13
Result:
Page. 14