Nodes/opencv-comfyui/OpenCV computeCorrespondEpilines_0
ComfyUI Node

OpenCV computeCorrespondEpilines_0

Stereo geometry without leaving the graph (computeCorrespondEpilines_0)

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV computeCorrespondEpilines_0
  • points
  • F
  • lines
  • nparray
whichImage

If you've ever shot a stereo pair - two photos of the same scene from slightly different angles - you've hit the fundamental question of 3D vision: given a point in one image, where is it in the other? The answer is never "a point." It's a line: the epipolar line. computeCorrespondEpilines_0 computes exactly that, wrapping cv2.computeCorrespondEpilines for ComfyUI.

What it does

Given a set of points in one image and the 3×3 fundamental matrix F that describes how the two cameras relate, this node works out, for each point, the line in the other image on which the matching point must lie. This is the constraint that makes stereo matching tractable - instead of searching the whole second image for a match, you search one line.

Each output line comes back as (a, b, c) meaning the line a*x + b*y + c = 0 in that other image.

The inputs and outputs

  • points (NPARRAY) - your points in one image, as (N, 1, 2) or (N, 2) of (x, y) pairs.
  • whichImage (INT) - 1 if the points are in image 1 (lines get computed for image 2), 2 for the reverse. Get this backwards and you'll get lines that are wrong but not obviously so - the geometry quietly stops making sense.
  • F (NPARRAY) - the 3×3 fundamental matrix. In this pack, findFundamentalMat_0 is how you get one, estimated from at least 7–8 matching point pairs across the two images.
  • lines (NPARRAY, optional) - an out-parameter. Per the README, skip it.
  • Output: nparray - an (N, 1, 3) array of epipolar lines.

When you'd actually reach for this

This is pure geometry, and it only makes sense if you're doing real stereo work: structure-from-motion, 3D reconstruction, or using epipolar constraints to reject bad feature matches (points whose match doesn't lie near its epipolar line are outliers - a classic RANSAC follow-up). In a ComfyUI image-gen context that's niche, and it assumes you already have point correspondences and a fundamental matrix. But if you're experimenting with 3D-from-images, having the full stereo toolkit in your graph instead of dropping to a Python script is genuinely pleasant.

Install and gotchas

Same pack, same install: ComfyUI Manager (search "opencv-comfyui") or

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui

Requires opencv-python-contrib. The traps are all about input shape: F must be 3×3, points must be (N, 2)-ish, and whichImage must match your bookkeeping. Watch the guidedFilter import conflict if you've got multiple OpenCV installs fighting. And remember - the output is line coefficients, not a drawing. If you want to see the lines overlaid, you'll need to render them yourself; this node hands you the math.

Categoryimage/OpenCV

Inputs (4)

NameTypeDefaultDescription
pointsNPARRAY
whichImageINT
FNPARRAY
linesoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY