# 图像基本操作
import cv2
import numpy as np
img = cv2.imread('Resources/SunsetSea.png')
# img1 = np.zeros((500, 500, 3), np.uint8)
# # print(img1)
#
# img2 = np.ones((500, 500, 3), np.uint8) * 255
# print(img2)
# px = img[100, 100]
# print(px)
# 修改像素点的值
# img[100:200, 100:200] = [0, 0, 0]
# 将图片所有通道反转(bgr→rgb)
# img = img[:, :, ::-1]
# 数组的维度,对于矩阵,n 行 m 列。 对于图像 h 高度 w宽度 c通道
print(img.shape)
# 数组元素的总个数,相当于 .shape 中 n*m 的值
print(img.size)
# ndarray 对象的数据类型
print(img.dtype)
cv2.imshow(" src Image ", img)
# cv2.imshow(" zeros ", img1)
# cv2.imshow(" ones ", img2)
cv2.waitKey(0)
OpenCV——图像基本操作
最新推荐文章于 2023-06-13 09:59:02 发布