Local feature extraction of sheepskin based on structure contour shape description

. Based on the precise sheepskin contour extracted by computer vision technology in the previous research of the team, this paper proposes the shape description technology based on the structure contour to extract the local features of the sheepskin, such as the head and hooves and the waste edge, which is the basis for the automatic edge removal of the sheepskin in the future. The algorithm uses Angle and position relation to segment the precise contour track of raw sheepskin into graph elements, and then uses geometric parameter shape description operator to describe and extract the edges that need to be removed, so as to obtain the starting point and end point of each local contour that needs to be removed. In this paper, the principle and implementation steps of this method are introduced in detail, and the experimental simulation verification shows that the extraction effect is good, which can meet the requirements of subsequent industrial production of automatic sheepskin cutting.


Introduction
Sheepskin production and processing enterprises automation level is relatively low, is still a typical labor-intensive industry. At present, the manual removal of sheepskins is laborintensive and the working environment is poor. Enterprises are facing increasingly severe labor difficulties. The automatic edge removal of sheepskin can be realized by computer vision processing technology, which can liberate the production labor force and greatly improve the production and processing efficiency and optimization cost of sheepskin production enterprises. The research team accurately extracted the contour information of sheepskin from the captured images in the early stage. At present, it is necessary to accurately identify the extremely uneven local contour features such as the head, hoofs and corners that need to be removed, so as to supplement the visual work of automatic edge removal of sheepskin.
To extract local target features, the image needs to be described first [1]. Common contour-based methods include Freeman chain code, curvature scale space descriptor, Fourier descriptor, wavelet descriptor and boundary moment, etc [2]. Fourier descriptors use low-frequency components to describe contours, which have the advantages of simple calculation, easy normalization and easy matching, but are not effective in identifying sharp or weak changes of contours [3]. The polygon approximation method has the advantages of simplifying the model and reducing the amount of data and low anti-interference, but for shape images with too complex shape, the approximation accuracy is difficult to grasp, and information is easy to be lost or description invalid [4]. Curvature scale space descriptor is a popular research method at present. Adamek et al. proposed a multi-scale space description method that uses shape convexity to represent shape features. This method hierarchically describes shape contour in multi-scale space and can distinguish the difference of shape boundary in detail [5]. Umut Konur et al. proposed the method of extracting fetal skull contour features in ultrasonic (US) mode by estimating CSS matching cost, which has better classification effect than the classical method [6]. However, this kind of method has the problem that the model is too complex to describe for the complexity of contour information. In order to ensure the subsequent accurate cutting, the precise information of the edge is retained during the extraction of sheepskin contour information, and the shape is relatively complex. Therefore, it is very complicated to extract the local information of the target using these conventional shape description methods, and the extraction effect is not good, which has certain limitations.
In view of the complexity and undirectedness of sheepskin contour, a local target extraction algorithm suitable for sheepskin image is proposed. This method is mainly used contour centroid localization image contour, and then use the contour centroid and the Angle of the relationship between the contour points section outline form figure yuan, then iterate over all form primitive Angle, and the perimeter shape is used to describe the operator, set the reasonable threshold required primitives extraction and optimize the extracting primitive merged to form the cutting path, achieve the goal of effective segmentation.

Problem description
The sheepskin contour images extracted by computer vision technology in previous studies are shown in Figure 1. According to a large number of experimental studies and observations on the sheepskin image shown in Figure 1, it is found that the sheepskin contour has the following relatively significant characteristics, which provides research ideas for feature extraction that needs to be extracted. Firstly, the sheepskin is not required to be placed in a flat position when collecting images, since the sheepskin contour image has no direction. Secondly, the shape and size of the cut head and hoof and waste skin of the sheepskin are different, which makes it difficult to directly use the shape description operator to extract the required local features. But the most striking feature of the sheepskin is the convex and jagged shape of the four hooves and the laminae, while the rest are more gentle, and each of them is at a similar Angle to the centre of the outline. A local feature extraction algorithm based on Angle relation and shape description operator is proposed.

Algorithm design
The algorithm mainly needs to solve the three problems of how to segment the primitives, how to describe the primitives, and how to optimize the primitives. As shown in Figure 1, the primitives formed by the target and other parts and the contour centroid at a certain angle have a strong distinguishing ability. The edges of raw sheepskin except for the head and hoof are relatively smooth, and generally appear similar to straight lines and arcs. And the graphic elements of the toe and waste edges that need to be cut are obviously half-enclosed or sharper for the contour centroid, so you can use the angle relationship to segment the contour to form the graphic element. Because of the randomness of segmentation, there is the situation that the starting point of segmentation directly divides the target graph elements. Moreover, the extraction target has the characteristics of different shapes and sizes. To solve this problem, searching for target features from every Angle of traversal image not only solves the problem of segmental starting point misclassification, but also improves the accuracy of target extraction. Aiming at the problem of how to describe the characteristics of the target graph, we can use the structural characteristics of the two graphs. One index that can easily distinguish the two is the perimeter of the graph, which is represented by the number of contour points of the graph in the form of data. The figure element of the head and hoofs shows a larger circumference, while the other parts are just the opposite. Only a reasonable threshold can be set to achieve preliminary segmentation and extraction. Since all the angles are traversed and the results of threshold segmentation are directly used for cutting, there are problems such as repetitive cutting, low cutting efficiency and inaccurate cutting position. Therefore, it is necessary to optimize the extracted meta-graph information. Overlapping primitives are redistributed from the starting and ending points of the contour into new primitives, and the straight line formed by the starting and ending points of the new primitives are taken as the cutting path. This can improve the cutting rate and avoid a wide range of repetitive cutting.

Implementation of feature extraction algorithm
The contour extraction algorithm has four main parts. The specific operation steps are as follows.
First of all, the contour information of the contour image is calculated using formula 1 to get the abscissa and ordinate of the center of mass, namely: where, X is the x-coordinate of the center of mass, Y is the y-coordinate of the center of mass, is the x-coordinate of the contour point , is the y-coordinate of the contour point , and N is the total number of contour points. The angles of all contour points to the center of mass can be calculated according to Formula 2: is the Angle from the contour point to the center of mass of the contour. An array 1 ( is an integer of -180° to 180°) is created to store the contour points of each Angle , and an array 2 is created to store the sequence numbers of the contour points of Angle . To filter the contour points and find from 180° to 180° every integer Angle between all the deviation in not more than ±0.5° point into the outline of each corresponding array 1 degree. Then, formula 3 is used to calculate the distance between the contour points in 1 array and the center of mass, namely: = �(Y − ) 2 + (X − ) 2 (3) where, is the distance between contour point I and the center of mass. The distance of each contour point in 1 array was compared. The point with the smallest distance was stored in the array. Meanwhile, the sequence number of contour points was stored in the array 2 , and the unique contour point and the sequence number of contour points corresponding to each Angle were found. Secondly from -180° to 180° clockwise every Angle of 9° performance form 361 primitives. Describe each set of graph elements, and calculate the perimeter of each set of graph elements according to Formula 4: where, is the contour perimeter of the primitive . Then set a reasonable screening threshold * , and use formula 5 to calculate * , namely: * = 3N/100 (5) Use formula 6 to filter all primitives: Finally, take out all the eligible pixels and optimize the extracted pixels, so that the overlapping pixels can be directly combined to form the new pixel with the largest circumference. The straight line segment at the beginning and end of the pixel can be used as the main cutting tool route.

Results and discussion
The programming environment of this experiment is Open CV2  It can be seen from Figure 2 that the algorithm can effectively extract the heads and hooves that need to be removed and some large defects in the accurate sheepskin contour image. Due to the certain difference in the shape features of the toe and the waste edge, the selection of different segmentation angles and starting angles has a greater impact on feature extraction. Figure 2 shows the defect features extracted from each angle. It can be seen that the smaller the angle is selected, the more accurate the feature positioning, but the worse the cutting position, and different starting positions will also affect the cutting position. In order to avoid the negative influence caused by the angle, the features of overlapping primitives extracted under the full angle are selected to merge to form a new primitive, which can eliminate the adverse influence caused by the angle. The feature image extracted after optimization is shown in Figure 3. It can be seen from Figure 3 that the accurate positioning of features and cutting under this algorithm can improve cutting efficiency and reduce invalid segmentation. In addition, the algorithm can extract all sharp heads and hoofs and edges with large defects, and the extracted cutting routes will be independent and will not interfere with each other.

Conclusion
Combining computer vision measurement technology and local feature extraction technology of shape description to realize automatic removal of sheepskins, changing the work mode of manual removal of sheepskins in primary processing enterprises. It solves the problem of labor intensity in the production and processing of enterprises, and the difficulty of employment caused by the harsh working environment, while greatly improving production efficiency and optimizing production costs. The sheepskin local feature extraction algorithm proposed in this paper can accurately and quickly locate the features to be cut, describe the primitives accurately and with low error, filter the extraction target and mark the cutting position, and realize the search of the cutting path. The method can meet the demand for automatic trimming of industrially produced raw sheepskins.