Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Basic Transformations | Image Processing with OpenCV
Computer Vision Course Outline
course content

Cursusinhoud

Computer Vision Course Outline

Computer Vision Course Outline

1. Introduction to Computer Vision
2. Image Processing with OpenCV
3. Convolutional Neural Networks
4. Object Detection
5. Advanced Topics Overview

book
Basic Transformations

OpenCV (Open Source Computer Vision Library) is a powerful open-source library designed for real-time computer vision and image processing. It provides tools for manipulating images, detecting objects, and even working with deep learning models.

Reading and Displaying an Image

Before performing transformations, let's first load and display an image using OpenCV. We have already imported the photo. But in your local computer for simple reading and displaying the photo you should use:

Resizing an Image

Resizing is useful for scaling images up or down while maintaining aspect ratio: cv2.resize(image, (0, 0), fx=0.5, fy=0.5), where fx and fy define the scaling factor for width and height.

You can also specify exact pixel dimensions: cv2.resize(image, (1000, 1200)), where (1000, 1200) is the output shape.

Rotating an Image

To rotate an image by a specific angle, we use cv2.getRotationMatrix2D() and cv2.warpAffine().

cv2.getRotationMatrix2D(center, angle, scale) defines the rotation matrix.

cv2.warpAffine(image, matrix, output_size) applies the transformation.

Cropping an Image

Cropping extracts a specific region from an image. It’s done using NumPy slicing. The syntax image[h_start:h_end, w_start:w_end] selects a region of interest.

Taak

Swipe to start coding

You need to create three images:

  • resized to a (100, 100) shape;
  • rotated 90 degrees clockwise;
  • cropped from the X: 250-600 and Y: 100-450 region.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 1
toggle bottom row

book
Basic Transformations

OpenCV (Open Source Computer Vision Library) is a powerful open-source library designed for real-time computer vision and image processing. It provides tools for manipulating images, detecting objects, and even working with deep learning models.

Reading and Displaying an Image

Before performing transformations, let's first load and display an image using OpenCV. We have already imported the photo. But in your local computer for simple reading and displaying the photo you should use:

Resizing an Image

Resizing is useful for scaling images up or down while maintaining aspect ratio: cv2.resize(image, (0, 0), fx=0.5, fy=0.5), where fx and fy define the scaling factor for width and height.

You can also specify exact pixel dimensions: cv2.resize(image, (1000, 1200)), where (1000, 1200) is the output shape.

Rotating an Image

To rotate an image by a specific angle, we use cv2.getRotationMatrix2D() and cv2.warpAffine().

cv2.getRotationMatrix2D(center, angle, scale) defines the rotation matrix.

cv2.warpAffine(image, matrix, output_size) applies the transformation.

Cropping an Image

Cropping extracts a specific region from an image. It’s done using NumPy slicing. The syntax image[h_start:h_end, w_start:w_end] selects a region of interest.

Taak

Swipe to start coding

You need to create three images:

  • resized to a (100, 100) shape;
  • rotated 90 degrees clockwise;
  • cropped from the X: 250-600 and Y: 100-450 region.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 1
Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Onze excuses dat er iets mis is gegaan. Wat is er gebeurd?
some-alt