Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Scaling, Rotating, Shifting and Edge Detection | Fundamentals of Image Manipulation with Python
Fundamentals of Image Manipulation with Python
course content

Зміст курсу

Fundamentals of Image Manipulation with Python

bookScaling, Rotating, Shifting and Edge Detection

In OpenCV, scaling, rotating, shifting, and edge detection are all image processing techniques used to manipulate and analyze images.

Scaling refers to changing the size of an image, which can be done using the cv2.resize() function. This function takes in an image and a tuple of the desired width and height and returns the resized image.

Rotating involves rotating an image using the cv2.getRotationMatrix2D() and cv2.warpAffine() functions. The cv2.getRotationMatrix2D() function accepts the following parameters:

  • The center of rotation;
  • The angle of rotation;
  • A scaling factor.

It returns a rotation matrix. The cv2.warpAffine() function takes in the image, the rotation matrix, and the size of the output image and returns the rotated image.

Shifting refers to moving an image by a specific amount in the x and y directions, which can be done using the cv2.warpAffine() function. This function requires:

  • An image;
  • A translation matrix;
  • The size of the output image.

It returns the shifted image.

Edge detection identifies the edges in an image, which can be accomplished using various edge detection algorithms such as Sobel, Canny, and Laplacian with the respective functions: Sobel(), Canny() and Laplacian(). These algorithms identify and highlight the edges of objects in an image, aiding tasks like object detection and image segmentation.

Завдання
test

Swipe to show code editor

  1. Resize the image image1.
  2. Use the correct function to get the rotation matrix.
  3. Use the Canny algorithm for edge detection.

Mark tasks as Completed
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

In OpenCV, scaling, rotating, shifting, and edge detection are all image processing techniques used to manipulate and analyze images.

Scaling refers to changing the size of an image, which can be done using the cv2.resize() function. This function takes in an image and a tuple of the desired width and height and returns the resized image.

Rotating involves rotating an image using the cv2.getRotationMatrix2D() and cv2.warpAffine() functions. The cv2.getRotationMatrix2D() function accepts the following parameters:

  • The center of rotation;
  • The angle of rotation;
  • A scaling factor.

It returns a rotation matrix. The cv2.warpAffine() function takes in the image, the rotation matrix, and the size of the output image and returns the rotated image.

Shifting refers to moving an image by a specific amount in the x and y directions, which can be done using the cv2.warpAffine() function. This function requires:

  • An image;
  • A translation matrix;
  • The size of the output image.

It returns the shifted image.

Edge detection identifies the edges in an image, which can be accomplished using various edge detection algorithms such as Sobel, Canny, and Laplacian with the respective functions: Sobel(), Canny() and Laplacian(). These algorithms identify and highlight the edges of objects in an image, aiding tasks like object detection and image segmentation.

Завдання
test

Swipe to show code editor

  1. Resize the image image1.
  2. Use the correct function to get the rotation matrix.
  3. Use the Canny algorithm for edge detection.

Mark tasks as Completed
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 9
AVAILABLE TO ULTIMATE ONLY
We're sorry to hear that something went wrong. What happened?
some-alt