Nodes/opencv-comfyui/OpenCV undistortPoints_1
ComfyUI Node

OpenCV undistortPoints_1

UndistortPoints_1 — the keypoint-correction twin you can swap freely

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV undistortPoints_1
  • src
  • cameraMatrix
  • distCoeffs
  • dst
  • R
  • P
  • nparray

undistortPoints_1 is the twin of undistortPoints_0: the same cv2.undistortPoints function, generated twice because OpenCV's type stubs list the function as multiple overloads. Identical inputs and outputs, zero behavioral difference. If a workflow references this one, it behaves exactly like the _0 version - the number is codegen, not a feature.

The function: take a list of 2D feature points (keypoints, corners, matches) and correct them for the camera's lens distortion, given the intrinsic matrix and distortion coefficients. This is the coordinate-level sibling of undistort, which remaps whole images. You reach for it when your pipeline detects points in real photos and then feeds them into geometry math - triangulatePoints for stereo reconstruction, findHomography, pose estimation. Skip the correction and every geometric result inherits the lens bend.

Inputs and outputs that matter

  • src (NPARRAY) - the input points, N×2 (or N×1×2). Coordinates, not an image.
  • cameraMatrix (NPARRAY) - 3×3 intrinsics.
  • distCoeffs (NPARRAY) - distortion coefficients.

Optional R (rectification matrix) and P (new camera matrix for reprojection) are for calibrated rigs - leave them unwired unless you know you need them; you'll get normalized output. Optional dst is the out-parameter; leave it alone. Output is one nparray of corrected points.

Installation

One pack, both twins: ComfyUI Manager (search "OpenCV"), or git clone https://github.com/geroldmeisinger/opencv-comfyui into ComfyUI/custom_nodes, restart. Requires opencv-contrib-python (pip install opencv-contrib-python). No models.

Common issues

Same traps as its twin: it wants a points array, not a photograph - feed it pixels and you get nonsense. Shape errors throw OpenCV assertions. And the pack-wide constraints apply (NPARRAY, batch size 1, Image2Nparray/Nparrays2Image at the edges). The output is coordinates, so don't expect to preview it as an image. This is the kind of node that's only interesting once you're already doing camera math - and if you are, having it available without leaving ComfyUI is the pack's whole argument.

Categoryimage/OpenCV

Inputs (6)

NameTypeDefaultDescription
srcNPARRAY
cameraMatrixNPARRAY
distCoeffsNPARRAY
dstoptNPARRAY
RoptNPARRAY
PoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY