Parse Matrix
Paste a table, get an array — the return leg of 'CV Array To Text'
- nparray
Sometimes the numbers in your graph shouldn't come from a node at all. A calibration you measured by hand, a list of crop boxes someone mailed you, a column you copied out of a spreadsheet - you want it in the graph as an NPARRAY so every downstream point, contour and remap node can use it. Parse Matrix takes delimited text and gives you a 2-D numpy matrix. That's the whole node, and it's a load-bearing one.
It's explicitly the return leg of CV Array To Text: format an array to text, save the string, load it back, parse it, and you have a round trip. The reason the pack splits that over two nodes (plus whatever writes the file) rather than putting a file picker on this one is a deliberate rule - the type-bridge nodes move data between socket types and literals, and don't do disk IO.
How it parses
text is a multiline STRING with the default 1 2 3\n4 5 6. Columns can be separated by spaces, tabs, commas or semicolons, rows by newlines, and consecutive separators collapse - so CSV, TSV, and whitespace-aligned output all parse without preprocessing. That collapse is also the gotcha: an empty CSV cell doesn't become a zero, it just disappears, and the row count changes.
Three optional settings:
dtype- output array depth.same as input(the default) resolves to float64, which is what almost every consumer wants.transpose- swap rows and columns. Handy when a pasted table is points-as-rows and a node wants coordinates as rows.skip_rows- drop N leading lines before parsing. Set it to 1 for a CSV header, because parsing a header line as numbers raises.
Ragged rows are rejected on purpose - if row 0 has three columns and row 4 has two, you get an error naming both rather than a silently truncated matrix. That's the right call: a matrix with inconsistent columns is a mistake, not data.
Output is a single NPARRAY, the parsed 2-D matrix.
Where it earns its keep
Wire it into anything that consumes NPARRAY: a point list into a warp or a polygon draw, a 3x3 into a matrix-inverse, a column of scores into CV Array Statistic, or a curve you then render with CV Plot 2D. Combined with CV Array To Text it's also how you get numeric data out of a graph, edit it in a text editor, and push it back in - which for a stubborn calibration value beats rebuilding the graph.
Install
Manager → search ComfyUI CV, or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
cd comfyui_cv && pip install "opencv-contrib-python-headless~=5.0.0.93"
Restart afterwards. Python ≥ 3.12 plus a V3-API ComfyUI. The pack declares the headless contrib OpenCV wheel; this node doesn't need contrib, but the pack's registry does.
Common issues
- "Inconsistent column count" - a ragged row, or an empty CSV cell that vanished during separator collapsing. Check the source text visually before assuming the node is wrong. (Note that a trailing empty line is fine; blank lines never count as rows.)
- "No matrix data found" - the text is empty or all whitespace, often because the upstream string was never actually populated.
- A header row explodes the parse -
skip_rows = 1. - Everything landed in one column - the separator is something the node doesn't recognize. Spaces, tabs, commas and semicolons only.
- ComfyUI's embedded JSON trips on non-ASCII - the workflow JSON is read with the Windows codepage in some environments, so keep the strings you paste here ASCII if you plan to share the workflow file.
Pack caveat as always: heavily LLM-assisted development, no production guarantee, no promised updates. This is one of the simpler nodes in the pack, which is the good news.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | 1 2 3 4 5 6 | Matrix data: spaces, tabs, commas or semicolons separate columns, newlines separate rows. Consecutive separators are collapsed. |
| dtypeopt | COMBO | same as input | Output array depth. 'same as input' defaults to CV_64F (float64). |
| transposeopt | BOOLEAN | false | Swap rows and columns (transpose the matrix). |
| skip_rowsopt | INT | 00–1024 | Drop this many leading lines before parsing - 1 skips a CSV header row (a header is text, so parsing one as numbers raises). Blank lines never count. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | Parsed 2-D numpy matrix. |