A method for detecting paint defects based on image processing
By dividing the grayscale value range of the surface image into multiple target grayscale intervals, and image enhancement processing is performed according to the degree of aggregation and grayscale value frequency, the problem of the histogram equalization algorithm destroying local features is solved, and the accuracy of brushing defect detection is improved.
Patent Information
- Application Number
- CN202411721359.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-11-28
AI Technical Summary
In the analysis of the surface image of the glue layer formed in the brushing stage, when the histogram equalization algorithm is used to enhance the feature of the image, local features will be destroyed and the accuracy of defect detection will be affected.
By dividing the grayscale value range of the surface image into multiple target grayscale intervals, the distance between the geometric center and the cluster cluster center, the grayscale value of pixel points in the cluster, and the grayscale value of other pixel points in the neighborhood range, the aggregation degree of the cluster class is calculated, and the mapping grayscale interval is determined based on the aggregation degree and grayscale value frequency, and image enhancement processing is performed.
While enhancing the contrast between the defect area and the normal area, local features in the surface image are retained and highlighted, thereby improving the accuracy of brushing defect detection.
Smart Images

Figure CN119251209B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and more specifically, to a method for detecting painting defects based on image processing. Background Art
[0002] The production process of adhesive tape includes multiple stages, among which the substrate and surface treatment stage and the coating stage are important stages for determining product quality and reducing the defective rate.
[0003] In the related technology, for example, a Chinese patent document with authorization announcement number CN108387587B discloses a defect detection method and detection equipment, which relates to the field of display device manufacturing technology, and is used to solve the problem that the traditional defect detection process is greatly affected by human factors, resulting in poor detection accuracy, and the traditional defect detection process is time-consuming, resulting in reduced production efficiency; the detection method includes: obtaining a grayscale image of a substrate to be detected; determining whether there is an abnormal grayscale area in the grayscale image, if so, determining the abnormal grayscale area and the normal grayscale area in the grayscale image, and then executing the next step, if not, determining that the substrate to be detected is qualified; calculating the grayscale difference between the abnormal grayscale area and the normal grayscale area; calculating the estimated film thickness difference between the abnormal grayscale area and the normal grayscale area based on the grayscale difference; judging whether the substrate to be detected is qualified based on the estimated film thickness difference; the method is applied to the manufacturing process of the display device to examine the thickness uniformity of the transparent film coated on the substrate.
[0004] The relevant technology provides methods for detecting and controlling product quality in the substrate and surface treatment stages. In addition, analyzing the surface image of the adhesive layer formed in the coating stage to obtain the coating defects of the adhesive layer is crucial to ensuring product quality. In order to reduce the impact of uneven lighting on surface image analysis, a histogram equalization algorithm is used to enhance the features of the surface image. The histogram equalization algorithm enhances the contrast of the surface image by expanding the grayscale value, but it will destroy the local features in the surface image and affect the accuracy of defect detection. Summary of the invention
[0005] In order to solve the technical problem that in the process of analyzing the surface image of the adhesive layer formed in the coating stage and obtaining the coating defects of the adhesive layer, when the histogram equalization algorithm is used to enhance the features of the surface image, the local features in the surface image will be destroyed, thereby affecting the accuracy of defect detection, the present invention provides a coating defect detection method based on image processing, including: in the process of producing the adhesive tape, collecting the surface image of the adhesive layer formed in the coating stage; forming a grayscale value range with the minimum grayscale value and the maximum grayscale value in the surface image; dividing the grayscale value range into multiple sub-intervals by different division methods, for all sub-intervals obtained by any division method: clustering all pixel points corresponding to all grayscale values in the sub-interval to obtain multiple clusters; according to the grayscale value of each pixel point in the cluster, calculating the first distribution feature of the cluster; according to the grayscale values of other pixel points in the neighborhood range of each pixel point in the cluster, calculating the second distribution feature of the cluster, the first distribution and the second distribution features are used to characterize the continuity of the pixel points in the cluster in grayscale, the neighborhood range of the pixel point is centered on the pixel point and has a size of area, Represents a first preset value; obtains the geometric center of all pixel points corresponding to each grayscale value in the cluster, and calculates the degree of aggregation of the cluster according to the distance between the geometric center and the cluster center of the cluster, the first distribution feature of the cluster, and the second distribution feature of the cluster; takes the average value of the degree of aggregation of all clusters in the sub-interval as the degree of aggregation of the sub-interval; takes the sum of the degrees of aggregation of all sub-intervals as the degree of aggregation of the division method; takes all sub-intervals obtained by the division method with the smallest degree of aggregation as all target grayscale intervals; determines the mapping grayscale interval of each target grayscale interval according to the degree of aggregation of each target grayscale interval and the sum of the frequencies of all grayscale values in each target grayscale interval; performs image enhancement processing on the surface image according to the mapping value of each grayscale value in the target grayscale interval in the mapping grayscale interval; calculates the uniformity of the glue coating of the glue layer according to the enhanced surface image, and then obtains the coating defects of the glue layer.
[0006] Compared with directly performing image enhancement processing on the surface image through histogram equalization, the present invention divides the grayscale value range of the surface image into multiple target grayscale intervals according to the distance between the geometric center and the clustering center of the cluster, the grayscale value of each pixel in the cluster, and the grayscale values of other pixels in the neighborhood of each pixel in the cluster. The obtained target grayscale intervals represent different local features in the surface image respectively, and then determine the mapping grayscale interval of each target grayscale interval according to the aggregation degree of each target grayscale interval and the sum of the frequencies of all grayscale values in each target grayscale interval, and determine the mapping value of each grayscale value in the target grayscale interval in the mapping grayscale interval, and then perform image enhancement processing on the surface image. At this time, the enhanced surface image obtained retains and highlights the local features in the surface image while enhancing the contrast between the defective area and the normal area, thereby improving the accuracy of paint defect detection.
[0007] Preferably, dividing the grayscale value range into a plurality of sub-intervals by different division methods comprises: dividing the grayscale value range into sub-intervals, is equal to the quantity parameter, and each subinterval consists of the left boundary, the right boundary, and all integers between the left boundary and the right boundary; The left boundary of the subinterval is ,and , Indicates The right boundary of the subinterval; The right boundary of the subinterval is ,and for Any integer in For the The value range of the right boundary of the subinterval is Indicates A gray value corresponding to a trough, wherein the trough is a trough in a gray histogram of the surface image; Indicates the serial number, for An integer in the range.
[0008] The present invention divides the gray value range into multiple sub-intervals by different division methods, and obtains a division method that can accurately and completely represent all local features in the surface image by analyzing all sub-intervals obtained under each division method.
[0009] Preferably, the method for obtaining the quantity parameter comprises: obtaining a grayscale histogram of the surface image, wherein the abscissa of the grayscale histogram is the grayscale value and the ordinate is the frequency of each grayscale value; obtaining all peaks and all troughs in the grayscale histogram, wherein each peak corresponds to a grayscale value, each trough corresponds to a grayscale value, and the frequency of the trough refers to the frequency of the grayscale value corresponding to the trough, and the frequency of the peak refers to the frequency of the grayscale value corresponding to the peak; for any trough, when the difference between the frequency of the trough and its two adjacent peaks is greater than a preset first threshold value, the trough is taken as a target trough; according to the quantity of all target troughs , determine the quantity parameters , then the quantity parameter equal .
[0010] In a surface image, the same local features usually appear as a group of similar grayscale values in the surface image. Therefore, the number parameter is determined according to the number of all target valleys in the grayscale histogram. , which can be used as a quantitative basis for dividing the grayscale value range of the surface image into sub-intervals, thereby accurately distinguishing local features in the surface image.
[0011] Preferably, the first distribution feature of the cluster satisfies the expression: ; In the formula, represents the first distribution feature of the cluster, represents the natural exponential function, Indicates that the gray value in the cluster is The number of all pixels in the range, Indicates that the gray value in the cluster is not The number of all pixels in the range, , Represents subintervals The left and right borders of For subinterval The gray value in Indicates taking the maximum value, Indicates the number of all pixels in the cluster.
[0012] Preferably, the second distribution feature of the cluster satisfies the expression: ; In the formula, represents the second distribution feature of the cluster, represents the natural exponential function, Indicates that the gray value in the cluster is The number of all pixels in the range, Indicates that the gray value in the cluster is The range of Among all other pixels in the neighborhood of a pixel, the gray value is The number of other pixels in the range, Indicates that the gray value in the cluster is The range of Among all other pixels in the neighborhood of a pixel, the gray value is not The number of other pixels in the range, , Represents subintervals The left and right borders of For subinterval The gray value in Indicates taking the maximum value, the size of the neighborhood range of the pixel point is , Indicates the first preset value.
[0013] Preferably, the calculating the aggregation degree of the clusters includes: ; In the formula, Indicates the degree of cluster aggregation. represents the natural exponential function, represents the first distribution feature of the cluster, represents the second distribution feature of the cluster, , Represents subintervals The left and right borders of For subinterval The gray value in Represents grayscale value The geometric center of all corresponding pixels in the cluster, represents the cluster center of the cluster, represents the Euclidean distance, , Represent the length and width of the surface image respectively.
[0014] Preferably, the step of determining the mapping grayscale interval of each target grayscale interval comprises: Target grayscale interval The mapping grayscale interval is ; Among them, the left boundary of the mapped grayscale interval , right border , Indicates The degree of aggregation of target grayscale intervals, means rounding up, and ; ; Indicates Target grayscale interval The sum of the frequencies of all gray values in ; Indicates The sum of the frequencies of all grayscale values in the target grayscale interval; Represents grayscale value The frequency, Indicates taking the minimum value, , Respectively represent the left and right boundaries of the grayscale value range.
[0015] Preferably, the method for obtaining the mapping value of each grayscale value in the target grayscale interval in the mapped grayscale interval includes: obtaining the mapping value of each grayscale value in the target grayscale interval in the mapped grayscale interval according to the transformation function in the histogram equalization algorithm, including: taking the target grayscale interval as the range of the independent variable of the transformation function, taking the mapped grayscale interval as the range of the dependent variable of the transformation function, taking each grayscale value in the target grayscale interval as the independent variable of the transformation function, obtaining the dependent variable corresponding to the independent variable in the transformation function, and using it as the mapping value of each grayscale value in the target grayscale interval in the mapped grayscale interval.
[0016] The present invention determines the mapping grayscale interval of each target grayscale interval according to the aggregation degree of each target grayscale interval and the sum of the frequencies of all grayscale values in each target grayscale interval, thereby retaining the local features in the surface image and distinguishing the local features represented by each target grayscale interval from the local features represented by other target grayscale intervals, thereby improving the accuracy of paint defect detection.
[0017] Preferably, the method of calculating the uniformity of the adhesive coating of the adhesive layer according to the enhanced surface image, and then obtaining the coating defects of the adhesive layer, comprises: dividing the enhanced surface image into a plurality of local windows, the size of the local windows being , Represents the second preset value; Calculate the variance of the grayscale values of all pixels in the local window ,Will as the uniformity of the local window; taking the average value of the uniformity of all the local windows as the glue coating uniformity of the glue layer; in response to the glue coating uniformity of the glue layer being less than a preset second threshold value, there is a coating defect in the glue layer.
[0018] The beneficial effects of the present invention are:
[0019] Compared with directly performing image enhancement processing on the surface image through histogram equalization, the present invention divides the grayscale value range of the surface image into multiple target grayscale intervals according to the distance between the geometric center and the clustering center of the cluster, the grayscale value of each pixel in the cluster, and the grayscale values of other pixels in the neighborhood of each pixel in the cluster. The obtained target grayscale intervals represent different local features in the surface image respectively, and then determine the mapping grayscale interval of each target grayscale interval according to the aggregation degree of each target grayscale interval and the sum of the frequencies of all grayscale values in each target grayscale interval, and determine the mapping value of each grayscale value in the target grayscale interval in the mapping grayscale interval, and then perform image enhancement processing on the surface image. At this time, the enhanced surface image obtained retains and highlights the local features in the surface image while enhancing the contrast between the defective area and the normal area, thereby improving the accuracy of paint defect detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The above and other purposes, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the detailed description below through the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0021] Figure 1 is a flow chart schematically illustrating a method for detecting painting defects based on image processing in the present invention;
[0022] Figure 2 is a surface image schematically showing the glue layer;
[0023] Figure 3 It is schematically shown Figure 2 Grayscale histogram of the surface image;
[0024] Figure 4 It schematically shows the direct use of the histogram equalization algorithm to Figure 2 When the surface image is enhanced, the enhanced surface image;
[0025] Figure 5 It schematically shows the direct use of the histogram equalization algorithm to Figure 2 When the surface image is enhanced, the grayscale histogram of the enhanced surface image;
[0026] Figure 6 The method of the present invention is schematically shown in Figure 2 When the surface image is enhanced, the enhanced surface image;
[0027] Figure 7 The method of the present invention is schematically shown in Figure 2When image enhancement is performed on a surface image, the grayscale histogram of the enhanced surface image is obtained. DETAILED DESCRIPTION
[0028] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0029] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0030] The production process of adhesive tape includes raw material procurement, substrate and surface treatment, adhesive preparation, coating, tape forming and post-processing, specifically:
[0031] 1. In the raw material procurement stage, by selecting appropriate raw materials, ensure that the raw material quality meets the requirements; among them, the types and characteristics of the raw materials of the substrate are:
[0032] (1) Polyester film (PET): This raw material has the characteristics of good transparency, high mechanical strength, and good chemical stability. It is suitable for various types of tapes, such as BOPP sealing tape, warning tape, etc.
[0033] (2) Polyethylene (PE): This raw material has the characteristics of good softness, excellent low temperature resistance and low cost. It is suitable for packaging tapes, double-sided tapes, etc.
[0034] (3) Acrylic film (PMMA): This raw material has the characteristics of high transparency, good weather resistance, and easy processing. It is suitable for double-sided tapes, label tapes, etc.
[0035] 2. In the substrate and surface treatment stage, the adhesion between the substrate and the adhesive is improved by surface treatment of the substrate; the substrate treatment includes steps such as cleaning, degreasing, dewatering, and drying to ensure that the substrate surface is clean and free of foreign matter, which can improve the adhesion between the substrate and the adhesive and reduce the probability of the tape falling off; the surface treatment includes chemical treatment (such as chromic acid treatment), physical treatment (such as flame treatment), etc., which can improve the roughness of the substrate surface and improve the adhesion between the adhesive and the substrate.
[0036] 3. In the adhesive preparation stage, select the appropriate adhesive according to the needs and carry out preparatory work before coating; among them, the types of adhesive raw materials include: natural rubber adhesive, synthetic rubber adhesive, acrylic adhesive, etc. Select the appropriate adhesive according to different application requirements, such as corrosion resistance, high temperature resistance, and oxidation resistance.
[0037] 4. During the coating stage, the adhesive is evenly applied to the substrate to form a layer of adhesive with a certain thickness. The adhesive coating techniques include spraying, scraping, roller coating, etc. Selecting a suitable coating method can improve coating uniformity and reduce coating defects. At the same time, by selecting high-precision coating equipment, such as scraper coaters, roller coaters, etc., the coating quality can be improved and the defective rate in the production process can be reduced.
[0038] 5. During the tape forming stage, the coated tape is cut, rolled, and processed to form a finished tape with certain specifications and shapes. Selecting appropriate forming equipment can improve production efficiency and reduce production costs.
[0039] 6. In the post-processing stage, the finished tape is cut, striped, etc. to meet different needs. Selecting appropriate post-processing equipment can improve product quality and customer satisfaction.
[0040] Among them, the substrate and surface treatment stage and the painting stage are important stages for determining product quality and reducing the defective rate. Therefore, analyzing the surface image of the adhesive layer formed in the painting stage and obtaining the painting defects of the adhesive layer are crucial to ensuring product quality.
[0041] The present invention discloses a method for detecting painting defects based on image processing, referring to Figure 1 , including steps S1 to S4:
[0042] In order to reduce the influence of uneven illumination on surface image analysis, a histogram equalization algorithm is used to enhance the features of the surface image. The histogram equalization algorithm enhances the contrast of the surface image by expanding the grayscale value, but it will destroy the local features in the surface image and affect the accuracy of defect detection. Therefore, according to the distance between the geometric center and the cluster center of the cluster, the grayscale value of each pixel in the cluster, and the grayscale values of other pixels in the neighborhood of each pixel in the cluster, the grayscale value range of the surface image of the glue layer is divided into multiple target grayscale intervals, and then the mapping grayscale interval of each target grayscale interval is determined according to the aggregation degree of each target grayscale interval and the sum of the frequencies of all grayscale values in each target grayscale interval, and the mapping value of each grayscale value in the target grayscale interval is determined in the mapping grayscale interval, so as to perform image enhancement processing on the surface image, and calculate the glue coating uniformity of the glue layer according to the enhanced surface image, and then obtain the brushing defects of the glue layer; the specific process is as follows:
[0043] S1. In the process of producing adhesive tape, the surface image of the adhesive layer formed in the coating stage is collected.
[0044] Specifically, in the process of producing the adhesive tape, a surface image of the adhesive layer formed in the coating stage is collected by a camera, and the surface image is a grayscale image.
[0045] For example, the surface image of the adhesive layer is as follows Figure 2 As shown, the grayscale histogram of the surface image is Figure 3 As shown; directly use the histogram equalization algorithm to Figure 2 When the surface image is enhanced, the enhanced surface image is as follows Figure 4 As shown, the grayscale histogram of the enhanced surface image is as follows Figure 5 shown.
[0046] S2. Divide the grayscale value range consisting of the minimum grayscale value and the maximum grayscale value in the surface image into multiple target grayscale intervals.
[0047] It should be noted that in the surface image, the same local features are usually manifested as a group of similar grayscale values in the surface image. These grayscale values are usually concentrated in a certain range and form an obvious peak distribution on the grayscale histogram. Therefore, the number parameter determined by the number of all target troughs in the grayscale histogram is , which can be used as a quantitative basis for dividing the grayscale value range of the surface image into sub-intervals, thereby accurately distinguishing local features in the surface image.
[0048] Specifically, a grayscale histogram of the surface image is obtained, wherein the horizontal axis of the grayscale histogram is the grayscale value, and the vertical axis is the frequency of each grayscale value; all peaks and all troughs in the grayscale histogram are obtained, wherein each peak corresponds to a grayscale value, each trough corresponds to a grayscale value, and the frequency of the trough refers to the frequency of the grayscale value corresponding to the trough, and the frequency of the peak refers to the frequency of the grayscale value corresponding to the peak; for any trough, when the difference between the frequency of the trough and its two adjacent peaks is greater than a preset first threshold, the trough is taken as a target trough; according to the number of all target troughs , determine the quantity parameters , then the quantity parameter equal .
[0049] The specific value of the preset first threshold can be set according to the actual application scenario and requirements, and the value taking method of the preset first threshold is [0.001, 0.01]. The present invention sets the preset first threshold to 0.004.
[0050] Furthermore, the minimum grayscale value and the maximum grayscale value in the surface image are combined to form a grayscale value range; the grayscale value range is divided into Sub-intervals.
[0051] Among them, the gray value range is divided into subintervals, including: each subinterval consists of a left boundary, a right boundary, and all integers between the left boundary and the right boundary; among them, the The left boundary of the subinterval is ,and , Indicates The right boundary of the subinterval; The right boundary of the subinterval is , for Any integer in For the The value range of the right boundary of the subinterval is Indicates The gray value corresponding to the trough; Indicates the serial number, for An integer in the range.
[0052] It should be noted that The left boundary of the subinterval is ,and ,in, represents the left boundary of the gray value range and is equal to the minimum gray value in the surface image; The right boundary of the subinterval is ,and ,in, Represents the right boundary of the grayscale value range and is equal to the maximum grayscale value in the surface image.
[0053] It should be noted that the grayscale value range is divided into intervals so that the grayscale values corresponding to the same local feature can be divided into the same target grayscale interval; since different sub-intervals are obtained by different division methods, in order to obtain a division method that can accurately and completely represent all local features in the surface image, the present invention analyzes all sub-intervals obtained under each division method.
[0054] Specifically, for all sub-intervals obtained by any division method, all pixel points corresponding to all grayscale values in the sub-interval are clustered to obtain multiple clusters; the geometric center of all pixel points corresponding to each grayscale value in the cluster is obtained, and the degree of aggregation of the cluster is calculated according to the distance between the geometric center and the cluster center of the cluster, the grayscale value of each pixel point in the cluster, and the grayscale values of other pixel points in the neighborhood range of each pixel point in the cluster; the average value of the degree of aggregation of all clusters in the sub-interval is taken as the degree of aggregation of the sub-interval; the sum of the degrees of aggregation of all sub-intervals is taken as the degree of aggregation of the division method; all sub-intervals obtained by the division method with the smallest degree of aggregation are taken as all target grayscale intervals, and finally the grayscale value range is divided into target grayscale range.
[0055] It should be noted that the present invention divides the grayscale value range into multiple sub-intervals by different division methods, and obtains a division method that can accurately and completely represent all local features in the surface image by analyzing all sub-intervals obtained under each division method.
[0056] Among them, for any sub-interval, all pixel points corresponding to all grayscale values in the sub-interval are clustered to obtain multiple clusters; since the number of all clusters is uncertain, the present invention selects the OPTICS (Ordering points to identify the clustering structure) clustering algorithm, and through the OPTICS clustering algorithm, all pixel points corresponding to all grayscale values in the sub-interval are clustered to obtain multiple clusters.
[0057] Furthermore, for any cluster, the method for obtaining the degree of aggregation of the cluster is: obtaining the geometric center of all pixel points corresponding to each grayscale value in the cluster; calculating the first distribution feature of the cluster based on the grayscale value of each pixel point in the cluster; calculating the second distribution feature of the cluster based on the grayscale values of other pixel points in the neighborhood of each pixel point in the cluster; calculating the degree of aggregation of the cluster based on the distance between the geometric center and the clustering center of the cluster, the first distribution feature of the cluster and the second distribution feature of the cluster.
[0058] The neighborhood range of the pixel point is centered at the pixel point and has a size of area, Represents a first preset value; the specific value of the first preset value can be set according to actual application scenarios and requirements, and the first preset value is an odd number in the range of [3,7]. The present invention sets the first preset value to 5.
[0059] Then the degree of aggregation of the cluster satisfies the expression:
[0060] ;
[0061] In the formula, Indicates the degree of aggregation of the cluster. represents the natural exponential function, represents the first distribution feature of the cluster, represents the second distribution feature of the cluster, , Represents subintervals The left and right borders of For subinterval The gray value in Represents grayscale value The geometric center of all corresponding pixels in this cluster, represents the cluster center of the cluster. represents the Euclidean distance, , Represent the length and width of the surface image respectively.
[0062] It should be noted that in the above formula, the gray value The smaller the Euclidean distance between the geometric center of all corresponding pixels in the cluster and the cluster center of the cluster, and the larger the first distribution feature and the second distribution feature of the cluster, the greater the aggregation degree of the cluster; since the pixels corresponding to the same local feature in the surface image are often connected in space, the gray value The smaller the Euclidean distance between the geometric center of all corresponding pixels in the cluster and the cluster center of the cluster, the more likely the pixels in the cluster are to belong to the same feature; since the pixels corresponding to the same feature in the surface image have similar texture distribution, the larger the first distribution feature and the second distribution feature of the cluster, the more likely the pixels in the cluster are to belong to the same local feature; in summary, the greater the degree of aggregation of the cluster, the more likely the pixels in the cluster are to belong to the same local feature.
[0063] Among them, the first distribution feature of the cluster satisfies the expression:
[0064] ;
[0065] In the formula, represents the first distribution feature of the cluster, represents the natural exponential function, Indicates that the gray value in this cluster is The number of all pixels in the range, Indicates that the gray value in this cluster is not The number of all pixels in the range, , Represents subintervals The left and right borders of For subinterval The gray value in Indicates taking the maximum value, Indicates the number of all pixels in this cluster.
[0066] The second distribution characteristic of the cluster satisfies the expression:
[0067] ;
[0068] In the formula, represents the second distribution feature of the cluster, represents the natural exponential function, Indicates that the gray value in this cluster is The number of all pixels in the range, Indicates that the gray value in this cluster is The range of Among all other pixels in the neighborhood of a pixel, the gray value is The number of other pixels in the range, Indicates that the gray value in this cluster is The range of Among all other pixels in the neighborhood of a pixel, the gray value is not The number of other pixels in the range, , Represents subintervals The left and right borders of Represents a subinterval The gray value in Indicates taking the maximum value.
[0069] It should be noted that the present invention judges the spatial continuity of pixels in the cluster by the distance between the geometric center and the cluster center of the cluster, and judges the grayscale continuity of pixels in the cluster by the first distribution feature and the second distribution feature of the cluster. Then, the degree of aggregation of the cluster obtained by the distance between the geometric center and the cluster center of the cluster, the first distribution feature and the second distribution feature of the cluster can more accurately characterize whether the pixels in the cluster belong to the same local feature.
[0070] S3. Perform image enhancement processing on the surface image according to the mapping value of each grayscale value in the target grayscale interval in the mapping grayscale interval.
[0071] Specifically, the mapping grayscale interval of each target grayscale interval is determined according to the aggregation degree of each target grayscale interval and the sum of the frequencies of all grayscale values in each target grayscale interval, wherein the first All grayscale values in the target grayscale interval refer to the Target grayscale interval All integers in All grayscale values in the target grayscale interval refer to the Target grayscale interval For all integers in Target grayscale interval The mapping grayscale interval is ,in, Indicates the serial number, for Integer in the range, Equal to the quantity parameter; , Respectively represent the mapping grayscale interval The left and right borders of the .
[0072] The left boundary and right border Satisfies the expression:
[0073] ;
[0074] ;
[0075] In the formula, Indicates The degree of aggregation of target grayscale intervals, Indicates rounding up. , Satisfies the expression:
[0076] ;
[0077] ;
[0078] in, Indicates Target grayscale interval The sum of the frequencies of all gray values in , , Respectively represent Target grayscale interval The left and right borders of Indicates The sum of the frequencies of all grayscale values in the target grayscale interval, , Respectively represent Target grayscale interval The left and right borders of Represents grayscale value The frequency, Indicates taking the minimum value, represents the left boundary of the gray value range and is equal to the minimum gray value in the surface image. Represents the right boundary of the grayscale value range and is equal to the maximum grayscale value in the surface image.
[0079] It is particularly important to note that for target grayscale interval, .
[0080] It should be noted that the greater the aggregation degree of the target grayscale interval, the more concentrated the distribution of the local features represented by the target grayscale interval. In order not to destroy the distribution characteristics of the local features, the size of the mapped grayscale interval of the target grayscale interval is smaller.
[0081] It should be further explained that, from the above formula, and The interval of composition It is based on The frequency of all gray values in the target gray interval is determined by the sum of the frequencies of the gray values in the target gray interval. According to the The degree of aggregation of the target grayscale intervals is from interval The interval intercepted There will be multiple grayscale values left in the The local features represented by the target grayscale interval are distinguished from the local features represented by other target grayscale intervals.
[0082] Further, the surface image is enhanced according to the mapping value of each grayscale value in the target grayscale interval in the mapping grayscale interval.
[0083] Among them, the method for obtaining the mapping value of each grayscale value in the target grayscale interval in the mapped grayscale interval includes: taking the target grayscale interval as the range of the independent variable of the transformation function, taking the mapped grayscale interval as the range of the dependent variable of the transformation function, taking each grayscale value in the target grayscale interval as the independent variable of the transformation function, obtaining the dependent variable corresponding to the independent variable in the transformation function, and using it as the mapping value of each grayscale value in the target grayscale interval in the mapped grayscale interval.
[0084] The transformation function is a well-known function in the histogram equalization algorithm, and the histogram equalization algorithm is a well-known algorithm, which will not be described in detail here.
[0085] Exemplarily, the method of the present invention is used to Figure 2 When the surface image is enhanced, the enhanced surface image is as follows Figure 6 As shown, the grayscale histogram of the enhanced surface image is as follows Figure 7 shown.
[0086] It should be noted that compared with directly performing image enhancement processing on the surface image through histogram equalization, the present invention divides the grayscale value range of the surface image into multiple target grayscale intervals according to the distance between the geometric center and the clustering center of the cluster, the grayscale value of each pixel in the cluster, and the grayscale values of other pixels in the neighborhood of each pixel in the cluster. The obtained target grayscale intervals represent different local features in the surface image respectively, and then determine the mapping grayscale interval of each target grayscale interval according to the aggregation degree of each target grayscale interval and the sum of the frequencies of all grayscale values in each target grayscale interval, and determine the mapping value of each grayscale value in the target grayscale interval in the mapping grayscale interval, and then perform image enhancement processing on the surface image. At this time, the enhanced surface image obtained, while enhancing the contrast between the defective area and the normal area, retains and highlights the local features in the surface image, thereby improving the accuracy of paint defect detection.
[0087] S4. Calculate the glue coating uniformity of the glue layer according to the enhanced surface image, and then obtain the coating defects of the glue layer.
[0088] Specifically, the enhanced surface image is divided into a plurality of local windows, and the size of the local window is , Represents the second preset value; Calculate the variance of the grayscale values of all pixels in each local window ,Will As the uniformity of each local window; the average value of the uniformity of all local windows is taken as the uniformity of the glue coating of the glue layer.
[0089] The specific value of the second preset value can be set according to actual application scenarios and requirements, and the second preset value is an odd number in the range of [13, 21]. The present invention sets the second preset value to 15.
[0090] Further, in response to the glue coating uniformity of the glue layer being less than a preset second threshold, a coating defect exists in the glue layer.
[0091] The specific value of the preset second threshold can be set according to the actual application scenario and requirements, and the value range of the preset second threshold is [0.5, 0.9]. The present invention sets the preset second threshold to 0.63.
[0092] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0093] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A method for detecting painting defects based on image processing, characterized in that: include: In the process of producing adhesive tape, the surface image of the adhesive layer formed in the coating stage is collected; The minimum gray value and the maximum gray value in the surface image form a gray value range; Divide the grayscale value range into multiple sub-intervals by different division methods, and for all sub-intervals obtained by any division method: cluster all pixel points corresponding to all grayscale values in the sub-intervals to obtain multiple clusters; calculate the first distribution feature of the cluster according to the grayscale value of each pixel point in the cluster; According to the grayscale values of other pixels in the neighborhood of each pixel in the cluster, the second distribution feature of the cluster is calculated. The first distribution and the second distribution features are used to characterize the continuity of the grayscale of the pixels in the cluster. The neighborhood of the pixel is centered at the pixel and has a size of area, represents a first preset value; obtains the geometric center of all pixel points corresponding to each gray value in the cluster, and calculates the degree of aggregation of the cluster according to the distance between the geometric center and the cluster center of the cluster, the first distribution feature of the cluster, and the second distribution feature of the cluster; takes the average value of the degree of aggregation of all clusters in the subinterval as the degree of aggregation of the subinterval; takes the sum of the degrees of aggregation of all subintervals as the degree of aggregation of the division method; All sub-intervals obtained by the division method with the minimum aggregation degree are used as all target grayscale intervals; the mapping grayscale interval of each target grayscale interval is determined according to the aggregation degree of each target grayscale interval and the sum of the frequencies of all grayscale values in each target grayscale interval; image enhancement processing is performed on the surface image according to the mapping value of each grayscale value in the target grayscale interval in the mapping grayscale interval; According to the enhanced surface image, the uniformity of the adhesive coating of the adhesive layer is calculated, and then the coating defects of the adhesive layer are obtained, including: dividing the enhanced surface image into multiple local windows, the size of the local window is , represents a second preset value; Calculate the variance of the grayscale values of all pixels in the local window ,Will as the uniformity of the local window; taking the average value of the uniformity of all the local windows as the glue coating uniformity of the glue layer; in response to the glue coating uniformity of the glue layer being less than a preset second threshold value, there is a coating defect in the glue layer.
2. The method for detecting painting defects based on image processing according to claim 1, characterized in that: The grayscale value range is divided into multiple sub-intervals by different division methods, including: The gray value range is divided into sub-intervals, Equal to the quantity parameter, each subinterval consists of the left boundary, the right boundary, and all integers between the left boundary and the right boundary; Among them, The left boundary of the subinterval is ,and , Indicates The right boundary of the subinterval; The right boundary of the subinterval is ,and for Any integer in For the The value range of the right boundary of the subinterval is Indicates A gray value corresponding to a trough, wherein the trough is a trough in a gray histogram of the surface image; Indicates the serial number, for An integer in the range.
3. The method for detecting painting defects based on image processing according to claim 2, characterized in that: The method for obtaining the quantity parameter includes: Obtaining a grayscale histogram of the surface image, wherein the abscissa of the grayscale histogram is the grayscale value and the ordinate is the frequency of each grayscale value; Obtain all peaks and all troughs in the grayscale histogram, each peak corresponds to a grayscale value, each trough corresponds to a grayscale value, and the frequency of the trough refers to the frequency of the grayscale value corresponding to the trough, and the frequency of the peak refers to the frequency of the grayscale value corresponding to the peak; For any trough, when the frequency differences between the trough and its two adjacent peaks are greater than a preset first threshold, the trough is taken as a target trough; Based on the number of all target troughs , determine the quantity parameters , then the quantity parameter equal .
4. The method for detecting painting defects based on image processing according to claim 1, characterized in that: The first distribution characteristic of the cluster satisfies the expression: ; In the formula, represents the first distribution feature of the cluster, represents the natural exponential function, Indicates that the gray value in the cluster is The number of all pixels in the range, Indicates that the gray value in the cluster is not The number of all pixels in the range, , Represents subintervals The left and right boundaries of For subinterval The gray value in Indicates taking the maximum value, Indicates the number of all pixels in the cluster.
5. The method for detecting painting defects based on image processing according to claim 1, characterized in that: The second distribution characteristic of the cluster satisfies the expression: ; In the formula, represents the second distribution feature of the cluster, represents the natural exponential function, Indicates that the gray value in the cluster is The number of all pixels in the range, Indicates that the gray value in the cluster is The range of Among all other pixels in the neighborhood of a pixel, the gray value is The number of other pixels in the range, Indicates that the gray value in the cluster is The range of Among all other pixels in the neighborhood of a pixel, the gray value is not The number of other pixels in the range, , Represents subintervals The left and right boundaries of For subinterval The gray value in Indicates taking the maximum value, the size of the neighborhood range of the pixel point is , Indicates the first preset value.
6. The method for detecting painting defects based on image processing according to claim 1, characterized in that: The calculation of the aggregation degree of the cluster includes: ; In the formula, Indicates the degree of cluster aggregation. represents the natural exponential function, represents the first distribution feature of the cluster, represents the second distribution feature of the cluster, , Represents subintervals The left and right boundaries of For subinterval The gray value in Represents grayscale value The geometric center of all corresponding pixels in the cluster, represents the cluster center of the cluster, represents the Euclidean distance, , Represent the length and width of the surface image respectively.
7. The method for detecting painting defects based on image processing according to claim 2, characterized in that: The step of determining a mapping grayscale interval of each target grayscale interval includes: No. Target grayscale interval The mapping grayscale interval is ; Among them, the left boundary of the mapped grayscale interval , right border , Indicates The degree of aggregation of target grayscale intervals, means rounding up, and ; ; Indicates Target grayscale interval The sum of the frequencies of all gray values in ; Indicates The sum of the frequencies of all grayscale values in the target grayscale interval; Represents grayscale value The frequency, Indicates taking the minimum value, , Respectively represent the left and right boundaries of the grayscale value range.
8. The method for detecting painting defects based on image processing according to claim 1, characterized in that: The method for obtaining the mapping value of each grayscale value in the target grayscale interval in the mapping grayscale interval includes: According to the transformation function in the histogram equalization algorithm, the mapping value of each grayscale value in the target grayscale interval in the mapped grayscale interval is obtained, including: taking the target grayscale interval as the range of the independent variable of the transformation function, taking the mapped grayscale interval as the range of the dependent variable of the transformation function, taking each grayscale value in the target grayscale interval as the independent variable of the transformation function, obtaining the dependent variable corresponding to the independent variable in the transformation function, and using it as the mapping value of each grayscale value in the target grayscale interval in the mapped grayscale interval.
Citation Information
Patent Citations
Defect detection methods and defect detection equipment
CN108387587B
Metal forging surface defect detection method based on image processing
CN118096739A
Textile defect detection method based on image processing
CN118587223A