SlideShare a Scribd company logo
Homework 08, UST
Downsampling and Upsampling of an Image using
Pyramids (pyrUp and pyrDown Methods)
Mr. Saeed Ullah,
Korean Institute of Science & Technology Information (KISTI),
University of Science & Technology (UST)
Saeedonline12@gmail.com
Summary—This report presents Downsampling (Zoom out) and
Upsampling (Zoom In) applied on an image. Tools used in this
project are OpenCV 3.2 Library which is a library used for Computer
Vision, and Visual Studio 2015 (64 bit).
I. INTRODUCTION
In computing, zooming is the ability to zoom in and out a
document or image at specified level. It is usually found in all
most all of the computer applications as it improves
accessibility for people with visual impairment and people
using mobile devices which have a relatively small screen.
Some of the important concepts for this project are:
 Image Pyramid
An image pyramid is a collection of images - all arising from a
single original image - that are successively downsampled
until some desired stopping point is reached.
There are two common kinds of image pyramids:
Gaussian pyramid: Used to downsample images
Laplacian pyramid: Used to reconstruct an upsampled image
from an image lower in the pyramid (with less resolution).
In this tutorial I have used the Gaussian pyramid.
 Gaussian Pyramid
Imagine the pyramid as a set of layers in which the higher the
layer, the smaller the size.
Every layer is numbered from bottom to top, so
layer (denoted as is smaller than layer ( ).
To produce layer in the Gaussian pyramid, I did the
following steps:
I. Convolve with a Gaussian kernel:
II. Removed every even-numbered row and column. It
can easily be noted that the resulting image will be
exactly one-quarter the area of its predecessor.
Iterating this process on the input
image (original image) produces the entire
pyramid. Now
III. First, upsize the image to twice the original in each
dimension, with the new even rows and columns
filled with zeros ( )
IV. Perform a convolution with the same kernel shown
above (multiplied by 4) to approximate the values of
the “missing pixels”.
These two procedures re implemented by the OpenCV
functions pyrUp and pyrDown.
II. OPENCV SOURCE CODE
/// Load image
src = imread("..datalena.jpg");
// Perform an infinite loop waiting for user
input.
while (true)
{
int c;
c = waitKey(10);
if ((char)c == 27)
{ break; }
if ((char)c == 'i')
{
pyrUp(tmp, dst, Size(tmp.cols * 2, tmp.rows *
2));} else if ((char)c == 'o') {
pyrDown(tmp, dst, Size(tmp.cols / 2, tmp.rows /
2)); }
imshow(window_name, dst);
tmp = dst;}
III. RESULTS
Fig. 1. Original Image
Fig. 2. Image with Zoom In Fig. 3. Image with Zoom Out
CONCLUSION: - You can also perform Zoom In and Zoom
Out on an Image by using resize() function or some other user
defined functions but OpenCV comes with built-in powerful
functions i.e. pyrUp() and pyrDown() by using which one can
perform zooming tasks more easily and efficiently.

More Related Content

What's hot

A Three-Dimensional Representation method for Noisy Point Clouds based on Gro...
A Three-Dimensional Representation method for Noisy Point Clouds based on Gro...A Three-Dimensional Representation method for Noisy Point Clouds based on Gro...
A Three-Dimensional Representation method for Noisy Point Clouds based on Gro...
Sergio Orts-Escolano
 
dilating and eroding in open cv
dilating and eroding in open cvdilating and eroding in open cv
dilating and eroding in open cv
Saeed Ullah
 
Seeing with Python - Pycon SG 2014
Seeing with Python - Pycon SG 2014Seeing with Python - Pycon SG 2014
Seeing with Python - Pycon SG 2014
Mark Rees
 
3d scanning for digital heritage
3d scanning for digital heritage3d scanning for digital heritage
3d scanning for digital heritageFrederic Kaplan
 
Seam Carving Approach for Multirate Processing of Digital Images
Seam Carving Approach for Multirate Processing of Digital ImagesSeam Carving Approach for Multirate Processing of Digital Images
Seam Carving Approach for Multirate Processing of Digital Images
IJLT EMAS
 
View-Dependent Texture Atlases (EG 2010)
View-Dependent Texture Atlases (EG 2010)View-Dependent Texture Atlases (EG 2010)
View-Dependent Texture Atlases (EG 2010)Matthias Trapp
 
Photogrametry_3D_Modelling[1]
Photogrametry_3D_Modelling[1]Photogrametry_3D_Modelling[1]
Photogrametry_3D_Modelling[1]Joachim Nkendeys
 
Urban 3D Semantic Modelling Using Stereo Vision, ICRA 2013
Urban 3D Semantic Modelling Using Stereo Vision, ICRA 2013Urban 3D Semantic Modelling Using Stereo Vision, ICRA 2013
Urban 3D Semantic Modelling Using Stereo Vision, ICRA 2013Sunando Sengupta
 
COMSOL Training Series (NNMDC Initiative)
COMSOL Training Series (NNMDC Initiative)COMSOL Training Series (NNMDC Initiative)
COMSOL Training Series (NNMDC Initiative)Aniket Tekawade
 

What's hot (10)

A Three-Dimensional Representation method for Noisy Point Clouds based on Gro...
A Three-Dimensional Representation method for Noisy Point Clouds based on Gro...A Three-Dimensional Representation method for Noisy Point Clouds based on Gro...
A Three-Dimensional Representation method for Noisy Point Clouds based on Gro...
 
dilating and eroding in open cv
dilating and eroding in open cvdilating and eroding in open cv
dilating and eroding in open cv
 
Seeing with Python - Pycon SG 2014
Seeing with Python - Pycon SG 2014Seeing with Python - Pycon SG 2014
Seeing with Python - Pycon SG 2014
 
3d from images
3d from images3d from images
3d from images
 
3d scanning for digital heritage
3d scanning for digital heritage3d scanning for digital heritage
3d scanning for digital heritage
 
Seam Carving Approach for Multirate Processing of Digital Images
Seam Carving Approach for Multirate Processing of Digital ImagesSeam Carving Approach for Multirate Processing of Digital Images
Seam Carving Approach for Multirate Processing of Digital Images
 
View-Dependent Texture Atlases (EG 2010)
View-Dependent Texture Atlases (EG 2010)View-Dependent Texture Atlases (EG 2010)
View-Dependent Texture Atlases (EG 2010)
 
Photogrametry_3D_Modelling[1]
Photogrametry_3D_Modelling[1]Photogrametry_3D_Modelling[1]
Photogrametry_3D_Modelling[1]
 
Urban 3D Semantic Modelling Using Stereo Vision, ICRA 2013
Urban 3D Semantic Modelling Using Stereo Vision, ICRA 2013Urban 3D Semantic Modelling Using Stereo Vision, ICRA 2013
Urban 3D Semantic Modelling Using Stereo Vision, ICRA 2013
 
COMSOL Training Series (NNMDC Initiative)
COMSOL Training Series (NNMDC Initiative)COMSOL Training Series (NNMDC Initiative)
COMSOL Training Series (NNMDC Initiative)
 

Similar to downsampling and upsampling of an image using pyramids (pyr up and pyrdown methods)

Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)
IJERA Editor
 
Automated Face Detection System
Automated Face Detection SystemAutomated Face Detection System
Automated Face Detection System
Abhiroop Ghatak
 
Introduction to Computer Vision using OpenCV
Introduction to Computer Vision using OpenCVIntroduction to Computer Vision using OpenCV
Introduction to Computer Vision using OpenCV
Dylan Seychell
 
aip basic open cv example
aip basic open cv exampleaip basic open cv example
aip basic open cv example
Saeed Ullah
 
OpenCV+Android.pptx
OpenCV+Android.pptxOpenCV+Android.pptx
OpenCV+Android.pptx
Vishwas459764
 
N1802038292
N1802038292N1802038292
N1802038292
IOSR Journals
 
An Introduction to Computer Science with Java .docx
An Introduction to  Computer Science with Java .docxAn Introduction to  Computer Science with Java .docx
An Introduction to Computer Science with Java .docx
daniahendric
 
AIML4 CNN lab256 1hr (111-1).pdf
AIML4 CNN lab256 1hr (111-1).pdfAIML4 CNN lab256 1hr (111-1).pdf
AIML4 CNN lab256 1hr (111-1).pdf
ssuserb4d806
 
Report face recognition : ArganRecogn
Report face recognition :  ArganRecognReport face recognition :  ArganRecogn
Report face recognition : ArganRecogn
Ilyas CHAOUA
 
Image De-Noising Using Deep Neural Network
Image De-Noising Using Deep Neural NetworkImage De-Noising Using Deep Neural Network
Image De-Noising Using Deep Neural Network
aciijournal
 
IMAGE DE-NOISING USING DEEP NEURAL NETWORK
IMAGE DE-NOISING USING DEEP NEURAL NETWORKIMAGE DE-NOISING USING DEEP NEURAL NETWORK
IMAGE DE-NOISING USING DEEP NEURAL NETWORK
aciijournal
 
Intro_OpenCV.ppt
Intro_OpenCV.pptIntro_OpenCV.ppt
Intro_OpenCV.ppt
RithikRaj25
 
A basic introduction to open cv for image processing
A basic introduction to open cv for image processingA basic introduction to open cv for image processing
A basic introduction to open cv for image processingChu Lam
 
Log polar coordinates
Log polar coordinatesLog polar coordinates
Log polar coordinates
Oğul Göçmen
 
Image De-Noising Using Deep Neural Network
Image De-Noising Using Deep Neural NetworkImage De-Noising Using Deep Neural Network
Image De-Noising Using Deep Neural Network
aciijournal
 
Python image processing_Python image processing.pptx
Python image processing_Python image processing.pptxPython image processing_Python image processing.pptx
Python image processing_Python image processing.pptx
shashikant484397
 
IEEE EED2021 AI use cases in Computer Vision
IEEE EED2021 AI use cases in Computer VisionIEEE EED2021 AI use cases in Computer Vision
IEEE EED2021 AI use cases in Computer Vision
SAMeh Zaghloul
 
Intro to computer vision in .net
Intro to computer vision in .netIntro to computer vision in .net
Intro to computer vision in .net
Stephen Lorello
 
line and circle detection using hough transform
line and circle detection using hough transformline and circle detection using hough transform
line and circle detection using hough transform
Saeed Ullah
 
OpenCV Introduction
OpenCV IntroductionOpenCV Introduction
OpenCV Introduction
Zachary Blair
 

Similar to downsampling and upsampling of an image using pyramids (pyr up and pyrdown methods) (20)

Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)
 
Automated Face Detection System
Automated Face Detection SystemAutomated Face Detection System
Automated Face Detection System
 
Introduction to Computer Vision using OpenCV
Introduction to Computer Vision using OpenCVIntroduction to Computer Vision using OpenCV
Introduction to Computer Vision using OpenCV
 
aip basic open cv example
aip basic open cv exampleaip basic open cv example
aip basic open cv example
 
OpenCV+Android.pptx
OpenCV+Android.pptxOpenCV+Android.pptx
OpenCV+Android.pptx
 
N1802038292
N1802038292N1802038292
N1802038292
 
An Introduction to Computer Science with Java .docx
An Introduction to  Computer Science with Java .docxAn Introduction to  Computer Science with Java .docx
An Introduction to Computer Science with Java .docx
 
AIML4 CNN lab256 1hr (111-1).pdf
AIML4 CNN lab256 1hr (111-1).pdfAIML4 CNN lab256 1hr (111-1).pdf
AIML4 CNN lab256 1hr (111-1).pdf
 
Report face recognition : ArganRecogn
Report face recognition :  ArganRecognReport face recognition :  ArganRecogn
Report face recognition : ArganRecogn
 
Image De-Noising Using Deep Neural Network
Image De-Noising Using Deep Neural NetworkImage De-Noising Using Deep Neural Network
Image De-Noising Using Deep Neural Network
 
IMAGE DE-NOISING USING DEEP NEURAL NETWORK
IMAGE DE-NOISING USING DEEP NEURAL NETWORKIMAGE DE-NOISING USING DEEP NEURAL NETWORK
IMAGE DE-NOISING USING DEEP NEURAL NETWORK
 
Intro_OpenCV.ppt
Intro_OpenCV.pptIntro_OpenCV.ppt
Intro_OpenCV.ppt
 
A basic introduction to open cv for image processing
A basic introduction to open cv for image processingA basic introduction to open cv for image processing
A basic introduction to open cv for image processing
 
Log polar coordinates
Log polar coordinatesLog polar coordinates
Log polar coordinates
 
Image De-Noising Using Deep Neural Network
Image De-Noising Using Deep Neural NetworkImage De-Noising Using Deep Neural Network
Image De-Noising Using Deep Neural Network
 
Python image processing_Python image processing.pptx
Python image processing_Python image processing.pptxPython image processing_Python image processing.pptx
Python image processing_Python image processing.pptx
 
IEEE EED2021 AI use cases in Computer Vision
IEEE EED2021 AI use cases in Computer VisionIEEE EED2021 AI use cases in Computer Vision
IEEE EED2021 AI use cases in Computer Vision
 
Intro to computer vision in .net
Intro to computer vision in .netIntro to computer vision in .net
Intro to computer vision in .net
 
line and circle detection using hough transform
line and circle detection using hough transformline and circle detection using hough transform
line and circle detection using hough transform
 
OpenCV Introduction
OpenCV IntroductionOpenCV Introduction
OpenCV Introduction
 

More from Saeed Ullah

aip shape detection and tracking using contours
aip shape detection and tracking using contoursaip shape detection and tracking using contours
aip shape detection and tracking using contours
Saeed Ullah
 
aip edge detection using sobel and canny methods
aip edge detection using sobel and canny methodsaip edge detection using sobel and canny methods
aip edge detection using sobel and canny methods
Saeed Ullah
 
captcha formation with warping and random number generation
captcha formation with warping and random number generationcaptcha formation with warping and random number generation
captcha formation with warping and random number generation
Saeed Ullah
 
histogram equalization of grayscale and color image
histogram equalization of grayscale and color imagehistogram equalization of grayscale and color image
histogram equalization of grayscale and color image
Saeed Ullah
 
Online Transaction Processing (OLTP) System for Dir Maidan Palace (Saeed BS p...
Online Transaction Processing (OLTP) System for Dir Maidan Palace (Saeed BS p...Online Transaction Processing (OLTP) System for Dir Maidan Palace (Saeed BS p...
Online Transaction Processing (OLTP) System for Dir Maidan Palace (Saeed BS p...
Saeed Ullah
 
A comprehensive study on nondestructive inspection of reinforced concrete uti...
A comprehensive study on nondestructive inspection of reinforced concrete uti...A comprehensive study on nondestructive inspection of reinforced concrete uti...
A comprehensive study on nondestructive inspection of reinforced concrete uti...
Saeed Ullah
 

More from Saeed Ullah (6)

aip shape detection and tracking using contours
aip shape detection and tracking using contoursaip shape detection and tracking using contours
aip shape detection and tracking using contours
 
aip edge detection using sobel and canny methods
aip edge detection using sobel and canny methodsaip edge detection using sobel and canny methods
aip edge detection using sobel and canny methods
 
captcha formation with warping and random number generation
captcha formation with warping and random number generationcaptcha formation with warping and random number generation
captcha formation with warping and random number generation
 
histogram equalization of grayscale and color image
histogram equalization of grayscale and color imagehistogram equalization of grayscale and color image
histogram equalization of grayscale and color image
 
Online Transaction Processing (OLTP) System for Dir Maidan Palace (Saeed BS p...
Online Transaction Processing (OLTP) System for Dir Maidan Palace (Saeed BS p...Online Transaction Processing (OLTP) System for Dir Maidan Palace (Saeed BS p...
Online Transaction Processing (OLTP) System for Dir Maidan Palace (Saeed BS p...
 
A comprehensive study on nondestructive inspection of reinforced concrete uti...
A comprehensive study on nondestructive inspection of reinforced concrete uti...A comprehensive study on nondestructive inspection of reinforced concrete uti...
A comprehensive study on nondestructive inspection of reinforced concrete uti...
 

Recently uploaded

CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
DuvanRamosGarzon1
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
Kamal Acharya
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 

Recently uploaded (20)

CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 

downsampling and upsampling of an image using pyramids (pyr up and pyrdown methods)

  • 1. Homework 08, UST Downsampling and Upsampling of an Image using Pyramids (pyrUp and pyrDown Methods) Mr. Saeed Ullah, Korean Institute of Science & Technology Information (KISTI), University of Science & Technology (UST) Saeedonline12@gmail.com Summary—This report presents Downsampling (Zoom out) and Upsampling (Zoom In) applied on an image. Tools used in this project are OpenCV 3.2 Library which is a library used for Computer Vision, and Visual Studio 2015 (64 bit). I. INTRODUCTION In computing, zooming is the ability to zoom in and out a document or image at specified level. It is usually found in all most all of the computer applications as it improves accessibility for people with visual impairment and people using mobile devices which have a relatively small screen. Some of the important concepts for this project are:  Image Pyramid An image pyramid is a collection of images - all arising from a single original image - that are successively downsampled until some desired stopping point is reached. There are two common kinds of image pyramids: Gaussian pyramid: Used to downsample images Laplacian pyramid: Used to reconstruct an upsampled image from an image lower in the pyramid (with less resolution). In this tutorial I have used the Gaussian pyramid.  Gaussian Pyramid Imagine the pyramid as a set of layers in which the higher the layer, the smaller the size. Every layer is numbered from bottom to top, so layer (denoted as is smaller than layer ( ). To produce layer in the Gaussian pyramid, I did the following steps: I. Convolve with a Gaussian kernel: II. Removed every even-numbered row and column. It can easily be noted that the resulting image will be exactly one-quarter the area of its predecessor. Iterating this process on the input image (original image) produces the entire pyramid. Now III. First, upsize the image to twice the original in each dimension, with the new even rows and columns filled with zeros ( ) IV. Perform a convolution with the same kernel shown above (multiplied by 4) to approximate the values of the “missing pixels”. These two procedures re implemented by the OpenCV functions pyrUp and pyrDown. II. OPENCV SOURCE CODE /// Load image src = imread("..datalena.jpg"); // Perform an infinite loop waiting for user input. while (true) { int c; c = waitKey(10); if ((char)c == 27) { break; } if ((char)c == 'i') { pyrUp(tmp, dst, Size(tmp.cols * 2, tmp.rows * 2));} else if ((char)c == 'o') { pyrDown(tmp, dst, Size(tmp.cols / 2, tmp.rows / 2)); } imshow(window_name, dst); tmp = dst;}
  • 2. III. RESULTS Fig. 1. Original Image Fig. 2. Image with Zoom In Fig. 3. Image with Zoom Out CONCLUSION: - You can also perform Zoom In and Zoom Out on an Image by using resize() function or some other user defined functions but OpenCV comes with built-in powerful functions i.e. pyrUp() and pyrDown() by using which one can perform zooming tasks more easily and efficiently.