File size: 324 Bytes
ac1c6ae
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import numpy as np
import cv2

def pil_cv2_image_converter(image):
    numpy_image = np.array(image)
    # Convert to an OpenCV image; notice the COLOR_RGB2BGR flag, which means
    # that the color is converted from RGB to BGR format.
    opencv_image = cv2.cvtColor(numpy_image, cv2.COLOR_RGB2BGR)
    return opencv_image