Horje
how to return PIL image from opencv Code Example
how to return PIL image from opencv
import cv2
import numpy as np
from PIL import Image

img = cv2.imread("path/to/img.png")

# You may need to convert the color.
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
im_pil = Image.fromarray(img)

# For reversing the operation:
im_np = np.asarray(im_pil)




Python

Related
hex to rgb python Code Example hex to rgb python Code Example
utf8 python encodage line Code Example utf8 python encodage line Code Example
convert opencv image to pil image Code Example convert opencv image to pil image Code Example
jupyter notebook dark theme Code Example jupyter notebook dark theme Code Example
load custom font pygame Code Example load custom font pygame Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7