# Landmark Generation in Visual Place Recognition Using Multi-Scale Sliding Window for Robotics
## 3 Proposed Method of Landmark Generation via MSW  
In this section, we detail our proposed method of generating artificial landmarks for visual place recognition via a MSW procedure. The method serves as a step in a standard landmark-based place recognition system shown in Figure 2 (second block on the left and right branches). Our proposed MSW method requires as input an image whose landmarks are to be generated, and there is only a single parameter \(s\) to set, the scales of landmarks desired. Analogous to the parameter setting in classical landmark-based place recognition methods [12], the output of the method produces 100 landmarksthat cover the image spatially uniformly and whose sizes between two properly chosen bounds are also uniformly distributed. All landmarks share the same aspect ratio as the input image. Our proposed MSW method is summarized in Algorithm 1 whose steps are described below. First, we define the size of a landmark in terms of a scale that is normalized with respect to the image size in pixels as follows:  
\[Scale=\frac{Landmark\;Size}{Image\;Size} \tag{1}\]  
```
Input: Image width \(W\) and height \(H\), landmark scales \(\mathbf{s}\) Output: Bounding boxes of extracted landmarks \(\mathbf{L}\) \(k=size(\mathbf{s})\) \(n=100/k\) for\(i=1\) to \(k\)do \(SW\gets round\big{(}W\times\frac{(1-\sqrt{s_{i}})}{\sqrt{n}-1}\big{)}\) \(SH\gets round\big{(}H\times\frac{(1-\sqrt{s_{i}})}{\sqrt{n}-1}\big{)}\) \(BW\gets W-SW\times(\sqrt{n}-1)\) \(BH\gets H-SH\times(\sqrt{n}-1)\) \(X\gets 1,Y\gets 1\) while\(X+BW\leq W\)do while\(Y+BH\leq H\)do \(\mathbf{L}\leftarrow[X,Y,BW,BH]\) \(Y\gets Y+SH\) endwhile \(Y\gets 1,X\gets X+SW\) endwhile endfor return\(\mathbf{L}\)
```  
**Algorithm 1**MSW based landmark extraction. We present the lower bound of the landmark scale at \(s_{1}\) to avoid generating small landmarks that typically exhibit poor matching results while the upper bound is set at \(s_{k}\) to avoid landmarks whose size is close to that of the image with poor shift invariance. We define a set of \(k\) discrete scales in \([s_{1},s_{k}]\), and refer to them as \(\mathbf{s}=[s_{1},...,s_{k}]\). To achieve uniform distribution of landmark size, we therefore generate \(n=100/k\) landmarks at each \(s_{i}\). To achieve uniform distribution of the landmarks spatially, we use a standard sliding window approach, as given in Algorithm 1. Specifically, the outer for-loop of Algorithm 1 between Lines 3 and 16 iterates through each of the \(k\) scales. Within an iteration, we first define the stride size along the width and the height of the image, \(SW\) and \(SH\). In addition, we can calculate the width and the height of the sliding window, \(BW\) and \(BH\), from the image and stride size and the constant number of landmarks at each scale, using Lines 6 and 7. The subsequent double while-loop between Lines 9 and 15 moves through the image to define the locations of the landmarks in terms of the coordinates of their upper left corners and their heights and widths. The bounding box array is kept in \(\mathbf{L}\) and returned as the output of the algorithm. Clearly, Algorithm 1 produces a set of landmarks that are uniformly distributed in size (scale) and in space. To illustrate our MSW method, Figure 3 gives an example of extracting 100 landmarks at four scales of \(\mathbf{s}=[0.16,\,0.25,\,0.36,\,0.49]\) (25 landmarks per scale), for \(s_{1}=0.16\) and \(s_{4}=0.49\), from an input image size at \(640\times 480\). Thus, the resulting \(SW\) is 96, 80, 64 and 48 pixels, respectively, whilst \(SH\) is 72, 60, 48 and 36 pixels, respectively, for the four scales. In addition, \([BW,\,BH]\) are [256, 192], [320, 240], [384, 288] and [448, 336], respectively. Figure 3: An example of extracting 100 landmarks from four scales by MSW. The left image shows the original image. The top right four images illustrate the uniform sampling process with 0.16, 0.25, 0.36 and 0.49 scales, respectively. Twenty-five landmarks are extracted from each scale in this case.