SlideShare a Scribd company logo
1 of 26
Download to read offline
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');
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');
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');
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

Similar to dip.pdf

An interdisciplinary course_in_digital_image_processing
An interdisciplinary course_in_digital_image_processingAn interdisciplinary course_in_digital_image_processing
An interdisciplinary course_in_digital_image_processing
Syed Muhammad Hammad
 

Similar to dip.pdf (20)

HANDWRITTEN DIGIT RECOGNITION USING MACHINE LEARNING
HANDWRITTEN DIGIT RECOGNITION USING MACHINE LEARNINGHANDWRITTEN DIGIT RECOGNITION USING MACHINE LEARNING
HANDWRITTEN DIGIT RECOGNITION USING MACHINE LEARNING
 
HANDWRITTEN DIGIT RECOGNITION USING MACHINE LEARNING
HANDWRITTEN DIGIT RECOGNITION USING MACHINE LEARNINGHANDWRITTEN DIGIT RECOGNITION USING MACHINE LEARNING
HANDWRITTEN DIGIT RECOGNITION USING MACHINE LEARNING
 
An Approach for Image Deblurring: Based on Sparse Representation and Regulari...
An Approach for Image Deblurring: Based on Sparse Representation and Regulari...An Approach for Image Deblurring: Based on Sparse Representation and Regulari...
An Approach for Image Deblurring: Based on Sparse Representation and Regulari...
 
IPT.pdf
IPT.pdfIPT.pdf
IPT.pdf
 
An interdisciplinary course_in_digital_image_processing
An interdisciplinary course_in_digital_image_processingAn interdisciplinary course_in_digital_image_processing
An interdisciplinary course_in_digital_image_processing
 
Learning with Relative Attributes
Learning with Relative AttributesLearning with Relative Attributes
Learning with Relative Attributes
 
IRJET- 3-D Face Image Identification from Video Streaming using Map Reduc...
IRJET-  	  3-D Face Image Identification from Video Streaming using Map Reduc...IRJET-  	  3-D Face Image Identification from Video Streaming using Map Reduc...
IRJET- 3-D Face Image Identification from Video Streaming using Map Reduc...
 
Android based application for graph analysis final report
Android based application for graph analysis final reportAndroid based application for graph analysis final report
Android based application for graph analysis final report
 
LMmanual.pdf
LMmanual.pdfLMmanual.pdf
LMmanual.pdf
 
Generation of Deepfake images using GAN and Least squares GAN.ppt
Generation of Deepfake images using GAN and Least squares GAN.pptGeneration of Deepfake images using GAN and Least squares GAN.ppt
Generation of Deepfake images using GAN and Least squares GAN.ppt
 
IRJET - Hand Gesture Recognition to Perform System Operations
IRJET -  	  Hand Gesture Recognition to Perform System OperationsIRJET -  	  Hand Gesture Recognition to Perform System Operations
IRJET - Hand Gesture Recognition to Perform System Operations
 
An Approach for Image Deblurring: Based on Sparse Representation and Regulari...
An Approach for Image Deblurring: Based on Sparse Representation and Regulari...An Approach for Image Deblurring: Based on Sparse Representation and Regulari...
An Approach for Image Deblurring: Based on Sparse Representation and Regulari...
 
IRJET- Facial Expression Recognition using GPA Analysis
IRJET-  	  Facial Expression Recognition using GPA AnalysisIRJET-  	  Facial Expression Recognition using GPA Analysis
IRJET- Facial Expression Recognition using GPA Analysis
 
Sign Detection from Hearing Impaired
Sign Detection from Hearing ImpairedSign Detection from Hearing Impaired
Sign Detection from Hearing Impaired
 
IRJET- Efficient Face Detection from Video Sequences using KNN and PCA
IRJET-  	  Efficient Face Detection from Video Sequences using KNN and PCAIRJET-  	  Efficient Face Detection from Video Sequences using KNN and PCA
IRJET- Efficient Face Detection from Video Sequences using KNN and PCA
 
Automated Image Captioning – Model Based on CNN – GRU Architecture
Automated Image Captioning – Model Based on CNN – GRU ArchitectureAutomated Image Captioning – Model Based on CNN – GRU Architecture
Automated Image Captioning – Model Based on CNN – GRU Architecture
 
MAJOR PROJECT
MAJOR PROJECT MAJOR PROJECT
MAJOR PROJECT
 
Dip iit workshop
Dip iit workshopDip iit workshop
Dip iit workshop
 
IRJET- Low Light Image Enhancement using Convolutional Neural Network
IRJET-  	  Low Light Image Enhancement using Convolutional Neural NetworkIRJET-  	  Low Light Image Enhancement using Convolutional Neural Network
IRJET- Low Light Image Enhancement using Convolutional Neural Network
 
CE344L-200365-Lab8.pdf
CE344L-200365-Lab8.pdfCE344L-200365-Lab8.pdf
CE344L-200365-Lab8.pdf
 

More from NetraBahadurKatuwal (6)

wmo-td_1182_en.pdf
wmo-td_1182_en.pdfwmo-td_1182_en.pdf
wmo-td_1182_en.pdf
 
DIP_Manual.pdf
DIP_Manual.pdfDIP_Manual.pdf
DIP_Manual.pdf
 
IJAEBv12n3b.pdf
IJAEBv12n3b.pdfIJAEBv12n3b.pdf
IJAEBv12n3b.pdf
 
MatLab-ImageProcessing.pdf
MatLab-ImageProcessing.pdfMatLab-ImageProcessing.pdf
MatLab-ImageProcessing.pdf
 
Report39.pdf
Report39.pdfReport39.pdf
Report39.pdf
 
SDGs_Booklet_Web_En.pdf
SDGs_Booklet_Web_En.pdfSDGs_Booklet_Web_En.pdf
SDGs_Booklet_Web_En.pdf
 

Recently uploaded

Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 

Recently uploaded (20)

Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 

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');
  • 13.
  • 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');
  • 16.
  • 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');
  • 18.
  • 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.