Tools for converting images by using OpenCV library.
limit_to_max_size
[source]
limit_to_max_size
(img
,max_size
)
Limit the image size to max size and scale the image,
if max size exceeded.
img
: The image to validate as OpenCV image.
max_size
: The max allowed image size.
:return: The eventually resized opencv image.
fit_to_max_size
[source]
fit_to_max_size
(img
,max_width
,max_height
)
Limit the image size to maximum width and height and scale the image,
if size exceeded.
img
: The image to validate as OpenCV Image.
max_width
: The max allowed image width.
max_height
: The max allowed image height.
:return: The eventually resized OpenCV image.
get_image_size
[source]
get_image_size
(fname
)
Calculates image size of a given image file.
fname
: the file path
return: the OpenCV image, image width and height
from_pillow_image
[source]
from_pillow_image
(img
)
Converts a Pillow image to OpenCV image.
img
: the Pillow image
return: the OpenCV image