# An Automatic Counting Algorithm for Topographic Maps Based on Videos for Map Management
## 3 Materials and Methods
### The Proposed Fusion Window Counting Algorithm
#### 3.2.1 Deformable Parts Model Based on Fast Feature Pyramids
According to the relationship between the appearance of mechanical wheels and the clarity change in the images in the video, the clearer frames corresponding to sheet designations are mainly concentrated in the interval without mechanical wheels. At the same time, because the pictures in this interval are visually free of mechanical wheel occlusion, the influence of the mechanical wheels on the clarity calculation of the images can also be reduced. Therefore, we propose a fusion window counting model, combining the FFP-DPM-ROI algorithm with IQA. Firstly, the mechanical wheels are quickly detected according to the improved deformable parts model. Secondly, the SMD function is used as the clarity assessment algorithm to quantify the image quality, and the two are combined to build the counting model. The specific combination process is as follows:  
Assume that the detection result and clarity value of the \(i\)th frame image are \(D_{i}\) and \(T_{i}\), respectively. If the mechanical wheel is detected, assign \(D_{i}\) to 1, otherwise assign 0; then, each video will obtain the periodic pulse curve of the detection result \(D_{i}\) about image \(i\). Through the above analysis, the clarity curves need to satisfy the following. \[T_{i}=\left\{ \begin{aligned} T_{i},D_{i}=0\\ 0,D_{i}=1\end{aligned} \right. \tag{9}\]  
Let the length of the \(j\)th interval without the mechanical wheel be \(I_{j}\), and the extremum of clarity in the interval be \(T_{jmax}\). If the interval satisfies \(\forall i\in[l,k],D_{i}\equiv 0\) and \(D_{k+1}=1\), then  
\[\left\{ \begin{aligned} I_{j}=k-1\\ T_{jmax}=max\{T_{i},T_{i+1},\cdots,T_{k}\}\end{aligned} \right. \tag{10}\]  
For each video, there is a theoretical interval without mechanical wheels in the video for each map counting process, and there is an extremum in each interval. However, the actual videos cannot accurately correspond one by one; so, the following different methods are used to define the windows in which the extremums are located in order to realize the counting. Suppose that the size of the window in which the \(m\)th extremum is located is \(W_{m}\). 1. Adaptive window method: take each \(I_{j}\) directly as the size of the window, i.e., \(W_{m1}=I_{j}(m=j)\); the number of extremums obtained is \(num_{a}\). 2. Fixed window method: take the fixed value as the size of the window, i.e., \(W_{m2}=Mo\left(I_{j}\right)\), where \(Mo\) is the mode function; generally, \(m\
eq j\) and the number of extremums obtained is \(num_{f}\). 3. Fusion window method: The toggle speed of the mechanical wheel is approximately uniform; there are several intervals of different lengths, but the lengths are stable within the threshold range of a certain fixed value \(W_{m2}\); so, the counting results of the above two methods can reflect each other. The fusion window counting model fuses the two, and if we set the final count value of the topographic maps in the video to \(Num\), then \[Num=\left\{ \begin{aligned} Num+1,num_{a}=num_{f}\\ Num,num_{a}\
eq num_{f}\end{aligned} \right.\] (11) That is, if \(num_{a}=num_{f}\), the map counting result is increased by one, and this method is used to count each interval in the video to obtain the final number of maps.