Python for Data Science: Image Handling
Scaling, Rotating, Shifting and Edge Detection
Edge Detection are all image processing techniques that can be used to manipulate and analyze images.
Scaling refers to the process of changing the size of an image, which can be done using the
cv2.resize() function. The function takes in an image and a tuple of the desired width and height and returns the resized image.
Rotating refers to the process of rotating an image, which can be done using the
cv2.warpAffine() functions. The
cv2.getRotationMatrix2D() function takes in the center of rotation, the angle of rotation, and a scaling factor and 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 the process of moving an image by a certain amount in the
y direction, which can be done using the
cv2.warpAffine() function. The function takes in the image, a translation matrix, and the size of the output image and returns the shifted image.
Edge detection is the process of identifying the edges in an image, which can be done using various edge detection algorithms such as Sobel, Canny, and Laplacian. These algorithms are used to identify and highlight the edges of objects in an image, which can be useful for tasks such as object detection and image segmentation.
- Resize an image;
- Rotate an image;
- Canny an image.
Everything was clear?