A surface defect detection method for hand-painted nano-coated canvas preparation
By analyzing the direction and grayscale anomaly of the edges in the canvas image and gamma change adjustment of the grayscale value, the problem of indistinguishable textures and defects in the prior art is solved, and the accuracy of canvas defect detection is improved.
Patent Information
- Application Number
- CN202411589681.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-11-08
AI Technical Summary
When detecting defects on canvas images, it is difficult to accurately distinguish the textures and defects of cotton and linen materials, resulting in inaccurate detection results.
By obtaining the edges in the canvas image, analyzing the direction and grayscale anomaly of the edges, using the least squares method to fit the edges, calculate the abnormality of the edges, and performing gamma change adjustments to the grayscale values of pixel points in the edges, inputting pre- The trained canvas defect recognition model is used for detection.
The accuracy of surface defect detection of hand-painted nanocoated canvas is improved, the grayscale difference between abnormal defects and normal areas is enhanced, and the impact of texture on defect detection is reduced.
Smart Images

Figure CN119131013B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image data processing, and more specifically, to a surface defect detection method for preparing a hand-painted nano-coated canvas. Background Art
[0002] Canvas is affected by humidity, oil absorption, fragility, susceptibility to insects and other factors, resulting in poor storage performance. Nano coating technology is a cutting-edge technology that uses the characteristics of nano materials to improve the storage performance of items. It forms a three-dimensional mesh protection structure by coating the canvas through spraying, brushing, dipping, etc., which can effectively improve the strength, toughness, ductility, corrosion resistance and oxidation resistance of the canvas. In order to ensure the quality of nano-coated canvas, it is necessary to perform surface defect detection on the canvas image to be coated.
[0003] Before performing defect detection on a canvas image, the image needs to be processed using an image enhancement algorithm. For example, a patent application document with publication number CN110084760A discloses a global adaptive grayscale image enhancement method based on dual gamma correction. The method inputs a grayscale image and initializes the parameters of a particle swarm optimization algorithm; performs dual gamma correction on the input image at each particle position to obtain a preliminary enhanced image, and updates the historical optimal fitness value and optimal position of the individual and group particles; determines whether the iterative optimization termination condition is met, and if not, updates the inertia weight, learning factor, speed and position of each particle and continues iterating; otherwise, uses the final group optimal position to perform dual gamma correction on the input image to obtain a final enhanced image.
[0004] Although the existing technology can enhance the contrast of low-illumination grayscale images, it only achieves overall enhancement of the low-illumination area. Using this method will enhance the texture and defects of the cotton and linen materials on the canvas, resulting in the enhanced texture and defects still cannot be accurately distinguished, thereby affecting the accuracy of canvas surface defect detection.
[0005] Based on this, how to accurately enhance the canvas image, thereby improving the accuracy of the surface defect detection results of the hand-painted nano-coated canvas, is a problem that needs to be solved urgently by technical personnel in this field. Summary of the invention
[0006] In order to solve the above technical problem of how to accurately enhance the canvas image and thus improve the accuracy of the surface defect detection results of the hand-painted nano-coated canvas, the present invention proposes a surface defect detection method for the preparation of a hand-painted nano-coated canvas, the method comprising the following steps:
[0007] Get the edge in the canvas image, determine the reference direction of the pixel points through the gradient direction of the pixel points in the edge, and record the reference direction that appears most times in the edge as the reference direction of the edge; obtain the degree of abnormality of the direction of the edge through the degree of deviation between the tangent direction of each pixel point in the edge and the reference direction of the edge; obtain the degree of abnormality of the grayscale of the edge through the grayscale difference between the edge and the adjacent pixels on the left and right sides; obtain the determination coefficient of the edge through the least squares method to fit the edge, and calculate the degree of abnormality of the edge: ; In the formula, Indicates the degree of abnormality of the edge, Indicates the grayscale abnormality of the edge. Indicates the degree of abnormality of the edge direction. Represents the determination coefficient of the edge; performs gamma change adjustment on the grayscale value of each pixel in the edge according to the abnormality degree of the edge, inputs the canvas image after gamma change adjustment into the pre-trained canvas defect recognition model, and obtains the defect detection result of the canvas image.
[0008] The present invention takes into account that the texture in the canvas image will affect the detection accuracy of the canvas image. Therefore, when determining the surface defect detection result of the hand-painted nano-coated canvas preparation, by analyzing the directional abnormality and grayscale abnormality of each edge in the canvas image, the possibility of each edge being an abnormal defect can be accurately obtained, and the grayscale value of the pixel point in the edge is adjusted according to the possibility that the edge is an abnormal defect, so as to achieve precise adjustment of the edge grayscale value, enhance the grayscale difference between the abnormal defect and the normal area, reduce the influence of the canvas texture on defect detection, thereby effectively improving the accuracy of surface defect detection of the hand-painted nano-coated canvas preparation.
[0009] According to a surface defect detection method for hand-painted nano-coated canvas prepared by the present invention, the step of obtaining the edge in the canvas image also includes: collecting a high-definition image of the canvas, and preprocessing the high-definition image of the canvas to obtain the canvas image.
[0010] The present invention takes into account the possibility of noise in the original captured canvas photo or image deformation due to lens distortion. Therefore, after the high-definition image of the canvas is captured, the high-definition image is preprocessed to effectively improve the image quality, thereby preparing for subsequent image processing.
[0011] According to a surface defect detection method for hand-painted nano-coated canvas prepared by the present invention, the reference direction of the pixel point is determined by the gradient direction of the pixel point in the edge, including: taking the perpendicular direction of the gradient direction of the pixel point in the edge as the tangent direction of the pixel point; taking the direction of the longitude or latitude corresponding to the minimum angle difference between the tangent direction and the longitude and latitude as the reference direction of the pixel point.
[0012] According to a surface defect detection method for hand-painted nano-coated canvas prepared by the present invention, the step of obtaining the degree of directional abnormality of the edge comprises: determining the degree of directional abnormality of the edge:
[0013] ; In the formula, Indicates the degree of abnormality of the edge direction. Indicates the number of pixels on the edge. represents the sine function, Indicates the angle between the tangent direction of the i-th pixel in the edge and the baseline. Indicates the edge The angle between the tangent direction of the pixel point and the baseline, Indicates the angle between the reference direction of the edge and the baseline. Represents the absolute value symbol.
[0014] The present invention provides a precise method for calculating the degree of directional anomaly of an edge. By analyzing the degree of deviation between the pixel points in the edge and the edge reference direction, the local directional performance of the edge can be accurately obtained, thereby accurately obtaining the degree of directional anomaly of the edge.
[0015] According to a surface defect detection method for hand-painted nano-coated canvas prepared by the present invention, the grayscale abnormality of the edge satisfies the relationship:
[0016] ;
[0017] In the formula, Indicates the grayscale abnormality of the edge. Indicates the number of pixels on the edge. Represents the gray value of the i-th pixel in the edge, Represents the grayscale value that appears most frequently in the canvas image. , Respectively represent the maximum grayscale value and the minimum grayscale value in the canvas image. Represents the grayscale variance of the edge and the adjacent pixels on the left and right sides. , Respectively represent the grayscale variance of adjacent pixels on one side and the other side of the edge, Represents the absolute value symbol.
[0018] According to a surface defect detection method for hand-painted nano-coated canvas provided by the present invention, the grayscale value of each pixel in the edge is adjusted by gamma change according to the abnormality of the edge, including: calculating the target grayscale value of each pixel in the edge after gamma change:
[0019] ; In the formula, Represents the target grayscale value of the i-th pixel in the edge, Represents the gray value of the i-th pixel in the edge, Indicates the degree of abnormality of the edge; adjusts the grayscale value of each pixel in the edge to the target grayscale value.
[0020] According to a surface defect detection method for hand-painted nano-coated canvas preparation provided by the present invention, the defect detection result of the canvas image is obtained, and then the method further includes: marking the defective pixels in the canvas image through a marking frame, and generating a detection report for the defective pixels and corresponding position information.
[0021] The present invention uses intuitive visual feedback to enable inspectors to quickly locate the problem, reduce misjudgments or missed judgments caused by human interpretation errors, and thus improve the accuracy of defect detection. At the same time, the generated test report can be used as a formal record file to prepare for subsequent quality control, production improvement, etc.
[0022] The present invention has the following beneficial effects:
[0023] Based on the above technical scheme, when determining the surface defect detection results of hand-painted nano-coated canvas preparation, the present invention can accurately obtain the possibility of each edge being an abnormal defect by analyzing the directional abnormality and grayscale abnormality of each edge in the canvas image, and adjust the grayscale value of the pixel point in the edge according to the possibility of the edge being an abnormal defect, thereby achieving precise adjustment of the edge grayscale value, enhancing the grayscale difference between abnormal defects and normal areas, and effectively improving the accuracy of surface defect detection of hand-painted nano-coated canvas preparation. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. 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:
[0025] Figure 1 A schematic flow chart of a surface defect detection method for preparing a hand-painted nano-coated canvas provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0026] 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.
[0027] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0028] It should be noted that the quality of the canvas will affect the quality of the obtained nano-coated canvas. Therefore, during the preparation process of the hand-painted nano-coated canvas, the quality of the canvas needs to be tested. When the defects on the canvas image are identified by conventional image detection algorithms, the horizontal and vertical stripes woven from the cotton and linen materials on the canvas will be confused with the defects on the canvas. The stripes may be mistakenly identified as defects, or the real defects may be covered by the stripes, resulting in inaccurate detection. In the prior art, image recognition processing is usually achieved by enhancing the image contrast. However, if the edges of the texture and defects woven from the cotton and linen materials on the canvas are enhanced, the enhanced texture and defects cannot be accurately distinguished, thereby affecting the accuracy of canvas surface defect detection.
[0029] Based on this, an embodiment of the present invention discloses a surface defect detection method for hand-painted nano-coated canvas preparation, which obtains the possible degree of abnormal defects of each edge in the canvas image and enhances the edges to different degrees according to the possible degree of abnormal defects, so that the enhanced defects and normal textures can be accurately distinguished, thereby avoiding the influence of normal texture on defect identification and effectively improving the accuracy of canvas defect detection.
[0030] For details, please see Figure 1 As shown, Figure 1 A schematic flow chart of a surface defect detection method for preparing a hand-painted nano-coated canvas provided in an embodiment of the present invention, the method comprises the following steps S1 to S4.
[0031] S1: Obtain an edge in the canvas image, determine the reference direction of the pixel points according to the gradient direction of the pixel points in the edge, and record the reference direction that appears most times in the edge as the reference direction of the edge.
[0032] It should be noted that the canvas image may include normal textures, abnormal defects and flat areas, among which the flat area is a smooth area with neither normal textures nor abnormal defects. The shape of the normal texture is usually linear and the direction is criss-crossed. Compared with the flat area, its grayscale is smaller, while the shape of the abnormal defect is more random and the direction is also random, and its grayscale is larger than the flat area.
[0033] Based on this, the embodiment of the present invention can achieve accurate distinction between normal textures and abnormal defects by acquiring the abnormal conditions of the grayscale and direction of each edge appearing in the non-flat area of the canvas image.
[0034] By way of example, in an embodiment of the present invention, for an edge to be processed in a canvas image, a reference direction of a pixel is determined by the gradient direction of the pixel in the edge, and the process also includes: acquiring a high-definition image of the canvas, preprocessing the high-definition image of the canvas to obtain a canvas image, and obtaining the edge in the canvas image through an edge detection algorithm.
[0035] The edge detection algorithm may be specifically configured according to actual needs, and the embodiment of the present invention does not impose too many limitations thereon.
[0036] Specifically, a high-definition image of the canvas may be captured by a high-definition industrial camera; the capturing method may be specifically set according to actual needs, and the embodiments of the present invention do not impose too many restrictions thereon.
[0037] Among them, the preprocessing method can be filtering denoising, image geometric transformation and grayscale processing, etc.; the preprocessing method can be specifically set according to actual needs, and the embodiment of the present invention does not impose too many restrictions here.
[0038] After the canvas image is obtained based on the above steps, the direction and grayscale abnormality of each edge in the canvas image can be obtained respectively through the following steps.
[0039] By way of example, in an embodiment of the present invention, the reference direction of a pixel point is determined by the gradient direction of the pixel point in the edge, including: taking the perpendicular direction of the gradient direction of the pixel point in the edge as the tangent direction of the pixel point; taking the direction of the longitude or latitude corresponding to the minimum angle difference between the tangent direction and the longitude and latitude as the reference direction of the pixel point.
[0040] In this way, the reference direction of each pixel point in the edge can be obtained, and the reference direction that appears most frequently in each pixel point in the edge is used as the reference direction of the edge.
[0041] For example, when determining the longitude and latitude of a canvas image, Hough line detection can be used to determine the straight lines in the canvas image, and a horizontal rightward straight line is defined as the baseline, and the angle formed by the baseline and the straight line in a counterclockwise direction is obtained; a histogram is constructed with the angle as the horizontal axis and the number of straight lines corresponding to the angle as the vertical axis, and the angles corresponding to the two largest peaks in the histogram are respectively used as the longitude and latitude of the canvas image.
[0042] After determining the reference direction of each edge based on the above steps, continue to perform the following steps to analyze the degree of abnormality of the direction of each edge.
[0043] S2: The degree of directional anomaly of the edge is obtained by the degree of deviation between the tangent direction of each pixel in the edge and the reference direction of the edge.
[0044] It should be noted that the reference direction of the edge can be obtained based on the above steps. The reference direction of the edge actually represents the angle with the highest probability of appearing in the edge, that is, the typical angle in the edge. Therefore, by analyzing the deviation between the angle between the tangent direction of each pixel in the edge and the baseline and the typical angle in the edge, the degree of abnormality of the edge direction can be accurately obtained.
[0045] For example, in the embodiment of the present invention, the degree of abnormality of the direction of the edge is determined, and the specific details can be referred to the following relationship:
[0046] ;
[0047] In the formula, Indicates the degree of abnormality of the edge direction. Indicates the number of pixels on the edge. represents the sine function, Indicates the angle between the tangent direction of the i-th pixel in the edge and the baseline. Indicates the edge The angle between the tangent direction of the pixel point and the baseline, Indicates the angle between the reference direction of the edge and the baseline. Represents the absolute value symbol.
[0048] In the above formula, Represents the i-th pixel and the The difference in the degree of the tangent direction angle between the pixels is used to characterize the smoothness of the local change of the edge. The larger the value, the stronger the local change of the edge at the i-th pixel, the greater the possibility that the i-th pixel is an abnormal defect, and the greater the corresponding directional abnormality; conversely, the larger the value, the smoother the local change of the edge at the i-th pixel, the greater the possibility that the i-th pixel is a normal texture, and the smaller the corresponding directional abnormality.
[0049] It indicates the degree of deviation of the local edge from the longitude and latitude of the canvas image. Since the normal texture of the canvas is distributed along the longitude and latitude, if the value is larger, it means that the local edge deviates more from the longitude and latitude of the canvas image. In terms of direction, the possibility that the edge is the canvas texture is smaller, the possibility that it is an abnormal defect is greater, and the corresponding degree of directional abnormality is also greater; conversely, if the value is smaller, it means that the local edge deviates less from the longitude and latitude of the canvas image. In terms of direction, the possibility that the edge is the canvas texture is greater, the possibility that it is an abnormal defect is smaller, and the corresponding degree of directional abnormality is also smaller.
[0050] After obtaining the directional abnormality of each edge based on the above steps, continue to determine the grayscale abnormality of the edge through the following steps.
[0051] S3: The grayscale abnormality of the edge is obtained by the grayscale difference between the edge and the adjacent pixels on the left and right sides; the determination coefficient of the edge is obtained by fitting the edge using the least squares method, and the abnormality of the edge is calculated.
[0052] The method of fitting the edge by the least square method to obtain the edge determination coefficient is a prior art and will not be described in detail in the embodiment of the present invention.
[0053] It should be noted that compared with the smooth flat area, the grayscale of the normal texture is smaller, and the grayscale distribution on both sides of the normal texture is more uniform; while the grayscale of the abnormal defect is larger, and the abnormal defect area usually includes the external edge and the internal area surrounded by the edge. The internal grayscale distribution and the external grayscale distribution of the abnormal defect are relatively consistent, but there is a large difference between the internal grayscale distribution and the external grayscale distribution.
[0054] Based on this, the degree of grayscale abnormality can be obtained by analyzing the grayscale changes around the edge.
[0055] For example, in the embodiment of the present invention, the grayscale abnormality of the edge is determined, and the specific relationship can be as follows:
[0056] ;
[0057] In the formula, Indicates the grayscale abnormality of the edge. Indicates the number of pixels on the edge. Represents the gray value of the i-th pixel in the edge, Represents the grayscale value that appears most frequently in the canvas image. , Respectively represent the maximum grayscale value and the minimum grayscale value in the canvas image. Represents the grayscale variance of the edge and the adjacent pixels on the left and right sides. , Respectively represent the grayscale variance of adjacent pixels on one side and the other side of the edge, Represents the absolute value symbol.
[0058] In the above formula, Yes The normalization process of The larger the value is, the more consistent the grayscale distribution inside the edge is, and the grayscale distribution outside is relatively consistent. However, the greater the difference between the internal and external grayscale distributions, the greater the grayscale anomaly of the corresponding edge. The smaller the value is, the more consistent the grayscale distribution on both sides of the edge is, and the smaller the grayscale anomaly of the corresponding edge is.
[0059] It represents the deviation between the gray value of the i-th pixel in the edge and the classic gray value in the edge. Since the gray value of the edge of the abnormal defect is quite different from the gray value of the flat area in the image, and it is an extreme gray value relative to the entire canvas image, and the edge of the normal texture is generally lighter in color than the abnormal defect and is widely distributed in the image, the larger the value is, the greater the possibility that the edge is an abnormal defect, and the corresponding grayscale abnormality is also greater; conversely, the smaller the value is, the greater the possibility that the edge is a normal texture, and the corresponding grayscale abnormality is also smaller.
[0060] After respectively obtaining the directional abnormality degree and the grayscale abnormality degree of each edge based on the above steps, the abnormality degree of the edge can be accurately obtained based on the directional abnormality degree and the grayscale abnormality degree of the edge.
[0061] For example, in the embodiment of the present invention, the abnormality degree of the edge is determined based on the abnormality degree of the direction of the edge and the abnormality degree of the grayscale. For details, see the following relationship:
[0062] ;
[0063] In the formula, Indicates the degree of abnormality of the edge, Indicates the grayscale abnormality of the edge. Indicates the degree of abnormality of the edge direction. represents the coefficient of determination of the edge.
[0064] The determination coefficient of the edge indicates the similarity between the edge and its fitting line, and its value range is from 0 to 1. The closer the determination coefficient is to 1, the higher the similarity between the edge and its fitting line. Since the normal texture is a straight line, the higher the determination coefficient, the more likely the edge is a normal texture and the lower the possibility of an abnormal defect. It can be used to characterize the degree of shape abnormality of the edge.
[0065] It can be understood that, when the degree of abnormality of the direction of the edge is small, but the degree of abnormality of its shape is large, the possibility that the edge has nonlinear characteristics is greater, that is, the possibility that the edge is an abnormal defect is greater.
[0066] Based on this, an embodiment of the present invention increases the degree of directional abnormality by using the degree of shape abnormality of the edge. The greater the degree of shape abnormality, the greater the degree of increase in the degree of directional abnormality, thereby accurately obtaining the actual degree of abnormality of the edge, and adjusting each pixel point in the edge based on the degree of abnormality of the edge, that is, continuing to execute the following steps.
[0067] S4: performing gamma change adjustment on the grayscale value of each pixel in the edge according to the degree of abnormality of the edge, inputting the canvas image after the gamma change adjustment into a pre-trained canvas defect recognition model to obtain a defect detection result of the canvas image.
[0068] It should be noted that the grayscale of the edge is reduced by the degree of abnormality of the edge, so that the edge in the canvas image can be distinguished from the flat area. In the edge area, due to the reduction of its grayscale value, a clear brightness difference can be formed with the flat area, making the edge more prominent, thereby enhancing the local contrast. In the entire canvas image, only the grayscale value of the edge area changes. The higher the degree of abnormality, the greater the degree of grayscale reduction, so that the abnormal defects in the canvas image can be accurately identified based on this.
[0069] By way of example, in an embodiment of the present invention, the grayscale value of each pixel in the edge is adjusted by gamma change according to the degree of abnormality of the edge, including: calculating the target grayscale value of each pixel in the edge after gamma change; adjusting the grayscale value of each pixel in the edge to the target grayscale value.
[0070] For example, the target grayscale value of each pixel in the edge after the gamma change is determined, and the details can be seen in the following relationship:
[0071] ;
[0072] In the formula, Represents the target grayscale value of the i-th pixel in the edge, Represents the gray value of the i-th pixel in the edge, Indicates the degree of abnormality of the edge.
[0073] In the above formula, Represents the gamma coefficient, through The grayscale value of the pixel can be reduced. The smaller the abnormality of the edge, the higher the possibility of normal texture, the smaller the gamma coefficient, the smaller the degree of reduction of the grayscale value of the i-th pixel, so that the grayscale difference between the pixel and the flat area in the canvas image is smaller; the greater the abnormality of the edge, the higher the possibility of abnormal defect, the larger the gamma coefficient, the greater the degree of reduction of the grayscale value of the i-th pixel, so that the grayscale difference between the pixel and the flat area in the canvas image is larger.
[0074] Based on the above steps, the grayscale value of the pixel points in the edge is adjusted, which can significantly enhance the difference between the edge and the flat area. The higher the degree of abnormality, the greater the degree of enhancement, so that the flat area, abnormal defects and normal textures can be distinguished, thereby improving the accuracy of canvas image defect detection.
[0075] By way of example, in an embodiment of the present invention, a gamma change adjustment is performed on the grayscale value of each pixel in the edge according to the degree of abnormality of the edge to assist in the surface defect detection of hand-painted nano-coated canvas preparation, including: inputting the canvas image after the gamma change adjustment into a pre-trained canvas defect recognition model to obtain a defect detection result of the canvas image.
[0076] Specifically, in an embodiment of the present invention, when pre-training a canvas defect recognition model, a historically collected canvas image can be used as a sample set, the sample set includes multiple types of edges, and each edge in the sample set is annotated using a corresponding detection type to obtain an annotated historically collected sample set, wherein the detection type may include texture, tear, scratch, pollution, defect, etc. The model training of yolov5 is completed using the annotated historically collected sample set to obtain a trained canvas defect recognition model that can be used for defect detection.
[0077] After the currently acquired canvas image is processed through the above steps, it is input into the trained canvas defect recognition model to obtain the defect detection result of the canvas image.
[0078] Among them, the specific steps of pre-training the canvas defect recognition model can be implemented by existing technologies, and the embodiments of the present invention will not be described in detail here.
[0079] For example, in an embodiment of the present invention, a defect detection result of a canvas image is obtained, and then the method further includes: marking defective pixels in the canvas image through a marking frame, and generating a detection report for the defective pixels and corresponding position information.
[0080] In this way, the embodiment of the present invention enables inspectors to quickly locate the problem through intuitive visual feedback, reducing misjudgments or missed judgments caused by human interpretation errors, thereby improving the accuracy of defect detection. At the same time, the generated inspection report can be used as a formal record file to prepare for subsequent quality control, production improvement, etc.
[0081] It can be seen that in an embodiment of the present invention, when determining the surface defect detection result of the hand-painted nano-coated canvas preparation, the edge in the canvas image can be obtained, and the reference direction of the pixel point can be determined by the gradient direction of the pixel point in the edge, and the reference direction that appears most times in the edge is recorded as the reference direction of the edge; the degree of abnormality of the direction of the edge is obtained by the degree of deviation between the tangent direction of each pixel point in the edge and the reference direction of the edge; the degree of abnormality of the grayscale of the edge is obtained by the grayscale difference between the edge and the adjacent pixels on the left and right sides; the determination coefficient of the edge is obtained by fitting the edge by the least squares method, and the degree of abnormality of the edge is calculated; the grayscale value of each pixel point in the edge is adjusted by gamma change according to the degree of abnormality of the edge, and the canvas image after the gamma change adjustment is input into a pre-trained canvas defect recognition model to obtain the defect detection result of the canvas image.
[0082] In this way, the embodiment of the present invention can accurately obtain the possibility that each edge is an abnormal defect by analyzing the degree of directional abnormality and grayscale abnormality of each edge in the canvas image, and adjust the grayscale value of the pixel in the edge according to the possibility that the edge is an abnormal defect, so as to achieve precise adjustment of the edge grayscale value and enhance the grayscale difference between abnormal defects and normal areas, thereby effectively improving the accuracy of surface defect detection in the preparation of hand-painted nano-coated canvas.
[0083] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A surface defect detection method for hand-painted nano-coated canvas preparation, characterized in that: include: Obtain the edge in the canvas image, determine the reference direction of the pixel point through the gradient direction of the pixel point in the edge, and record the reference direction with the most occurrences in the edge as the reference direction of the edge; obtain the degree of abnormality of the direction of the edge through the degree of deviation between the tangent direction of each pixel point in the edge and the reference direction of the edge; The grayscale abnormality of the edge is obtained by the grayscale difference between the edge and the adjacent pixels on the left and right sides; the determination coefficient of the edge is obtained by fitting the edge using the least squares method, and the abnormality of the edge is calculated: ; In the formula, Indicates the degree of abnormality of the edge, Indicates the grayscale abnormality of the edge. Indicates the degree of abnormality of the edge direction. represents the coefficient of determination of the edge; The grayscale value of each pixel in the edge is adjusted by gamma change according to the abnormality of the edge, and the canvas image after gamma change adjustment is input into a pre-trained canvas defect recognition model to obtain the defect detection result of the canvas image.
2. The surface defect detection method for preparing a hand-painted nano-coated canvas according to claim 1 is characterized in that: The method of obtaining the edge in the canvas image also includes: A high-definition image of the canvas is collected, the high-definition image of the canvas is preprocessed to obtain a canvas image, and an edge in the canvas image is obtained through an edge detection algorithm.
3. The surface defect detection method for preparing a hand-painted nano-coated canvas according to claim 1 is characterized in that: The step of determining the reference direction of the pixel point by the gradient direction of the pixel point in the edge includes: The direction perpendicular to the gradient direction of the pixel point in the edge is taken as the tangent direction of the pixel point; the direction of the longitude or latitude corresponding to the minimum angle difference between the tangent direction and the longitude and latitude is taken as the reference direction of the pixel point.
4. The surface defect detection method for preparing a hand-painted nano-coated canvas according to claim 3 is characterized in that: The obtaining of the degree of abnormality of the edge direction includes: Determine how directional anomaly the edge is: ; In the formula, Indicates the degree of abnormality of the edge direction. Indicates the number of pixels on the edge. represents the sine function, Indicates the angle between the tangent direction of the i-th pixel in the edge and the baseline. Indicates the edge The angle between the tangent direction of the pixel point and the baseline, Indicates the angle between the reference direction of the edge and the baseline. Represents the absolute value symbol.
5. The surface defect detection method for preparing a hand-painted nano-coated canvas according to claim 1 is characterized in that: The grayscale abnormality of the edge satisfies the relationship: ; In the formula, Indicates the grayscale abnormality of the edge. Indicates the number of pixels on the edge. Represents the gray value of the i-th pixel in the edge, Represents the grayscale value that appears most frequently in the canvas image. , Respectively represent the maximum grayscale value and the minimum grayscale value in the canvas image. Represents the grayscale variance of the edge and the adjacent pixels on the left and right sides. , Respectively represent the grayscale variance of adjacent pixels on one side and the other side of the edge, Represents the absolute value symbol.
6. The surface defect detection method for preparing a hand-painted nano-coated canvas according to claim 1 is characterized in that: The step of performing gamma change adjustment on the grayscale value of each pixel in the edge according to the abnormality degree of the edge includes: Calculate the target grayscale value of each pixel in the edge after gamma change: ; In the formula, Represents the target grayscale value of the i-th pixel in the edge, Represents the gray value of the i-th pixel in the edge, Indicates the degree of abnormality of the edge; adjusts the grayscale value of each pixel in the edge to the target grayscale value.
7. The surface defect detection method for preparing a hand-painted nano-coated canvas according to claim 1 is characterized in that: The defect detection result of the canvas image is obtained, and then the following steps are further included: The defective pixels in the canvas image are marked with a marking box, and a detection report is generated with the defective pixels and the corresponding position information.
Citation Information
Patent Citations
Global self-adaptive grayscale image enhancement method based on double gamma correction
CN110084760A
Plastic mold surface defect analysis and detection method based on image processing
CN116934740A
Electronic cigarette production quality detection method based on image processing
CN117455904A