reconstruct
R2026bReconstruct 3-D scene using structure-from-motion (SfM) by incrementally processing all camera views after initialization
Since R2026b
Description
The reconstruct function reconstructs the full point cloud of
the 3-D scene and estimates camera poses by incrementally processing all remaining views in
the view graph after initialization. Use the reconstruct object function
as the final step in the SfM pipeline after you have initialized the reconstruction using the
triangulateInitialViews object function. Use the
isInitialized function to verify whether the sfm
object is ready for incremental 3-D reconstruction before calling the
reconstruct function. After all images have been processed, use the
poses and pointCloud object functions to retrieve
the estimated camera poses and the sparse point cloud of the 3-D scene,
respectively.
The reconstruct function adds images one at a time, starting from the
initial two-view reconstruction produced by the triangulateInitialViews
object function. For each new image, the function estimates the camera pose by solving the
Perspective-n-Point (PnP) problem, triangulates new 3-D points, and refines both poses and
points using bundle adjustment. For more information about the algorithm, see Algorithms.
If the reconstruction fails, the reconstruct function returns an
error. For more information on resolving issues during reconstruction, see Tips.
incrementally processes all the camera views in the view graph associated with the
sfmObj = reconstruct(sfmObj)sfm object sfmObj to estimate camera poses and
reconstruct the full 3-D scene as a sparse point cloud. The function then returns a version
of the input SfM object with updated WorldPointSet,
ViewGraph, and ProcessedImages property values.
specifies options using one or more name-value arguments. For example,
sfmObj = reconstruct(sfmObj,Name=Value)reconstruct(sfmObj,MaxReprojectionError=12,MinNumInliers=20) relaxes
the PnP and inlier thresholds, enabling the function to register more images.
Examples
Input Arguments
Name-Value Arguments
Output Arguments
Tips
If not all images registered during reconstruction, the most common reasons and countermeasures are:
Insufficient 3-D to 2-D correspondences — Increase the
MaxReprojectionErrorargument or decrease theMinNumInliersargument to enable the function to register more images.No covisible 3-D points with the processed views — Increase the
MaxTriangulationErrorargument or decrease theMinTriangulationAngleargument to enable the function to register more images.
If the reconstruction looks noisy, decrease the value of the
MaxTriangulationErrorargument to keep only well-triangulated 3-D points, or increase the value of theMaxSolverIterationsargument to perform more precise bundle adjustment.If the processing is too slow, decrease the values of the
NumViewsRefinedandMaxNumRefinementarguments to speed up local bundle adjustment, or increase the value of theGlobalRefinementFrequencyargument to reduce the frequency of global bundle adjustment.Inspect the next‑best‑view selection by checking the processing order of image views using the
ProcessedImagesproperty of the outputsfmobject. Ideally, thereconstructfunction processes views with strong overlap and good geometric coverage early. If the function processes views with good overlap late or not at all, consider adjusting feature matching, pose estimation, or triangulation parameters to better match your scene.Specify the
Verboseargument astrueto monitor which views the function registers, enabling you to spot any issues during reconstruction.For more information, see Best Practices for 3-D Reconstruction Using Structure from Motion.
Algorithms
After initialization, the reconstruct function incrementally
registers the remaining views to expand the 3‑D reconstruction. It adds one view at a time by
selecting a well‑supported next view, estimating its camera pose from the existing 3‑D
structure, triangulating new 3‑D points, and refining camera poses and the scene structure
using bundle adjustment. Throughout the process, the algorithm merges duplicate points and
removes outliers to maintain a stable and consistent reconstruction. It performs local
refinement for each newly added view and periodically performs global refinement to correct
accumulated drift.
The function produces incremental reconstruction using these steps:
Next best view selection — The algorithm selects the unprocessed view that shares the largest number of reliable 2‑D to 3‑D correspondences with the current reconstruction. It prioritizes views that already observe sufficient triangulated 3‑D points, reducing pose uncertainty and maximizing the contribution of well‑conditioned geometry.
Camera pose estimation — The algorithm estimates the camera pose of the selected view by solving the Perspective‑n‑Point problem with RANSAC, using 2‑D feature observations and their corresponding 3‑D world points. RANSAC rejects outlier correspondences and retains a pose supported by a consistent inlier set.
Triangulation and point merging — After registering the new view, the algorithm triangulates new 3‑D points from feature correspondences between the new view and previously registered views. It merges duplicate 3‑D points that represent the same scene point to keep the reconstruction consistent.
Local bundle adjustment and outlier filtering — For each newly processed view, the algorithm performs local bundle adjustment to jointly refine the pose of the new view, the poses of strongly connected neighboring views, and the 3‑D points they observe. The algorithm selects neighboring views that share sufficient tracks and provide strong geometric constraints, such as larger triangulation angles. The number of neighboring views refined is controlled by the
NumViewsRefinedargument. After optimization, the algorithm removes 3‑D points and correspondences with high reprojection error.Re‑triangulation — Using the refined camera poses from bundle adjustment, the algorithm triangulates additional 3‑D points to enable more point tracks to qualify and improve reconstruction accuracy.
Global bundle adjustment — At regular intervals controlled by the
GlobalRefinementFrequencyargument, and again after all views have been processed, the algorithm performs global bundle adjustment. This step jointly refines all registered camera poses and all reconstructed 3‑D points to correct drift and improve scene‑wide consistency.
Version History
Introduced in R2026b
See Also
sfm | connectImagePairs | isConnected | verifyImagePairs | isVerified | triangulateInitialViews | isInitialized | poses | pointCloud | plot



