SlideShare a Scribd company logo
Jawaharlal Nehru Engineering College
Laboratory Manual
DIGITAL IMAGE PROCESSING
For
Final Year Students
Manual made by
Prof.A.G.PATIL
 Author JNEC, Aurangabad
MGM’S
Jawaharlal Nehru Engineering College
N-6, CIDCO, Aurangabad
Department of Electronics &Telecommunication
Vision of the Department:
To develop GREAT technocrats and to establish centre of excellence in the field of Electronics
and Telecommunications.
 Global technocrats with human values
 Research and lifelong learning attitude,
 Excellent ability to tackle challenges
 Awareness of the needs of society
 Technical expertise
Mission of the Department:
1. To provide good technical education and enhance technical competency by providing
good infrastructure, resources, effective teaching learning process and competent, caring
and committed faculty.
2. To provide various platforms to students for cultivating professional attitude and ethical
values.
3. Creating a strong foundation among students which will enable them to pursue their
career choice.
Jawaharlal Nehru Engineering College
Technical Document
This technical document is a series of Laboratory manuals of Electronics & Telecommunication
and is a certified document of Jawaharlal Nehru Engineering College. The care has been taken to
make the document error free but still if any error is found kindly bring it to the notice of subject
teacher and HOD.
Recommended by,
HOD
Approved by,
Principal
FOREWORD
It is my great pleasure to present this laboratory manual for final year engineering students for
the subject of Digital Image Processing keeping in view the vast coverage required for
visualization of concepts of Digital Image Processing.
As a student, many of you may be wondering with some of the questions in your mind regarding
the subject and exactly that has been tried to answer through this manual.
Faculty members are also advised that covering these aspects in initial stage itself, will greatly
relieve them in future, as much of the load will be taken care by the enthusiastic energies of the
students, once they are conceptually clear.
Prof. A.G.Patil
LABORATORY MANUAL CONTENTS
This manual is intended for the Final year students of Electronics subject of Digital Image
Processing. This manual typically contains Practical/Lab Sessions related to Digital Image
Processing covering various aspects related the subject to enhance understanding of the subject.
Students are advised to thoroughly go through this manual rather than only topics mentioned in
the syllabus, as practical aspects are the key to understanding conceptual visualization of
theoretical aspects covered in the books.
Good Luck for your Enjoyable Laboratory Sessions.
Prof. A.G.Patil
SUBJECT INDEX
1. Do’s and Don’ts
2. Lab exercise:
1) MATLAB program to extract different Attributes of an Image.
2) MATLAB program for Image Negation.
3) MATLAB program for Power Law Transformation.
4) MATLAB program for Histogram Mapping and Equalization.
5) MATLAB program for Image Smoothening and Sharpening.
6) MATLAB program for Edge Detection using Sobel, Prewitt and Roberts Operators.
7) MATLAB program for Morphological Operations on Binary Images.
8) MATLAB program for Pseudo Coloring.
9) MATLAB program for Chain Coding.
10) MATLAB program for DCT/IDCT Computation.
3. Quiz on the subject.
4. Conduction of Viva-Voce Examination.
5. Evaluation and Marking System.
Do’s and Don’ts in the Laboratory:
1) Do not handle any equipment before reading the instructions/Instruction manuals.
2) Strictly observe the instructions given by the teacher/Lab Instructor.
Instructions for Laboratory Teachers:
1) Submission related to whatever lab work has been completed should be done during the
next lab session.
2) The promptness of submission should be encouraged by way of marking and evaluation
patterns that will benefit the sincere students.
Program (1) : Extraction of different Image Attributes
%MATLAB program to extract image attributes.
clc;
clear all;
close all;
image1=imread('flowers.jpg');
size(image1) % to display dimensions of input image
image2=rgb2gray(image1);
subplot(2,2,4);
imshow(image2);
title('GRAYSCALE');
[r c d]=size(image1);
z=zeros(r,c);
tempr=image1;
tempr(:,:,2)=z;
tempr(:,:,3)=z;
subplot(2,2,1);
imshow(tempr);
title('RED');
tempg=image1;
tempg(:,:,1)=z;
tempg(:,:,3)=z;
subplot(2,2,2)
imshow(tempg);
title('GREEN');
tempb=image1;
tempb(:,:,1)=z;
tempb(:,:,2)=z;
subplot(2,2,3);
imshow(tempb);
title('BLUE');
ans =
240 320 3
Program (2) : Image Negation
%MATLAB program for Image Negation.
clc;
clear all;
close all;
a = imread('dexter.jpg');
subplot(1,2,1);
imshow(a);
title('Dexter');
b = 255-a;
subplot(1,2,2);
imshow(b);
title('Negation of Dexter');
Program (3) : Power Law Transformation
%MATLAB program for Power Law Transformation
clc;
clear all;
close all;
a = imread('flowers.jpg');
gamma = 1.1;
b = double(a).^gamma;
subplot(1,2,1);
imshow(a);
title ('Original Image');
subplot(1,2,2);
imshow(uint8(b));
title ('Power Law Transformed Image');
Program (4) : Histogram Mapping and Equalization
%MATLAB program for histogram mapping and equalisation.
clc;
clear all;
close all;
a = imread('flowers.jpg');
b = rgb2gray(a);
subplot(2,2,1);
imshow(b);
title('grayscale image of original rgb image');
c = im2double(b);
subplot(2,2,2);
imhist(c);
title('histogram mapping of grayscale original image');
d = histeq (c);
subplot(2,2,3);
imshow(d);
title('grayscale original image after histogram equalisation');
subplot(2,2,4);
imhist(d);
title('histogram mapping of equalised grayscale original image');
dip.pdf
Program (5) : Image Smoothening and Sharpening
% MATLAB program for image smoothing and sharpening.
clc;
clear all;
close all;
a = imread ('dexter.jpg');
subplot(1,3,1);
imshow(a);
title('original image');
h = fspecial('gaussian'); % create predefined 2-D filter
b = imfilter(a,h); % N-D filtering of multidimensional images
subplot(1,3,2);
imshow(b);
title('smoothened image');
c = imsharpen(a);
subplot(1,3,3);
imshow(c);
title('sharpened image');
Program (6) : Edge Detection using Sobel, Prewitt and Roberts Operators
% MATLAB program for image smoothing and sharpening.
clc;
clear all;
close all;
a = imread('dexter.jpg');
b = rgb2gray(a);
subplot(2,2,1);
imshow(a);
title('Original Image');
c1 = edge(b,'sobel');
subplot(2,2,2);
imshow(c1);
title('Sobel Operator');
c2 = edge(b,'prewitt');
subplot(2,2,3);
imshow(c2);
title('Prewitt Operator');
c3 = edge(b,'roberts');
subplot(2,2,4);
imshow(c3);
title('Roberts Operator');
dip.pdf
Program (7) : Morphological Operations on Binary Images
% MATLAB program for morphological operations on binary images.
clc;
clear all;
close all;
a = imread ('circles.jpg');
b = im2bw(a,0.4);
subplot(2,3,1);
imshow(b);
title('original binary image');
c = bwmorph(b,'remove'); % removes interior pixels to obtain outline
subplot(2,3,2);
imshow(c);
title('outline of original image');
d = bwmorph(b,'skel',Inf); % applies operation infinite times till image no longer changes
subplot(2,3,3);
imshow(d);
title('skeleton of original image');
se = strel('line',11,90); % create a 'line' structuring element
e = imdilate(b,se); % dilate image with a structuring element
subplot(2,3,4);
imshow(e),
title('dilation of original image');
f = imerode(b,se); % erode image with a structuring element
subplot(2,3,5);
imshow(f),
title('erosion of original image');
g = bwmorph(b,'bothat'); % performs morphological "bottom hat" operation
subplot(2,3,6);
imshow(g);
title('bottom hat operation on original image');
dip.pdf
Program (8) : Pseudo Coloring
%MATLAB program for pseudo coloring.
clc;
clear all;
close all;
input_img=imread('rice.tif'); % Read image from graphics file
[m n]=size(input_img); %Array dimensions
input_img=double(input_img); %Convert to double precision
for i=1:m
for j=1:n
if input_img(i,j)>=0 & input_img(i,j)<50
output_img(i,j,1)=input_img(i,j,1)+50;
output_img(i,j,2)=input_img(i,j)+100;
output_img(i,j,3)=input_img(i,j)+10;
end
if input_img(i,j)>=50 & input_img(i,j)<100
output_img(i,j,1)=input_img(i,j)+35;
output_img(i,j,2)=input_img(i,j)+128;
output_img(i,j,3)=input_img(i,j)+10;
end
if input_img(i,j)>=100 & input_img(i,j)<150
output_img(i,j,1)=input_img(i,j)+152;
output_img(i,j,2)=input_img(i,j)+130;
output_img(i,j,3)=input_img(i,j)+15;
end
if input_img(i,j)>=150 & input_img(i,j)<200
output_img(i,j,1)=input_img(i,j)+50;
output_img(i,j,2)=input_img(i,j)+140;
output_img(i,j,3)=input_img(i,j)+25;
end
if input_img(i,j)>=200 & input_img(i,j)<=256
output_img(i,j,1)=input_img(i,j)+120;
output_img(i,j,2)=input_img(i,j)+160;
output_img(i,j,3)=input_img(i,j)+45;
end
end
end
subplot(2,2,1), % Create axes in tiled positions
imshow(uint8(input_img)), %Display input image
title('Input Image') %Add title to current axes
subplot(2,2,2), % Create axes in tiled positions
imshow(uint8(output_img)), %Display output image
title('Pseudo Coloured Image') %Add title to current axes
Program (9) : Chain Coding
%MATLAB program for chain coding.
clc;
close all;
clear all;
X=[0 1 1 0;1 0 0 1;1 0 0 1;0 1 1 0]; % Test matrices
B1=[0 1 0;1 1 1;0 1 0]; % Plot multiple frequency response objects and doubles on
same graph
B2=[1 1 1;1 1 1;1 1 1]; % Plot multiple frequency response objects and doubles on
same graph
Erx=imerode(X,B1); % Erode image
Erf=imerode(Erx,B2); % Erode image
disp('Chain rule1 LHS');
disp(Erf); %Display array
DiB=imdilate(B1,B2); % dilates the grayscale, binary, or packed binary image
B1, returning the dilated image, B2.
Erx1=imerode(X,DiB);
disp('Chain rule1 RHS');
disp(Erx1); %Display array
Dix1=imdilate(X,B1); % dilates the grayscale, binary, or packed binary image X,
returning the dilated image, B1.
Dix=imdilate(Dix1,B2); % dilates the grayscale, binary, or packed binary image Dix
1, returning the dilated image, B2.
disp('Chain rule2 LHS');
disp(Dix); %Display array
DiB=imdilate(B1,B2);
Dix2=imdilate(X,DiB);
disp('Chain rule2 RHS'); %Display array
disp(Dix2); %Display array
Output:
Chain rule1 LHS
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
Chain rule1 RHS
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
Chain rule2 LHS
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
Chain rule2 RHS
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
Program (10) : DCT/IDCT Computation
%MATLAB program for DCT/IDCT computation.
clc;
clear all;
close all;
m=input('Enter the basis matrix dimension: '); % Request user input
n=m;
alpha2=ones(1,n)*sqrt(2/n);
alpha2(1)=sqrt(1/n);
alpha1=ones(1,m)*sqrt(2/m);
alpha(1)=sqrt(1/m); % square root.
for u=0:m-1
for v=0:n-1
for x=0:m-1
for y=0:n-1
a{u+1,v+1}(x+1,y+1)=alpha1(u+1)*alpha2(v+1)*...
cos((2*x+1)*u*pi/(2*n))*cos((2*y+1)*v*pi/(2*n));
end
end
end
end
mag=a;
figure(3) % Create figure graphics object
k=1;
% Code to plot the basis
for i=1:m
for j=1:n
subplot(m,n,k) % Create axes in tiled positions
imshow(mag{i,j},256) % Display image
k=k+1;
end
end
Enter the basis matrix dimension: 5
Output:
QUIZ ON THE SUBJECT:
1) What is the basis for numerous spatial domain processing techniques ?
2) What is the significance if image processing in the world of internet ?
3) In which image we notice that the components of histogram are concentrated on the low
side on intensity scale ?
4) What is Histogram Equalization also called as ?
5) What is Histogram Matching also called as ?
6) Histogram Equalization is mainly used for what purpose ?
7) To reduce computation if one utilizes non-overlapping regions, it usually produces which
effect ?
8) What does SEM stands for?
9) What is he type of Histogram Processing in which pixels are modified based on the
intensity distribution of the image called as ?
10) Which type of Histogram Processing is suited for minute detailed enhancements?
11) What is the class of the color map array of the indexed image ?
12) What type of discipline is Computer Vision ?
13) What is a geometry consisting of in-line arrangement of sensors for image acquisition
called ?
14) What is he difference is intensity between the highest and the lowest intensity levels in an
image called ?
15) What is the name of procedure done on a digital image to alter the values of its individual
pixels called ?
CONDUCTION OF VIVA-VOCA EXAMINATIONS:
Teacher should conduct oral exams of the students with full preparation. Normally, the
objective questions with guess are to be avoided. To make it meaningful, the questions should be
such that depth of the students in the subject is tested. Oral examinations are to be conducted in
co-cordial environment amongst the teachers taking the examination. Teachers taking such
examinations should not have ill thoughts about each other and courtesies should be offered to
each other in case of difference of opinion, which should be critically suppressed in front of the
students.
EVALUATION OF MARKING SYSTEM:
Basic honesty in the evaluation and marking system is absolutely essential and in the
process, impartial nature of the evaluator is required in the examination system. It is a wrong
approach or concept to award the students by way of easy marking to get cheap popularity
among the students, which they do not deserve. It is a primary responsibility of the teacher that
right students who are really putting up lot of hard work with right kind of intelligence are
correctly awarded.
The marking patterns should be justifiable to the students without any ambiguity and teacher
should see that students are faced with just circumstances.

More Related Content

PPTX
Image Processing Using MATLAB
Amarjeetsingh Thakur
 
PDF
BE-DIP-Lab-Manual.pdf
NetraBahadurKatuwal
 
PDF
DIP_Manual.pdf
NetraBahadurKatuwal
 
PDF
Digital Image Processing Using Matlab 2nd Edition Rafael C Gonzalez
rusetidawnel
 
PPTX
Introductory Digital Image Processing using Matlab, IIT Roorkee
Vinayak Sahai
 
PDF
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
nagwaAboElenein
 
PPTX
Image processing in MATLAB
Amarjeetsingh Thakur
 
Image Processing Using MATLAB
Amarjeetsingh Thakur
 
BE-DIP-Lab-Manual.pdf
NetraBahadurKatuwal
 
DIP_Manual.pdf
NetraBahadurKatuwal
 
Digital Image Processing Using Matlab 2nd Edition Rafael C Gonzalez
rusetidawnel
 
Introductory Digital Image Processing using Matlab, IIT Roorkee
Vinayak Sahai
 
Fundamentals_of_Digital image processing_A practicle approach with MatLab.pdf
nagwaAboElenein
 
Image processing in MATLAB
Amarjeetsingh Thakur
 

Similar to dip.pdf (20)

PPTX
Image processing lab work
Shajun Nisha
 
PDF
An interdisciplinary course_in_digital_image_processing
Syed Muhammad Hammad
 
PPT
lec1_matlab.ppt basic all operations matlab operations
samraj sundarraj
 
PDF
Basics of Image Processing using MATLAB
vkn13
 
PDF
Image processing with matlab
neetirajsinh
 
PPTX
ImageProcessingWithMatlab(HasithaEdiriweera)
Hasitha Ediriweera
 
DOCX
matlab.docx
AraniNavaratnarajah2
 
PDF
Digital image processing using matlab: basic transformations, filters and ope...
thanh nguyen
 
PPT
Matlab
Aman kazmi
 
PPT
Introduction to Machine Vision
Nasir Jumani
 
PDF
Basics of image processing using MATLAB
Mohsin Siddique
 
PPTX
Image processing
Antriksh Saxena
 
PPTX
Image processing
Antriksh Saxena
 
PPTX
Ec section
Antriksh Saxena
 
PPT
Image Processing using Matlab . Useful for beginners to learn Image Processing
Ashok Kumar
 
DOC
Simple Matlab tutorial using matlab inbuilt commands
Lakshmi Sarvani Videla
 
PPTX
Introduction to Image Processing with MATLAB
Sriram Emarose
 
DOCX
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
mercysuttle
 
PPT
mathematics laboratory lecture 1_matlab.ppt
DBalraj1
 
PPT
rmsip98.ppt
vasuhisrinivasan
 
Image processing lab work
Shajun Nisha
 
An interdisciplinary course_in_digital_image_processing
Syed Muhammad Hammad
 
lec1_matlab.ppt basic all operations matlab operations
samraj sundarraj
 
Basics of Image Processing using MATLAB
vkn13
 
Image processing with matlab
neetirajsinh
 
ImageProcessingWithMatlab(HasithaEdiriweera)
Hasitha Ediriweera
 
Digital image processing using matlab: basic transformations, filters and ope...
thanh nguyen
 
Matlab
Aman kazmi
 
Introduction to Machine Vision
Nasir Jumani
 
Basics of image processing using MATLAB
Mohsin Siddique
 
Image processing
Antriksh Saxena
 
Image processing
Antriksh Saxena
 
Ec section
Antriksh Saxena
 
Image Processing using Matlab . Useful for beginners to learn Image Processing
Ashok Kumar
 
Simple Matlab tutorial using matlab inbuilt commands
Lakshmi Sarvani Videla
 
Introduction to Image Processing with MATLAB
Sriram Emarose
 
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
mercysuttle
 
mathematics laboratory lecture 1_matlab.ppt
DBalraj1
 
rmsip98.ppt
vasuhisrinivasan
 
Ad

Recently uploaded (20)

PPTX
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
PPT
SCOPE_~1- technology of green house and poyhouse
bala464780
 
PDF
Software Testing Tools - names and explanation
shruti533256
 
PPTX
easa module 3 funtamental electronics.pptx
tryanothert7
 
PDF
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
PDF
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
PPTX
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
PDF
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
PDF
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
PDF
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
PDF
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
PPT
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
PDF
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
PDF
Zero Carbon Building Performance standard
BassemOsman1
 
PPTX
Tunnel Ventilation System in Kanpur Metro
220105053
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PPTX
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
PDF
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
PDF
Introduction to Data Science: data science process
ShivarkarSandip
 
PDF
LEAP-1B presedntation xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hatem173148
 
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
SCOPE_~1- technology of green house and poyhouse
bala464780
 
Software Testing Tools - names and explanation
shruti533256
 
easa module 3 funtamental electronics.pptx
tryanothert7
 
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
Zero Carbon Building Performance standard
BassemOsman1
 
Tunnel Ventilation System in Kanpur Metro
220105053
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
Introduction to Data Science: data science process
ShivarkarSandip
 
LEAP-1B presedntation xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hatem173148
 
Ad

dip.pdf

  • 1. Jawaharlal Nehru Engineering College Laboratory Manual DIGITAL IMAGE PROCESSING For Final Year Students Manual made by Prof.A.G.PATIL  Author JNEC, Aurangabad
  • 2. MGM’S Jawaharlal Nehru Engineering College N-6, CIDCO, Aurangabad Department of Electronics &Telecommunication Vision of the Department: To develop GREAT technocrats and to establish centre of excellence in the field of Electronics and Telecommunications.  Global technocrats with human values  Research and lifelong learning attitude,  Excellent ability to tackle challenges  Awareness of the needs of society  Technical expertise Mission of the Department: 1. To provide good technical education and enhance technical competency by providing good infrastructure, resources, effective teaching learning process and competent, caring and committed faculty. 2. To provide various platforms to students for cultivating professional attitude and ethical values. 3. Creating a strong foundation among students which will enable them to pursue their career choice.
  • 3. Jawaharlal Nehru Engineering College Technical Document This technical document is a series of Laboratory manuals of Electronics & Telecommunication and is a certified document of Jawaharlal Nehru Engineering College. The care has been taken to make the document error free but still if any error is found kindly bring it to the notice of subject teacher and HOD. Recommended by, HOD Approved by, Principal
  • 4. FOREWORD It is my great pleasure to present this laboratory manual for final year engineering students for the subject of Digital Image Processing keeping in view the vast coverage required for visualization of concepts of Digital Image Processing. As a student, many of you may be wondering with some of the questions in your mind regarding the subject and exactly that has been tried to answer through this manual. Faculty members are also advised that covering these aspects in initial stage itself, will greatly relieve them in future, as much of the load will be taken care by the enthusiastic energies of the students, once they are conceptually clear. Prof. A.G.Patil
  • 5. LABORATORY MANUAL CONTENTS This manual is intended for the Final year students of Electronics subject of Digital Image Processing. This manual typically contains Practical/Lab Sessions related to Digital Image Processing covering various aspects related the subject to enhance understanding of the subject. Students are advised to thoroughly go through this manual rather than only topics mentioned in the syllabus, as practical aspects are the key to understanding conceptual visualization of theoretical aspects covered in the books. Good Luck for your Enjoyable Laboratory Sessions. Prof. A.G.Patil
  • 6. SUBJECT INDEX 1. Do’s and Don’ts 2. Lab exercise: 1) MATLAB program to extract different Attributes of an Image. 2) MATLAB program for Image Negation. 3) MATLAB program for Power Law Transformation. 4) MATLAB program for Histogram Mapping and Equalization. 5) MATLAB program for Image Smoothening and Sharpening. 6) MATLAB program for Edge Detection using Sobel, Prewitt and Roberts Operators. 7) MATLAB program for Morphological Operations on Binary Images. 8) MATLAB program for Pseudo Coloring. 9) MATLAB program for Chain Coding. 10) MATLAB program for DCT/IDCT Computation. 3. Quiz on the subject. 4. Conduction of Viva-Voce Examination. 5. Evaluation and Marking System.
  • 7. Do’s and Don’ts in the Laboratory: 1) Do not handle any equipment before reading the instructions/Instruction manuals. 2) Strictly observe the instructions given by the teacher/Lab Instructor. Instructions for Laboratory Teachers: 1) Submission related to whatever lab work has been completed should be done during the next lab session. 2) The promptness of submission should be encouraged by way of marking and evaluation patterns that will benefit the sincere students.
  • 8. Program (1) : Extraction of different Image Attributes %MATLAB program to extract image attributes. clc; clear all; close all; image1=imread('flowers.jpg'); size(image1) % to display dimensions of input image image2=rgb2gray(image1); subplot(2,2,4); imshow(image2); title('GRAYSCALE'); [r c d]=size(image1); z=zeros(r,c); tempr=image1; tempr(:,:,2)=z; tempr(:,:,3)=z; subplot(2,2,1); imshow(tempr); title('RED'); tempg=image1; tempg(:,:,1)=z; tempg(:,:,3)=z; subplot(2,2,2) imshow(tempg); title('GREEN'); tempb=image1; tempb(:,:,1)=z; tempb(:,:,2)=z; subplot(2,2,3); imshow(tempb); title('BLUE');
  • 10. Program (2) : Image Negation %MATLAB program for Image Negation. clc; clear all; close all; a = imread('dexter.jpg'); subplot(1,2,1); imshow(a); title('Dexter'); b = 255-a; subplot(1,2,2); imshow(b); title('Negation of Dexter');
  • 11. Program (3) : Power Law Transformation %MATLAB program for Power Law Transformation clc; clear all; close all; a = imread('flowers.jpg'); gamma = 1.1; b = double(a).^gamma; subplot(1,2,1); imshow(a); title ('Original Image'); subplot(1,2,2); imshow(uint8(b)); title ('Power Law Transformed Image');
  • 12. Program (4) : Histogram Mapping and Equalization %MATLAB program for histogram mapping and equalisation. clc; clear all; close all; a = imread('flowers.jpg'); b = rgb2gray(a); subplot(2,2,1); imshow(b); title('grayscale image of original rgb image'); c = im2double(b); subplot(2,2,2); imhist(c); title('histogram mapping of grayscale original image'); d = histeq (c); subplot(2,2,3); imshow(d); title('grayscale original image after histogram equalisation'); subplot(2,2,4); imhist(d); title('histogram mapping of equalised grayscale original image');
  • 14. Program (5) : Image Smoothening and Sharpening % MATLAB program for image smoothing and sharpening. clc; clear all; close all; a = imread ('dexter.jpg'); subplot(1,3,1); imshow(a); title('original image'); h = fspecial('gaussian'); % create predefined 2-D filter b = imfilter(a,h); % N-D filtering of multidimensional images subplot(1,3,2); imshow(b); title('smoothened image'); c = imsharpen(a); subplot(1,3,3); imshow(c); title('sharpened image');
  • 15. Program (6) : Edge Detection using Sobel, Prewitt and Roberts Operators % MATLAB program for image smoothing and sharpening. clc; clear all; close all; a = imread('dexter.jpg'); b = rgb2gray(a); subplot(2,2,1); imshow(a); title('Original Image'); c1 = edge(b,'sobel'); subplot(2,2,2); imshow(c1); title('Sobel Operator'); c2 = edge(b,'prewitt'); subplot(2,2,3); imshow(c2); title('Prewitt Operator'); c3 = edge(b,'roberts'); subplot(2,2,4); imshow(c3); title('Roberts Operator');
  • 17. Program (7) : Morphological Operations on Binary Images % MATLAB program for morphological operations on binary images. clc; clear all; close all; a = imread ('circles.jpg'); b = im2bw(a,0.4); subplot(2,3,1); imshow(b); title('original binary image'); c = bwmorph(b,'remove'); % removes interior pixels to obtain outline subplot(2,3,2); imshow(c); title('outline of original image'); d = bwmorph(b,'skel',Inf); % applies operation infinite times till image no longer changes subplot(2,3,3); imshow(d); title('skeleton of original image'); se = strel('line',11,90); % create a 'line' structuring element e = imdilate(b,se); % dilate image with a structuring element subplot(2,3,4); imshow(e), title('dilation of original image'); f = imerode(b,se); % erode image with a structuring element subplot(2,3,5); imshow(f), title('erosion of original image'); g = bwmorph(b,'bothat'); % performs morphological "bottom hat" operation subplot(2,3,6); imshow(g); title('bottom hat operation on original image');
  • 19. Program (8) : Pseudo Coloring %MATLAB program for pseudo coloring. clc; clear all; close all; input_img=imread('rice.tif'); % Read image from graphics file [m n]=size(input_img); %Array dimensions input_img=double(input_img); %Convert to double precision for i=1:m for j=1:n if input_img(i,j)>=0 & input_img(i,j)<50 output_img(i,j,1)=input_img(i,j,1)+50; output_img(i,j,2)=input_img(i,j)+100; output_img(i,j,3)=input_img(i,j)+10; end if input_img(i,j)>=50 & input_img(i,j)<100 output_img(i,j,1)=input_img(i,j)+35; output_img(i,j,2)=input_img(i,j)+128; output_img(i,j,3)=input_img(i,j)+10; end if input_img(i,j)>=100 & input_img(i,j)<150 output_img(i,j,1)=input_img(i,j)+152; output_img(i,j,2)=input_img(i,j)+130; output_img(i,j,3)=input_img(i,j)+15; end if input_img(i,j)>=150 & input_img(i,j)<200 output_img(i,j,1)=input_img(i,j)+50; output_img(i,j,2)=input_img(i,j)+140; output_img(i,j,3)=input_img(i,j)+25; end if input_img(i,j)>=200 & input_img(i,j)<=256 output_img(i,j,1)=input_img(i,j)+120; output_img(i,j,2)=input_img(i,j)+160; output_img(i,j,3)=input_img(i,j)+45; end end end subplot(2,2,1), % Create axes in tiled positions imshow(uint8(input_img)), %Display input image title('Input Image') %Add title to current axes
  • 20. subplot(2,2,2), % Create axes in tiled positions imshow(uint8(output_img)), %Display output image title('Pseudo Coloured Image') %Add title to current axes
  • 21. Program (9) : Chain Coding %MATLAB program for chain coding. clc; close all; clear all; X=[0 1 1 0;1 0 0 1;1 0 0 1;0 1 1 0]; % Test matrices B1=[0 1 0;1 1 1;0 1 0]; % Plot multiple frequency response objects and doubles on same graph B2=[1 1 1;1 1 1;1 1 1]; % Plot multiple frequency response objects and doubles on same graph Erx=imerode(X,B1); % Erode image Erf=imerode(Erx,B2); % Erode image disp('Chain rule1 LHS'); disp(Erf); %Display array DiB=imdilate(B1,B2); % dilates the grayscale, binary, or packed binary image B1, returning the dilated image, B2. Erx1=imerode(X,DiB); disp('Chain rule1 RHS'); disp(Erx1); %Display array Dix1=imdilate(X,B1); % dilates the grayscale, binary, or packed binary image X, returning the dilated image, B1. Dix=imdilate(Dix1,B2); % dilates the grayscale, binary, or packed binary image Dix 1, returning the dilated image, B2. disp('Chain rule2 LHS'); disp(Dix); %Display array DiB=imdilate(B1,B2); Dix2=imdilate(X,DiB); disp('Chain rule2 RHS'); %Display array disp(Dix2); %Display array
  • 22. Output: Chain rule1 LHS 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Chain rule1 RHS 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Chain rule2 LHS 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Chain rule2 RHS 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  • 23. Program (10) : DCT/IDCT Computation %MATLAB program for DCT/IDCT computation. clc; clear all; close all; m=input('Enter the basis matrix dimension: '); % Request user input n=m; alpha2=ones(1,n)*sqrt(2/n); alpha2(1)=sqrt(1/n); alpha1=ones(1,m)*sqrt(2/m); alpha(1)=sqrt(1/m); % square root. for u=0:m-1 for v=0:n-1 for x=0:m-1 for y=0:n-1 a{u+1,v+1}(x+1,y+1)=alpha1(u+1)*alpha2(v+1)*... cos((2*x+1)*u*pi/(2*n))*cos((2*y+1)*v*pi/(2*n)); end end end end mag=a; figure(3) % Create figure graphics object k=1; % Code to plot the basis for i=1:m for j=1:n subplot(m,n,k) % Create axes in tiled positions imshow(mag{i,j},256) % Display image k=k+1; end end Enter the basis matrix dimension: 5
  • 25. QUIZ ON THE SUBJECT: 1) What is the basis for numerous spatial domain processing techniques ? 2) What is the significance if image processing in the world of internet ? 3) In which image we notice that the components of histogram are concentrated on the low side on intensity scale ? 4) What is Histogram Equalization also called as ? 5) What is Histogram Matching also called as ? 6) Histogram Equalization is mainly used for what purpose ? 7) To reduce computation if one utilizes non-overlapping regions, it usually produces which effect ? 8) What does SEM stands for? 9) What is he type of Histogram Processing in which pixels are modified based on the intensity distribution of the image called as ? 10) Which type of Histogram Processing is suited for minute detailed enhancements? 11) What is the class of the color map array of the indexed image ? 12) What type of discipline is Computer Vision ? 13) What is a geometry consisting of in-line arrangement of sensors for image acquisition called ? 14) What is he difference is intensity between the highest and the lowest intensity levels in an image called ? 15) What is the name of procedure done on a digital image to alter the values of its individual pixels called ?
  • 26. CONDUCTION OF VIVA-VOCA EXAMINATIONS: Teacher should conduct oral exams of the students with full preparation. Normally, the objective questions with guess are to be avoided. To make it meaningful, the questions should be such that depth of the students in the subject is tested. Oral examinations are to be conducted in co-cordial environment amongst the teachers taking the examination. Teachers taking such examinations should not have ill thoughts about each other and courtesies should be offered to each other in case of difference of opinion, which should be critically suppressed in front of the students. EVALUATION OF MARKING SYSTEM: Basic honesty in the evaluation and marking system is absolutely essential and in the process, impartial nature of the evaluator is required in the examination system. It is a wrong approach or concept to award the students by way of easy marking to get cheap popularity among the students, which they do not deserve. It is a primary responsibility of the teacher that right students who are really putting up lot of hard work with right kind of intelligence are correctly awarded. The marking patterns should be justifiable to the students without any ambiguity and teacher should see that students are faced with just circumstances.