Numpy addition, opencv addition, image fusion


Numpy addition

Modular addition

Operation method: result = image 1 + image 2

Opencv addition

Saturation operation

Operation method: result = cv2.add (image 1, image 2)

Note: the size and type of images involved in the operation must be consistent


import cv2
import numpy as np
a = cv2.imread("image\lena256.bmp")
b = a
add1 = a + b
add2 = cv2.add(a, b)
cv2.imshow("add1", add1)
cv2.imshow("add2", add2)

Image fusion

Fusion of two or more images into one image

The fused image contains more information and can be more convenient for human observation or computer processing

Image addition: result image = image 1 + image 2

img = img1 + img2

Image fusion: result image = image 1 x coefficient 1 + image 2 x coefficient 2 + brightness adjustment

img = img1 * 0.3 + img2 * 0.7 + 18

Function addweighted

dst = cv.addWeighted(src1, alpha, src2, beta, gamma)
dst = src x alpha + src2 x beta +gamma

Note: the parameter gamma cannot be omitted

This work adoptsCC agreement, reprint must indicate the author and the link to this article


Recommended Today


Supervisor [note] Supervisor – H view supervisor command help Supervisorctl – H view supervisorctl command help Supervisorctl help view the action command of supervisorctl Supervisorctl help any action to view the use of this action 1. Introduction Supervisor is a process control system. Generally speaking, it can monitor your process. If the process exits abnormally, […]