January 2018
Intermediate to advanced
268 pages
6h 20m
English
In this section, we will discuss resizing an image. This is one of the most common operations in computer vision. We can resize an image using a scaling factor, or we can resize it to a particular size. Let's see how to do that:
import cv2img = cv2.imread('images/input.jpg')img_scaled = cv2.resize(img,None,fx=1.2, fy=1.2, interpolation = cv2.INTER_LINEAR)cv2.imshow('Scaling - Linear Interpolation', img_scaled)img_scaled = cv2.resize(img,None,fx=1.2, fy=1.2, interpolation = cv2.INTER_CUBIC)cv2.imshow('Scaling - Cubic Interpolation', img_scaled)img_scaled = cv2.resize(img,(450, 400), interpolation = cv2.INTER_AREA)cv2.imshow('Scaling - Skewed Size', img_scaled)cv2.waitKey()
Read now
Unlock full access