Nodes/comfyui_cv/CV Triangulate Points (Two-View)
ComfyUI Node

CV Triangulate Points (Two-View)

Reconstructs sparse 3D points from two views given the matched 2D points, the shared camera matrix and the relative pose (cv2.triangulatePoints) - the sparse structure half of two-view structure-from-motion. It builds the projection matrices P1 = K[I|0] (view 1) and P2 = K[R|t] (view 2, from 'CV Recover Pose'), triangulates each correspondence and divides out the homogeneous coordinate. Points are in VIEW-1 camera coordinates and only up to the same global scale as the unit translation. The 'valid' mask flags points that pass the cheirality check (positive depth in BOTH cameras) and are finite - outlier matches and points near infinity are marked 0; preview points_3d with 'Inspect CV Data' and check reproj_error (mean pixels over valid points; under ~1-2 px is a clean reconstruction). Failure-tolerant: 0 points or a degenerate pose returns empty arrays, error 0 and count 0 instead of raising.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Triangulate Points (Two-View)
  • points_a
  • points_b
  • camera_matrix
  • rotation
  • translation
  • points_3d
  • valid
  • reproj_error
  • count
Categoryimage/CV/features

Inputs (5)

NameTypeDefaultDescription
points_aNPARRAYPoints in view 1, Nx1x2 (matched, same order as points_b).
points_bNPARRAYCorresponding points in view 2, Nx1x2.
camera_matrixNPARRAY3x3 intrinsic matrix K shared by both views.
rotationNPARRAY3x3 relative rotation R (from 'CV Recover Pose').
translationNPARRAY3x1 relative translation t (from 'CV Recover Pose').

Outputs (4)

NameTypeDescription
points_3dNPARRAYNx3 float64 points in view-1 camera coordinates (invalid points are zeroed - see 'valid').
validNPARRAYNx1 uint8: 1 = finite and in front of both cameras.
reproj_errorFLOATMean reprojection error in pixels over valid points (0 if none are valid).
countINTNumber of valid 3D points.