Resized = cv2.resize(img, (new_width, new_height))Ĭv2.imshow(f"Elephants at scale ", resized)įeel free to comment out/uncomment a line based on which interpolation method you want to use. Then multiply both the width and the height of the original image by the scaling factor.įinally, call the cv2.resize() function with downscaled width and height.įor instance, let’s scale the image down to 25% of the original size and show it using the imshow() function. To do this, specify a scaling factor that is less than 1. This means you keep the aspect ratio of the image but make the image smaller. One way to change the size of your image is by downscaling it. (new_width, new_height) is the dsize parameter from the original syntax. In other words, we are going to call the cv2.resize() function with the following syntax: cv2.resize(src, (new_width, new_height)) To keep it simple, we are only going to use these two parameters at first: GitHub - PyImageSearch/imutils: A series of convenience functions to make basic image processing operations such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and Python.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |