ComfyUI Node
CV Color Range
Selects the pixels whose colour is within `tolerance` of `center` on every channel - 'cv2.inRange around a value' rather than lower/upper bounds. Unlike the raw inRange it is CIRCULAR-aware: tell it via `format` which channel is a hue and its period, and the band wraps, so a hue centred on 0 also keeps values near the top of the range (red across the 179/0 seam) in ONE pass. Center/tolerance take one value per channel (a 'CV Scalar' literal, or the outputs of 'CV Color Range From Sample'); a single value broadcasts. Outputs a 0/255 mask - chain into morphology / bitwise_and or 'CV Array -> Mask'. Convert to HSV/HLS first (cv2_cvtColor) for intuitive hue/sat/val selection.
CV Color Range
- image
- center
- tolerance
- mask
◄formatlinear - no circular channel (BGR/RGB/Lab/Luv/YCrCb/gray)►
Categoryimage/CV/segmentation
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | NPARRAY,IMAGE | Colour array in whatever space you want to threshold (BGR, HSV, Lab, a single hue channel...). Set 'format' to match. A ComfyUI IMAGE arrives as BGR uint8. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size. | |
| center | NPARRAY | Target colour, one value per channel, e.g. a 'CV Scalar' (60, 200, 200) for green in 8-bit HSV. A single value broadcasts to every channel. | |
| tolerance | NPARRAY | Accepted half-width per channel, e.g. (15, 60, 60). A pixel is kept when every channel is within center +/- tolerance; for a circular channel a tolerance >= period/2 accepts every hue. | |
| format | COMBO | linear - no circular channel (BGR/RGB/Lab/Luv/YCrCb/gray) | Which channel (if any) is a circular hue, and its period - numpy arrays carry no colour-space tag. All other channels are treated linearly. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | NPARRAY | uint8 0/255 mask of the in-range pixels. |