From 28df4ef4ef9e948ea43ed77578e9a52e2eacd70e Mon Sep 17 00:00:00 2001 From: Thomas Fritz Date: Sat, 27 Jan 2024 01:49:01 +0100 Subject: [PATCH] Add docstring to resize function --- imutils/convenience.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/imutils/convenience.py b/imutils/convenience.py index 9704eb2..ab71359 100644 --- a/imutils/convenience.py +++ b/imutils/convenience.py @@ -62,7 +62,20 @@ def rotate_bound(image, angle): # perform the actual rotation and return the image return cv2.warpAffine(image, M, (nW, nH)) -def resize(image, width=None, height=None, inter=cv2.INTER_AREA): +def resize(image, width: int=None, height: int=None, inter=cv2.INTER_AREA): + """ + Resizes an image while retaining its aspect ratio. + + Args: + image: The image to resize + width (int, optional): The width of the resized image in pixels. + height (int, optional): The height of the resized image in pixels. Ignored if a width is given. + inter (int, optional): Interpolation mode. Defaults to cv2.INTER_AREA. + + Returns: + the resized image. + """ + # initialize the dimensions of the image to be resized and # grab the image size dim = None