## 2 Detection Model
### Foreground Motion Blocks Extraction
#### 2.1.1 Sampling Areas Determination
* **Stable and Others**: For a stable situation, it is easy to judge by checking whether \(E(|V(\mathbb{X})|)\simeq 0\) or \(Var(|\mathcal{MV}(\mathbb{X}|)\simeq 0\). Besides, the sampling set \(\mathbb{X}\) contains most of intracoded blocks (\(|\mathbb{X}^{C}|\gg|\mathbb{I}|\)), which indicates the stable situation as well. The last circumstances \(C^{\prime}\) is named as \"rest\" when it does not satisfy any of the above circumstances. Please note that \(C^{\prime}\) may consist some important situations that we have ignored in previous detection steps. For example, the combination of panning and zooming, which occurs frequently in video recording. It is hard to decompose both panning and zooming motion vector component since the panning component can have any directions and norms. An alternative way is to simplify this problem by extracting the horizontal and vertical panning motion vectors from the composed one separately. We consider the upper-right corner sampling area in Figure 4 for instance, solid lines represent the extracted motion vectors, and they can be forced to decompose into the zoom-in and the retrieved horizontal/vertical components (dotted lines and red solid lines). The norm of the zoom-in component is set as a fixed value to make sure the retrieved motion vector is horizontal or vertical. We re-compare the retrieved horizontal and vertical components for the sampling areas using the camera panning model; if it satisfies the conditions, the status of camera is both panning and zooming. On the other hand, the zoom-out situation follows the same rule as the zoom-in. We propose a decision tree model is designed for global motion detection, as depicted in Figure 5.

Also, a related algorithm is written in Algorithm 2. ```
1:if\((E(|V(\mathbb{X})|)\simeq 0\) and \(Var(|V(\mathbb{X})|)\simeq 0)\)or\(|\mathbb{I}^{\mathbb{C}}|\gg|\mathbb{I}|\), return\(C_{s}\). 2: Compute \(S_{cp}\) using (11), if\(S_{cp}>t_{h1}\), return\(C_{p}\). 3: Compute \(S_{z}\) using (18), if\(|S_{z}|>t_{h2}\) and \(S_{z}>0\)return\(C_{zi}\). 4:elseif\(|S_{z}|>t_{h2}\) and \(S_{z}<0\)return\(C_{zo}\). 5:elsereturn\(C^{\prime}\). ```

**Algorithm 2** Global motion decision algorithm

The tree is mainly classified into three categories: stable, panning, zooming, and they are ordered by occurrence probabilities. Threshold \(t_{h1}\) and \(t_{h2}\) are induced to control the detection precision. #### 2.1.3 Global Motion Compensation

A global motion compensation procedure is recommended for each block to retrieve the foreground MVs. Since the coding unit (CU) has different resolutions both in VPX and in HEVC, it is recommended to unify the block size for processing as \(8\times 8\). For each block \(b_{i}\) in a frame, its compensated motion vector is computed through:

\[mv_{r}(b_{i})=mv(b_{i})-mv_{g}(b_{i}), \tag{19}\]

where \(mv_{r}(b_{i})\) and \(mv_{g}(b_{i})\) denote the real and global motion vector respectively. The key problem is to compute \(mv_{g}\) for each block \(b_{i}\) in different camera circumstances. Consider each element \(h\in\mathcal{H}\)

Figure 4: Motion vector decompostion on horizontal and vertical directions. Figure 5: A decision tree model for global motion detection. for \(h=C_{s}\), \(mw_{r}(b_{i})=mv(b_{i})\); For \(h=C_{p}\), \(mv_{g}(b_{i})=E(\mathcal{MV}(\mathbb{X}))\); For \(h=C_{zo}\) and \(h=C_{zi}\), according to Figure 3, it might be asserted that \(mrg_{b}(b_{i})\) and \(\widehat{f_{bi}}\) have the same or opposite directions, in other words, \(\frac{mrg_{b}(b_{i})\cdot\widehat{f_{bi}}}{|mrg_{b}(b_{i})|\widehat{f_{bi}}|} \simeq\pm 1\). When \(h=C_{zi}\), \(mv_{g}(b_{i})=\widehat{f_{bi}}\), and when \(h=C_{zo}\), \(mrg_{g}(b_{i})=-\alpha\widehat{f_{bi}}\).