A kind of insole automatic classification method based on shape and color characteristicTechnical field
The present invention relates to machine vision and machine learning field, the present invention can be widely applied to insole manufacturing and processing enterpriseA kind of insole automatic classification method based on shape and color characteristic in industry on insole assembly line.
Background technology
In insole manufacturing enterprise, the insole come out from different molding presses proceeds on assembly line, and operative employee needs will notSame type insole carries out manual identified, manual sort, and then by same type, for example same shape and color beatPacket, this mode the degree of automation is low, and low production efficiency, especially for the assembly line of big flux, effect is undesirable.Machine visionWith identification stablize, quickly, it is untouchable the features such as, replace human eye to have bright prospects with vision, currently, be directed to insole it is specialProfit concentrates on health-care hospital, tracks suspect according to shoe sole print.And in production line, the automatic identification to insole and classificationPatent do not have.
Invention content
The purpose of the present invention is to provide one kind being used for production line, to the automatic identification and sorting technique of insole.
A method of the insole based on shape and color characteristic is classified automatically, it is characterised in that including:
(1), insole or so foot recognition methods, steps are as follows:
1. calculates third moment to the profile of input, profile barycenter (Xc, Yc) and main shaft slope are calculated, and calculate by matterHeart vertical major linear equation L1;
2. puts calculating one by one to 1. middle input profile, judge a little in straight line L1Left side or right side;
3. calculates separately straight line L1Left and right side profile point area S1、S2And barycenter (X1,Y1) and barycenter (X2,Y2);
4. judges S1And S2Size, if S1More than S2, then S1For toe part, according to (X1,Y1) and (Xc, Yc)Position relationship obtains the rotation angle of needs, and profile is rotated around (Xc, Yc) in making 1, makes (X1,Y1) with (Xc, Yc) straight line in waterProsposition is set, and toe-cap is towards a left side;If S2More than S1, then S2For toe part, according to (X2,Y2) and (Xc, Yc) position relationship, it obtains and needsRotation angle, in making 1 profile around (Xc, Yc) rotate, make (X2,Y2) with (Xc, Yc) straight line in horizontal position, toe-cap is towards a left side;
5. obtain pivoting rear wheel exterior feature convex closure region with rotate rear region difference, difference region barycenter (Xres,Yres), if Yres is less than Yc, it is judged as left foot, if Yres is more than Yc, is judged as right crus of diaphragm.
(2), off-line training includes the following steps:
1. piece images have multiple insoles, first manual rectangle frame selects insole, then carries out medium filtering to image, then rightRGB image is transformed into hsv color space, to V channel images into row threshold division, then carries out most bull wheel to image after Threshold segmentationExterior feature extraction;
2. is to the area of largest contours, arc length, the length of minimum enclosed rectangle, the width of minimum enclosed rectangle, H channel imagesGray average is as feature;
3. establishes left and right SVM classifier, and add class label respectively according to insole or so foot recognition methods, then intoRow SVM training, and the file after training is preserved;
(3), online recognition includes the following steps:
1. after reads image, carrying out medium filtering to whole image, being then transformed into hsv color space to RGB imageIn, to V channel images into row threshold division, contours extract is carried out to the bianry image after segmentation, traverses every profile;
2. first judges contour area, threshold value, when area is smaller, table is arranged for the 1. middle profile extractedIt is shown as impurity, is given up;Then the area of extraction profile, arc length, the length of minimum enclosed rectangle, the width of minimum enclosed rectangle, the channels HGradation of image mean value is as feature;
3. is just classified with left foot SVM classifier according to insole or so foot recognition methods, if it is left foot, if it isRight crus of diaphragm is just classified with right crus of diaphragm SVM classifier;To obtain tag along sort, further insole is concluded to that belonging to itClass.
The method that the insole based on shape and color characteristic that the application proposes is classified automatically uses number by machine visionIt is identified for the structure of detection module and the detection of insole shape color according to machine learning algorithm in science, it is not affected by environment,Identification is stablized, and quickly, improves production efficiency, reduction manually reduces production cost.
Description of the drawings
The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
Fig. 1 is off-line training partial process view of the present invention;
Fig. 2 is insole of the present invention or so foot identification process figure;
Fig. 3 is online recognition partial process view of the present invention.
Specific implementation mode
With reference to specific embodiment, the present invention is furture elucidated, is only used for explaining invention, and should not be understood as to this hairBright limitation.
A method of the insole based on shape and color characteristic is classified automatically, including off-line training and online recognition, such asShown in Fig. 1, off-line training includes the following steps:
1. piece images have multiple insoles, first manual rectangle frame selects insole, then carries out medium filtering to image, then rightRGB image is transformed into hsv color space, to V channel images into row threshold division, then carries out most bull wheel to image after Threshold segmentationExterior feature extraction;
2. is to the area of largest contours, arc length, the length of minimum enclosed rectangle, the width of minimum enclosed rectangle, H channel imagesGray average is as feature;
3. establishes left and right SVM classifier, and add class label respectively according to insole or so foot recognition methods, then intoRow SVM training, and the file after training is preserved;
As shown in Fig. 2, steps are as follows for the recognition methods of insole or so foot:
1. calculates third moment to the profile of input, profile barycenter (Xc, Yc) and main shaft slope are calculated, and calculate by matterHeart vertical major linear equation L1;
2. puts calculating one by one to 1. middle input profile, judge a little in straight line L1Left side or right side;
3. calculates separately straight line L1Left and right side profile point area S1、S2And barycenter (X1,Y1) and barycenter (X2,Y2);
4. judges S1And S2Size, if S1More than S2, then S1For toe part, according to (X1,Y1) and (Xc, Yc)Position relationship obtains the rotation angle of needs, and profile is rotated around (Xc, Yc) in making 1., makes (X1,Y1) with (Xc, Yc) straight line in waterProsposition is set, and toe-cap is towards a left side;If S2More than S1, then S2For toe part, according to (X2,Y2) and (Xc, Yc) position relationship, it obtains and needsRotation angle, make 1. in profile around (Xc, Yc) rotate, make (X2,Y2) with (Xc, Yc) straight line in horizontal position, toe-cap is towards a left side;
5. obtain pivoting rear wheel exterior feature convex closure region with rotate rear region difference, difference region barycenter (Xres,Yres), if Yres is less than Yc, it is judged as left foot, if Yres is more than Yc, is judged as right crus of diaphragm.
As shown in figure 3, online recognition, includes the following steps:
1. after reads image, carrying out medium filtering to whole image, being then transformed into hsv color space to RGB imageIn, to V channel images into row threshold division, contours extract is carried out to the bianry image after segmentation, traverses every profile;
2. first judges contour area, threshold value, when area is smaller, table is arranged for the 1. middle profile extractedIt is shown as impurity, is given up;Then the area of extraction profile, arc length, the length of minimum enclosed rectangle, the width of minimum enclosed rectangle, the channels HGradation of image mean value is as feature;
3. is just classified with left foot SVM classifier according to insole or so foot recognition methods, if it is left foot, if it isRight crus of diaphragm is just classified with right crus of diaphragm SVM classifier;To obtain tag along sort, further insole is concluded to that belonging to itClass.
The method that the insole of the application is classified automatically is used for by machine vision using machine learning algorithm in data scienceThe structure of detection module and the detection identification of insole shape color, not affected by environment, identification is stablized, and quickly, improves production effectRate reduces production cost.
The present invention is described by embodiment, but is not limited the invention, with reference to description of the invention, instituteOther variations of disclosed embodiment, are such as readily apparent that the professional person of this field, such variation should belong toWithin the scope of the claims in the present invention limit.