summary refs log tree commit diff stats
path: root/opencv/code/a9.py
blob: fab1a4ee45375024c115bcb5bd220b46287248c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
import cv2

image1 = cv2.imread("9i1.jpg", cv2.IMREAD_GRAYSCALE)
image2 = cv2.imread("9i2.jpg", cv2.IMREAD_GRAYSCALE)

assert image1.shape == image2.shape, "Input images must have the same dimensions"

result_image = cv2.subtract(image1, image2)

cv2.imwrite("9o.jpg", 255 - result_image)