Multiplying images by a constant and one another
Just like normal matrices or NumPy ndarrays, images can be multiplied by a constant and with one another. We can multiply an image by a constant, as follows:
import cv2
img1 = cv2.imread('/home/pi/book/dataset/4.2.03.tiff', 1)
img2 = cv2.imread('/home/pi/book/dataset/4.2.05.tiff', 1)
cv2.imshow('Image1', img1 * 2)
cv2.waitKey(0)
cv2.destroyAllWindows()
In the preceding code, every element of the ndarray representing the image is multiplied by 2. Run the preceding program and see the output. We can also multiply images with one another, as follows:
cv2.imshow('Image1', img1 * 2)
The result is likely to look like noise.