Crop and Resize
Explore how to find image dimensions and maintain aspect ratio while resizing images in OpenCV. Understand the coordinate system used for cropping images and apply cropping by selecting pixel ranges. This lesson helps you master essential image editing skills useful for computer vision tasks.
We'll cover the following...
What do you think will happen if we try to read multiple images of a large size ?
So, what’s the solution?
To solve this issue, we resize the large images into smaller ones.
Find the dimensions of the image
To find the dimensions of the image, we use the img.shape method of the OpenCV library. Here, img is the object we’ve stored the image in. Let’s run the program to find the dimensions of the image:
In the output, the first parameters are the height and width, respectively. The third parameter is the number of ...