Disclosure of Invention
In order to solve the technical problems, the invention aims to provide a vision-based silica gel molding effect detection method, which adopts the following technical scheme:
the invention provides a vision-based silica gel molding effect detection method, which comprises the following steps:
obtaining a silica gel area image and a mold image; obtaining a defect super-pixel block according to the similarity between the silica gel super-pixel block of the silica gel area image and the mold super-pixel block of the mold image; constructing the information richness of each pixel point according to the characteristic difference between the pixel point in the defect super pixel block and the pixel point in the preset first neighborhood; obtaining a second suspected defect pixel point and a suspected defect area formed by the second suspected defect pixel point according to the information richness;
obtaining the edge of the suspected defect area, uniformly setting a preset number of sampling points on the edge, obtaining an area identification value according to the curvatures among different sampling points, and screening out a circular defect area according to the area identification value; constructing class discrimination values according to gray value differences and distribution between each circular defect region and other circular defect regions in a preset second neighborhood, and identifying bubble defect regions and pinhole defect regions according to the class discrimination values;
In the non-circular defect area, obtaining angle correlation according to the change between angles between two symmetrical sampling points on the edge and adjacent sampling points of the two symmetrical sampling points, and screening out a crack defect area according to the average angle correlation of the non-circular defect area;
screening out a gloss defect area according to the average gray value difference of the silica gel super pixel block and the mold super pixel block corresponding to the positions of other suspected defect areas;
taking the pinhole defect area, the bubble defect area, the crack defect area and the luster defect area as defect areas; and obtaining a molding evaluation value of the silica gel according to the size, the number and the preset weight of each type of defect area, and obtaining the molding effect of the silica gel according to the molding evaluation value.
Further, the obtaining of the defective super pixel block includes:
the silica gel region image and the mold image are subjected to SLIC super-pixel segmentation algorithm to obtain a silica gel super-pixel block and a mold super-pixel block, wherein the silica gel super-pixel block and the mold super-pixel block have a corresponding relation in position; calculating by using a shape context operator to obtain shape similarity between the silica gel super pixel block and the mold super pixel block corresponding to the position;
Calculating the ratio of the average gray value difference between the silica gel super pixel block corresponding to the position and the mold super pixel block to the shape similarity to obtain a first ratio; performing negative correlation mapping and normalization on the first ratio to obtain the similarity;
and when the similarity is smaller than a preset similarity threshold, taking the silica gel super-pixel block as the defect super-pixel block.
Further, the obtaining of the information richness includes:
respectively comparing gray values of a target pixel point in the defective pixel block with other pixel points in the first adjacent area, counting the number of gray value differences larger than a preset gray threshold value, and recording the number as a gray difference value number;
obtaining the average gray value difference between the target pixel point and the other pixel points in the first adjacent area, and adjusting the average gray value difference by taking the gray difference value number as a weight to obtain the information complexity of the target pixel point; judging whether the target pixel point is a first suspected defect pixel point or not according to a preset complexity threshold value;
if the target pixel point is the first suspected defective pixel point, obtaining each pixel point in the first neighborhood of other pixel points in the first suspected defective pixel point, and calculating gray value differences between the first suspected defective pixel point and the pixel points corresponding to the positions of the other pixel points in the first neighborhood; obtaining an accumulated value of the gray value differences; mapping and normalizing the accumulated value negative correlation to obtain gray level similarity;
Performing negative correlation mapping and averaging on all the gray level similarities corresponding to the first suspected defective pixel points to obtain gray level specific factors of the first suspected defective pixel points;
and taking the product of the information complexity of the first suspected defective pixel point and the gray scale specific factor as the information richness of the first suspected defective pixel point.
Further, the obtaining of the area identification value includes:
forming two line segments by one of the sampling points and two adjacent sampling points, taking the included angle between each line segment and a horizontal line as curvature, and taking the absolute value of the difference value of the two curvatures as an angle characteristic value;
and multiplying the angle characteristic value variance mapped and normalized by the negative correlation with the average angle characteristic value to obtain the region identification value.
Further, the obtaining of the category discrimination value includes:
obtaining the average Euclidean distance from the target circular defect region to all other circular defect regions in the second neighborhood;
constructing the class discrimination value according to the gray value difference and distribution conditions of the target circular defect area and all other circular defect areas in the second neighborhood, wherein the class discrimination value comprises the following components:
In the method, in the process of the invention,represented as the target circular defect regionIs used for the class distinction value of (c),represented as the target circular defect regionThe corresponding said average euclidean distance,represented as the target circular defect regionIs the second neighbor of (1)The average gray value of the individual circular defect areas,represented as the target circular defect regionIs used for the color filter,the function is extracted for the maximum value,represented as the target circular defect regionAnd within said second neighborhoodFirst, theThe shape similarity of the individual circular defect areas,represented as the target circular defect regionAll of the other circular defect areas within the second neighborhood.
Further, the obtaining of the angle correlation includes:
in the non-circular defect area, obtaining perpendicular lines of connecting lines of two adjacent sampling points of a target sampling point, obtaining an intersection point of the perpendicular lines and the non-circular defect area, and taking the intersection point farthest from the target sampling point as a target intersection point; taking the sampling point with the closest target intersection point distance as a symmetrical sampling point of the target sampling point; respectively obtaining two curvatures corresponding to the target sampling point and the symmetrical sampling point;
Obtaining a first angle difference value according to one curvature difference of the target sampling point and the symmetrical sampling point, and obtaining a second angle difference value according to the other curvature difference of the target sampling point and the symmetrical sampling point; and taking the mean value of the negative correlation mapping and normalization of the first angle difference value and the second angle difference value as the angle correlation.
Further, the obtaining of the molding evaluation value includes:
obtaining a molding evaluation value according to the size, the number and the preset weight of each type of defect area, wherein the molding evaluation value comprises the following components:
in the method, in the process of the invention,the molding evaluation value expressed as silica gel,expressed as the number of pinhole defect areas,expressed as the number of bubble defect regions,expressed as the number of crack defect areas,expressed as the number of the gloss defect areas,expressed as the maximum area of the defective area,expressed as the maximum length of the edge of the defective area,represented as the first of the pinhole defect areasThe area of the individual defect areas is determined,represented as the first of the bubble defect regionsThe area of the individual defect areas is determined,represented as the first of the crack defect regionsThe edge length of each defective area, Represented as the first of the gloss-defective areasThe area of the individual defect areas is determined,expressed as a weighted value of the pinhole defect area,expressed as a weighted value of the bubble defect region,expressed as a weighted value of the crack defect region,expressed as a weighted value of the gloss defect area.
Further, the obtaining the molding effect of the silica gel according to the molding evaluation value includes:
when the molding evaluation value is larger than a preset excellent threshold value, the molding effect of the silica gel is excellent; when the molding evaluation value is larger than a preset good threshold value and smaller than or equal to a preset excellent threshold value, the molding effect of the silica gel is good; when the molding evaluation value is less than or equal to a preset good threshold, the molding effect of the silica gel is extremely poor.
Further, the obtaining the silicone gel region image and the mold image includes:
acquiring a formed silica gel surface image and a mold RGB image by using an industrial camera through a fixed light source, and carrying out graying treatment on the silica gel surface image and the mold RGB image to obtain a silica gel surface gray image and a mold gray image; and obtaining the silica gel region image and the mold image by adopting an Ojin threshold segmentation method for the silica gel surface gray level image and the mold gray level image.
The invention has the following beneficial effects:
according to the invention, firstly, the silica gel surface image and the mold image are analyzed through the super-pixel segmentation algorithm, whether the silica gel surface has defects or not is judged, further analysis is carried out on the defective super-pixel blocks, the information richness of the pixel points is extracted to screen out suspected defect areas, the suspected defect areas can be more efficiently found out through the screening, and the detection efficiency and accuracy are improved. Dividing suspected defect areas, screening out circular defect areas through edge curvature change conditions of the defect areas, and screening out pinhole defect areas and bubble defect areas according to defect characteristics of pinhole defects and bubble defects in the circular defect areas, namely, the pinhole defect areas are relatively dense in distribution of pinhole defects because light cannot irradiate the pinhole defect areas, and the neighborhood areas are similar, so that the pinhole defect areas and the bubble defect areas can be obtained through gray value characteristics and distribution characteristic analysis of the circular defect areas. Regarding the non-circular defect area, considering whether the edge change has similarity according to the curvature of two symmetrical sampling points on the edge, and screening out a crack area according to the local parallelism characteristic of the edge change. And screening out the gloss defect areas from the final other suspected defect areas according to the characteristic that the difference between the surface gray value of the gloss defect and the normal surface gray value is large, wherein the rest suspected defect areas are the normal areas which are mistakenly identified. The comprehensive and accurate defect types are obtained, the detection efficiency and the detection precision are improved, the silica gel molding evaluation value is obtained according to the defect types, the influence of different defect types on the silica gel molding effect is considered, different types of severity degree weights are applied to different defect types, the detection of the silica gel molding effect is finally realized, and further the silica gel molding quality is better evaluated.
Detailed Description
In order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following detailed description is given below of a vision-based silica gel molding effect detection method according to the invention, which is specific to the implementation, structure, characteristics and effects thereof, with reference to the accompanying drawings and the preferred embodiments. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following specifically describes a specific scheme of the silica gel molding effect detection method based on vision provided by the invention with reference to the accompanying drawings.
Referring to fig. 1, a flowchart of a method for detecting a silica gel molding effect based on vision according to an embodiment of the invention is shown, where the method includes:
step S1: obtaining a silica gel area image and a mold image; obtaining a defect super-pixel block according to the similarity between the silica gel super-pixel block of the silica gel area image and the mold super-pixel block of the mold image; constructing the information richness of each pixel point according to the characteristic difference between the pixel point in the defect super pixel block and the pixel point in the preset first neighborhood; and obtaining a second suspected defect pixel point and a suspected defect area formed by the second suspected defect pixel point according to the information richness.
Since the molding of the silicone is often performed based on a mold, the difference between the silicone region image and the mold image is considered when the defect detection is performed on the surface of the silicone, and thus the silicone region image and the mold image need to be obtained, specifically including:
The method comprises the steps of acquiring a formed silica gel surface image and a formed mold RGB image through an industrial camera, carrying out graying treatment on the silica gel surface image and the mold RGB image to obtain a silica gel surface gray image and a mold gray image, and carrying out graying treatment on the silica gel surface image and the mold RGB image by adopting a weighted graying method in the embodiment of the invention, wherein the weighted graying method is a technical means well known to a person skilled in the art, and redundant description is omitted. Preferably, the method of division of the Ojin threshold is adopted, silica gel and a mold are used as the foreground, the rest areas are used as the background to divide the silica gel surface gray level image and the mold gray level image, and the silica gel area image and the mold image are obtained.
Before further analyzing the silica gel area image, it is necessary to determine whether the silica gel has a suspected defect area, and in order to improve the efficiency of detecting the suspected defect area, the silica gel area image and the mold image may be preprocessed to obtain a plurality of silica gel super-pixel blocks and mold super-pixel blocks. The pixel points in one super pixel block have similar characteristics of texture, color, brightness and the like, the complexity after image processing is greatly reduced through the calculation of the super pixel block, and the detection efficiency is improved, so that the super pixel segmentation can be carried out on the image in the preprocessing stage. And identifying the defect super pixel block in the silica gel region image by obtaining the similarity between the silica gel super pixel block and the mold super pixel block, so that a specific second suspected defect pixel point is conveniently acquired. Obtaining a defective superpixel block according to a similarity between the silica gel superpixel block of the silica gel area image and the mold superpixel block of the mold image, specifically includes:
When the silica gel area image and the mold image are preprocessed, the silica gel super-pixel block and the mold super-pixel block are preferably obtained by adopting an SLIC super-pixel segmentation algorithm on the silica gel area image and the mold image, and in the embodiment of the invention, the number of preset super-pixel blocks is 200, so that the number of the silica gel super-pixel block and the mold super-pixel block is 200. Each silica gel super pixel block in the silica gel area image has a one-to-one correspondence relation with the mold super pixel block in the mold image in position, for example, the seed point coordinates of the silica gel super pixel block at the upper left corner in the silica gel area image are taken as a first row and a first column, the seed coordinates of the silica gel super pixel blocks adjacent in the horizontal direction are taken as a first row and a second column, the seed coordinates of the silica gel super pixel blocks adjacent in the vertical direction are taken as a second row and a first column, the seed point coordinates of all the silica gel super pixel blocks are obtained to obtain a super pixel block matrix formed according to the seed point coordinates of the silica gel super pixel blocks, and the super pixel block matrix formed by combining the seed point coordinates of the mold super pixel blocks can find the silica gel super pixel block and the mold super pixel block with one-to-one correspondence relation in position.
When the similarity of the silica gel super pixel block and the mold super pixel block is obtained, the shape similarity between the silica gel super pixel block and the mold pixel block corresponding to the position is calculated according to the shape similarity degree and the average gray value difference of the two super pixel blocks, and preferably, the shape similarity between the silica gel super pixel block and the mold pixel block corresponding to the position is calculated by adopting a shape context operator. Calculating the ratio of the average gray value difference between the silica gel super pixel block corresponding to the position and the mold super pixel block to the shape similarity to obtain a first ratio; and carrying out negative correlation mapping and normalization on the first ratio to obtain similarity, wherein the similarity represents the distinguishing degree of the silica gel super-pixel block and the mold super-pixel block. In the embodiment of the invention, in consideration of convenience of numerical calculation, the similarity expression comprises:
in the method, in the process of the invention,represented as a silica gel superpixel blockSuper pixel block with mouldThe degree of similarity between the two,represented as a silica gel superpixel blockThe average gray value of the inner pixel point,represented as a mold superpixel blockThe average gray value of the inner pixel point,represented as a silica gel superpixel blockSuper pixel block with mouldThe degree of similarity in shape between the two,represented as one of the super pixel blocks of silica gel,the super pixel block is expressed as a super pixel block with the corresponding relation between the positions of the mold super pixel block and the silica gel super pixel block, Expressed as a natural constant.The first ratio is expressed as, mapping and normalizing are carried out on the negative first ratio by an exponential function based on a natural constant, when the difference of average gray values is smaller, the shape similarity is larger, the first ratio is smaller, and the similarity of the corresponding silica gel super-pixel block and the corresponding mold super-pixel block is larger.
In the embodiment of the invention, the similarity threshold is set to be 0.8, and when the similarity is smaller than the similarity threshold, the silica gel super-pixel block is a defective super-pixel block with defects, so that all defective super-pixel blocks are obtained.
In order to facilitate the subsequent classification of the defect area, a suspected defect area formed by the second suspected defective pixel is required to be obtained, so that the information richness of the first suspected defective pixel is calculated by acquiring the characteristic information of the pixel in the defect super pixel block, the information richness of the first suspected defective pixel is larger because the suspected defect area is irregular, and the texture area of the normal pixel information is changed regularly, so that the information richness of the normal pixel is smaller, and whether the first suspected pixel is the second suspected defective pixel is judged.
In the embodiment of the invention, the preset first neighborhood is eight neighborhoods around one pixel point. The characteristic information of the pixel point comprises the information complexity and the gray scale specific factor of the pixel point, the information complexity represents the condition that the target pixel point contains information, and when the target pixel point is richer in information, the greater the information complexity is, the more likely the pixel point is the first suspected defect pixel point, namely the pixel point is the pixel point of the suspected defect area or the pixel point of the texture area. And acquiring gray level similarity for the first suspected pixel point, wherein the gray level similarity represents the similarity between the first suspected defective pixel point and each pixel point in the first neighborhood, carrying out negative correlation mapping on the gray level value similarity between the first suspected defective pixel point and all pixel points in the first neighborhood, and obtaining a mean value to obtain a gray level specific factor of the first suspected defective pixel point, and when the smaller gray level similarity indicates that the two pixel points are more likely to be different types of pixel points, representing more information, so that the larger the gray level specific factor is, the more likely the first suspected defective pixel point is the second suspected defective pixel point. Therefore, the information richness of each pixel point is constructed according to the characteristic difference between the pixel point in the defect super pixel block and the pixel point in the preset first neighborhood, and the second suspected defect pixel point and the suspected defect area formed by the second suspected defect pixel point are obtained according to the information richness, which comprises the following steps:
(1) In the embodiment of the invention, the preset gray threshold is 5. And respectively comparing the gray values of the target pixel point in the defect super pixel block and other pixel points in the first neighborhood, counting the number of gray value differences larger than the gray threshold value, and recording the number as the gray difference value number.
The average gray value difference between the target pixel point and other pixel points in the first neighborhood is obtained, the gray difference value number is used as a weight to adjust the average gray difference, and the information complexity of the target pixel point is obtained, wherein the information complexity represents the average gray value difference degree between the target pixel point and the pixel points in the first neighborhood. In the embodiment of the invention, the expression of the information complexity comprises the following steps of:
in the method, in the process of the invention,expressed as target pixel pointsIs used for the information complexity of the (c) information,expressed as target pixel pointsFirst in-vicinity firstThe gray value of each pixel point,expressed as target pixel pointsIs used for the gray-scale value of (c),the function is extracted for the maximum value,expressed as a number of gray differences.The normalized value expressed as the gray value difference, namely, the numerical value for evaluating the gray value difference is defined through normalization, so that the calculation of the subsequent algorithm is convenient. When the average gray value difference is larger, the gray difference number is larger, the information complexity is larger, which means that the more complex the information contained in the target pixel point is, the more likely the pixel point is a suspected defect Pixel points of regions and texture regions.
In the embodiment of the invention, the complexity threshold is set to be 0.9. When the information complexity of the target pixel point is greater than the complexity threshold value, the target pixel point is indicated to be a first suspected defect pixel point, namely a pixel point of a suspected defect area and a pixel point of a texture area; otherwise, the target pixel point is a normal pixel point.
(2) In order to further obtain a more accurate second suspected defective pixel point, obtaining other pixel points in a first neighbor of the first suspected defective pixel point, obtaining pixel points in the first neighbor corresponding to the other pixel points, calculating gray value differences between the pixel points corresponding to the positions of the first suspected defective pixel point and the other pixel points in the respective first neighbor, obtaining accumulated values of the gray value differences, mapping and normalizing the accumulated values in a negative correlation manner to obtain gray similarity, wherein the gray similarity represents the gray value change similarity degree of the first suspected defective pixel point and a pixel point in the first neighbor. In the embodiment of the invention, the expression of the gray level similarity comprises the following steps of:
in the method, in the process of the invention,represented as a first suspected defective pixelAnd pixel points in the first neighborhood Is used for the gray level similarity of the (c) image,represented as a first suspected defective pixelFirst in-vicinity firstThe gray value of each pixel point,represented as a first suspected defective pixelFirst in-vicinity firstThe gray value of each pixel point,represented as a first suspected defective pixelOne pixel in the first neighborhood,expressed as a natural constant.The accumulated value of the gray value difference is expressed, the accumulated value of the negative gray value difference is mapped and normalized by an exponential function based on a natural constant, and the obtained gray similarity and the gray value difference change into a negative correlation relationship and the numerical range is between 0 and 1. When the gray value difference changes more, the gray similarity is smaller, which means that the two pixels are more likely to be different types of pixels, and the first suspected defective pixel is more likely to be the second suspected defective pixel.
And carrying out negative correlation mapping and averaging on all gray level similarities corresponding to the first suspected defective pixel point to obtain a gray level specific factor of the first suspected defective pixel point. The gray scale specific factor represents the gray scale similarity relation between the first suspected defective pixel point and all other pixel points in the first neighborhood.
(3) Taking the product of the information complexity and the gray scale specific factor of the first suspected defective pixel point as the information richness of the first suspected defective pixel point, wherein the information richness represents the information change degree represented by the first suspected defective pixel point. In the embodiment of the invention, the information richness formula is given by considering the convenience of numerical calculation:
In the method, in the process of the invention,representing a first suspected defective pixelIs used for the information richness of the (a),representing a first suspected defective pixelIs used for the information complexity of the (c) information,then the first suspected defective pixel point is representedSimilarity between the i-th pixel point and the q-th pixel point in the point neighborhood.Expressed as a gray scale specific factor, the gray scale similarity and the information richness are in negative correlation, and the value range of the gray scale similarity is between 0 and 1, therefore, the gray scale similarity is adoptedThe gray level similarity and the gray level specific factor are in negative correlation, and the gray level factor and the information richness are in positive correlation. If the gray level similarity is smaller, the gray level specificity factor is larger, the information richness is larger, and the first suspected defect pixel point is more likely to be a second suspected defect pixel point.
In the embodiment of the invention, the defect threshold is set to 0.85. When the information richness of the first suspected defective pixel point is larger than the defect threshold, the first suspected defective pixel point is a second suspected defective pixel point, and a suspected defective area formed by the second suspected defective pixel point is obtained.
Step S2: obtaining the edge of a suspected defect area, uniformly setting a preset number of sampling points on the edge, obtaining an area identification value according to the curvature among different sampling points, and screening out a circular defect area according to the area identification value; and constructing class discrimination values according to gray value differences and distribution between each circular defect region and other circular defect regions in a preset second neighborhood, and identifying bubble defect regions and pinhole defect regions according to the class discrimination values.
According to step S1, it is known that the silica gel region has defects, but the damage degree of the silica gel caused by different defect types is different, for example, when the silica gel surface has a certain pinhole defect, the silica gel can still be used continuously, but when the silica gel has a crack defect, the silica gel cannot be used normally, so that further detection of the suspected defect region is required to obtain a specific type of defect. Firstly, the circular defect area in the suspected defect area is identified so as to distinguish the pinhole defect area and the bubble defect area later, the shape and the change amplitude of the edge are judged by considering the edge change characteristics of the circular defect area through the change of the edge curvature, and then the circular defect area is screened out. Therefore, the edge of the suspected defect area is obtained, a preset number of sampling points are uniformly arranged on the edge, an area identification value is obtained according to the curvature among different sampling points, and a circular defect area is screened out according to the area identification value, and the method specifically comprises the following steps:
obtaining edges of the suspected defective areas, in an embodiment of the present invention, obtaining the suspected defective areasUniformly selecting the edge pixel pointsAnd sampling points. Obtaining two line segments formed by one sampling point and two adjacent sampling points, taking the included angle between each line segment and a horizontal line as curvature, wherein the curvature represents the edge change trend of the sampling points, taking the absolute value of the difference value of the two curvature as an angle characteristic value, and each sampling point is provided with a pair The angle characteristic value is the trend of the change of the edge angle. And multiplying the angle characteristic value variance mapped and normalized by the negative correlation with the average angle characteristic value to obtain the region identification value, wherein the region identification value represents the probability of occurrence of the circular defect region. In the embodiment of the invention, the region identification value formula specifically comprises the following components in consideration of the convenience of numerical calculation:
in the method, in the process of the invention,a region identification value expressed as a suspected defective region,expressed as the average angular feature value of the edge of the suspected defective area,represented as the first on the edge of the suspected defective areaThe angle characteristic value of each sampling point,expressed as the total number of preset sampling points,expressed as a natural constant.And (3) representing the variance of the angle characteristic value, mapping and normalizing the negative angle characteristic value variance by an exponential function with a natural constant as a base, wherein when the variance value is smaller, the region identification value is larger, which means that the edge angle change of the suspected defect region is flatter, the edge is more likely to be arc-shaped, and the likelihood that the suspected defect region is a circular defect region is higher. When the average angle characteristic value is larger, the angle change range is larger, and the suspected defect area is unlikely to be cracked The more likely the seam defect region is a circular defect region.
In the embodiment of the invention, the area threshold is set to 0.8. When the area identification value of the suspected defect area is larger than the area threshold value, the suspected defect area is a circular defect area; otherwise, the suspected defect area is a non-circular defect area. And further dividing the circular defect area to obtain a pinhole defect area and a bubble defect area. When the silica gel has pinhole defects, the pinhole defects indicate that the silica gel is pierced, so that light cannot be irradiated inside the silica gel, the gray values of the pinhole defects are smaller, the pinhole defects are often distributed densely, and adjacent defect areas are similar, so that the pinhole defect areas and bubble defect areas can be identified through the gray value difference and the distribution condition of the circular defect areas. Therefore, a class discrimination value is constructed according to the gray value difference and distribution between each circular defect region and other circular defect regions in a preset second neighborhood, the class discrimination value represents the characteristic value for distinguishing pinhole defects from bubble defects, and the method for acquiring the class discrimination value specifically comprises the following steps:
(1) In the embodiment of the invention, a center point of a circular defect area is selected, a circle with 200-bit radius is set to be a circle by taking the center point as a circle center, and a second neighborhood is obtained. And obtaining the average Euclidean distance from the target circular defect area to all other circular areas in the second neighborhood, namely the distribution density degree of the adjacent circular defect areas of the target circular defect area.
(2) According to the gray value difference and distribution of the target circular area and all other circular defect areas in the second neighborhood, a class discrimination value is constructed, and the class discrimination value formula is as follows:
in the method, in the process of the invention,represented as a target circular defect regionCategory judgment of (a)The other value of the difference,represented as a target circular defect regionThe corresponding average euclidean distance is used,represented as a target circular defect regionIs the second neighbor of (1)The average gray value of the individual circular defect areas,represented as a target circular defect regionIs used for the color filter,the function is extracted for the maximum value,represented as a target circular defect regionAnd the second adjacent intra-domainThe shape similarity of the individual circular defect areas,represented as a target circular defect regionAll other circular defect areas in the second neighborhood.Represented as a target circular defect regionAverage similarity with all other circular defect areas in the second neighborhood, and taking denominator as target circular defect areaTotal number of all other circular defect regions in the second neighborhood of (2), in the moleculeRepresented as a region of defect according to a target circleAnd the second adjacent intra-domainObtaining the target circular defect region by the average gray value difference and the shape similarity of the circular defect regions And the second adjacent intra-domainA single similarity of the individual circular defect areas,represented as a target circular defect region obtained by performing a negative correlation calculation on a single similarityTotal similarity to all other circular defect areas in the second neighborhood. When the average Euclidean distance of the target circular defect area is larger, namely other circular areas in the second neighborhood are densely distributed, the average gray value is smaller, the average similarity between the target circular defect area and the other circular areas in the second neighborhood is larger, the class discrimination value is larger, and the target circular defect area is more likely to be a pinhole defect area.
In the embodiment of the invention, the category threshold is set to 0.8. When the class discrimination value of the target circular defect area is larger than the class threshold value, the class of the target circular defect area is a pinhole defect area; otherwise, the bubble defect areas are identified, and all the circular defect areas are identified.
Step S3: in the non-circular defect area, the angle correlation is obtained according to the change between angles formed by two symmetrical sampling points on the edge and the adjacent sampling points, and the crack defect area is screened according to the average angle correlation of the non-circular defect area.
The non-circular defect area is provided with a crack defect area, the edges of the crack defect area have the characteristic of similarity, and the two symmetrical edges are provided with local parallelism, so that the edge of the non-circular defect area is subjected to angle change calculation, and whether the edge is the crack defect area is judged through the similarity of the angle change. Therefore, in the non-circular defect area, the angle correlation is obtained according to the change between the angles between two symmetrical sampling points on the edge and the adjacent sampling points, and the crack defect area is screened according to the average angle correlation of the non-circular defect area, which comprises the following steps:
And obtaining a perpendicular line of a connecting line of two sampling points adjacent to the target sampling point on the edge of the non-circular defect area, wherein the perpendicular line is intersected with the non-circular defect area to form two intersection points, taking the intersection point farthest from the target sampling point as the target intersection point, and obtaining the sampling point with the minimum Euclidean distance from the target intersection point as a symmetrical point corresponding to the target sampling point. According to the method for obtaining the curvature of the sampling point in the step S2, two curvatures corresponding to the target sampling point and the symmetrical sampling point are obtained, a first angle difference value is obtained according to the absolute value of one curvature difference value of the target sampling point and the symmetrical sampling point, a second angle difference value is obtained according to the absolute value of the other curvature difference value of the target sampling point and the symmetrical sampling point, the first angle difference value and the second angle difference value both represent whether edge variation trends between the two sampling points are similar or not, and the average value of negative correlation mapping and normalization of the first angle difference value and the second angle difference value is taken as angle correlation, wherein the angle correlation represents the degree of similarity of angles between the sampling points, namely the degree of similarity of edge variation. In the embodiment of the invention, in consideration of the convenience of numerical calculation, the angle correlation expression specifically includes:
In the method, in the process of the invention,expressed as target sampling pointsAnd symmetrical sampling pointsIs a function of the angular dependence of (a),expressed as target sampling pointsAdjacent to the sampling pointThe angle formed by the line segment and the horizontal line is a curvature,expressed as target sampling pointsAdjacent to the sampling pointThe line segment is angled to the horizontal line as another curvature,represented as symmetrical sampling pointsAdjacent to the sampling pointThe angle formed by the line segment and the horizontal line is a curvature,represented as symmetrical sampling pointsAdjacent to the sampling pointThe line segment is angled to the horizontal line as another curvature,expressed as a natural constant.Represented as a first angle difference value,and the second angle difference value is expressed, mapping and normalizing are respectively carried out on the negative first angle difference value and the negative second angle difference value through an exponential function based on a natural constant, and when the first angle difference value and the second angle difference value are smaller, the angle correlation is larger, the edge change of the target sampling point and the symmetrical sampling point is more similar.
The method comprises the steps of obtaining the average value of the angle correlation of sampling points in a non-circular defect area, taking the average value angle correlation as a screening index of a crack defect area, wherein the larger the average value angle correlation is, the more similar the edge change of the non-circular defect area is, namely, the parallelism exists at the local edges of two symmetrical ends, and the more likely the corresponding area is the crack defect area. In the embodiment of the invention, the crack threshold is set to 0.8. When the average value angle correlation is larger than the crack threshold value, the non-circular defect area is a crack defect area; otherwise, the non-circular defect area is other suspected defect areas.
Step S4: and screening out the gloss defect area according to the average gray value difference of the silica gel super pixel block and the die super pixel block corresponding to the positions of other suspected defect areas.
The identification of the pinhole defect area, the bubble defect area and the crack defect area is completed through the step S2 and the step S3, and the rest other suspected defect areas are analyzed and screened to obtain a gloss defect area, wherein the average gray value of the gloss defect area is the most obvious distinguishing characteristic, so that the gloss defect area is screened according to the average gray value difference between the corresponding silica gel super-pixel block and the die super-pixel block where the other suspected defect areas are located, and the method specifically comprises the following steps:
the average gray value of the silica gel super pixel block corresponding to the position of other suspected defect areas is obtained, the silica gel super pixel block is provided with the mold super pixel block corresponding to the position, the average gray value of the other suspected defect areas in the mold super pixel block can be obtained, and whether the other defect areas are luster defect areas or not is judged according to the difference of the two average gray values.
In the embodiment of the invention, the gloss threshold value is set to be 20, and when the average gray value difference is larger than the gloss threshold value, the other suspected defect areas are gloss defect areas; otherwise, the other suspected defect area is a false detection area, namely, does not belong to the defect area.
Step S5: pinhole defect areas, bubble defect areas, crack defect areas and gloss defect areas are used as defect areas; and obtaining a molding evaluation value of the silica gel according to the size, the number and the preset weight of each type of defect area, and obtaining a molding effect of the silica gel according to the molding evaluation value.
According to the steps S2, S3 and S4, pinhole defect areas, bubble defect areas and crack defect areas are obtained respectively, the number of defect areas of each type is counted, and defect areas formed by the defect areas of each type are obtained. Therefore, according to the size, the number and the preset weight of each type of defect area, a molding evaluation value of the silica gel is obtained, and according to the molding evaluation value, the molding effect of the silica gel can be obtained, and the specific method comprises the following steps:
obtaining a molding evaluation value of the silica gel according to the size, the number and the preset weight of each type of defect area, wherein the molding evaluation value comprises:
in the method, in the process of the invention,represented as a molding evaluation value of the silica gel,expressed as the number of pinhole defect areas, Expressed as the number of bubble defect regions,expressed as the number of crack defect areas,expressed as the number of gloss defective areas,represented as the maximum area of the defective area,represented as the maximum length of the edge of the defective area,represented as the first of the pinhole defect areasThe area of the individual defect areas is determined,represented as the first bubble defect regionThe area of the individual defect areas is determined,represented as the first in the crack defect regionThe edge length of each defective area,represented as the first in the gloss-defective areaThe area of the individual defect areas is determined,expressed as a weighted value of the pinhole defect area,expressed as a weighted value of the bubble defect region,expressed as a weighted value of the crack defect area,expressed as a weighted value of the gloss defect area. In the embodiment of the invention, the weighted value of the pinhole defect area is setWeighting value of bubble defect regionWeighting value of crack defect regionWeighted value of gloss defect area。Expressed as the defect degree of the silica gel surface, the denominator is the total number of defect areas of different types, the numerator is the sum of the defect degrees of the defect areas of different types,expressed as the degree of defect in the pinhole defect area,expressed as the defect level of the bubble defect region, Expressed as the degree of defect in the crack defect region,the extent of defects in the gloss defect areas. Taking the degree of pinhole defect as an example,denoted as the firstThe probability of occurrence of each pinhole defect region in the defect region is calculated only, and the influence of the defect area is not considered, so that the first introduction is requiredArea of each pinhole defect region is obtainedDenoted as the firstThe defect duty cycle of the individual pinhole defect areas in the defect area affects,denoted as pair IWeighting the ratio of the pinhole defect area to the defect area to obtain the firstThe defect degree of each pinhole area is finally obtainedThe defect degree expressed as the whole pinhole defect area and the rest type defect degree formulas have the same meaning. When the defect is passedThe larger the degree, the smaller the molding evaluation value of the silica gel, and the poorer the molding quality of the silica gel. When there is no defective region in the silicone gel region image, the molding evaluation value of the silicone gel is 1.
In the embodiment of the invention, the excellent threshold is set to be 0.8, and the good threshold is set to be 0.5. When the molding evaluation value is larger than the excellent threshold value, the molding effect of the silica gel is excellent, which indicates that the silica gel does not need to be processed; when the molding evaluation value is smaller than or equal to the excellent threshold value and larger than the good threshold value, the molding effect of the silica gel is good, which indicates that the silica gel needs to be subjected to defect repair treatment; when the molding evaluation value is less than or equal to the good threshold, the molding effect of the silica gel is extremely poor, which indicates that the silica gel needs to be produced again.
In summary, according to the embodiment of the invention, a silica gel super pixel and a mold super pixel block corresponding to a silica gel region image and a mold image are obtained, a defect pixel block is obtained according to the similarity of the silica gel super pixel and the mold super pixel block, a suspected defect region is obtained according to the information richness of pixel points in the defect pixel block, a round defect region is screened out according to the edge variation characteristics of the suspected defect region, a pinhole defect region and a bubble defect region are identified for the round defect region through gray value difference and distribution, a crack defect region is screened out according to the edge similarity characteristics of a non-round defect region, a gloss defect region is screened out according to the average gray value difference of the silica gel super pixel and the mold super pixel block corresponding to the positions for other suspected defect regions, a pinhole defect region, a bubble defect region, a crack defect region and a gloss defect region are taken as defect regions, a molding evaluation value of silica gel is obtained according to the size, the number and preset weight of each type of defect region, and a molding effect of silica gel is obtained according to the molding evaluation value. According to the embodiment of the invention, the influence of different defects on the silica gel molding effect is considered, the evaluation of the silica gel molding effect is realized by accurately extracting the defective pixel points and comprehensively and accurately classifying the defective areas, the defect degree of silica gel is better reflected, and the quality problem of silica gel molding is more comprehensively evaluated.
It should be noted that: the sequence of the embodiments of the present invention is only for description, and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments.
The foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and scope of the invention are intended to be included within the scope of the invention.