With the improvement of living standards,nuts have become an essential health food in people’s daily life.At present,in nut detection,most industrial sites also use manual or single equipment for detection,the quality of nuts detected is uneven,and the efficiency is low.In order to obtain high-quality nuts,this study takes walnut nuts as an example to design an on-line detection system of nut size and defect classification based on machine vision.The main purpose of the system design is how to use machine vision technology to further improve and improve the detection method of nut size and defect classification,so as to quickly and accurately detect high-quality nuts,to meet people’s demand for nut food.The system can not only improve the accuracy rate of detection results,but also has strong applicability,and can be applied to other kinds of nut detection.The main contents of this paper are as follows(1)In the image processing part,according to the external characteristics of walnut nuts,image filtering,image segmentation,image filling,connected domain division and other corresponding image processing methods are used to preliminarily complete the segmentation of the target area and background in the image,which lays the foundation for the subsequent realization of walnut nut size and defect classification.(2)In the dimension detection part,based on the analysis of image processing methods,the geometric feature extraction methods of area,eccentricity and minimum circumscribed rectangle are proposed.The results show that the geometric feature method can effectively extract the outer contour of walnut.Based on the analysis of camera calibration algorithm,the transformation relationship between each coordinate system is solved,and the pixel processing and fitting measurement of the target area are carried out to obtain the pixel distance.According to the inside and outside parameters of the camera and the pixel distance,the coordinates of the corresponding points in the world coordinate system and the corresponding contour length are obtained.The results show that the algorithm based on camera calibration and fitting measurement can quickly and accurately detect the actual size of walnut nuts.(3)In the part of defect classification and detection,aiming at distinguishing the feature types of external defects of walnut nuts,the paper further studies and analyzes whether there are defects on the surface of walnut nuts,and proposes a transfer learning method based on the combination of multiple adaptive balance tradaboost algorithm and heuristic algorithm.According to the similarities between the fields,the method applies the data of the developed field to the undeveloped field for learning,that is,modifies the existing template,and then applies it to other related tasks or problems.Compared with KNN,SVM,CNN and BP neural network methods,this method does not need to label a large number of data sets in the process of image classification,does not over fit the results,and has the advantages of high efficiency and high accuracy.The results show that the method can effectively control the influence of data differences on the accurate establishment of training model,so as to lay the foundation for the safe and reliable operation of the system and maintenance decision-making.(4)The design and implementation of the system platform takes the industrial camera as the image acquisition equipment,the industrial computer as the data transmission and processing center,the controller operates the console,uses TCP / IP protocol and serial communication for data transmission,and designs the nut size and defect classification online detection system platform.Results on the surface,the system can realize the online detection of walnut nut size and defects with high accuracy and high efficiency. |