2022-05-08|閱讀時間 ‧ 約 1 分鐘

opencv and matplotlib different

  • opencv is use BGR color
  • matplotlib is use RGB color
顯示圖片
  • opencv
from PIL import Image
import cv2
import numpy as npimg = Image.open('Image.jpg')
img = np.array(img)
cv2.imshow('img', img)
cv2.waitKey()
  • matplotlib
from PIL import Image
import matplotlib.pyplot as plt
import numpy as npimg = Image.open('Image.jpg')
img = np.array(img)
plt.imshow(img)
plt.show()
分享至
成為作者繼續創作的動力吧!
© 2024 vocus All rights reserved.