ComfyUI Node
Colorize Superpixels (FLANN)
Colorizes a grayscale image using a color reference image via FLANN-based superpixel matching. Internally extracts stride-2 patch features, builds a PCA feature space from the reference, segments both images into superpixels (SLIC), matches gray superpixels to color superpixels via FLANN KDTree kNN, and transfers a/b chrominance through distance-weighted kernel regression with guided filter cleanup.
Colorize Superpixels (FLANN)
- target
- reference
- image
- success
◄n_seg300►
◄k8►
◄flann_checks16►
◄flann_trees5►
◄guided_r12►
◄guided_eps0.04►
Categoryimage/CV/colorize
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| target | IMAGE | Grayscale image to colorize (converted to grayscale internally, so a color image also works). | |
| reference | IMAGE | Color reference whose a/b palette is transferred. The target's own luminance structure is preserved. | |
| n_seg | INT | 30010–5000 | Number of SLIC superpixels. More segments = finer color detail but slower. |
| k | INT | 81–128 | kNN neighbors. Higher = smoother, more blending. |
| flann_checksopt | INT | 161–1024 | FLANN KDTree search checks. Higher = more accurate, slower. |
| flann_treesopt | INT | 51–50 | FLANN KDTree tree count. More trees = faster queries, more memory. |
| guided_ropt | INT | 120–100 | Guided filter radius (0 = disabled). Smooths chrominance while respecting luminance edges. |
| guided_epsopt | FLOAT | 0.040–10 | Guided filter epsilon squared. Higher = smoother, less edge-aware. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | Colorized result: target luminance + reference chrominance transferred via FLANN superpixel matching. |
| success | BOOLEAN | False when the pipeline could not produce a result (empty input, no valid segments, FLANN found no matches). |