# Machine-Vision-Based Algorithm for Blockage Recognition of Jittering Sieve in Corn Harvester
## 2 Material and Method
### Algorithm of sieve Dividing  
As is shown in Figure 1a, the jittering sieve is composed of a set of tiered sub-sieves. In order to provide basis for automatic blockage cleaning, it is necessary to locate the blockages to the sub-sieves. Therefore, the first task of our study is to accurately divide the sieves. For this purpose, we develop a dividing algorithm that is summarized as Algorithm 1. The division of a sieve can be regarded as the problem to recognize the edges of each sub-sieve. For readable we provide an example while we introduce the algorithm. The original image with the spatial size of \(600\times 500\) is presented in Figure 1a \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Notation** & **Definition** & **Notation** & **Definition** & **Notation** & **Definition** \\ \hline \(x,a...\) & scalars & \(x,a...\) & vectors & \(X,A...\) & matrices \\ \(\underline{\mathbf{X}},\underline{\mathbf{A}}\) & tensors & mean\((\cdot)\) & mean value & \(\|\cdot\|_{F}\) & Frobenius-norm \\ \(\text{Cov}(\cdot)\) & covariance & \(\text{Var}(\cdot)\) & variance & \(\rho(\cdot)\) & cross-correlation \\ \hline
**Abbreviation** & **Full Name** & **Abbreviation** & **Full Name** & **Abbreviation** & **Full Name** \\ \hline \multirow{2}{*}{RGB} & red, green, & \multirow{2}{*}{MV} & \multirow{2}{*}{machine vision} & \multirow{2}{*}{F-norm} & \multirow{2}{*}{Frobenius-norm} \\  & blue & & & & \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Notations and abbreviations. and it is denoted by \(\underline{\mathbf{X}}\in\mathcal{R}^{n_{1}\times n_{2}\times 3}\). Let its first order and second order represent the row and column, respectively. We first recognize the row edges. The strategy is based on the fact that the luminance of the pixels in row edges is obviously lower than that in other positions. In other word, if we denote \(\mathbf{e}_{row}\in\mathcal{R}^{n_{1}}\) and \(\mathbf{e}=\|\underline{\mathbf{X}}(i,:,:)\|_{F}\), the indexes of minimums in \(\mathbf{e}_{row}\) should indicate the row edges, and these minimums show the approximate cyclicity as the widths of sub-sieves are close. To avoid the choice of minimums that do not indicate row edges, the cyclicity, \(c_{row}\), should be determined. For this purpose we utilize the zero-centering operation to \(\mathbf{e}_{row}\) (step 6 of Algorithm 1), and then use the trigonometric function to fit it. This procedure is shown in Figure 1b. Next, we select the minimums of \(\mathbf{e}_{row}\) based on the constraint that two adjacent points are at least \(0.85c_{row}\) apart, and the result is presented in Figure 1c, where the indexes of red points, written as \(\Gamma_{row}\) indicate the positions of row edges. ```
0: Original RGB image \(\underline{\mathbf{X}}\in\mathcal{R}^{n_{1}\times n_{2}\times 3}\), aspect ratio of sub-sieves \(\mu\). 1: Initialize matrix \(\mathbf{A}=\mathbf{0}\in\mathcal{R}^{n_{1}\times n_{2}}\);
2: Initialize vector \(\mathbf{e}_{row}\in\mathcal{R}^{n_{1}}\);
3:for each row \(i\in\{1,2,\cdots,n_{1}\}\)do
4: Denote \(\mathbf{X}_{i}=\underline{\mathbf{X}}(i,:,:)\) and compute \(\mathbf{e}_{row}(i)=\|\mathbf{X}_{i}\|_{F}\);
5:endfor
6:\(\mathbf{e}_{row}\leftarrow\mathbf{e}_{row}-\text{mean}(\text{e}_{row})\);
7: Utilize trigonometric function to fit \(\mathbf{e}_{row}\), obtaining the cycle \(c_{row}\), \(\alpha_{row}=0.03c_{row}\);
8: Find the minimums of \(\mathbf{e}_{row}\), and two adjacent minimums are at least \(0.85c_{row}\) apart. The indexes of these minimums are denoted as \(\Gamma_{row}\);
9: Denote \(\underline{\mathbf{X}}=\underline{\mathbf{X}}(\Gamma_{row},:,:)\), \(c_{col}=\mu c_{row}\), \(\alpha_{col}=0.03c_{col}\);
10: Repeat the strategy given in steps 2-5 to obtain the F-norms each column of \(\underline{\mathbf{X}}\), denoted as \(\mathbf{e}_{col}\in\mathbb{R}^{n_{2}}\);
11: Find the maximums of \(\mathbf{e}_{col}\), and two adjacent maximums are at least \(0.85c_{col}\) apart.