Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
8 views

Digital Image Processing Lab.

The document outlines a Digital Image Processing Lab course for B.Tech Computer Science students, detailing six experiments that include concepts such as histogram equalization, averaging filters, morphological operations, region of interest filling, and edge detection algorithms using MATLAB. Each experiment includes an aim, objective, required tools, theoretical background, program code, results, and conclusions. The document serves as a practical guide for students to learn and implement various image processing techniques.

Uploaded by

Uttam Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Digital Image Processing Lab.

The document outlines a Digital Image Processing Lab course for B.Tech Computer Science students, detailing six experiments that include concepts such as histogram equalization, averaging filters, morphological operations, region of interest filling, and edge detection algorithms using MATLAB. Each experiment includes an aim, objective, required tools, theoretical background, program code, results, and conclusions. The document serves as a practical guide for students to learn and implement various image processing techniques.

Uploaded by

Uttam Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Name :-

Subject :- Digital Image Processing Lab.


Class :- B.tech
Year :- 3rd
Branch :- Computer Science

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.

Image Processing Concept.

AIM: To study the Image Processing concept.

OBJECTIVE: To study the Image Processing concept.

TOOLS REQUIRED: Matlab

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

AIM: To obtain histogram equalization image.

OBJECTIVE: To obtain histogram equalization image.

TOOLS REQUIRED: Matlab

THEORY: Histogram equalization is a method in image processing of contrast adjustment using


the image's histogram. Histogram equalization often produces unrealistic effects in
photographs; however it is very useful for scientific images like thermal or x-ray images, often
the same class of images to which one would apply false color. Also histogram equalization can
produce undesirable effects when applied to images with low color depth.For example, if applied
to 8-bit image displayed with 8 bit gray scale it will further reduce color depth (number of unique
shades of gray) of the image. Histogram equalization will work the best when applied to images
with much higher depth than palette size, like continuous data or 16-bit gray-scale images.

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.

AIM: To Implement smoothing or averaging filter in spatial domain.

OBJECTIVE: To Implement smoothing or averaging filter in spatial domain.

TOOLS REQUIRED: Matlab

THEORY: Filtering is a technique for modifying or enhancing an image. Mask or filters


will be defined. The general process of convolution and correlation will be introduced via an
example. Also smoothing linear filters such as box and weighted average filters will be
introduced.
In statistic and image processing, to smooth a data set is to create an approximating function
that attempts to capture important patterns in the data, while leaving out noise or other fine-
scale structures/rapid phenomena. In smoothing, the data points of a signal are modified so
individual points (presumably because of noise) are reduced, and points that are lower than
the adjacent points are increased leading to a smoother signal.
Smoothing may be used in two important ways that can aid in data analysis by being able to
extract more information from the data as long as the assumption of smoothing is reasonable
by being able to provide analyses that are both flexible and robust. different algorithms are used
in smoothing.

PROGRAM:

% Program for implementation of smoothing or averaging filter in spatial domain


I=imread('trees.tif');
subplot(2,2,1); imshow(J);
title('original image');
f=ones(3,3)/9;
h=imfilter(I,f,'circular');
subplot(2,2,2);
imshow(h);
title('averaged image');

Page. 7
Result :

Conclusion: This we have performed the smoothing or averaging filter operation on the

Original image and we get filtered image.

Page. 8
Program 4.

Opening and Closing of the image.

AIM: Program for opening and closing of the image.

OBJECTIVE: Program for opening and closing of the image.

TOOLS REQUIRED: Matlab

THEORY: In mathematical morphology, opening is the dilation of the erosion of aset by


a structuring elements B:

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.

Region of Interest for the image.

AIM: To fill the region of interest for the image.

OBJECTIVE: To fill the region of interest for the image

TOOLS REQUIRED: Matlab

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:

% Program for ROI


clc; close all; load trees
I=ind2gray(X,map);
imshow(I)
title('original image'); I2=roifill;
imshow(I2)
title('OUTPUT IMAGE');

Page. 11
Result:

Original Image

Output Image

Conclusion: This we have filled the interested region in the original image.

Page. 12
Program 6.

Edge detection algorithm

AIM: Program for edge detection algorithm.

OBJECTIVE: Program for edge detection algorithm

TOOLS REQUIRED: MATLAB

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:

Edge detected image Edge detected image

Conclusion: This we have detected the edges in the original image.

Page. 14

You might also like