Nodes/opencv-comfyui/OpenCV findFundamentalMat_0
ComfyUI Node

OpenCV findFundamentalMat_0

Relate two camera views with zero calibration — the fundamental matrix

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV findFundamentalMat_0
  • points1
  • points2
  • mask
  • nparray_0
  • nparray_1
method
ransacReprojThreshold
confidence
maxIters

The fundamental matrix is the essential matrix's uncalibrated cousin, and it's the one you can actually use without knowing anything about your camera. Given matching points in two views, cv2.findFundamentalMat computes the 3x3 matrix F that relates them purely in pixel coordinates - no intrinsics, no focal length, no calibration session with a checkerboard. If you've got two frames of the same scene and nothing but raw pixel correspondences, this node is where you start.

OpenCV findFundamentalMat_0 is that function wrapped for ComfyUI, in its full-signature form: (points1, points2, method, ransacReprojThreshold, confidence, maxIters, mask).

Inputs

  • points1 / points2 - matching points across the two views, NPARRAY (Nx1x2 or Nx2). The matching is on you - this node estimates the matrix, it doesn't find correspondences.
  • method - the estimation method, as an int. 8 = RANSAC (your default; it tolerates wrong matches), 4 = LMEDS (robust, slower), 2 = 8-point, 1 = 7-point (least points but very sensitive to noise). For anything real, use 8.
  • ransacReprojThreshold - how far (in pixels) a match can be off and still count as an inlier. Default 3.0 is a sane starting point.
  • confidence - RANSAC confidence, 0.99+ default. Leave it.
  • maxIters - RANSAC iteration cap; 1000 is plenty for a few hundred points.

Outputs: nparray_0 is the 3x3 fundamental matrix F, nparray_1 is the inlier mask. Neither is an image - this is the pack's classic trap, and you'll know it when you try to preview the output and hit 'NoneType' object has no attribute 'shape'.

What you'd use it for

Epipolar geometry, mostly: F lets you constrain where a point in one view must appear in the other (the epipolar line), which powers stereo rectification, dense matching, and structure-from-motion. In a ComfyUI workflow you're most likely to reach for it when you want to check whether two frames were shot from the same viewpoint, or when you're building the correspondence stage of a 3D-ish pipeline and need a robust model of the two-view relationship.

One honest caveat: this pack has near-zero community footprint - nobody is posting polished workflows built on the geometry nodes, because assembling the matched-point arrays by hand is real work. Treat it as a raw tool, not a drag-and-drop magic box. If you just need to align or warp an image, findHomography is the friendlier choice; F is about relationships between views, not warping one onto the other.

Install

ComfyUI Manager → search opencv-comfyui → install → restart. Manual:

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

requirements.txt installs opencv-contrib-python, numpy, torch. The pack imports cv2 at load, so a broken OpenCV install nukes the whole pack at startup - duplicate-package conflicts show up as Cannot import name 'guidedFilter' from 'cv2.ximgproc'. And remember the Image2Nparray/Nparrays2Image dance: this node speaks numpy NPARRAY, not ComfyUI IMAGE, and it only handles batch_size == 1.

findFundamentalMat_1 is this node's byte-identical UMat twin; pick either. The _2/_3 pair is the same math without the maxIters parameter, from an older OpenCV signature - _0 here is the one to prefer.

Categoryimage/OpenCV

Inputs (7)

NameTypeDefaultDescription
points1NPARRAY
points2NPARRAY
methodINT
ransacReprojThresholdFLOAT
confidenceFLOAT
maxItersINT
maskoptNPARRAY

Outputs (2)

NameTypeDescription
nparray_0NPARRAY
nparray_1NPARRAY