The invention relates to an image-based 
steel bar end face automatic recognition counting 
algorithm. First of all, the end face region which needs to be processed in the image is extracted. the imageis preprocessed, which includes image scaling, 
Gaussian filtering; using cloud model to classify 
pixel color, obtaining preliminary segmentation of image according to the 
classification result, extracting parameters after closed operation to the segmented large connected region, including 
area ratio, center of gravity, aggregation degree, linear weighting to obtain reference value and selection, and obtaining end face region to be processed. Then the end face area is counted by fixed 
branch separation. Some images are preprocessed, including 
grayscale, 
histogram equalization and adaptive threshold binarization, and the 
binary image of the face region is obtained. Estimated 
radius of a single face is obtained by 
particle size measurement method, template is constructed according to formula,
template matching is carried out, and the center position of the face is obtained. Finally, the robustness of the 
algorithm is improved by restriction conditions. The average correct rate of the invention can reach 97%.