Skip to content

Image Pipeline Playground

feat(examples): add hist-eq, morph cleanup, and contour templates

Mohammad Rajaei151f12477d7d
diff --git a/backend/examples/contour_detect.json b/backend/examples/contour_detect.json
new file mode 100644
index 0000000..0cbb047
--- /dev/null
+++ b/backend/examples/contour_detect.json
@@ -0,0 +1,63 @@
+{
+ "version": 1,
+ "name": "contour-detect",
+ "description": "Binary threshold then find contours — structure / blob starter.",
+ "seed": 0,
+ "sampleCount": 1,
+ "graph": {
+ "nodes": [
+ {
+ "id": "load-1",
+ "type": "load_image",
+ "params": { "path": "examples/lena.png" },
+ "position": { "x": 0, "y": 0 }
+ },
+ {
+ "id": "gray-1",
+ "type": "to_gray",
+ "params": {},
+ "position": { "x": 220, "y": 0 }
+ },
+ {
+ "id": "thresh-1",
+ "type": "threshold",
+ "params": { "method": "otsu", "thresh": 127.0, "maxval": 255.0 },
+ "position": { "x": 440, "y": 0 }
+ },
+ {
+ "id": "contours-1",
+ "type": "find_contours",
+ "params": {
+ "mode": "external",
+ "method": "simple",
+ "thickness": 2,
+ "overlay": "on_input"
+ },
+ "position": { "x": 660, "y": 0 }
+ }
+ ],
+ "edges": [
+ {
+ "id": "e1",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "gray-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e2",
+ "source": "gray-1",
+ "source_port": "image",
+ "target": "thresh-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e3",
+ "source": "thresh-1",
+ "source_port": "image",
+ "target": "contours-1",
+ "target_port": "image"
+ }
+ ]
+ }
+}
diff --git a/backend/examples/hist_equalize.json b/backend/examples/hist_equalize.json
new file mode 100644
index 0000000..b81f5db
--- /dev/null
+++ b/backend/examples/hist_equalize.json
@@ -0,0 +1,45 @@
+{
+ "version": 1,
+ "name": "hist-equalize",
+ "description": "Grayscale then histogram equalize — classic OCR / document preprocess.",
+ "seed": 0,
+ "sampleCount": 1,
+ "graph": {
+ "nodes": [
+ {
+ "id": "load-1",
+ "type": "load_image",
+ "params": { "path": "examples/lena.png" },
+ "position": { "x": 0, "y": 0 }
+ },
+ {
+ "id": "gray-1",
+ "type": "to_gray",
+ "params": {},
+ "position": { "x": 220, "y": 0 }
+ },
+ {
+ "id": "eq-1",
+ "type": "histogram_equalize",
+ "params": {},
+ "position": { "x": 440, "y": 0 }
+ }
+ ],
+ "edges": [
+ {
+ "id": "e1",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "gray-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e2",
+ "source": "gray-1",
+ "source_port": "image",
+ "target": "eq-1",
+ "target_port": "image"
+ }
+ ]
+ }
+}
diff --git a/backend/examples/morphology_cleanup.json b/backend/examples/morphology_cleanup.json
new file mode 100644
index 0000000..d6c90ca
--- /dev/null
+++ b/backend/examples/morphology_cleanup.json
@@ -0,0 +1,58 @@
+{
+ "version": 1,
+ "name": "morphology-cleanup",
+ "description": "Threshold then morphological open to clean noise before analysis.",
+ "seed": 0,
+ "sampleCount": 1,
+ "graph": {
+ "nodes": [
+ {
+ "id": "load-1",
+ "type": "load_image",
+ "params": { "path": "examples/lena.png" },
+ "position": { "x": 0, "y": 0 }
+ },
+ {
+ "id": "gray-1",
+ "type": "to_gray",
+ "params": {},
+ "position": { "x": 220, "y": 0 }
+ },
+ {
+ "id": "thresh-1",
+ "type": "threshold",
+ "params": { "method": "otsu", "thresh": 127.0, "maxval": 255.0 },
+ "position": { "x": 440, "y": 0 }
+ },
+ {
+ "id": "morph-1",
+ "type": "morphology_ex",
+ "params": { "op": "open", "ksize": 5, "shape": "ellipse" },
+ "position": { "x": 660, "y": 0 }
+ }
+ ],
+ "edges": [
+ {
+ "id": "e1",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "gray-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e2",
+ "source": "gray-1",
+ "source_port": "image",
+ "target": "thresh-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e3",
+ "source": "thresh-1",
+ "source_port": "image",
+ "target": "morph-1",
+ "target_port": "image"
+ }
+ ]
+ }
+}
diff --git a/frontend/public/examples/contour_detect.json b/frontend/public/examples/contour_detect.json
new file mode 100644
index 0000000..0cbb047
--- /dev/null
+++ b/frontend/public/examples/contour_detect.json
@@ -0,0 +1,63 @@
+{
+ "version": 1,
+ "name": "contour-detect",
+ "description": "Binary threshold then find contours — structure / blob starter.",
+ "seed": 0,
+ "sampleCount": 1,
+ "graph": {
+ "nodes": [
+ {
+ "id": "load-1",
+ "type": "load_image",
+ "params": { "path": "examples/lena.png" },
+ "position": { "x": 0, "y": 0 }
+ },
+ {
+ "id": "gray-1",
+ "type": "to_gray",
+ "params": {},
+ "position": { "x": 220, "y": 0 }
+ },
+ {
+ "id": "thresh-1",
+ "type": "threshold",
+ "params": { "method": "otsu", "thresh": 127.0, "maxval": 255.0 },
+ "position": { "x": 440, "y": 0 }
+ },
+ {
+ "id": "contours-1",
+ "type": "find_contours",
+ "params": {
+ "mode": "external",
+ "method": "simple",
+ "thickness": 2,
+ "overlay": "on_input"
+ },
+ "position": { "x": 660, "y": 0 }
+ }
+ ],
+ "edges": [
+ {
+ "id": "e1",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "gray-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e2",
+ "source": "gray-1",
+ "source_port": "image",
+ "target": "thresh-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e3",
+ "source": "thresh-1",
+ "source_port": "image",
+ "target": "contours-1",
+ "target_port": "image"
+ }
+ ]
+ }
+}
diff --git a/frontend/public/examples/hist_equalize.json b/frontend/public/examples/hist_equalize.json
new file mode 100644
index 0000000..b81f5db
--- /dev/null
+++ b/frontend/public/examples/hist_equalize.json
@@ -0,0 +1,45 @@
+{
+ "version": 1,
+ "name": "hist-equalize",
+ "description": "Grayscale then histogram equalize — classic OCR / document preprocess.",
+ "seed": 0,
+ "sampleCount": 1,
+ "graph": {
+ "nodes": [
+ {
+ "id": "load-1",
+ "type": "load_image",
+ "params": { "path": "examples/lena.png" },
+ "position": { "x": 0, "y": 0 }
+ },
+ {
+ "id": "gray-1",
+ "type": "to_gray",
+ "params": {},
+ "position": { "x": 220, "y": 0 }
+ },
+ {
+ "id": "eq-1",
+ "type": "histogram_equalize",
+ "params": {},
+ "position": { "x": 440, "y": 0 }
+ }
+ ],
+ "edges": [
+ {
+ "id": "e1",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "gray-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e2",
+ "source": "gray-1",
+ "source_port": "image",
+ "target": "eq-1",
+ "target_port": "image"
+ }
+ ]
+ }
+}
diff --git a/frontend/public/examples/morphology_cleanup.json b/frontend/public/examples/morphology_cleanup.json
new file mode 100644
index 0000000..d6c90ca
--- /dev/null
+++ b/frontend/public/examples/morphology_cleanup.json
@@ -0,0 +1,58 @@
+{
+ "version": 1,
+ "name": "morphology-cleanup",
+ "description": "Threshold then morphological open to clean noise before analysis.",
+ "seed": 0,
+ "sampleCount": 1,
+ "graph": {
+ "nodes": [
+ {
+ "id": "load-1",
+ "type": "load_image",
+ "params": { "path": "examples/lena.png" },
+ "position": { "x": 0, "y": 0 }
+ },
+ {
+ "id": "gray-1",
+ "type": "to_gray",
+ "params": {},
+ "position": { "x": 220, "y": 0 }
+ },
+ {
+ "id": "thresh-1",
+ "type": "threshold",
+ "params": { "method": "otsu", "thresh": 127.0, "maxval": 255.0 },
+ "position": { "x": 440, "y": 0 }
+ },
+ {
+ "id": "morph-1",
+ "type": "morphology_ex",
+ "params": { "op": "open", "ksize": 5, "shape": "ellipse" },
+ "position": { "x": 660, "y": 0 }
+ }
+ ],
+ "edges": [
+ {
+ "id": "e1",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "gray-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e2",
+ "source": "gray-1",
+ "source_port": "image",
+ "target": "thresh-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e3",
+ "source": "thresh-1",
+ "source_port": "image",
+ "target": "morph-1",
+ "target_port": "image"
+ }
+ ]
+ }
+}