## 3 Materials and Methods
### Terminology, Notation, and Definitions
If there is no need to reference \(V\), we omit the superscript and refer to \(F_{l}\) as the contextualized frame of \(K_{l,\Delta}\). For example, let \(V=(F_{1},\ldots,F_{1+4})=(F_{1},F_{2},F_{3},F_{4},F_{5})\), then the 3-context of \(F_{1}^{V}\) is  
\[K_{1,3}^{V}=\left(F_{\phi(1-3)},F_{\phi(1-2)},F_{\phi(1-1)},F_{\phi(1)},F_{ \phi(1+1)},F_{\phi(1+2)},F_{\phi(1+3)}\right)\cap V=\]  
\[(F_{1},F_{1},F_{1},F_{1},F_{2},F_{3},F_{4})\cap(F_{1},F_{2},F_{3},F_{4},F_{5}) =(F_{1},F_{2},F_{3},F_{4}).\]  
Analogously, the 2-context of \(F_{4}^{V}\) is  
\[K_{4,2}^{V}=\left(F_{\phi(4-2)},F_{\phi(4-1)},F_{\phi(4)},F_{\phi(4+1)},F_{ \phi(4+2)}\right)\cap V=\]  
\[(F_{2},F_{3},F_{4},F_{5},F_{5})\cap(F_{1},F_{2},F_{3},F_{4},F_{5})=(F_{2},F_{3 },F_{4},F_{5}).\]  
If \(F_{l}\in V\), then \(F_{l}(r,c)\) is the pixel value at row \(r\) and column \(c\) in \(F_{l}\). If \(F_{l}\) is a frame whose pixel values at each position \((r,c)\) are real numbers, we use the notation \(\max\{F_{l}\}\) to refer to the maximum such value in the frame. If \(V=(F_{t},\ldots,F_{t+k})\), then the mean frame of \(V\), denoted as \(F_{\mu}^{V}\) or \(F_{\mu}\) when \(V\) can be omitted, is the frame where the pixel value at \((r,c)\) is the mean of the pixel values at \((r,c)\) of all frames \(F_{l}^{V}\), as defined in Equation (3). \[F_{\mu}^{V}(r,c)=\frac{1}{k}\sum_{l=t}^{t+k}F_{l}^{V}(r,c) \tag{3}\]  
If pixels are \(n\)-dimensional tuples (e.g., each \(F_{l}^{V}\) is an RGB or PNG image), then each pixel in \(F_{\mu}^{V}\) is an \(n\)-dimensional tuple of the means of the corresponding tuple values in all frames \(F_{l}^{V}\). Let \(V=(F_{t},\ldots,F_{t+k})\) be a video, and let \(\Delta\) be a context size and \(K_{l,\Delta}^{V}\) be the context of \(F_{l}^{V}\). The \(l\)-th dynamic background frame of \(V\), denoted as \(B_{l,\Delta}^{V}\), \(t\leq l\leq t+k\), is defined in Equation (4) as the mean frame of \(K_{l,\Delta}^{V}\) (i.e., the mean frame of the \(\Delta\)-context of \(F_{l}^{V}\)). \[B_{l,\Delta}^{V}=F_{\mu}^{K_{l,\Delta}^{V}} \tag{4}\]  
In general, the dynamic background operation specified in Equation (4) is designed to filter out noise, blurriness, and static portions of the images in a given video. As the third video set in the supplementary material shows, BeePIV can process videos taken against the background of grass, trees, and bushes. For an example, consider a 12-frame video \(V\) in Figure 2, and let \(\Delta=3\). Figure 3 shows 12 dynamic background frames for the video in Figure 2. In particular, \(B_{1,3}^{V}\) is the mean frame of \(K_{1,3}^{V}=(F_{1},F_{2},F_{3},F_{4})\) of \(F_{1}^{V}\); \(B_{2,3}^{V}\) is the mean frame of \(K_{2,3}^{V}=(F_{1},F_{2},F_{3},F_{4},F_{5})\) of \(F_{2}^{V}\); \(B_{3,3}^{V}\) is the mean frame of \(K_{3,3}^{V}=(F_{1},F_{2},F_{3},F_{4},F_{5},F_{6})\) of \(F_{3}^{V}\); and \(B_{4,3}^{V}\) is the mean frame of \(K_{4,3}^{V}=(F_{1},F_{2},F_{3},F_{4},F_{5},F_{6},F_{7})\) of \(F_{4}^{V}\). Proceeding to the right in this manner, we reach \(B_{12,3}^{V}\), the last contextualized frame of \(V\), which is the mean frame of \(K_{12,3}^{V}=(F_{9},F_{10},F_{11},F_{12})\) of \(F_{12}^{V}\). Figure 2: Twelve frames of a video \(V=(F_{1},\ldots,F_{12})\). A neighborhood function maps a pixel position \((r,c)\) in \(F_{l}\) to a set of positions around it. In particular, we define two neighborhood functions \(h_{4}(r,c)\) (see Equation (5)) and \(h_{8}(r,c)\) (see Equation (6)) for the standard 4- and 8-neighborhoods, respectively, used in many image processing operations. Given a position \((r,c)\) in \(F_{l}\), the statement \((\exists(k,l)\in h_{8}(r,c))(k<r\wedge l<c)\) states that the 8-neighborhood of \((r,c)\) includes a position \((k,l)\) such that \(k<r\) and \(l<c\).