python图像的io操作源代码

import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt

# 读取图像

img = cv.imread("bilibili.jpg",0)

# 显示图像
# 2.1 OPENCV
# cv.imshow("bilibili", img)
# cv.waitKey(0)
# cv.destroyAllWindows()

# 2.2 matplotlib
# plt.imshow(img[:,:,::-1])
# plt.show()
# # 3图像保存
cv.imwrite("bilibili2.png", img)
python图像的io操作源代码插图
THE END