import cv2
img = cv2.imread('img/test.jpeg')
print(img.shape)  # 行,列,通道
print(img.shape[0])  # 行 ==》 高
print(img.shape[1])  # 列 ==》 宽
print(img.shape[2])  # 通道数量
print(len(img))  # 多少行
print(len(img[0]))  # 多少列
print(img)  # 图片RGB矩阵

打印结果如下

(451, 699, 3)
451
699
3
451
699
[[[255 255 255]
  [255 255 255]
  [255 255 255]
  ...
  [255 255 255]
  [255 255 255]
  [255 255 255]]

 [[255 255 255]
  [255 255 255]
  [255 255 255]
  ...
  [255 255 255]
  [255 255 255]
  [255 255 255]]

 [[255 255 255]
  [255 255 255]
  [255 255 255]
  ...
  [255 255 255]
  [255 255 255]
  [255 255 255]]

 ...

 [[255 255 255]
  [255 255 255]
  [255 255 255]
  ...
  [255 255 255]
  [255 255 255]
  [255 255 255]]

 [[255 255 255]
  [255 255 255]
  [255 255 255]
  ...
  [255 255 255]
  [255 255 255]
  [255 255 255]]

 [[255 255 255]
  [255 255 255]
  [255 255 255]
  ...
  [255 255 255]
  [255 255 255]
  [255 255 255]]]

Process finished with exit code 0
 

最后修改于 2020-03-22 00:11:59
如果觉得我的文章对你有用,请随意赞赏
扫一扫支付
上一篇