From the course: OpenCV for Python Developers
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Scale and rotate images
From the course: OpenCV for Python Developers
Scale and rotate images
- [Instructor] Some of the most basic but important image processing actions include scaling and rotating. Let's begin by learning how to use scaling. To do this, we'll define our first variable called img_half = cv2.resize, noting that cv2.resize is the main resizing function. We'll pass in a value of img, and then we pass in the absolute size or 0,0 to not set an absolute size in pixels, and then we can optionally pass in our relative factors of fx=0.5, fy=0.5. This will result in an image that is half the size in both dimensions of the original. Next, we can type img_stretch = cv2.resize, and then, again, we'll pass in our image. This time in parentheses, we'll pass in a value of 600,600. Meaning we're going to explicitly scale the image to those dimensions. Next, let's type out img_stretch_near, and this will equal cv2.resize. Again, passing an img. Again, setting to be 600,600 in parentheses. And then this time…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Get started with OpenCV and Python5m 36s
-
(Locked)
Get started with OpenCV and Python: Google Collab6m 5s
-
(Locked)
Access and understand pixel data4m 12s
-
(Locked)
Data types and structures7m 36s
-
(Locked)
Image types and color channels8m 51s
-
(Locked)
Pixel manipulations and filtering4m 41s
-
(Locked)
Blur, dilation, and erosion5m 50s
-
(Locked)
Scale and rotate images5m 14s
-
(Locked)
Use video inputs4m 57s
-
(Locked)
Create custom interfaces4m 50s
-
(Locked)
Challenge: Create a simple drawing app2m 15s
-
(Locked)
Solution: Create a simple drawing app7m 32s
-
-
-
-