# An Image Edge Detection Algorithm Based on an Artificial Plant Community
## 4 Algorithm Design
### Initialization of the APC  
In this step, the main parameters are initialized, including the population size \(S\), maximum number of iterations \(K\), iteration counter \(k\), seeding probability \(p_{s}\), growing probability \(p_{g}\), fruiting probability \(p_{f}\), and artificial plant individual \(x\). It is assumed that the seeding rate represents the ratio of the population size of the artificial plant community after a seeding operation to the original population size of the artificial plant community before seeding. The relationship of the seeding rate to the population size is shown in Table 2.  
As we can see from Table 2, negative growth of the population size will cause the artificial plant community to lose its search ability quickly, and positive growth of the population size will cause the search ability of the artificial plant community to continue to increase. However, an increase in the population size will also bring about a rapid decline in the convergence speed, and the temporal and spatial performance of the algorithm will also deteriorate rapidly. Here, it is recommended that the population size \(S\) of the artificial plant community should be fixed. The natural plant community is composed of a variety of plants, and each artificial plant has many individuals. Similarly, the artificial plant individual \(x\) is encoded into a set of possible edge pixels as a feasible solution variable. If the corresponding pixel is selected as an edge pixel, the corresponding binary bit in the artificial plant individual \(x\) is set to 1; otherwise, it is 0. To reduce the amount of computation required, pixels with habitable gradient values greater than the high threshold \(Th_{H}\) are marked as edge pixels, and they do not need to be calculated or solved. Hence, to obtain the feasible solution \(x\), we only need to search the candidate edge pixels below the high threshold \(Th_{H}\). Here, double thresholds are employed in the APC to implement edge detection and recognize false edges. After image preprocessing and nonmaximum suppression, we obtain all possible edges of the image \(I(i,j)\), together with many false edges. The gray value distribution of the habitable gradient edge image \(H(i,j)\) produced by the bi-threshold operator detection, is uneven. If the pixels with low nonzero habitable gradient values are \begin{table}
\begin{tabular}{c c} \hline
**Seeding Rate** & **Population Size after 50 Iterations** \\ \hline
0.8 & 0.850 \(\times\) original size \\
1.0 & 1 \(\times\) original size \\
1.2 & 1.250 \(\times\) original size \\
1.5 & 1.550 \(\times\) original size \\
2.0 & 250 \(\times\) original size \\
5.0 & 550 \(\times\) original size \\ \hline \end{tabular}
\end{table} 
Table 2: Seeding rate and population size. regarded as edge pixels, false edges will occur. Here, the use of two thresholds can help us efficiently identify the edge pixels, with a high threshold \(Th_{H}\) and a low threshold \(Th_{L}\). On one hand, pixels with habitable gradient amplitudes greater than \(Th_{H}\) must be edge pixels, not false edge pixels. On the other hand, pixels with habitable gradient amplitudes smaller than \(Th_{L}\) are false edge pixels, and may not be edge pixels. If the gradient amplitude of a pixel is greater than \(Th_{L}\) but less than \(Th_{H}\), it is necessary to judge the gradient amplitude values of its neighboring pixels. Hence, if the gradient amplitude value of a neighbor pixel is greater than \(Th_{L}\) and less than \(Th_{H}\), the APC algorithm is employed to judge a candidate edge pixel. \[\left\{ \begin{array}{l}if\ H(i,j)>Th_{H},\ \text{then}\ i\ \text{is an edge pixel}\\ \ \text{else}\ if\ H(i,j)<Th_{L},\ \text{then}\ i\ \text{is a false edge pixel}\\ \ \text{else, APC selects}\ i\ \text{as an edge pixel by hueristic search}\end{array} \right. \tag{8}\]  
Many potential edges identified in Equation (7) are officially recognized as edges because their gradient amplitudes are higher than the high threshold \(Th_{H}\), but the connectivity is low.