triangulateInitialViews
R2026bSyntax
Description
The triangulateInitialViews object function selects the best
pair of views from the view graph geometrically verified by the
verifyImagePairs function and initializes the sparse 3-D
reconstruction. Use the triangulateInitialViews object function as the
third step in the SfM pipeline, followed by the reconstruct object
function, which reconstructs the point cloud of the full 3-D scene by processing all the
remaining views in the view graph. Use the isVerified function to verify
whether an sfm object is ready for 3-D reconstruction initialization before
calling the triangulateInitialViews function.
The triangulateInitialViews object function picks the pair of views
with the most reliable feature matches and sufficient baseline separation, or parallax,
estimates the relative camera pose between the two views, and triangulates the first set of
3-D points. For more information about the algorithm, see Algorithms.
If the initialization fails, the triangulateInitialViews function
returns an error. For more information on resolving issues during initialization, see Tips.
selects the best initial view pair from the view graph associated with the sfmObj = triangulateInitialViews(sfmObj)sfm
object sfmObj, and triangulates the corresponding 3-D points from the
selected views. The function then returns a version of the input SfM object with updated
WorldPointSet, ViewGraph, and ProcessedImages
properties.
uses the two views specified by the view IDs sfmObj = triangulateInitialViews(sfmObj,viewPairIDs)viewPairID to triangulate
the first set of 3-D points, instead of automatically selecting the best view pair.
[___] = triangulateInitialViews(
specifies additional options using one or more name-value arguments in addition to any
combination of arguments from previous syntaxes. For example,
sfmObj,Name=Value)triangulateInitialViews(sfmObj,MinMedianAngle=10) relaxes the minimum
parallax requirement for triangulation.
Examples
Input Arguments
Name-Value Arguments
Output Arguments
Tips
If the function returned an error, the most common cause is that no view pair satisfies the
MinMedianAngleorMaxTriangulationErrorthreshold. Reduce theMinMedianAngleargument or increase theMaxTriangulationErrorargument to enable more view pairs to qualify.Use the
infooutput argument to retrieve the exact view pair selected for initialization and verify that the selected pair makes sense for your scene. Also, a median triangulation angle below5degrees might indicate that the initial points are unreliable.For turntable or orbital capture patterns, you can usually achieve good initialization with the default parameters. For forward-motion sequences, such as driving, you might need to reduce the
MinMedianAngleargument because the baseline between consecutive frames is small.After initialization, use the
plotobject function to visually confirm the two-view reconstruction before proceeding to thereconstructfunction.For more information, see Best Practices for 3-D Reconstruction Using Structure from Motion.
Algorithms
SfM initialization establishes the first stable 3‑D reconstruction for an image sequence
by selecting a robust initial image pair from the verified view graph. By default, the
triangulateInitialViews function selects a pair that provides reliable
feature correspondences and a sufficient baseline for accurate triangulation. It estimates the
relative camera pose for the selected pair and triangulates an initial set of 3‑D points. This
initial reconstruction forms the foundation for incrementally adding views and expanding the
scene structure. Selecting a strong initial view pair is critical because it directly affects
the accuracy, scale consistency, and stability of the entire SfM process.
The function selects the initial view pair using these steps:
Rank candidate image pairs — The function ranks connected image pairs in the view graph based on the number of geometrically verified feature matches obtained during image pair verification. It also evaluates the spatial distribution of these matches to ensure uniform coverage across the image plane, prioritizing pairs that provide both strong connectivity and well‑distributed correspondences.
Estimate relative camera pose — Starting from the highest ranked pair, the function estimates the relative camera pose using the essential matrix to model general 3‑D scene geometry.
Triangulate initial 3‑D points — The function triangulates inlier feature correspondences between the two views to generate an initial set of 3‑D world points.
Evaluate triangulation quality — The function computes the median triangulation angle of the reconstructed points and selects the pair only if this value exceeds the required minimum threshold, indicating a sufficient baseline.
Filter unreliable 3‑D points — The function removes triangulated points with reprojection errors above the maximum allowed threshold or with triangulation angles below the minimum acceptable angle to improve reconstruction robustness.
After selecting a valid initial pair, the function initializes the SfM reconstruction state using the estimated camera poses and filtered 3‑D points.
Version History
Introduced in R2026b
See Also
sfm | connectImagePairs | isConnected | verifyImagePairs | isVerified | isInitialized | reconstruct | poses | pointCloud | plot






