标签:逻辑运算 img 代码 应用 gic jpg 遮罩层 图像 sha
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("subtract_demo", dst) def divide_demo(m1, m2): dst = cv.divide(m1, m2) cv.imshow("divide_demo", dst) def multiply_demo(m1, m2): dst = cv.multiply(m1, m2) cv.imshow("multiply_demo", dst)
求图像的均值和方差
def others(m1, m2): ‘‘‘ M1 = cv.mean(m1)#输出像素均值 M2 = cv.mean(m2) ‘‘‘ M1, dev1 = cv.meanStdDev(m1)#返回图像的均值和标准差 M2, dev2 = cv.meanStdDev(m2) print(M1) print(M2) print(dev1) print(dev2)
#逻辑与和或 def logic_demo(m1, m2): dst1 = cv.bitwise_and(m1, m2) dst2 = cv.bitwise_or(m1, m2) cv.imshow("and_demo", dst1) cv.imshow("or_demo", dst2) #逻辑非 def not_demo(): image = cv.imread("H:\coding\opencvpicture\WindowsLogo.jpg") dst = cv.bitwise_not(image) cv.imshow("not_demo", dst)
def contrast_brightness(image, c, b):#c表示对比度,b表示亮度 h, w, ch = image.shape blank = np.zeros([h, w, ch], image.dtype)#创建了跟原图一样的空白的图像 dst = cv.addWeighted(image, c, blank, 1-c, b)#第一张图,其权重,第二张图,其权重,亮度 cv.imshow("con-bri-demo", dst)
标签:逻辑运算 img 代码 应用 gic jpg 遮罩层 图像 sha
原文地址:https://www.cnblogs.com/yzh1008/p/12525971.html