# Texture Construction Edge Detection Algorithm
## 2 Texture Construction Edge Detection Algorithm
### Optimal Edge Thinning Process
(**a**) 0\({}^{\circ}\); (**b**) 90\({}^{\circ}\); (**c**) 180\({}^{\circ}\); (**d**) 270\({}^{\circ}\). Figure 3: Binary coding. Figure 2: Thinning process example. The binarized block texture template of different angles can be obtained using the binarized block texture template of 0\({}^{\circ}\). Figure 5 shows the schematic of a block texture template that uses a permutation order of the binarized coding order to obtain different angles. Figure 5a shows a texture change at 0\({}^{\circ}\) and a binarization code of 000011110. Figure 5b shows a texture change with Figure 5a rotated by 180\({}^{\circ}\) to the left and a binarization code of 011110000. Therefore, in the subsequent thinning texture template, only the 0\({}^{\circ}\) binarized block texture must be retained and the remaining three angle changed binarized block textures can be obtained by different coding orders. The binarized coding of the thinning texture template developed at the table is shown in Table 1. According to the number of pixels and the distribution, it can be summarized into 31 patterns and sorted according to the size of the binarized value. Among them, there are 28 types of templates with four angle changes, one type of template with two angle changes, and two types of templates with a single angle change. The four angle changes refer to the four different textures of the template containing 0\({}^{\circ}\), 90\({}^{\circ}\), 180\({}^{\circ}\), and 270\({}^{\circ}\) of angle rotation; the two angle changes refer to the two different textures of the pixels in the template containing 0\({}^{\circ}\) and 90\({}^{\circ}\) angle rotation; and the single angle change means that the template contains a texture of 0\({}^{\circ}\). Next, a processing method for filtering out redundant pixels of the candidate edge images processed by the non-maximum suppression method according to the thinning texture template prepared will be described. First, the edge point of the candidate edge image is taken as the center pixel and a block of 3 \(\times\) 3 pixels is taken out. When there is one pixel in the block, it is regarded as isolated noise filtering; when the block has two pixels, it is regarded as the end of the edge segment; and when there are three or more pixels in the block, the thinning texture template in Table 1 and its angled rotation are compared to see whether the texture changes match according to the number of pixels in the block. When they match, the redundant pixels in the candidate edge image are filtered out sequentially in the raster-scan process to achieve the best edge thinning process. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Number of pixels** & **4 Changes in Degree (0\({}^{\circ}\), 90\({}^{\circ}\), 180\({}^{\circ}\), and 270\({}^{\circ}\))** & **2 Changes in Degree (0\({}^{\circ}\) and 90\({}^{\circ}\))** & **1 Change in Degree (0\({}^{\circ}\))** \\ \hline
3 & 000110010 & & \\ \hline
4 & 000010111 & 00011110 & 00011001 & \\  & 00011010 & 000111010 & \\ \hline
5 & 00011111 & 001010111 & 0011101 & 010111010 \\  & 001111100 & & 010111101 & \\ \hline
6 & 000111111 & 001011111 & 00111101 & \\  & 0011111001 & 01011101 & 01011101 & \\  & 011111001 & 10111001 & \\ \hline
7 & 001111111 & 0010111111 & 01110111 & 01111110 \\  & 111110011 & 11111001 & & \\ \hline
8 & 01111111 & 101111111 & & \\ \hline
9 & & & & \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Thinning texture template binarization coding. Figure 5: Block texture template angle change. (**a**) 0\({}^{\circ}\); (**b**) 180\({}^{\circ}\). Figure 6 shows the preliminary thinning candidate edge image obtained in Figure 1c after the non-maximum suppression method. From the partial enlargement area, it can be observed that there are still redundant pixels around most of the edges, so it does not achieve the optimal edge thinning treatment. Figure 7 shows the best edge thinning image obtained after the thinning texture template processing.