import cv2
import numpy as np
img = cv2.imread('car.jpg', 1)
imgInfo = img.shape
height = imgInfo[0]
width = imgInfo[1]
dst = np.zeros((height, width, 3), np.uint8)
for i in range(0, height):
for j in range(0, width):
(b,g,r) = img[i,j]
dst[i, j] = (255-b, 255-g, 255-r)
cv2.imshow('dst',dst)
cv2.waitKey(0)
欢迎关注微信公众号“源起1024”或扫描下方二维码获取更多学习资源