## 4 Hierarchical Incremental Maps
### Image Level Loop Closure. Position and Orientation Descriptors  
This algorithm activates if the Node Level Loop Closure is successful and outputs a non-empty set \(N^{*}\) of candidate nodes. In this case, it is necessary to determine which specific image or images close the loop, being the most similar to \(l_{q}\). Given the set of candidate nodes \(N^{*}\), all their corresponding images \(I^{N^{*}}\) are evaluated to find the image \(I_{i}\) which is the most similar image to \(I_{q}\). The problem is solved using two different similarity metrics, described in Section 3. These similarity metrics are computed between the descriptor of the image \(I_{q}\) and every of the descriptors of the \(I^{N^{*}}\) candidate images. Using both metrics, the comparison combines position and orientation information. First, position information is obtained comparing the position descriptor of the image \(I_{q}\) with the position descriptors of the images \(I^{N^{*}}\) using _Euclidean distance_. Second, the orientation information is used. In this case the method estimates the relative shift between each candidate image \(I_{i}\) and \(I_{q}\). Then the panoramic image \(I_{i}\) and its associated descriptor are shifted, in such a way that after this shift, both images have the same relative orientation. Then the distance between the orientation descriptors is calculated using _Euclidean distance_ (Equation (5)), where \(\vec{d}_{q}\) is the descriptor obtained from the new image \(I_{q}\) and \(\vec{d}_{k}\) is the descriptor of each of the images \(I_{k}\) contained in the candidate nodes \(N^{*}\) after running the Node Level Loop Closure process. \[dist_{eucl}\vec{d}_{q}=\sqrt{\sum_{j=1}^{t}{((\vec{d}_{q}(j)-\vec{d}_{k}(j))^{ 2}}} \tag{5}\]  
This process is repeated for all the images \(I_{k}\) contained in the set of candidate nodes \(N^{*}\). After that, the method calculates the inverse of these distance measures, so the images with small distances (images that are more similar) will have higher similarity measure. Then, the result is normalized in such a way that the sum of the similarities is equal to 1. Next, the position and orientation similarity measures are multiplied to obtain the final similarity measure that combines both kinds of information. The image \(I_{i}\) with the associated higher result is then retrieved by the Image Level Loop Closure (and its node as the most similar node to \(I_{q}\). It is possible to see an example of these measures in Figure 6, where Figure 6a shows the similarity measures between the image \(I_{q}\) and the images in the candidate nodes when using position descriptors; Figure 6b shows the same similarity comparison but using orientation descriptors and Figure 6c shows the final similarity measures obtained by multiplying  
Figure 5: Values of x in the node level loop closure condition versus number of clusters in Equation (4). position and orientation measures. These results (final similarity measure) are the data used to retrieve both the image and the node that close the loop with \(I_{q}\). Only the images \(I_{k}\) that belong to the candidate nodes \(N^{*}\) have a value in these figures, the other images are considered to have null measure. \[sim\frac{\vec{d}_{k}}{\vec{d}_{q}}=\frac{1}{dist_{eucl}\vec{d}_{q}} \tag{6}\]  
\[i=\underset{k}{\operatorname{argmax}}(sim\frac{\vec{d}_{k}}{\vec{d}_{q}}) \tag{7}\]  
If no node is selected as candidate node \((N^{*}=\emptyset)\) the Image Level Loop Closure process cannot be run. Therefore, the image \(I_{q}\) is not assigned to any node, and it remains unclassified, waiting for information from the next images (those which are subsequently captured by the robot). When a set of consecutive images are left unclassified, a new node has to be created with them and the node  
Figure 6: Node Level Loop Closure process example. The node labels are arranged along the top of each subfigure.