ComfyUI Node
CV Text To Array
Splits typed text into an (N,) array of STRINGS - the form the pack's caption inputs take ('CV Draw Labels'.labels), and the same thing a QR/barcode detector's `texts` output or 'CV Load Labels'.labels_array already produces. Use it to name a handful of things by hand: annotation anchors, class names for a small classifier, legend entries. 'CV Numbers To Array' is the numeric counterpart (it parses the same text into floats/ints instead) and 'CV Array To Text' is the inverse. Entries keep their order and their count, so an array of N labels lines up one-for-one with N points - which is what every consumer assumes.
CV Text To Array
- nparray
- count
◄text►
◄separatorone per line►
◄keep_emptyfalse►
Categoryimage/CV/low-level
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | The entries to split, one per line by default. Blank lines are dropped, so a trailing newline is harmless; surrounding whitespace on each entry is trimmed. Empty text gives an empty array, not an error. | |
| separator | COMBO | one per line | How to cut the text into entries. 'one per line' is the safest for captions - it is the only option that lets an entry contain spaces AND commas. Pick 'comma' for a list pasted from a CSV header, 'whitespace' for single-word tokens. |
| keep_emptyopt | BOOLEAN | false | Keep entries that are empty after trimming. Off drops them, which is what you want when the text was typed by hand. Turn it ON when the entries must stay aligned with a fixed-length list and a blank line means 'no caption for this one'. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | (N,) numpy array of strings (dtype '<U'). Wire it into 'CV Draw Labels'.labels, or anywhere a detector's `texts` output would go. |
| count | INT | How many entries were produced. Check it against the number of points you are labelling - the drawing nodes reject a mismatch rather than silently labelling the wrong ones. |