summary refs log tree commit diff stats
path: root/opencv/code/a13.py
diff options
context:
space:
mode:
Diffstat (limited to 'opencv/code/a13.py')
-rw-r--r--opencv/code/a13.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/opencv/code/a13.py b/opencv/code/a13.py
new file mode 100644
index 0000000..3afdf1a
--- /dev/null
+++ b/opencv/code/a13.py
@@ -0,0 +1,9 @@
+import cv2
+
+image = cv2.imread("1i.png", cv2.IMREAD_GRAYSCALE)
+
+threshold_values = [50, 100, 150]
+
+for i, threshold in enumerate(threshold_values, start=1):
+    _, segmented_image = cv2.threshold(image, threshold, 255, cv2.THRESH_BINARY)
+    cv2.imwrite(f"13.{i}.jpg", segmented_image)