| Hazelnut is one of the common nut tree species.The shell is hard,the kernel is crispy and delicious,and the aroma is sweet.It can be eaten raw or fried.It is deeply loved by everyone.Because hazelnut kernels are rich in protein,vitamins,calcium,iron,and phosphorus.And other trace elements and a large amount of oil,so the demand is increasing in the food processing industries such as baking and oil.Affected by growth environment and storage conditions,hazelnut kernels often have defects such as shriveled,moth-eaten,mildew,and rot.Traditional classification and identification mainly rely on manual sorting,which is inefficient and has different evaluation criteria.It is easy to make mistakes and the quality level of hazelnut kernels cannot be effectively guaranteed.In addition,the shapes of hazelnut kernels are roughly the same,and the difference is not visible to the naked eye.Due to different origins,types and picking periods,the difficulty of identifying and classifying hazelnut kernels will be further increased.It is difficult to clearly divide the sample with the traditional threshold The background is separated.Aiming at such problems,this paper introduces the bionic algorithm-moth-to-fire algorithm,and combines it with the traditional threshold segmentation algorithm to find the best threshold.First,the overall image and individual individual image of the hazelnut kernel sample are collected separately,and the obtained original image is processed with wavelet noise reduction to remove interference.Threshold segmentation of the image by moth extinguishing algorithm,fusion of PSO algorithm,and adding adaptive weights to avoid local minimization caused by iteration,so that moths can achieve better results in both the global optimization in the early stage and the local optimization in the later stage.Effect,reduce time loss and effectively improve computing efficiency.This achieves a good separation of the fine edges of the hazelnut sample from the overall image.Through three types of measurement indicators,the traditional OTSU method,the before and after improvement of the moth fire fighting algorithm are compared.It can be seen from the experimental results that the improved algorithm has better segmentation effect and higher recognition efficiency.Finally,through morphological analysis,the edges of individual samples of hazelnut kernels are extracted and the inflection points of the edges are marked.Calculate the number of inflection points at the same time,and then mark the defective kernels by judging the degree of smoothness of the hazelnut kernel surface.The Hough transform is used to fit the elliptic curve to the edge of the hazelnut kernel sample image,mark and output the num ber of full kernels,so as to realize the defect detection of the hazelnut kernel.The experimental results show that this method can accurately and quickly detect and screen the defective grains in 5 kinds of hazelnut kernels(full,shriveled,mildew,moth-eaten,and rotten),and the accuracy rate reaches more than 95%,which effectively improves the processing of hazelnut kernels.Sorting efficiency in the process. |