# Add new tracks that are only present in the new frames of GraphB
#... (This part of the code handles tracks that are not connected to the common frames) return GraphAB  
The pseudo-code is illustrated in the block diagram in Figure 6, together with an explanation of the method.  
To handle fewer image overlaps and ensure per-image point clouds are aligned, we utilized the merge2 graphs function in this task. This process ensures that the point clouds from both graphs are aligned in a standard coordinate system, effectively merging the 3D reconstructions from the two image pairs. The merge2 graphs function is essential for aligning point clouds from two graphs, each representing a pair of images and their corresponding 3D points. This function enables the alignment of point clouds from images that do not directly overlap as long as they are connected through a chain of overlapping images. This approach reduces the need for excessive image overlaps, as the point cloud from an intermediate image can serve as a bridge to align the point clouds of non-overlapping images. The alignment process in merge2 graphs involves several key steps:  
1. Identify Common Frames: The function identifies standard frames between the two graphs, which is crucial for establishing correspondences and aligning the coordinate systems.  
2. Transform to Common Coordinate System: The function calculates the transformation that aligns the second graph's coordinate system with the first graph's coordinate system. This transformation is based on the camera poses of the first standard frame in both graphs. The 3D points of the second graph are then transformed using this transformation, and the camera poses are updated accordingly.
3. Merge Data: The frames, camera poses, and 3D points from both graphs are combined into a new graph. The observation indices are updated to ensure the 3D points are correctly associated with their corresponding image observations.  
This process ensures that the point clouds from both graphs are aligned in a standard coordinate system, resulting in a merged 3D reconstruction from the two image pairs.  
The ability to align point clouds from non-overlapping images reduces the number of required image overlaps, contributing to the efficiency of this approach.  
The accuracy of depth information derived from the proposed method and other techniques (depth map, SfM, and MVS) was evaluated by comparing their deviation from ground truth references, such as CT scans, laser scans, manual measurements, and rendered synthetic models. The accuracy metric, the Percentage of Correct Points (PCP), represents the proportion of points with positional errors below a predefined threshold (1 mm). The proposed method demonstrated superior accuracy compared to the baseline (depth map), particularly in Dataset 2, where it achieved 79% accuracy, indicating a 21% reduction in deviation from ground truth. In Dataset 3, suboptimal lighting conditions or low-texture surfaces likely reduced feature-matching reliability, resulting in lower accuracy (67.3%). Factors influencing accuracy include scene contrast, lighting consistency, and image overlap. It is important to note that the accuracy metric reflects relative performance under controlled experimental conditions and that ground truth acquisition may introduce minor inherent errors. Overall, the accuracy percentages highlight the proposed method's effectiveness in generating geometrically consistent 3D reconstructions, particularly in high-contrast scenarios, validating its potential for cultural heritage preservation.  
Figure 6: Illustration of the pseudo-code.