| Peanut is widely used in related fields such as food and industry because of its rich composition.However,affected by climate and other external environmental factors.Peanuts can be moth-eaten,breakage,and mildew during harvesting,shipping,and storage.The commonly methods of sorting peanut kernels include manual selection and Color Sorter,but both have obvious shortcomings.Computer vision technology has the advantages of no damage and fast speed,so it has a wide range of applications in agricultural engineering.This paper uses computer vision technology to detect the appearance quality of peanut kernels.A peanut kernel recognition method based on principal component analysis(PCA)to optimize characteristic parameters and combining sparrow search algorithm(SSA)with support vector machine(SVM)is proposed.While realizing the classification of intact,damaged and mildewed peanut kernels,the classification efficiency and accuracy are greatly improved.Finally,the research on the peanut kernel size grading method and the design of the online detection and grading system are completed.The specific research contents carried out in this paper are as follows:(1)Research on image preprocessing method of peanut kernel.Firstly,the mean shift algorithm is selected through experiments to denoise the peanut kernel image.The B channel image is extracted based on the component method as a grayscale image.Then the histogram threshold segmentation method is used to separate the target and the background.Finally,the image of a single peanut kernel without background is intercepted by the circumscribed rectangle method.(2)Research on color and texture feature extraction algorithm of peanut kernels and dimensionality reduction of feature parameters.Firstly,the color features of H,S and V components are extracted based on HSV space.Considering that the color feature alone will cause misclassification,it is necessary to add texture features to distinguish.In order to facilitate the extraction,the texture feature extraction area is cropped and grayscale transformed,and the grayscale texture features of peanut kernels are extracted based on the grayscale co-occurrence matrix method.Due to the strong correlation between the feature parameters,principal component analysis is used to reduce the data dimension of the color and texture feature parameters at last.(3)A peanut kernel classification model based on sparrow search algorithm(SSA)optimization support vector machine was constructed.By using the sparrow search algorithm to optimize the parameters of the support vector machine,the SSA-SVM classification model is constructed.Compared with the traditional SVM,the recognition accuracy is increased by 1.66%.Then,the feature parameters before and after dimensionality reduction are input into the SSA-SVM classification model for testing.The recognition accuracy rates of both are 98.33%,but the model iteration time is shortened by 29.1% after dimensionality reduction.(4)Research on peanut kernel size grading method and software system design.Firstly,the image edges are expanded,filled and cropped to remove incomplete peanut kernels.The area is selected as the characteristic parameter of peanut kernel classification,and the K-mean clustering algorithm is used to determine the classification benchmarks at all levels.Compared with the manual classification results,the accuracy rate is 92.5%.Based on the MFC library,the visual interface of peanut kernel size grading system is developed.and the functions of peanut kernel image reading,processing and result display can be realized through the operation interface. |