标签:Plan waitkey pytho open pen 数据 sar b2b port
PIL.Image转换成OpenCV格式
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()
OpenCV转换成PIL.Image格式
import cv2
from PIL import Image
import numpy
img = cv2.imread("plane.jpg")
cv2.imshow("OpenCV",img)
image = Image.fromarray(cv2.cvtColor(img,cv2.COLOR_BGR2RGB))
image.show()
cv2.waitKey()
判断图像数据是否是OpenCV格式
isinstance(img, np.ndarray)
python中PIL.Image和OpenCV图像格式相互转换
标签:Plan waitkey pytho open pen 数据 sar b2b port
原文地址:https://www.cnblogs.com/enumx/p/12359850.html