《OpenCV系列教程》
项目位置:OpenCV-Sample
代码位置:11-ImagePixelsBeChange.py
import cv2
import numpy as npimg = cv2.imread('./res/mini.jpeg')
cv2.imshow('img', img)num = np.zeros(img.shape, img.dtype) + 150
imgIncrease = cv2.add(img, num)
imgSubtract = cv2.subtract(img, num)cv2.imshow('img', img)
cv2.imshow('increase', imgIncrease)
cv2.imshow('subtract', imgSubtract)cv2.waitKey()
cv2.destroyAllWindows()
为每个像素点都增加 150的数值