Nodes/ComfyUI-XJNodes/Mask Refine (K-Means)
ComfyUI Node

Mask Refine (K-Means)

A ComfyUI node in XJNodes/segs with 5 inputs and 1 output.

By alexjx·Created 9 months ago·Updated 3 months ago· 0
Mask Refine (K-Means)
  • image
  • mask
  • refined_mask
n_clusters3
grow_pixels50
similarity_threshold0.50
CategoryXJNodes/segs

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
maskMASK
n_clustersINT32–10Number of k-means clusters to use for color segmentation. More clusters can capture more color variation but may be slower.
grow_pixelsINT500–200Maximum pixels to grow the mask. Use with similarity_threshold to control how far the growth extends.
similarity_thresholdFLOAT0.500–1Threshold for including similar clusters (0-1). Higher = more strict. Use to include clusters that are close in color to the original mask, for smoother boundaries.

Outputs (1)

NameTypeDescription
refined_maskMASK