cv2.computeCorrespondEpilines
For a point here, the line it must lie on there
- points
- F
- nparray
The idea in one paragraph
Take a photo of a scene from two places. Pick a feature in the first photo. In the second photo, its match cannot be just anywhere - it has to lie somewhere on one specific line. That line is an epipolar line, and computing it for a batch of points is what cv2.computeCorrespondEpilines does. It's the geometric constraint that makes stereo matching tractable and makes bad feature matches obvious: if your "matched" pair isn't sitting on the line, the match is wrong.
So the two uses are: validate (draw the lines, see which matches ignore them) and constrain (search only along the line instead of the whole image). It's a raw wrapper from ComfyUI CV (bmad4ever/comfyui_cv), category image/CV/low-level/cv2 C.
How it works
You give it a set of 2D points, a fundamental matrix F, and which of the two images those points came from. It applies the epipolar constraint - effectively multiplying each homogeneous point by the fundamental matrix - and returns, for each input point, a line in the other image in the form ax + by + c = 0. Three numbers per point, N lines in one NPARRAY.
The whichImage input is the part that trips people, so it's worth stating plainly: it selects where the points came from, not where the lines are drawn. Pick the wrong one and the lines come out in a plausible-looking but meaningless place. The pack doesn't make you remember "1 or 2" either - the dropdown reads as sentences: "points are from image 1 (lines for image 2)" and "points are from image 2 (lines for image 1)".
Inputs and outputs that matter
- points - required, NPARRAY only.
N×1or1×Nof type CV_32FC2 (float32, two components per point). An IMAGE/MASK link is rejected - these are coordinates, not pixels. - whichImage - required COMBO, as above.
- F - required, NPARRAY only. The 3×3 fundamental matrix, e.g. from
cv2.findFundamentalMator the curated CV Find Fundamental Matrix node in this pack. - nparray - the output: N lines as
(a, b, c).
Where the output goes next: the curated CV Draw Epipolar Lines node renders them as an overlay, which is the fastest way to see whether your matches and your F agree. If you'd rather keep it numeric, the endpoints can be derived and pushed through the standard drawing nodes - but honestly, the overlay is the point.
Adjacent nodes in the same pack, in the order you'd actually use them: CV Detect Features → CV Match Features → CV Find Fundamental Matrix → this node → CV Draw Epipolar Lines. It's the classic two-view geometry pipeline, and it's the shape of the pack's own feature-matching example workflows.
Installing the pack
Manager → search ComfyUI CV, or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_cv
Restart ComfyUI. Python ≥ 3.12 and a V3 node API ComfyUI are required. Dependencies: opencv-contrib-python-headless~=5.0.0.93, numpy, torch. Note that some of the pack's bundled example workflows expect ComfyUI-Inspire-Pack, ComfyUI-Custom-Scripts, or Basic Data Handling - the nodes work without them.
Where people get burned
- dtype.
CV_32FC2is not "whatever my point node emitted". If your points are float64 or int32, cast them first (CV Cast Array) - the error message from cv2's overload resolution will be opaque. whichImagereversed. The single most likely silent error in this node. Symptom: lines that look structured and confident and are simply wrong. Draw one known-good match to check.- A shaky
Fmakes shaky lines. AnFestimated from bad matches gives you lines that "look" fine and constrain nothing. Check the inlier count and the reprojection quality upstream before blaming this node. - Points from the wrong space. If you cropped, resized, or undistorted one image, the points must be in the same coordinates as the
Fyou're using - otherwise the constraint is void and nothing tells you. - The pack's caveats, once, so you're not surprised later. The README is unusually candid: LLM-assisted development, acknowledged risk of overfitting to test cases, no planned updates, and "not recommended in production" without independent review. There is also no Reddit corpus around this pack at all - nothing to Google when a number looks wrong. For geometry you intend to trust, cross-check a line or two by hand.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| points | NPARRAY | Input points. $N \times 1$ or $1 \times N$ matrix of type CV_32FC2 or vector\ . A data array (points / matrix), NOT an image - only an NPARRAY link is accepted here. | |
| whichImage | COMBO | points are from image 1 (lines for image 2) | Index of the image (1 or 2) that contains the points . |
| F | NPARRAY | Fundamental matrix that can be estimated using #findFundamentalMat or #stereoRectify . A data array (points / matrix), NOT an image - only an NPARRAY link is accepted here. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |