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

Conteúdo do Curso

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.

Tarefa
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 desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

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.

Tarefa
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 desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 1. Capítulo 9
AVAILABLE TO ULTIMATE ONLY
We're sorry to hear that something went wrong. What happened?
some-alt