Disclosure of Invention
(One) solving the technical problems
Aiming at the defects of the prior art, the invention provides the method and the system for measuring the dimension parameters of the rubber mold, which have the advantages of accuracy, high efficiency, real time and the like, and solve the problems that the dimension stability of the rubber mold is insufficient due to poor thermoplastic effect of the rubber, and the efficiency of modification is low and the effect is poor by manual measurement, so that the actual requirements cannot be met.
(II) technical scheme
In order to solve the technical problems that the rubber mold is insufficient in dimensional stability due to poor thermoplastic effect of rubber, and the efficiency of measurement and modification is low and the effect is poor by manual measurement, and the actual requirements cannot be met, the invention provides the following technical scheme:
The embodiment discloses a method for measuring dimension parameters of a rubber mold, which specifically comprises the following steps:
s1, installing a laser camera, collecting image data of rubber molds in different batches, and establishing a training data set;
s2, processing the rubber mold image data of different batches in the training data set based on an image processing method to obtain processed rubber mold image data;
s3, extracting the image contour of the rubber mold by a background separation method based on the obtained processed image data of the rubber mold;
S4, determining optimal standard size parameters of the rubber mold and setting standard size parameter ranges of the rubber mold through a genetic algorithm based on the extracted image outlines of the rubber molds in different batches;
S5, collecting image data of the rubber molds of the current batch in real time, extracting the image contours of the rubber molds of the image data of the rubber molds of the current batch, and determining the size parameters of the rubber molds of the current batch in a contour comparison mode.
According to the invention, the laser cameras are installed, the rubber mold image data of different batches are collected, the rubber mold image data of different batches in the training data set are processed based on the image processing method, meanwhile, the rubber mold image contour is extracted through the background separation method based on the obtained processed rubber mold image data, the optimal standard size parameter of the rubber mold is determined through the genetic algorithm based on the extracted rubber mold image contour of different batches, the standard size parameter range of the rubber mold is set, and the size parameter of the rubber mold of the current batch is determined through the mode of collecting the rubber mold image data of the current batch in real time and comparing the contour, so that the measurement efficiency of the size parameter of the rubber mold is improved.
Preferably, the installing the laser camera, collecting image data of rubber molds of different batches, and establishing a training data set includes the following steps:
Setting the positions of all characteristic points on the rubber mold, and fixing the relative positions of the camera and the rubber mold, so that the characteristic points on the rubber mold are uniformly distributed in the whole camera view;
and in a preset working range of the laser camera, acquiring rubber mold images shot by the laser cameras of different batches according to preset sampling intervals, and establishing a training data set.
According to the invention, the positions of all characteristic points on the rubber mold are set, the relative positions of the camera and the rubber mold are fixed, and meanwhile, the accuracy of rubber mold image acquisition is ensured by acquiring rubber mold images shot by laser cameras of different batches and establishing a training data set.
Preferably, the image processing method is used for processing the rubber mold image data of different batches in the training data set, and the obtained processed rubber mold image data comprises the following steps:
S21, selecting a pixel point in the training data set image data, and setting a rectangular window by taking the pixel point as a center;
S22, calculating average gray values of all pixel points in the set rectangular window through an average filtering algorithm.
Preferably, the calculating the average gray value of all the pixels in the set rectangular window by the mean filtering algorithm includes the following steps:
Setting the size of a rectangular window as n multiplied by n;
the mean filtering algorithm calculation formula is as follows:
Wherein,Representing the selected coordinates asAnd n represents the window size,Representing the coordinates within a window asGray values of (2);
And taking the value calculated by the mean value filtering algorithm of the selected pixel point as the gray value of the pixel point, and carrying out data processing on all the pixel points in the image data of the determined training data set to obtain the processed image data.
According to the invention, the pixel points in the training data set image data are selected, a rectangular window is set by taking the pixel points as the center, and the average gray values of all the pixel points in the set rectangular window are calculated through the average filtering algorithm, so that the effectiveness of the image data is improved.
Preferably, the step of extracting the image profile of the rubber mold by a background separation method based on the obtained processed image data of the rubber mold comprises the steps of:
s31, initializing fuzzy average algorithm parameters;
setting the total pixel point number of the processed image data as N, classifying the processed image data into A class,For the center point of each class,Representing points of interestSum classThe objective function and constraint of the fuzzy mean algorithm are as follows:
The objective function formula:;
Constraint condition type:;
wherein m is a blur index, the blur index is a blur degree in a photographed image,Represent the firstThe center point of the class is defined as the center point of the class,The characteristic points of the acquisition are represented,Representation pointsTo the firstClass center pointJ represents an objective function;
s32, performing iterative clustering operation on similar pixel points to finish separation of an image target and a background.
Preferably, the iterative clustering operation is performed on similar pixel points, and the separation of the image target and the background is completed, which comprises the following steps:
Calculating the distance from the random point in the class to the class center point based on the initially set center point of each class;
continuously adjusting the center point of each class according to the constraint condition, continuously iterating until the center points of all classes are not changed, and stopping iterating;
the classification of the pixel points in the image is completed by searching the minimum value of the objective function corresponding to each characteristic point, so that the separation of the image target and the background is realized;
clustering center based on clustering algorithm updateSum matrixThe following is shown:
;
;
Wherein,A center point representing a kth class; Representation pointsTo the firstClass center pointIs used for the distance of (a),Representation pointsTo the kth class center pointIs a distance of (2);
The pixel types are converged into two types through continuous iterative clustering, the rubber mold image contour is extracted through a mode of setting gray values of the two types of pixel points, and the characteristic points of the rubber mold image contour are recorded.
According to the invention, the pixel points of the processed image data are classified by initializing the fuzzy mean algorithm parameters, iterative clustering operation is carried out on the similar pixel points, the separation of an image target and a background is completed, meanwhile, the image contour of the rubber mold is extracted by respectively setting the gray values of the two types of pixel points, the characteristic points of the image contour of the rubber mold are recorded, and the accuracy of the image contour extraction of the rubber mold is improved.
Preferably, the determining the optimal standard size parameter of the rubber mold and setting the standard size parameter range of the rubber mold by a genetic algorithm based on the extracted image profiles of the rubber mold in different batches comprises the following steps:
s41, setting genetic population scale, iteration times and chromosome coding;
S42, randomly generating initial population;
S43, taking a parameter average algorithm as an fitness function of a genetic algorithm, and calculating the fitness of each individual in the population;
Setting a group of extracted rubber mold image contour feature points represented by each individual;
Setting coordinates of the central points of the extracted rubber mold image contours, calculating the distances from the contour feature points of each extracted rubber mold image to the central points of the extracted rubber mold image contours, and calculating the average value of the distances from the contour feature points of each extracted rubber mold image to the central points of the extracted rubber mold image contours;
The fitness calculation formula of each individual is as follows:
;
Wherein,Indicating fitness of the t-th individual;
s44, selecting excellent individuals from all individuals based on a roulette manner;
the roulette mode selects the excellent individual calculation formula among all the individuals as follows:
Wherein,Representing the probability that the t-th individual is selected,Representing probability, T representing population size;
S45, intersecting selected excellent individuals in a sequential intersecting mode to generate a new population after intersecting;
S46, randomly selecting an individual in the population to carry out edge with set probability to generate a mutated population;
S47, comparing the adaptability difference value between the initial population and the population subjected to the genetic algorithm cross mutation;
When (when)<0, Indicating that the population fitness after mutation is higher than the initial population, and the population is accepted whenNot less than 0, meaning that the population fitness after mutation is lower than that of the initial population, refusing to accept the population;
S48, judging whether the maximum iteration number is reached according to the iteration number of the algorithm, outputting an optimal solution when the maximum iteration number is reached, and continuously executing the step S44 when the maximum iteration number is not reached;
Setting a group of extracted rubber mold image contour feature points represented by the output optimal solution as optimal standard size parameters of the rubber mold;
And setting a rubber mold construction error range, and determining a rubber mold standard size parameter range of each rubber mold image contour feature point based on the optimal standard size parameter of the rubber mold.
According to the invention, the optimal standard size parameters of the rubber mold are continuously and iteratively calculated through genetic algorithm by extracting the image outlines of the rubber molds in different batches, and meanwhile, the standard size parameter range of the rubber mold is set based on the optimal standard size parameters of the rubber mold obtained through calculation, so that the reliability of standard determination of the rubber mold is improved.
Preferably, the step of collecting the image data of the rubber mold of the current batch in real time, extracting the image profile of the rubber mold of the image data of the rubber mold of the current batch, and determining the size parameter of the rubber mold of the current batch by means of profile comparison comprises the following steps:
Definition of the definitionThe optimal standard size parameter of the rubber mold is represented, and the projection image of the optimal standard size parameter of the rubber mold on a two-dimensional plane isSetting a contour image extracted from a projection image of a two-dimensional plane asSetting the contour of the rubber mold image for extracting the image data of the rubber mold of the current batch asBy a similarity functionTo judge the contour image、Is the degree of coincidence of (2);
Wherein,For two contoursAnd (3) withThe area of the overlapping portion is defined by,And (3) withAreas corresponding to the contours respectively; the larger S, the more similar the two regions, when the two regions overlap,;
When (when)When the rubber mold is in the optimal standard size parameter, the current batch of rubber molds are indicated;
When (when)And selecting dissimilar characteristic points, calculating the distance between the dissimilar profile characteristic points and the optimal standard size parameter, and outputting the size parameters of all the profile characteristic points of the current batch of rubber molds.
The invention passes through.
The embodiment also discloses a system for measuring the size parameters of the rubber mold, which comprises an image acquisition module, an image processing module, a contour extraction module, a standard size determination module and a rubber mold size parameter determination module;
the image acquisition module is used for acquiring image data of rubber molds in different batches and transmitting the image data to the image processing module;
the image processing module is used for processing the received rubber mold image data to obtain processed rubber mold image data;
The contour extraction module is used for extracting the contour of the processed rubber mold image data;
the standard size determining module is used for determining standard size parameters of the rubber mold image contour according to the rubber mold image contour of different batches;
the rubber mold size parameter determining module is used for determining real-time rubber mold size parameters according to the contour comparison mode.
(III) beneficial effects
Compared with the prior art, the invention provides a method and a system for measuring the dimension parameters of a rubber mold, which have the following beneficial effects:
1. According to the invention, by installing a laser camera, collecting rubber mold image data of different batches and processing the rubber mold image data of different batches in a training data set based on an image processing method, extracting the rubber mold image contour through a background separation method based on the obtained processed rubber mold image data, determining the optimal standard size parameter of the rubber mold and setting the standard size parameter range of the rubber mold through a genetic algorithm based on the extracted rubber mold image contour of different batches, further determining the size parameter of the rubber mold of the current batch through a mode of collecting the rubber mold image data of the current batch in real time and comparing the contour, and improving the measurement efficiency of the size parameter of the rubber mold.
2. According to the invention, the positions of all characteristic points on the rubber mold are set, the relative positions of the camera and the rubber mold are fixed, and meanwhile, the accuracy of rubber mold image acquisition is ensured by acquiring rubber mold images shot by laser cameras of different batches and establishing a training data set.
3. According to the method, the pixel points in the training data set image data are selected, a rectangular window is set by taking the pixel points as the center, and the average gray values of all the pixel points in the set rectangular window are calculated through the average filtering algorithm, so that the effectiveness of the image data is improved.
4. According to the method, the pixel points of the processed image data are classified by initializing the fuzzy mean algorithm parameters, iterative clustering operation is carried out on the similar pixel points, separation of an image target and a background is completed, meanwhile, the image contour of the rubber mold is extracted by setting gray values of the two types of pixel points respectively, characteristic points of the image contour of the rubber mold are recorded, and the accuracy of extracting the image contour of the rubber mold is improved.
5. According to the invention, the optimal standard size parameters of the rubber mold are continuously and iteratively calculated through genetic algorithm by extracting the image outlines of the rubber molds in different batches, and meanwhile, the standard size parameter range of the rubber mold is set based on the optimal standard size parameters of the rubber mold obtained through calculation, so that the reliability of standard determination of the rubber mold is improved.
6. According to the invention, the rubber mold image data of the current batch are acquired in real time, the rubber mold image contour of the rubber mold image data of the current batch is extracted, and the distances between dissimilar contour feature points and the optimal standard size parameters are calculated in a contour comparison mode, so that the real-time performance of measuring the rubber mold size parameters is improved.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
Referring to fig. 1, the embodiment discloses a method for measuring dimension parameters of a rubber mold, which specifically includes the following steps:
s1, installing a laser camera, collecting image data of rubber molds in different batches, and establishing a training data set;
Installing a laser camera, collecting image data of rubber molds of different batches, and establishing a training data set, wherein the method comprises the following steps:
Setting the positions of all characteristic points on the rubber mold, and fixing the relative positions of the camera and the rubber mold, so that the characteristic points on the rubber mold are uniformly distributed in the whole camera view;
In a preset working range of the laser camera, acquiring rubber mold images shot by the laser cameras of different batches according to preset sampling intervals, and establishing a training data set;
s2, processing the rubber mold image data of different batches in the training data set based on an image processing method to obtain processed rubber mold image data;
Processing the rubber mold image data of different batches in the training data set based on an image processing method to obtain processed rubber mold image data, wherein the processing method comprises the following steps of:
S21, selecting a pixel point in the training data set image data, and setting a rectangular window by taking the pixel point as a center;
S22, calculating average gray values of all pixel points in a set rectangular window through an average filtering algorithm;
Setting the size of a rectangular window as n multiplied by n;
the mean filtering algorithm calculation formula is as follows:
Wherein,Representing the selected coordinates asAnd n represents the window size,Representing the coordinates within a window asGray values of (2);
Taking the value calculated by the mean value filtering algorithm of the selected pixel point as the gray value of the pixel point, and carrying out data processing on all the pixel points in the image data of the determined training data set to obtain the processed image data;
s3, extracting the image contour of the rubber mold by a background separation method based on the obtained processed image data of the rubber mold;
Based on the obtained processed rubber mold image data, extracting the contour of the rubber mold image by a background separation method comprises the following steps:
s31, initializing fuzzy average algorithm parameters;
setting the total pixel point number of the processed image data as N, classifying the processed image data into A class,For the center point of each class,Representing points of interestSum classThe objective function and constraint of the fuzzy mean algorithm are as follows:
The objective function formula:;
Constraint condition type:;
wherein m is a blur index, the blur index is a blur degree in a photographed image,Represent the firstThe center point of the class is defined as the center point of the class,The characteristic points of the acquisition are represented,Representation pointsTo the firstClass center pointJ represents an objective function;
S32, performing iterative clustering operation on similar pixel points to finish separation of an image target and a background;
The iterative clustering operation of the similar pixel points comprises the following steps:
Calculating the distance from the random point in the class to the class center point based on the initially set center point of each class;
continuously adjusting the center point of each class according to the constraint condition, continuously iterating until the center points of all classes are not changed, and stopping iterating;
Further, the classification of the pixel points in the image is completed by searching the minimum value of the objective function corresponding to each characteristic point, so that the separation of the image target and the background is realized;
further, clustering center updated based on clustering algorithmSum matrixThe following is shown:
;
;
Wherein,A center point representing a kth class; Representation pointsTo the firstClass center pointIs used for the distance of (a),Representation pointsTo the kth class center pointIs a distance of (2);
further, the pixel types are converged into two types through continuous iterative clustering, the rubber mold image contour is extracted through a mode of setting gray values of the two types of pixel points respectively, and the characteristic points of the rubber mold image contour are recorded;
S4, determining optimal standard size parameters of the rubber mold and setting standard size parameter ranges of the rubber mold through a genetic algorithm based on the extracted image outlines of the rubber molds in different batches;
Based on the extracted image outlines of the rubber molds in different batches, determining the optimal standard size parameters of the rubber molds through a genetic algorithm and setting the standard size parameter ranges of the rubber molds comprises the following steps:
s41, setting genetic population scale, iteration times and chromosome coding;
S42, randomly generating initial population;
S43, taking a parameter average algorithm as an fitness function of a genetic algorithm, and calculating the fitness of each individual in the population;
Setting a group of extracted rubber mold image contour feature points represented by each individual;
Setting coordinates of the central points of the extracted rubber mold image contours, calculating the distances from the contour feature points of each extracted rubber mold image to the central points of the extracted rubber mold image contours, and calculating the average value of the distances from the contour feature points of each extracted rubber mold image to the central points of the extracted rubber mold image contours;
The fitness calculation formula of each individual is as follows:
;
Wherein,Indicating fitness of the t-th individual;
s44, selecting excellent individuals from all individuals based on a roulette manner;
the roulette mode selects the excellent individual calculation formula among all the individuals as follows:
Wherein,Representing the probability that the t-th individual is selected,Representing probability, T representing population size;
S45, intersecting selected excellent individuals in a sequential intersecting mode to generate a new population after intersecting;
S46, randomly selecting an individual in the population to carry out edge with set probability to generate a mutated population;
S47, comparing the adaptability difference value between the initial population and the population subjected to the genetic algorithm cross mutation;
When (when)<0, Indicating that the population fitness after mutation is higher than the initial population, and the population is accepted whenNot less than 0, meaning that the population fitness after mutation is lower than that of the initial population, refusing to accept the population;
S48, judging whether the maximum iteration number is reached according to the iteration number of the algorithm, outputting an optimal solution when the maximum iteration number is reached, and continuously executing the step S44 when the maximum iteration number is not reached;
Setting a group of extracted rubber mold image contour feature points represented by the output optimal solution as optimal standard size parameters of the rubber mold;
Further, setting a rubber mold construction error range, and determining a rubber mold standard size parameter range of each rubber mold image contour feature point based on the optimal standard size parameter of the rubber mold;
s5, collecting image data of the rubber molds of the current batch in real time, extracting the image contours of the rubber molds of the image data of the rubber molds of the current batch, and determining the size parameters of the rubber molds of the current batch in a contour comparison mode;
collecting image data of a rubber mold of a current batch in real time, extracting an image contour of the rubber mold of the image data of the rubber mold of the current batch, and determining the size parameter of the rubber mold of the current batch in a contour comparison mode comprises the following steps:
Definition of the definitionThe optimal standard size parameter of the rubber mold is represented, and the projection image of the optimal standard size parameter of the rubber mold on a two-dimensional plane isSetting a contour image extracted from a projection image of a two-dimensional plane asSetting the contour of the rubber mold image for extracting the image data of the rubber mold of the current batch asBy a similarity functionTo judge the contour image、Is the degree of coincidence of (2);
Wherein,For two contoursAnd (3) withThe area of the overlapping portion is defined by,And (3) withAreas corresponding to the contours respectively; the larger S, the more similar the two regions, when the two regions overlap,;
When (when)When the rubber mold is in the optimal standard size parameter, the current batch of rubber molds are indicated;
When (when)Selecting dissimilar characteristic points, calculating the distance between the dissimilar profile characteristic points and the optimal standard size parameter, and outputting the size parameters of all profile characteristic points of the current batch of rubber molds;
Example 2
The embodiment also discloses a system for measuring the size parameters of the rubber mold, which comprises an image acquisition module, an image processing module, a contour extraction module, a standard size determination module and a rubber mold size parameter determination module;
the image acquisition module is used for acquiring image data of rubber molds in different batches and transmitting the image data to the image processing module;
the image processing module is used for processing the received rubber mold image data to obtain processed rubber mold image data;
The contour extraction module is used for extracting the contour of the processed rubber mold image data;
the standard size determining module is used for determining standard size parameters of the rubber mold image contour according to the rubber mold image contour of different batches;
the rubber mold size parameter determining module is used for determining real-time rubber mold size parameters according to the contour comparison mode.
Although embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made therein without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.