Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docstring to resize function #288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion imutils/convenience.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down