Skip to content

Image Pipeline Playground

feat(frontend): add HSV mask, CLAHE, and K-Means templates

Mohammad Rajaei80e6b6a22a04
diff --git a/README.md b/README.md
index 43c0101..255611f 100644
--- a/README.md
+++ b/README.md
@@ -117,7 +117,7 @@ docker compose up --build
7. Use **Export** / **Load** for workflow JSON; **Export Python** for a standalone script.
8. Open **About** (info button next to the brand) for license and GitHub.
-Example workflows live under [`backend/examples/`](backend/examples/) (e.g. [`blur_canny.json`](backend/examples/blur_canny.json), [`albumentations_augment.json`](backend/examples/albumentations_augment.json); image: [`lena.png`](backend/examples/lena.png)).
+Example workflows live under [`backend/examples/`](backend/examples/) (e.g. Blur & Canny, Albu Augment, HSV Color Mask, CLAHE & Sharpen, K-Means Palette; image: [`lena.png`](backend/examples/lena.png)).
## Albumentations augments
diff --git a/backend/examples/clahe_sharpen.json b/backend/examples/clahe_sharpen.json
new file mode 100644
index 0000000..9f438c7
--- /dev/null
+++ b/backend/examples/clahe_sharpen.json
@@ -0,0 +1,45 @@
+{
+ "version": 1,
+ "name": "clahe-sharpen",
+ "description": "CLAHE contrast boost then sharpen — local contrast enhancement.",
+ "seed": 0,
+ "sampleCount": 1,
+ "graph": {
+ "nodes": [
+ {
+ "id": "load-1",
+ "type": "load_image",
+ "params": { "path": "examples/lena.png" },
+ "position": { "x": 0, "y": 0 }
+ },
+ {
+ "id": "clahe-1",
+ "type": "clahe",
+ "params": { "clip_limit": 3.0, "tile_grid": 8 },
+ "position": { "x": 240, "y": 0 }
+ },
+ {
+ "id": "sharpen-1",
+ "type": "sharpen",
+ "params": { "amount": 1.2, "kernel": "laplacian" },
+ "position": { "x": 480, "y": 0 }
+ }
+ ],
+ "edges": [
+ {
+ "id": "e1",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "clahe-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e2",
+ "source": "clahe-1",
+ "source_port": "image",
+ "target": "sharpen-1",
+ "target_port": "image"
+ }
+ ]
+ }
+}
diff --git a/backend/examples/hsv_color_mask.json b/backend/examples/hsv_color_mask.json
new file mode 100644
index 0000000..5e99b13
--- /dev/null
+++ b/backend/examples/hsv_color_mask.json
@@ -0,0 +1,74 @@
+{
+ "version": 1,
+ "name": "hsv-color-mask",
+ "description": "HSV in-range mask then apply to the original — classic color segmentation.",
+ "seed": 0,
+ "sampleCount": 1,
+ "graph": {
+ "nodes": [
+ {
+ "id": "load-1",
+ "type": "load_image",
+ "params": { "path": "examples/lena.png" },
+ "position": { "x": 0, "y": 80 }
+ },
+ {
+ "id": "hsv-1",
+ "type": "to_hsv",
+ "params": {},
+ "position": { "x": 240, "y": 0 }
+ },
+ {
+ "id": "range-1",
+ "type": "in_range",
+ "params": {
+ "space": "hsv",
+ "c0_min": 0,
+ "c0_max": 25,
+ "c1_min": 40,
+ "c1_max": 180,
+ "c2_min": 60,
+ "c2_max": 255,
+ "output": "mask"
+ },
+ "position": { "x": 460, "y": 0 }
+ },
+ {
+ "id": "mask-1",
+ "type": "apply_mask",
+ "params": { "fill": "black" },
+ "position": { "x": 680, "y": 80 }
+ }
+ ],
+ "edges": [
+ {
+ "id": "e1",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "hsv-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e2",
+ "source": "hsv-1",
+ "source_port": "image",
+ "target": "range-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e3",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "mask-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e4",
+ "source": "range-1",
+ "source_port": "image",
+ "target": "mask-1",
+ "target_port": "mask"
+ }
+ ]
+ }
+}
diff --git a/backend/examples/kmeans_palette.json b/backend/examples/kmeans_palette.json
new file mode 100644
index 0000000..c7c632a
--- /dev/null
+++ b/backend/examples/kmeans_palette.json
@@ -0,0 +1,37 @@
+{
+ "version": 1,
+ "name": "kmeans-palette",
+ "description": "K-means color quantization — reduce the image to a small palette.",
+ "seed": 0,
+ "sampleCount": 1,
+ "graph": {
+ "nodes": [
+ {
+ "id": "load-1",
+ "type": "load_image",
+ "params": { "path": "examples/lena.png" },
+ "position": { "x": 0, "y": 0 }
+ },
+ {
+ "id": "kmeans-1",
+ "type": "kmeans_colors",
+ "params": {
+ "k": 6,
+ "attempts": 3,
+ "output": "quantized",
+ "palette_height": 48
+ },
+ "position": { "x": 260, "y": 0 }
+ }
+ ],
+ "edges": [
+ {
+ "id": "e1",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "kmeans-1",
+ "target_port": "image"
+ }
+ ]
+ }
+}
diff --git a/frontend/public/examples/clahe_sharpen.json b/frontend/public/examples/clahe_sharpen.json
new file mode 100644
index 0000000..9f438c7
--- /dev/null
+++ b/frontend/public/examples/clahe_sharpen.json
@@ -0,0 +1,45 @@
+{
+ "version": 1,
+ "name": "clahe-sharpen",
+ "description": "CLAHE contrast boost then sharpen — local contrast enhancement.",
+ "seed": 0,
+ "sampleCount": 1,
+ "graph": {
+ "nodes": [
+ {
+ "id": "load-1",
+ "type": "load_image",
+ "params": { "path": "examples/lena.png" },
+ "position": { "x": 0, "y": 0 }
+ },
+ {
+ "id": "clahe-1",
+ "type": "clahe",
+ "params": { "clip_limit": 3.0, "tile_grid": 8 },
+ "position": { "x": 240, "y": 0 }
+ },
+ {
+ "id": "sharpen-1",
+ "type": "sharpen",
+ "params": { "amount": 1.2, "kernel": "laplacian" },
+ "position": { "x": 480, "y": 0 }
+ }
+ ],
+ "edges": [
+ {
+ "id": "e1",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "clahe-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e2",
+ "source": "clahe-1",
+ "source_port": "image",
+ "target": "sharpen-1",
+ "target_port": "image"
+ }
+ ]
+ }
+}
diff --git a/frontend/public/examples/hsv_color_mask.json b/frontend/public/examples/hsv_color_mask.json
new file mode 100644
index 0000000..5e99b13
--- /dev/null
+++ b/frontend/public/examples/hsv_color_mask.json
@@ -0,0 +1,74 @@
+{
+ "version": 1,
+ "name": "hsv-color-mask",
+ "description": "HSV in-range mask then apply to the original — classic color segmentation.",
+ "seed": 0,
+ "sampleCount": 1,
+ "graph": {
+ "nodes": [
+ {
+ "id": "load-1",
+ "type": "load_image",
+ "params": { "path": "examples/lena.png" },
+ "position": { "x": 0, "y": 80 }
+ },
+ {
+ "id": "hsv-1",
+ "type": "to_hsv",
+ "params": {},
+ "position": { "x": 240, "y": 0 }
+ },
+ {
+ "id": "range-1",
+ "type": "in_range",
+ "params": {
+ "space": "hsv",
+ "c0_min": 0,
+ "c0_max": 25,
+ "c1_min": 40,
+ "c1_max": 180,
+ "c2_min": 60,
+ "c2_max": 255,
+ "output": "mask"
+ },
+ "position": { "x": 460, "y": 0 }
+ },
+ {
+ "id": "mask-1",
+ "type": "apply_mask",
+ "params": { "fill": "black" },
+ "position": { "x": 680, "y": 80 }
+ }
+ ],
+ "edges": [
+ {
+ "id": "e1",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "hsv-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e2",
+ "source": "hsv-1",
+ "source_port": "image",
+ "target": "range-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e3",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "mask-1",
+ "target_port": "image"
+ },
+ {
+ "id": "e4",
+ "source": "range-1",
+ "source_port": "image",
+ "target": "mask-1",
+ "target_port": "mask"
+ }
+ ]
+ }
+}
diff --git a/frontend/public/examples/kmeans_palette.json b/frontend/public/examples/kmeans_palette.json
new file mode 100644
index 0000000..c7c632a
--- /dev/null
+++ b/frontend/public/examples/kmeans_palette.json
@@ -0,0 +1,37 @@
+{
+ "version": 1,
+ "name": "kmeans-palette",
+ "description": "K-means color quantization — reduce the image to a small palette.",
+ "seed": 0,
+ "sampleCount": 1,
+ "graph": {
+ "nodes": [
+ {
+ "id": "load-1",
+ "type": "load_image",
+ "params": { "path": "examples/lena.png" },
+ "position": { "x": 0, "y": 0 }
+ },
+ {
+ "id": "kmeans-1",
+ "type": "kmeans_colors",
+ "params": {
+ "k": 6,
+ "attempts": 3,
+ "output": "quantized",
+ "palette_height": 48
+ },
+ "position": { "x": 260, "y": 0 }
+ }
+ ],
+ "edges": [
+ {
+ "id": "e1",
+ "source": "load-1",
+ "source_port": "image",
+ "target": "kmeans-1",
+ "target_port": "image"
+ }
+ ]
+ }
+}
diff --git a/frontend/src/workflow/templates.ts b/frontend/src/workflow/templates.ts
index 82b3d26..183d93e 100644
--- a/frontend/src/workflow/templates.ts
+++ b/frontend/src/workflow/templates.ts
@@ -37,4 +37,22 @@ export const WORKFLOW_TEMPLATES: WorkflowTemplate[] = [
description: 'Annotations + color jitter + flip with synced bboxes/keypoints.',
path: '/examples/albumentations_augment.json',
},
+ {
+ id: 'hsv_color_mask',
+ name: 'HSV Color Mask',
+ description: 'HSV in-range mask then apply to the original image.',
+ path: '/examples/hsv_color_mask.json',
+ },
+ {
+ id: 'clahe_sharpen',
+ name: 'CLAHE & Sharpen',
+ description: 'Local contrast (CLAHE) followed by sharpening.',
+ path: '/examples/clahe_sharpen.json',
+ },
+ {
+ id: 'kmeans_palette',
+ name: 'K-Means Palette',
+ description: 'Quantize colors with k-means for a compact palette.',
+ path: '/examples/kmeans_palette.json',
+ },
]