import cv2 as cv
import numpy as np
def get_image_info (image):
#读取图像
print(type(image))
print(image.shape)
print(image.size) #像素数量
print(image.dtype) #字节位数
pixel_data = np.array(image) #获取像素数据
print(pixel_data)
import cv2 as cv
img = cv.imread("D:\Personal\picture\ABC.jpg")
cv.namedWindow("image")
cv.imshow("image",img)
get_image_info(img)
gray = cv.cvtColor(img,cv.COLOR_RGB2GRAY) #得到灰色图像
cv.imwrite("D:\Study\Abc.png",gray) #保存在D:\Study
cv.waitKey(0)
#释放窗口
cv.destroyAllWindows()