OpenCV findEssentialMat_2
Essential matrix when you only know the focal length
- points1
- points2
- mask
- nparray_0
- nparray_1
OpenCV findEssentialMat_2 is the "I don't have a full camera calibration, but I know the focal length" version of the essential-matrix estimation. Same goal as findEssentialMat_1 - recover the rotation and translation between two camera views from matching points - but instead of feeding it a full 3x3 intrinsic matrix, you hand it two numbers: focal and pp.
That's the whole point of this variant. OpenCV builds a simplified camera matrix internally assuming a square pixel (fx = fy = focal) with the principal point pp sitting wherever you say. It's a legit shortcut for phone-camera and webcam work where you know the lens spec but never bothered with a checkerboard calibration, and it's the variant the OpenCV docs describe as findEssentialMat(points1, points2, focal, pp, ...).
Inputs
points1/points2- matching points across the two views, asNPARRAY(Nx1x2orNx2).focal- focal length in pixels, aFLOAT. For most real lenses this is roughlyimage_widthfor a normal lens, more for telephoto. If you genuinely have no idea, start there and accept the result is approximate.pp- the principal point, as aSTRINGcomposite literal. This is the one that trips people up: OpenCV expects aPoint2d, and this pack passes composite types around as Python literals parsed withliteral_eval. So you type it as(320, 240)- parentheses, comma, no quotes. A bare320, 240will throw aninvalid syntaxerror.method-8for RANSAC, the only mode you'll realistically use.prob,threshold,maxIters- RANSAC tuning; the defaults are sensible, leave them alone.
The outputs are the same as the other essential-matrix nodes: nparray_0 is the 3x3 essential matrix, nparray_1 is the per-point inlier mask.
What it's actually for
If you're building a pose-estimation or camera-tracking workflow inside ComfyUI, _2 is a solid middle ground between "I have a full calibration matrix" (_1) and "I have nothing, give me the fundamental matrix" (findFundamentalMat). The tradeoff is real: the fx == fy, no-skew assumption is wrong for most real cameras, but for synthetic or game-capture frames it's often exactly right, since the renderer knows the lens.
Just remember the common trap across the whole pack: points and matrices flow as NPARRAY, not ComfyUI IMAGEs, and the output of this node is not a picture - it's geometry. Preview it and you'll get the 'NoneType' object has no attribute 'shape' error. Nparrays2Image is for turning actual image arrays back into viewable frames.
Install and gotchas
It lives in the geroldmeisinger/opencv-comfyui pack. Install via ComfyUI Manager (search opencv-comfyui) or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
then restart. requirements.txt installs opencv-contrib-python, numpy, and torch; the pack imports cv2 at startup, so a broken/conflicting OpenCV install means the whole pack won't load. If cvtColor says you need CV_8UC1, your image isn't grayscale - convert with code 6 first.
Note findEssentialMat_3 is byte-for-byte the same node (OpenCV's type stubs declare every function twice, once for MatLike and once for UMat, and the generator emits both). Pick either; _2 is the one people usually reach for.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| points1 | NPARRAY | — | |
| points2 | NPARRAY | — | |
| focal | FLOAT | — | |
| pp | STRING | — | |
| method | INT | — | |
| prob | FLOAT | — | |
| threshold | FLOAT | — | |
| maxIters | INT | — | |
| maskopt | NPARRAY | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| nparray_0 | NPARRAY | — |
| nparray_1 | NPARRAY | — |