 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Upsampling an image using OpenCV
In this program, we will up sample an image. Up sampling is increasing the spatial resolution while keeping the 2D representation of an image. It is typically used for zooming in on a small region of an image. We will use the pyrup() function in the openCV library to complete this task.
Original Image

Algorithm
Step 1: Read the image. Step 2: Pass the image as a parameter to the pyrup() function. Step 3: Display the output.
Example Code
import cv2 image = cv2.imread('testimage.jpg') print("Size of image before pyrUp: ", image.shape) image = cv2.pyrUp(image) print("Size of image after pyrUp: ", image.shape) cv2.imshow('UpSample', image)  Output
Size of image before pyrUp: (350, 700, 3) Size of image after pyrUp: (700, 1400, 3)

Explanation
If we observe the size of the image before and after using the pyrUp function, we see that the size is increased, i.e., we have up sampled the image.
Advertisements
 