ComfyUI Node
CV Take By Index
Looks every element of an integer array up in a table and returns what it found: table row i replaces index value i. With the (K,C) palette of 'CV Reduce Array By Label' and the label map that produced it, this paints each region with its own colour; it equally maps a per-component area or score (from 'cv2.connectedComponentsWithStats') into a heat map. Unlike cv2.LUT it has no 256-entry limit and takes any integer dtype.
CV Take By Index
- table
- index
- values
◄out_of_rangeclamp►
◄fill_value0.00►
Categoryimage/CV/low-level
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| table | NPARRAY | Lookup table, (K,) or (K,C...): row i is the value that index i stands for. Its dtype is preserved. | |
| index | NPARRAY | Integer array of any shape - typically an [H,W] label map. Each element is replaced by the corresponding table row. | |
| out_of_range | COMBO | clamp | What to do with an index outside 0..K-1: clamp to the nearest row, wrap around (modulo K, for a repeating palette), or write 'fill_value'. |
| fill_valueopt | FLOAT | 0.00-1000000000000–1000000000000 | Value written for out-of-range indices when out_of_range is 'fill' (cast to the table's dtype). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| values | NPARRAY | The gathered array: the shape of 'index' plus the table's trailing axes, in the table's dtype. An [H,W] index over a (K,3) table gives [H,W,3] - cast it to uint8 with 'CV Cast Array' to preview it. |