import cv2 as cv import numpy as np def add_demo(m1,m2): dst=cv.add(m1,m2) #量图片加在一起 cv.imshow("add_demo",dst) def subtract_demo(m1,m2): dst=cv.subtract(m1,m2) #量图片减在一起 cv.imshow("add_demo",dst) def divide_demo(m1,m2): dst=cv.divide(m1,m2) #量图片乘在一起 cv.imshow("add_demo",dst) def multiply_demo(m1,m2): dst=cv.multiply(m1,m2) #量图片除在一起 cv.imshow("add_demo",dst) def logic_demo(m1, m2): #与或操非作 dst = cv.bitwise_and(m1, m2) dst2 = cv.bitwise_or(m1, m2) dst3 = cv.bitwise_not(image) cv.imshow("add_demo", dst) cv.imshow("add_demo", dst2) cv.imshow("add_demo", dst3) def contrast_brightness_demo(image, c, b): #亮度增强 h, w, ch = image.shape blank = np.zeros([h, w, ch], image.dtype) dst = cv.addWeighted(image, c, blank, 1-c, b) #图像混合dst = α · img1 +