PIL image to np.array

PIL, np.array

PIL.Image转换成OpenCV格式

##reference https://blog.csdn.net/dcrmg/java/article/details/78147219
import cv2
from PIL import Image
import numpy

image = Image.open("plane.jpg")
image.show()
img = cv2.cvtColor(numpy.asarray(image),cv2.COLOR_RGB2BGR)
cv2.imshow("OpenCV",img)
cv2.waitKey()
Author

Karobben

Posted on

2020-01-22

Updated on

2024-01-11

Licensed under

Comments