Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

读取图片

import cv2
img = cv2.imread('image_path')

显示图片


import cv2
img = cv2.imread('image_path')
cv2.imshow('name',img)
cv2.waitKey()
cv2.destroyAllWindows()

图像形状

import cv2
img = cv2.imread('image_path')
img.shape

图像分割,通道拆分

import cv2
img = cv2.imread('image_path')
b,g,r = cv2.split(img)

图像运算

  • cv2.add 方法 相加 取最大值255
  • img_a + img_b ,直接相加结果除255 取模
import cv2
img_a = cv2.imread('image_a_path')
img_b = cv2.imread('image_b_path')
img_c = cv2.add(img_a,img_b)
img_d = img_a + img_b