summary refs log tree commit diff stats
path: root/opencv/code/a9.py
diff options
context:
space:
mode:
Diffstat (limited to 'opencv/code/a9.py')
-rw-r--r--opencv/code/a9.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/opencv/code/a9.py b/opencv/code/a9.py
new file mode 100644
index 0000000..fab1a4e
--- /dev/null
+++ b/opencv/code/a9.py
@@ -0,0 +1,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)