This pull request adds a new module (image_conversion.py) with functions to convert between Python Imaging Library (PIL) and OpenCV image formats:
pil_to_cv2(pil_image):
Converts a PIL image to a NumPy array representing the image in OpenCV format (BGR channel order). Raises a ValueError if the PIL image mode is not RGB or BGR.
cv2_to_pil(cv2_image):
Converts a NumPy array representing an OpenCV image (BGR channel order) to a PIL image object.
A unit test file (test_image_conversion.py) is also included to ensure the functionality of these functions.
This pull request adds a new module (image_conversion.py) with functions to convert between Python Imaging Library (PIL) and OpenCV image formats:
A unit test file (test_image_conversion.py) is also included to ensure the functionality of these functions.