SlideShare a Scribd company logo
COMPUTER GRAPHICS AND
IMAGE PROCESSING
Assignment of Lab
Abstract
A complete practiceand a well-defined documentation of the tasks thatare to be performed as
an assignment
Name: M AMIR FAROOQ
RegistrationNo. 2014-CS-03
Submitted To: MAM URSOOSA
1
Assignment of Computer Graphics & Image Processing (Lab)
Question # 9
Sobel Operators
Answer
Command: img =imread('E:hello.jpg','jpg');
figure(1),imshow(img);
filter1=[-1 -2 -1;0 0 0;1 2 1];
filter2=[-1 0 1;-2 0 2;-1 0 1];
res1=imfilter(img,filter1);
figure(2),imshow(res1);
res2=imfilter(img,filter2);
figure(3),imshow(res2);
figure(4),imshow(res1+res2);
Output:
2
Question # 10
Prewitt Operators
Answer
Command: img=imread('E:hello.jpg','jpg');
figure(1),imshow(img);
filter1=[-1 -1 -1;0 0 0;1 1 1]
filter2=[-1 0 1;-1 0 1;-1 0 1]
res1=imfilter(img,filter1);
figure(2),imshow(res1);
res2=imfilter(img,filter2);
figure(3),imshow(res2);
figure(4),imshow(res1+res2);
Output:
3
Question # 11
Guassian Filter
Answer
Command: img=imread('E:hello.jpg','jpg');
figure(1),imshow(img);
filter1=fspecial('gaussian',[7 7],2)
res=imfilter(img,filter1);
figure(2),imshow(res)
Output:
4
Question # 12
Median Filter
Answer
Command: img=imread('E:hello.jpg','jpg');
figure(1),imshow(img);
res=imnoise(img,'salt & pepper',0.01);
figure(2),imshow(res)
figure(3),imshow(medfilt2(temp));
Output:
Question # 13
Average Filter
Answer
Command: img=imread('E:hello.jpg','jpg');
figure(1),imshow(img);
temp1=fspecial('average',[7 7]);
figure(2),imshow(imfilter(img,temp1));
5
Output:
Question # 14
Laplacian Filter
Answer
Command: img=imread('E:hello.jpg','jpg');
figure(1),imshow(img);
a=fspecial('laplacian');
figure(2),imshow(imfilter(img,a));
Output:
6
Question # 15
Robert Opertor
Answer
Command: img=imread('E:hello.jpg','jpg');
figure(1),imshow(img);
temp1=[-1 0;0 -1];
temp2=[0 1;-1 0];
res1=imfilter(img,temp1);
figure(2),imshow(res1);
res2=imfilter(img,temp2);
figure(3),imshow(res2);
figure(4),imshow(res1+res2);
Output:
Q 16: Low Pass Filter
7
Thisfilterisusedforsmoothinginfrequencydomain.
Code:
img=imread('E:hello.jpg','jpg');
img1=rgb2gray(img);
filt=[11 1
1 1 1
1 1 1]/9
image=imfilter(img1,filt);
filtered_img=img1-image;
subplot(1,2,1),imshow(img1);title('Orignal Image');
subplot(1,2,2),imshow(filtered_img);title('LowPassFilter');
Q 17: HighPass Filter
Code:
img=imread('E:hello.png','png');
img1=rgb2gray(img);
8
filt=[11 1
1 1 1
1 1 1]/9;
image=imfilter(img1,filt);
filtered_img=2*img1-image;
subplot(1,2,1),imshow(img1);title('Orignal Image');
subplot(1,2,2),imshow(filtered_img);title('After ApplyingHighPassFilter');
Q 18: HighBoost Filter
Code:
img=imread('E:hello.jpg,',jpg');
img1=rgb2gray(img);
filt=[11 1
1 1 1
1 1 1]/9;
image=imfilter(img1,filt);
9
filtered_img=2*img1-image;
subplot(1,2,1),imshow(b);title('OrignalImage');
subplot(1,2,2),imshow(filtered_img);title('HighBoostImage');
Q 19: Horizental and Vertical Edges Using Prewitt Filter
Code:
img=imread('C:UsersAppleDesktop1','jpg');
img1=rgb2gray(img);
edges_of_image=edge(img1,'prewitt');
subplot(1,2,1)
imshow(img1);title('Orignal Image');
subplot(1,2,2),
10
imshow(edges_of_image);title('Horizental &Vertical Edges');

More Related Content

PPTX
4. functions
PhD Research Scholar
 
PDF
lab91_lab92_merged.pdfbbbbbbbbbbbbbbbbbbb
annarascala
 
PPTX
Image processing lab work
Shajun Nisha
 
PDF
662305 LAB13
Nitigan Nakjuatong
 
PPTX
Digital Image Processing (Lab 09 and 10)
Moe Moe Myint
 
PDF
Of class1
Janet Huang
 
4. functions
PhD Research Scholar
 
lab91_lab92_merged.pdfbbbbbbbbbbbbbbbbbbb
annarascala
 
Image processing lab work
Shajun Nisha
 
662305 LAB13
Nitigan Nakjuatong
 
Digital Image Processing (Lab 09 and 10)
Moe Moe Myint
 
Of class1
Janet Huang
 

Similar to Manual of image processing lab (20)

PDF
CE344L-200365-Lab7.pdf
UmarMustafa13
 
PDF
CE344L-200365-Lab5.pdf
UmarMustafa13
 
PPTX
artificial intelligencemaster class.pptx
usukkingdom
 
PPTX
Introduction to image contrast and enhancement method
Abhishekvb
 
PPTX
Python 03-parameters-graphics.pptx
TseChris
 
PDF
Dip 1
moramvenkat
 
PDF
Denis Sergienko "Pip install driven deep learning"
Fwdays
 
PPTX
License Plate Recognition System
Hira Rizvi
 
PDF
"Quantum" performance effects
Sergey Kuksenko
 
PPTX
29-kashyap-mask-detaction.pptx
KASHYAPPATHAK7
 
PDF
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
The Statistical and Applied Mathematical Sciences Institute
 
PPTX
Application of recursive perturbation approach for multimodal optimization
Pranamesh Chakraborty
 
PPTX
Advanced Concepts in Python
Saraswathi Murugan
 
DOCX
Quiz 9 cp_sol
Syed HassanYousaf
 
PDF
CE344L-200365-Lab8.pdf
UmarMustafa13
 
PPTX
Eugene Khvedchenya. State of the art Image Augmentations with Albumentations.
Lviv Startup Club
 
DOCX
matlab.docx
AraniNavaratnarajah2
 
DOCX
Computer graphics
shafiq sangi
 
PDF
Need helping adding to the code below to plot the images from the firs.pdf
actexerode
 
PPTX
project_final_seminar
MUKUL BICHKAR
 
CE344L-200365-Lab7.pdf
UmarMustafa13
 
CE344L-200365-Lab5.pdf
UmarMustafa13
 
artificial intelligencemaster class.pptx
usukkingdom
 
Introduction to image contrast and enhancement method
Abhishekvb
 
Python 03-parameters-graphics.pptx
TseChris
 
Denis Sergienko "Pip install driven deep learning"
Fwdays
 
License Plate Recognition System
Hira Rizvi
 
"Quantum" performance effects
Sergey Kuksenko
 
29-kashyap-mask-detaction.pptx
KASHYAPPATHAK7
 
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
The Statistical and Applied Mathematical Sciences Institute
 
Application of recursive perturbation approach for multimodal optimization
Pranamesh Chakraborty
 
Advanced Concepts in Python
Saraswathi Murugan
 
Quiz 9 cp_sol
Syed HassanYousaf
 
CE344L-200365-Lab8.pdf
UmarMustafa13
 
Eugene Khvedchenya. State of the art Image Augmentations with Albumentations.
Lviv Startup Club
 
Computer graphics
shafiq sangi
 
Need helping adding to the code below to plot the images from the firs.pdf
actexerode
 
project_final_seminar
MUKUL BICHKAR
 
Ad

More from maamir farooq (20)

DOCX
Ooad lab1
maamir farooq
 
PPT
Lesson 03
maamir farooq
 
PPT
Lesson 02
maamir farooq
 
PDF
Php client libray
maamir farooq
 
PDF
Swiftmailer
maamir farooq
 
PDF
Lect15
maamir farooq
 
PDF
Lec 7
maamir farooq
 
PPTX
Lec 6
maamir farooq
 
PDF
Lec 5
maamir farooq
 
PDF
J query 1.7 cheat sheet
maamir farooq
 
PDF
Assignment
maamir farooq
 
PDF
Java script summary
maamir farooq
 
PDF
Lec 3
maamir farooq
 
PDF
Lec 2
maamir farooq
 
PPTX
Lec 1
maamir farooq
 
PPTX
Css summary
maamir farooq
 
PDF
Session management
maamir farooq
 
PDF
Data management
maamir farooq
 
PPTX
Content provider
maamir farooq
 
PDF
Android sq lite database tutorial
maamir farooq
 
Ooad lab1
maamir farooq
 
Lesson 03
maamir farooq
 
Lesson 02
maamir farooq
 
Php client libray
maamir farooq
 
Swiftmailer
maamir farooq
 
J query 1.7 cheat sheet
maamir farooq
 
Assignment
maamir farooq
 
Java script summary
maamir farooq
 
Css summary
maamir farooq
 
Session management
maamir farooq
 
Data management
maamir farooq
 
Content provider
maamir farooq
 
Android sq lite database tutorial
maamir farooq
 
Ad

Recently uploaded (20)

PPTX
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
PPTX
Strengthening open access through collaboration: building connections with OP...
Jisc
 
PPTX
Introduction and Scope of Bichemistry.pptx
shantiyogi
 
PPTX
Presentation on Janskhiya sthirata kosh.
Ms Usha Vadhel
 
PPTX
Skill Development Program For Physiotherapy Students by SRY.pptx
Prof.Dr.Y.SHANTHOSHRAJA MPT Orthopedic., MSc Microbiology
 
PPTX
How to Manage Global Discount in Odoo 18 POS
Celine George
 
PPTX
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
PDF
3.The-Rise-of-the-Marathas.pdfppt/pdf/8th class social science Exploring Soci...
Sandeep Swamy
 
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
PDF
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Mithil Fal Desai
 
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
MartinaBurlando1
 
PPTX
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
Sourav Kr Podder
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PDF
UTS Health Student Promotional Representative_Position Description.pdf
Faculty of Health, University of Technology Sydney
 
PDF
5.Universal-Franchise-and-Indias-Electoral-System.pdfppt/pdf/8th class social...
Sandeep Swamy
 
PDF
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
PDF
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
Strengthening open access through collaboration: building connections with OP...
Jisc
 
Introduction and Scope of Bichemistry.pptx
shantiyogi
 
Presentation on Janskhiya sthirata kosh.
Ms Usha Vadhel
 
Skill Development Program For Physiotherapy Students by SRY.pptx
Prof.Dr.Y.SHANTHOSHRAJA MPT Orthopedic., MSc Microbiology
 
How to Manage Global Discount in Odoo 18 POS
Celine George
 
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
3.The-Rise-of-the-Marathas.pdfppt/pdf/8th class social science Exploring Soci...
Sandeep Swamy
 
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Mithil Fal Desai
 
NOI Hackathon - Summer Edition - GreenThumber.pptx
MartinaBurlando1
 
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
Open Quiz Monsoon Mind Game Prelims.pptx
Sourav Kr Podder
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
UTS Health Student Promotional Representative_Position Description.pdf
Faculty of Health, University of Technology Sydney
 
5.Universal-Franchise-and-Indias-Electoral-System.pdfppt/pdf/8th class social...
Sandeep Swamy
 
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 

Manual of image processing lab

  • 1. COMPUTER GRAPHICS AND IMAGE PROCESSING Assignment of Lab Abstract A complete practiceand a well-defined documentation of the tasks thatare to be performed as an assignment Name: M AMIR FAROOQ RegistrationNo. 2014-CS-03 Submitted To: MAM URSOOSA
  • 2. 1 Assignment of Computer Graphics & Image Processing (Lab) Question # 9 Sobel Operators Answer Command: img =imread('E:hello.jpg','jpg'); figure(1),imshow(img); filter1=[-1 -2 -1;0 0 0;1 2 1]; filter2=[-1 0 1;-2 0 2;-1 0 1]; res1=imfilter(img,filter1); figure(2),imshow(res1); res2=imfilter(img,filter2); figure(3),imshow(res2); figure(4),imshow(res1+res2); Output:
  • 3. 2 Question # 10 Prewitt Operators Answer Command: img=imread('E:hello.jpg','jpg'); figure(1),imshow(img); filter1=[-1 -1 -1;0 0 0;1 1 1] filter2=[-1 0 1;-1 0 1;-1 0 1] res1=imfilter(img,filter1); figure(2),imshow(res1); res2=imfilter(img,filter2); figure(3),imshow(res2); figure(4),imshow(res1+res2); Output:
  • 4. 3 Question # 11 Guassian Filter Answer Command: img=imread('E:hello.jpg','jpg'); figure(1),imshow(img); filter1=fspecial('gaussian',[7 7],2) res=imfilter(img,filter1); figure(2),imshow(res) Output:
  • 5. 4 Question # 12 Median Filter Answer Command: img=imread('E:hello.jpg','jpg'); figure(1),imshow(img); res=imnoise(img,'salt & pepper',0.01); figure(2),imshow(res) figure(3),imshow(medfilt2(temp)); Output: Question # 13 Average Filter Answer Command: img=imread('E:hello.jpg','jpg'); figure(1),imshow(img); temp1=fspecial('average',[7 7]); figure(2),imshow(imfilter(img,temp1));
  • 6. 5 Output: Question # 14 Laplacian Filter Answer Command: img=imread('E:hello.jpg','jpg'); figure(1),imshow(img); a=fspecial('laplacian'); figure(2),imshow(imfilter(img,a)); Output:
  • 7. 6 Question # 15 Robert Opertor Answer Command: img=imread('E:hello.jpg','jpg'); figure(1),imshow(img); temp1=[-1 0;0 -1]; temp2=[0 1;-1 0]; res1=imfilter(img,temp1); figure(2),imshow(res1); res2=imfilter(img,temp2); figure(3),imshow(res2); figure(4),imshow(res1+res2); Output: Q 16: Low Pass Filter
  • 8. 7 Thisfilterisusedforsmoothinginfrequencydomain. Code: img=imread('E:hello.jpg','jpg'); img1=rgb2gray(img); filt=[11 1 1 1 1 1 1 1]/9 image=imfilter(img1,filt); filtered_img=img1-image; subplot(1,2,1),imshow(img1);title('Orignal Image'); subplot(1,2,2),imshow(filtered_img);title('LowPassFilter'); Q 17: HighPass Filter Code: img=imread('E:hello.png','png'); img1=rgb2gray(img);
  • 9. 8 filt=[11 1 1 1 1 1 1 1]/9; image=imfilter(img1,filt); filtered_img=2*img1-image; subplot(1,2,1),imshow(img1);title('Orignal Image'); subplot(1,2,2),imshow(filtered_img);title('After ApplyingHighPassFilter'); Q 18: HighBoost Filter Code: img=imread('E:hello.jpg,',jpg'); img1=rgb2gray(img); filt=[11 1 1 1 1 1 1 1]/9; image=imfilter(img1,filt);
  • 10. 9 filtered_img=2*img1-image; subplot(1,2,1),imshow(b);title('OrignalImage'); subplot(1,2,2),imshow(filtered_img);title('HighBoostImage'); Q 19: Horizental and Vertical Edges Using Prewitt Filter Code: img=imread('C:UsersAppleDesktop1','jpg'); img1=rgb2gray(img); edges_of_image=edge(img1,'prewitt'); subplot(1,2,1) imshow(img1);title('Orignal Image'); subplot(1,2,2),