OpenCV undistortImagePoints_0
When your 'image' is actually a grid of points
- src
- cameraMatrix
- distCoeffs
- dst
- nparray
Here's a node that will make sense to about four people, and they're all camera-calibration nerds. cv2.undistortImagePoints is a specialized cousin of the usual undistort / undistortPoints pair. The ordinary undistort corrects an image; undistortPoints corrects a list of point coordinates. This one corrects an image made of points - an array where each pixel's value isn't brightness but a coordinate, so the whole image encodes a grid of feature positions that all need the same lens correction applied at once. It exists for calibration pipelines where you want to undistort a whole dense grid in one shot rather than looping over thousands of individual points.
Straight talk: if you're here by accident, this is not the node you want. Real photos aren't "images of points," and feeding a normal photograph in will produce garbage. The image-level distortion fix for actual pictures is undistort_0/undistort_1. Reach for undistortImagePoints only when you're explicitly building a points-image representation, which is deep calibration territory.
Inputs and outputs that matter
- src (NPARRAY) - the points-image: pixels encode point coordinates, not brightness.
- cameraMatrix (NPARRAY) - the 3×3 intrinsics matrix.
- distCoeffs (NPARRAY) - the distortion coefficients.
- arg1 (STRING) - this one deserves attention. It's the extra composite parameter the generator didn't name, and it's parsed with Python's
ast.literal_eval- the pack's convention for composite OpenCV types. In practice you can passNone(a valid literal) to use the defaults, or supply the appropriate tuple/array literal if you know the signature you're targeting. If you getinvalid syntax (<unknown>, line 0), your literal is malformed.
The optional dst is an out-parameter - leave it unwired. Output is one nparray.
Installation
Pack-wide: ComfyUI Manager (search "OpenCV" or geroldmeisinger/opencv-comfyui), or git clone https://github.com/geroldmeisinger/opencv-comfyui into ComfyUI/custom_nodes, restart. Needs opencv-contrib-python (pip install opencv-contrib-python). No models.
Common issues
The pack's standard trio applies - NPARRAY only, batch size 1 (split with ImageFromBatch), Image2Nparray/Nparrays2Image at the boundaries. Add the literal-parsing trap: arg1 is a string that must be valid Python, so a stray brace is an instant invalid syntax error. And honestly, the biggest "issue" with this node is that almost nobody needs it. It's the most niche entry in the undistort family, present because the pack auto-generates everything. Don't feel bad skipping it.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| cameraMatrix | NPARRAY | — | |
| distCoeffs | NPARRAY | — | |
| arg1 | STRING | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |