0% found this document useful (0 votes)
173 views42 pages

DIP Lab Manual Updated

Uploaded by

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

DIP Lab Manual Updated

Uploaded by

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

LAB FILE

Subject Code : 6CS4-21


Subject Name : Digital Image Processing Lab
Branch : Computer Science Engineering
Year : III Year/ VI Semester

Arya College OF Engineering & Research Centre


Department of Computer Science & Engineering
(Rajasthan Technical University, KOTA)
RAJASTHAN TECHNICAL UNIVERSITY, KOTA
Syllabus
III Year-VI Semester: B.Tech. Computer Science and Engineering
6CS4-21: Digital Image Processing Lab
Credit: 1.5 Max. Marks: 75 (IA:45, ETE:30)
0L+0T+3P End Term Exam: 2 Hours

SN List of Experiments
Point-to-point transformation. This laboratory experiment provides for thresholding an
1 image and the evaluation of its histogram. Histogram equalization. This experiment
illustrates the relationship among the intensities (gray levels) of an image and its
histogram.
Geometric transformations. This experiment shows image rotation, scaling, and
2
translation. Two-dimensional Fourier transform

3 Linear filtering using convolution. Highly selective filters

Ideal filters in the frequency domain. Non Linear filtering using convolutional masks.
4 Edge detection. This experiment enables students to understand the concept of edge
detectors and their operation in noisy images
Morphological operations: This experiment is intended so students can appreciate the
5 effect of morphological operations using a small structuring element on simple binary
images. The operations that can be performed are erosion, dilation, opening, closing,
open-close, close-open.

ACERC/CSE/DIP Lab Page 2


LIST OF EXPERIMENT
6CS4-21: Digital Image Processing Lab

S.No. LIST OF EXPRIMENT


To provides the thresholding an image and the evaluation of its histogram using
1 histogram equalization and illustrates the relationship among the intensities (gray
levels) of an image and its histogram
2 To shows image rotation, scaling, and translation using Geometric transformations.
3 To perform the Two-dimensional Fourier transform operation in an image.
4 To perform the Linear filtering using convolution in an image
5 Image Edge Detection Using Sobel Filtering and Canny Filtering
To perform the following operations in an image.
6 (a) erosion,
(b) dilation,
To perform the following operations in an image.
7 (a) opening,
(b) closing,

ACERC/CSE/DIP Lab Page 3


DO’S AND DON’TS

DO’S

1. Student should get the record of previous experiment checked before starting the new
experiment.
2. Read the manual carefully before starting the experiment.
3. Checked the program by the instructor.
4. Get your results checked by the teacher.
5. Computers must be handled carefully.
6. Maintain strict discipline.
7. Keep your mobile phone switched off or in vibration mode.
8. Students should get the experiment allotted for next turn, before leaving the lab.

DON’TS

1. Do not touch or attempt to touch the mains power supply Wire with bare hands.
2. Do not overcrowd the tables.
3. Do not tamper with equipments.
4. Do not leave the without permission from the teacher.

ACERC/CSE/DIP Lab Page 4


INSTRUCTIONS TO THE STUDENTS

GENERAL INSTRUCTIONS
 Maintain separate observation results for each laboratory.
 Observations or readings should be taken only in the observation copy.
 Get the readings counter signed by the faculty after the completion of the experiment.
 Maintain Index column in the observation copy and get the signature of the faculty before
leaving the lab.

BEFORE ENTERING THE LAB


 The previous experiment should have been written in the practical file, without which the
students will not be allowed to enter the lab.
 The students should have written the experiment in the observation copy that they are
supposed to perform in the lab.
 The experiment written in the observation copy should have aim, apparatus required, circuit
diagram/algorithm, blank observation table (if any), formula (if any), programme (if any),
model graph (if any) and space for result.

ACERC/CSE/DIP Lab Page 5


WHEN WORKING IN THE LAB
 Necessary equipments/apparatus should be taken only from the lab assistant by
 Making an issuing slip, which would contain name of the experiment, names of batch
members and apparatus or components required.
 Never switch on the power supply before getting the permission from the faculty.

BEFORE LEAVING THE LAB


 The equipments/components should be returned back to the lab assistant in good condition
after the completion of the experiment.
 The students should get the signature from the faculty in the observation copy.
 They should also check whether their file is checked and counter signed in the index.

ACERC/CSE/DIP Lab Page 6


PROGRAM EDUCATION OBJECTIVES AND OUTCOMES

Subject Name/Code: Digital Image Processing lab / 6CS4-21


Class: B. Tech. III Yr VI Sem. Computer Science & Engineering

L T P
0 0 2
External Marks: 30 Internal Marks: 45 Total Marks: 75
(1) Program Description: To offer high quality education in the field of Electrical Engineering and to
prepare students abreast of latest global industrial and research requirements and fulfill responsibility
towards community.

(2) Program Objective:


I. Preparation: To prepare undergraduate students with appropriate blend of theoretical
foundations, experimentation & technical implementation to comprehend and pinpoint problems
in the field of electrical Engineering to excel in postgraduate programs or to succeed in industry /
technical profession.
II. Core competence: To provide students with a solid foundation in mathematical, scientific and
engineering fundamentals required to solve electrical engineering problems and also to pursue
higher studies. Student will be able to employ his knowledge along with necessary techniques &
tools for modern engineering applications.
III. Breadth: To train students with good scientific and electrical engineering breadth so as to
comprehend, analyze, design, and create novel products and solutions for the real life problems in
the present electrical system.
IV. Professionalism: To inculcate in students professional and ethical attitude, Communication
Skills, teamwork Skills, computer programming skill and an ability to relate electrical
engineering issues to broader social context.
V. Learning Environment: To provide student with an academic environment aware of excellence,
leadership, and the life-long learning needed for a successful professional career through
independent studies, thesis, internships etc.

ACERC/CSE/DIP Lab Page 7


(3) Course Outcomes & it's mapping with PO

List of Program Outcomes

Engineering Knowledge: Apply knowledge of mathematics and science, with


PO-1 fundamentals of Computer Science & Engineering to be able to solve complex
engineering problems related to CSE.
Problem Analysis: Identify, Formulate, review research literature and analyze
PO-2
complex engineering problems related to CSE and reaching substantiated conclusions
using first principles of mathematics, natural sciences and engineering sciences.
Design/Development of solutions: Design solutions for complex engineering
PO-3 problems related to CSE and design system components or processes that meet the
specified needs with appropriate consideration for the public health and safety and the
cultural societal and environmental considerations.
Conduct Investigations of Complex problems: Use research–based knowledge and
PO-4 research methods including design of experiments, analysis and interpretation of data,
and synthesis of the information to provide valid conclusions.
Modern Tool Usage: Create, Select and apply appropriate techniques, resources and
PO-5 modern engineering and IT tools including prediction and modeling to computer
science related complex engineering activities with an understanding of the
limitations.
The Engineer and Society: Apply Reasoning informed by the contextual knowledge
PO-6
to assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the CSE professional engineering practice.
Environment and Sustainability: Understand the impact of the CSE professional
PO-7 engineering solutions in societal and environmental contexts and demonstrate the
knowledge of, and need for sustainable development.
PO-8 Ethics: Apply Ethical Principles and commit to professional ethics and
responsibilities and norms of the engineering practice.
PO-9 Individual and Team Work: Function effectively as an individual and as a member
or leader in diverse teams and in multidisciplinary Settings.
Communication: Communicate effectively on complex engineering activities with
PO-10 the engineering community and with society at large such as able to comprehend and
with write effective reports and design documentation, make effective presentations
and give and receive clear instructions.
Project Management and Finance: Demonstrate knowledge and understanding of
PO-11 the engineering management principles and apply these to one’s own work, as a
member and leader in a team, to manage projects and in multi disciplinary
environments.
Life-Long Learning: Recognize the need for and have the preparation and ability to
PO-12
engage in independent and life-long learning the broadest context of technological
change.

ACERC/CSE/DIP Lab Page 8


List of Program Specific Outcomes (PSO)
Knowledge Enhancement in Computing: The ability to interpret the foundation
and strategy of hardware and software of computer systems. Graduates can solve the
PSO-1 problems in the areas related to algorithms, multimedia, data analytics, cloud
computing, human computer interface, robotics, artificial intelligence and
networking for efficient design of computer systems.
Software Design and Development: The ability to understand the software
development lifecycle and methodologies of software systems. Graduate will learn
PSO-2
competent skills and knowledge of software design process. Graduate will be
acquaintance to practical proficiency with a broad area of programming concepts.

(4) MAPPING OF PROGRAM OBJECTIVE WITH PROGRAM OUTCOMES ANS PSO

PROGRAM OUTCOME
PSO
PO-1 PO-2 PO-3 PO-4 PO-5 PO-6 PO-7 PO-8 PO-9 PO-10 PO-11 PO-12

I 2 1 3 2 1 - - - - - - 3

II 1 1 2 2 - - - - - - - 2

Note: Correlation levels 1, 2 or 3 as defined below:


1: Slight (Low) 2: Moderate (Medium) 3: Substantial (High)

(5) Course Objectives :


The study of subject Digital Image Processing lab 6CS4-21 in undergraduate program in
Computer Science Engineering Branch will achieve the following major objective-
1. This Lab helps the student to understand the Fundamentals of Digital image and its
processing.
2. Perform the image enhancement technique for the improvement of pictorial information for
human perception i.e. enhancing the quality of the image so that the image will have a better
look
3. Apply the concepts of image filtering techniques in which a graduate will be able to remove
the redundancy pixels and transmit the image using edge.
4. Describe object detection and recognition technique learning which a graduate will be able to
understand the fundamentals of digital signal processing with particular emphasis on problems in
biomedical research and clinical medicine.

ACERC/CSE/DIP Lab Page 9


(6) Course Objective to Program Outcomes Mapping:

PROGRAM OUTCOMES PSO’s


COURSE
PO- PO- PO- PO- PO- PO- PO- PO- PO- PO- PO- PO- PSO- PSO-
OUTCOMES
1 2 3 4 5 6 7 8 9 10 11 12 1 2

CO-1 3 - - - - - - - - - - 1 1 -
CO-2 1 - - 2 - - - - - - - - - -
CO-3 - - - 3 - - - - - - - - - -
CO-4 - - - - - 1 - - - - - - - -

Note: Correlation levels 1, 2 or 3 as defined below:


1: Slight (Low) 2: Moderate (Medium) 3: Substantial (High)

(7)Text Books /Reference Books:


Text/
S.N. Author Name Book Title Publisher
Reference

1 Rafael C. Digital Image Text


Pearson
Gonzalez Processing

Fundamentals of
2 Reference
Anil K Jain Digital Image Prentice Hall
Processing

(8) Instructional Methods:


1. Direct Instructions:
I. Black board presentation
II. Multimedia presentation
2. Interactive Instruction:
I. Experiment Table Instruction.
II. Quiz/Viva Voice

ACERC/CSE/DIP Lab Page 10


3. Indirect Instructions:
I. Problem Solving
II. Lab Assignment
4. Independent Instructions:
I. Lab Records
II. Performing experiments

(9) Learning Materials:


1. Lab Manuals
2. Multimedia material
3. Related Software.

(10) Assessment of Outcomes:


1. Session tests/ internal assessment (one in each semester).
2. End term exam/External assessment (Conducted by RTU, Kota)

(11) Outcomes will be achieved through following:


1. Class room/Lab teaching.
2. Experiment performance.
3. Video lectures

ACERC/CSE/DIP Lab Page 11


Experiment – 1

Object: To provides the thresholding an image and the evaluation of its histogram using
histogram equalization and illustrates the relationship among the intensities (gray levels) of an
image and its histogram.

Software: MATLAB

Theory :
Histogram is a graphical representation of the intensity distribution of an image. In simple terms,
it represents the number of pixels for each intensity value considered.
Histogram Equalization is a computer image processing technique used to improve contrast in
images. It accomplishes this by effectively spreading out the most frequent intensity values, i.e.
stretching out the intensity range of the image. This method usually increases the global contrast
of images when its usable data is represented by close contrast values. This allows for areas of
lower local contrast to gain a higher contrast.
A color histogram of an image represents the number of pixels in each type of color component.
Histogram equalization cannot be applied separately to the Red, Green and Blue components of
the image as it leads to dramatic changes in the image’s color balance. However, if the image is
first converted to another color space, like HSL/HSV color space, then the algorithm can be
applied to the luminance or value channel without resulting in changes to the hue and saturation
of the image.
Adaptive Histogram Equalization
Adaptive Histogram Equalization differs from ordinary histogram equalization in the respect that
the adaptive method computes several histograms, each corresponding to a distinct section of the
image, and uses them to redistribute the lightness values of the image. It is therefore suitable for
improving the local contrast and enhancing the definitions of edges in each region of an image.

ACERC/CSE/DIP Lab Page 12


Contrastive Limited Adaptive Equalization
Contrast Limited AHE (CLAHE) differs from adaptive histogram equalization in its contrast
limiting. In the case of CLAHE, the contrast limiting procedure is applied to each neighborhood
from which a transformation function is derived. CLAHE was developed to prevent the over
amplification of noise that adaptive histogram equalization can give rise to.

Program:
clc;clear all;close all;
imgetfile;
u=imread(ans);
o=rgb2gray(u);
imshow(o);
figure;
imhist(o);
i=histeq(o);
figure;
imshow(i);
figure;
imhist(i);

Result: In this experiment provides for thresholding an image and the evaluation of its histogram
using Histogram equalization. This experiment illustrates the relationship among the intensities
(gray levels) of an image and its histogram.

ACERC/CSE/DIP Lab Page 13


Fig 1.1: Gray Scale Image

Fig 1.2: Histogram of Original Image

ACERC/CSE/DIP Lab Page 14


Fig 1.3: Image After Applying Histogram Equalization

Fig 1.4: Histogram equalization

ACERC/CSE/DIP Lab Page 15


Viva Question

1. What is histogram equalization in digital image processing?

2. Why histogram equalization is needed?

3. What happens if histogram equalization is applied twice?

4. Why histogram is used in image processing?

5. What is histogram equalization in Matlab?

6. What is entropy image processing?

7. Why is a histogram useful?

8. What is the advantage of histogram?

9. What is contrast in image processing?

10. How do you make a histogram graph?

ACERC/CSE/DIP Lab Page 16


Experiment – 2

Object: To shows image rotation, scaling, and translation using Geometric transformations.

Software: MATLAB

Theory:
Perform generic geometric transformations using the imwarp workflow. Geometric
transformations map pixel coordinates in the output image to coordinates in the input image. The
mapping process then interpolates the value of output pixels from the input image. Use these
functions to perform general 2-D, 3-D, and N-D geometric transformations. To perform a 2-D or
3-D geometric transformation, first create a geometric transformation object that stores
information about the transformation. Then, pass the image to be transformed and the geometric
transformation object to the imwarp function.
Functions
imwarp Apply geometric transformation to image

affineOutputView Create output view for warping images

fitgeotrans Fit geometric transformation to control point pairs

findbounds Find output bounds for spatial transformation

fliptform Flip input and output roles of spatial transformation structure

makeresampler Create resampling structure

maketform Create spatial transformation structure (TFORM)

tformarray Apply spatial transformation to N-D array

tformfwd Apply forward spatial transformation

tforminv Apply inverse spatial transformation

ACERC/CSE/DIP Lab Page 17


Program:
clc;clear all;close all;
imgetfile;
u=imread(ans);
im_cr = imcrop(u,[75 68 130 112]);
imshow(u);
figure;
imshow(im_cr);
im_rt=imrotate(u,90);
figure;
imshow(u);
figure;
imshow(im_rt);
im_ts= imtranslate(u,[15, 25],'FillValues',255);
figure, pi=imshow(u);
pi.Parent.Visible='on';
figure, op=imshow(im_ts);
op.Parent.Visible='on';

Result: We have done the operation on digital image and shown image rotation, scaling, and
translation using Geometric transformations.

ACERC/CSE/DIP Lab Page 18


Fig 2.1: Original Image

Fig 2.2: Image Crop

ACERC/CSE/DIP Lab Page 19


Fig 2.3: Original Image Rotate 90 0

ACERC/CSE/DIP Lab Page 20


Fig 2.4: Image Scaling

ACERC/CSE/DIP Lab Page 21


Viva Question

1. What is meant by geometric transformation?

2. What is spatial transformation?

3. What are the types of geometric transformation?

4. What is geometric transformation in image processing?

5. What are the basic transformations?

6. What are the rules of translations?

7. What is the mean of transformation?

8. What is a coordinate rule?

9. What is Transformation computer graphics?

10. What do you mean by 3d transformation?

ACERC/CSE/DIP Lab Page 22


Experiment – 3

Object: To perform the Two-dimensional Fourier transform operation in an image.

Software: MATLAB

Theory:
The Fourier Transform is an important image processing tool which is used to decompose an
image into its sine and cosine components. The output of the transformation represents the image
in the Fourier or frequency domain, while the input image is the spatial domain equivalent. In the
Fourier domain image, each point represents a particular frequency contained in the spatial
domain image.
The Fourier Transform is used in a wide range of applications, such as image analysis, image
filtering, image reconstruction and image compression.
Program:
clc;
clear all;
close all;
imgetfile;
u=imread(ans);
oip=rgb2gray(u);
imshow(oip);
uiop=fft2(oip);
figure;
imshow(uiop);
uyiop=ifft2(uiop);
figure;
imshow(uint8(uyiop));

Result: Performed the Two-dimensional Fourier transform operation in an image.

ACERC/CSE/DIP Lab Page 23


Fig 3.1: Gray Scale Image

Fig 3.2: Encrypted Image after Applying Fourier Transform

ACERC/CSE/DIP Lab Page 24


Fig 3.3: Decrypted image After Applying Inverse of Fourier Transform

ACERC/CSE/DIP Lab Page 25


Viva Question

1. What is the Fourier transform of an image?

2. What is 2d Fourier transform?

3. What is spatial frequency in image processing?

4. Why FFT is used in image processing?

5. What is the difference between DFT and FFT?

6. What is the convolution theorem in image processing?

7. What is Fourier Transform and its applications?

8. What is an image signal?

9. What is FFT size?

10. What are the steps involved in digital image processing?

ACERC/CSE/DIP Lab Page 26


Experiment – 4

Object: To perform the Linear filtering using convolution in an image.

Software: MATLAB

Theory:
Linear filtering of an image is accomplished through an operation called convolution.
Convolution is a neighborhood operation in which each output pixel is the weighted sum of
neighboring input pixels. The matrix of weights is called the convolution kernel, also known as
the filter. A convolution kernel is a correlation kernel that has been rotated 180 degrees.
For example, suppose the image is

A = [ 17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9]
and the convolution kernel is
h=[8 1 6
3 5 7
4 9 2]

The following figure shows how to compute the (2,4) output pixel using these steps:
1. Rotate the convolution kernel 180 degrees about its center element.
2. Slide the center element of the convolution kernel so that it lies on top of the (2,4)
element of A.
3. Multiply each weight in the rotated convolution kernel by the pixel of A underneath.
4. Sum the individual products from step 3.

ACERC/CSE/DIP Lab Page 27


Hence the (2,4) output pixel is

Program:
clc;
clear all;
close all;
imgetfile;
u=imread(ans);
imshow(u);
Hm = fspecial('motion',20,45);
MotionBlur = imfilter(u,Hm,'replicate');
figure;
imshow(MotionBlur);
Hb = fspecial('disk',10);
blurred = imfilter(u,Hb,'replicate');
figure;
imshow(blurred);
Result : We perform the Linear filtering using convolution in an image.

ACERC/CSE/DIP Lab Page 28


ACERC/CSE/DIP Lab Page 29
Viva Question

1. What is linear filtering in image processing?

2. What is a convolution filter?

3. What is linear image?

4. Why filters are used in image processing?

5. What makes a filter linear?

6. Are convolution filters linear?

7. What is convolution of an image?

8. What is the purpose of convolution?

9. What is non linear filter in image processing?

10. What is the intensity of an image?

ACERC/CSE/DIP Lab Page 30


Experiment – 5

Object: Image Edge Detection Using Sobel Filtering and Canny Filtering.

Software: MATLAB

Theory:
Edge detection is an image processing technique for finding the boundaries of objects within
images. It works by detecting discontinuities in brightness. Edge detection is used for image
segmentation and data extraction in areas such as image processing, computer vision, and
machine vision. Common edge detection algorithms include Sobel, Canny, Prewitt, Roberts, and
fuzzy logic methods.

Edge detection method, specified as one of the following.

Method Description

'Sobel' Finds edges at those points where the gradient of the image I is maximum, using
the Sobel approximation to the derivative.

'Prewitt' Finds edges at those points where the gradient of I is maximum, using the
Prewitt approximation to the derivative.

'Roberts' Finds edges at those points where the gradient of I is maximum, using the
Roberts approximation to the derivative.

'log' Finds edges by looking for zero-crossings after filtering I with a Laplacian of
Gaussian (LoG) filter.

'zerocross' Finds edges by looking for zero-crossings after filtering I with a filter that you
specify, h

ACERC/CSE/DIP Lab Page 31


'Canny' Finds edges by looking for local maxima of the gradient of I. The edge function
calculates the gradient using the derivative of a Gaussian filter. This method uses
two thresholds to detect strong and weak edges, including weak edges in the
output if they are connected to strong edges. By using two thresholds, the Canny
method is less likely than the other methods to be fooled by noise, and more
likely to detect true weak edges.

'approxcanny' Finds edges using an approximate version of the Canny edge detection algorithm
that provides faster execution time at the expense of less precise detection.
Floating point images are expected to be normalized in the range [0 1].

Program:
clc;clear all;close all;
po=imgetfile;
I = imread(po);%select coin
imshow(I)
BW1 = edge(I,'sobel');
BW2 = edge(I,'canny');
figure;
imshowpair(BW1,BW2,'montage');
title('Sobel Filter Canny Filter');

Result: we have perform the Image Edge Detection Using Sobel Filtering and Canny Filtering

ACERC/CSE/DIP Lab Page 32


ACERC/CSE/DIP Lab Page 33
Viva Question

1. What does a Sobel filter do?

2. What is canny edge detection in image processing?

3. How does Sobel edge detection work?

4. How do you implement Canny edge detection?

5. How is edge detection done?

6. What does Sobel mean?

7. Why is Sobel edge detected?

8. What does Laplacian filter do?

9. What is an edge in an image?

10. What is an edge filter?

ACERC/CSE/DIP Lab Page 34


Experiment – 6

Object: To perform the following operations in an image.


(a) erosion,
(b) dilation.

Software: MATLAB

Theory:
Morphology is a broad set of image processing operations that process images based on shapes.
Morphological operations apply a structuring element to an input image, creating an output
image of the same size. In a morphological operation, the value of each pixel in the output image
is based on a comparison of the corresponding pixel in the input image with its neighbors.

The most basic morphological operations are dilation and erosion. Dilation adds pixels to the
boundaries of objects in an image, while erosion removes pixels on object boundaries. The
number of pixels added or removed from the objects in an image depends on the size and shape
of the structuring element used to process the image. In the morphological dilation and erosion
operations, the state of any given pixel in the output image is determined by applying a rule to
the corresponding pixel and its neighbors in the input image. The rule used to process the pixels
defines the operation as a dilation or an erosion. This table lists the rules for both dilation and
erosion.
Dilation and erosion are often used in combination to implement image processing operations.
For example, the definition of a morphological opening of an image is an erosion followed by a
dilation, using the same structuring element for both operations. We can combine dilation and
erosion to remove small objects from an image and smooth the border of large objects.

ACERC/CSE/DIP Lab Page 35


Program:
(a) erosion
clc;
clear all;
close all;
po=imgetfile;
I = imread(po);
originalBW = I;
se = strel('disk',11);
erodedBW = imerode(originalBW,se);
imshow(originalBW), figure, imshow(erodedBW)

(b) dilation

clc;
clear all;
close all;
po=imgetfile;
I = imread(po);
se = strel('ball',5,5);
I2 = imdilate(I,se);
imshow(I), title('Original')
figure, imshow(I2), title('Dilated')

Result: We have perform the erosion and dilation operations in an image.

ACERC/CSE/DIP Lab Page 36


ACERC/CSE/DIP Lab Page 37
Viva Question

1. What is erosion in image processing?

2. What are morphological operators?

3. What is binary dilation?

4. How segmentation is done in image processing?

5. What is erosion and dilation?

6. How do you do dilation?

7. What are the types of morphology?

8. What is resolution of an image?

9. What is the highest resolution photo?

10. How many pixels is considered high resolution?

ACERC/CSE/DIP Lab Page 38


Experiment – 7

Object: To perform the following operations in an image.


(a) opening,
(b) closing.

Software: MATLAB

Theory:
Morphological image processing is a collection of non-linear operations related to the
shape or morphology of features in an image. According to Wikipedia, morphological operations
rely only on the relative ordering of pixel values, not on their numerical values, and therefore are
especially suited to the processing of binary images. Morphological operations can also be
applied to greyscale images such that their light transfer functions are unknown and therefore
their absolute pixel values are of no or minor interest.
Morphological techniques probe an image with a small shape or template called a
structuring element. The structuring element is positioned at all possible locations in the image
and it is compared with the corresponding neighborhood of pixels. Some operations test whether
the element "fits" within the neighborhood, while others test whether it "hits" or intersects the
neighborhood:

Program:
(a) Opening
clc;
clear all;
close all;
po=imgetfile;
I = imread(po);
figure, imshow(I);
se = strel('disk',5);

ACERC/CSE/DIP Lab Page 39


afterOpening = imopen(I,se);
figure, imshow(afterOpening,[]);

(b) Closing
clc;clear all;close all;
po=imgetfile;
I = imread(po);
originalBW = I;
imshow(originalBW);
se = strel('disk',10);
closeBW = imclose(originalBW,se);
figure, imshow(closeBW);
Result: We have perform the opening and closing operations in an image.

ACERC/CSE/DIP Lab Page 40


ACERC/CSE/DIP Lab Page 41
Viva Question

1. What are morphological operators?

2. What is opening and closing in image processing?

3. What is an opening image?

4. What are the types of morphology?

5. What is morphological reconstruction?

6. What is the meaning of morphological structure?

7. What is another word for morphology?

8. What is meant by digital image?

9. What do you mean by image processing?

10. Why is image processing important?

ACERC/CSE/DIP Lab Page 42

You might also like