A method for detecting defects of improperly printed patterns on a fabric surface
By analyzing the brightness consistency and printing influence in the grayscale image of the cloth surface, adjusting the brightness consistency and performing regional growth segmentation, the accuracy problem of printing defect detection under the influence of uneven illumination is solved and the detection effect is significantly improved.
Patent Information
- Application Number
- CN202411000936.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-10-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, uneven lighting causes different brightness in different areas of the cloth surface, making it impossible to accurately segment printing defects on the cloth surface, reducing detection accuracy.
By acquiring the grayscale image of the cloth surface, the local brightness consistency, printing performance and printing influence of the target pixels are analyzed, the brightness consistency is adjusted, and regional growth and image segmentation are performed based on the brightness consistency adjustment, and the image is segmented to improve detection accuracy.
By more clearly distinguishing the printing area in the segmented image, the accuracy and image quality of printing defect detection on the surface of the fabric are improved.
Smart Images

Figure CN118537335B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of cloth printing defect detection, and in particular to a method for detecting defects caused by incorrect printing of a cloth surface pattern. Background Art
[0002] During the production process of fabric, various shapes of patterns are usually printed on its surface. However, during the printing process, the fabric pattern is often not printed correctly due to the uneven placement of the fabric, resulting in some areas being uncolored, affecting the appearance of the fabric surface and reducing the quality of the fabric product. Therefore, it is necessary to detect printing defects on the fabric surface to ensure that the product quality meets the standards.
[0003] In the related technology, image segmentation methods are usually used to identify printing defects in fabric surface images. However, due to the influence of uneven lighting, the brightness of different areas on the fabric surface is different, resulting in the inability to accurately segment the defects, thereby reducing the accuracy of detecting printing defects on the fabric surface pattern. Summary of the invention
[0004] In order to solve the technical problem that due to the influence of uneven illumination, different areas of the cloth surface have different brightness, which makes it impossible to segment accurate defects, thereby reducing the accuracy of detecting defects in the printing of the cloth surface, the purpose of the present invention is to provide a method for detecting defects in the incorrect printing of the cloth surface. The technical solution adopted is as follows:
[0005] The present invention provides a method for detecting defects of improperly printed patterns on a cloth surface, the method comprising:
[0006] Get a grayscale image of the cloth surface;
[0007] Taking any pixel in the grayscale image as the target pixel, in a preset neighborhood centered on the target pixel, the local brightness consistency of the target pixel is obtained according to the difference in the grayscale value distribution of the pixels in different preset directions with the target pixel as the starting point in the preset neighborhood;
[0008] According to the gray value of each pixel point in the preset neighborhood, feature pixels are selected from the preset neighborhood, and expansion is performed with each feature pixel point as the center to obtain different expansion areas for each feature pixel point; according to the distribution of the gray value of each pixel point in each of the expansion areas, the printing performance degree of each feature pixel point is obtained; according to the distance between the feature pixels in the preset neighborhood and the difference in the printing performance degree of the feature pixels, the printing influence degree of the target pixel point is obtained;
[0009] According to the printing influence degree of the target pixel and the local brightness consistency, the adjusted brightness consistency of the target pixel is obtained; based on the adjusted brightness consistency of each pixel, the grayscale image is subjected to region growth to obtain different growth regions; each growth region in the grayscale image is subjected to image segmentation to obtain a segmented image;
[0010] The printing defects of the cloth surface pattern are detected based on the segmented image.
[0011] Furthermore, obtaining the local brightness consistency of the target pixel point according to the difference in the grayscale value distribution of the pixel points in different preset directions with the target pixel point as the starting point in the preset neighborhood includes:
[0012] In a preset neighborhood, the standard deviation of the grayscale values of all pixels in each preset direction is used as the grayscale discrete parameter of each preset direction, and the average value of the grayscale discrete parameters of all preset directions is used as the overall discrete value;
[0013] Taking the average grayscale value of all pixels in each preset direction as the initial grayscale mean value of each preset direction, and taking the average grayscale mean value of all preset directions as the overall grayscale mean value;
[0014] The absolute value of the difference between the grayscale discrete parameter and the overall discrete value in each preset direction is used as the grayscale discrete deviation value in each preset direction; the absolute value of the difference between the initial grayscale mean value and the overall grayscale mean value in each preset direction is used as the grayscale distribution deviation value in each preset direction;
[0015] The product value of the range of the grayscale values of all pixels in each preset direction, the grayscale discrete deviation value and the grayscale distribution deviation value is used as the distribution difference characteristic value of each preset direction;
[0016] The accumulated values of the distribution difference characteristic values in all preset directions are negatively correlated and normalized to obtain the local brightness consistency of the target pixel.
[0017] Furthermore, the expansion is performed with each characteristic pixel point as the center to obtain different expansion areas for each characteristic pixel point, including:
[0018] Taking each feature pixel as the center, expand outwards each time The area composed of the feature pixel and the pixels expanded each time is taken as the first pixel of each feature pixel. expansion area, of which , Indicates the preset maximum number of layers.
[0019] Furthermore, obtaining the printing performance level of each characteristic pixel point includes:
[0020] Taking any characteristic pixel as the target characteristic pixel, taking any extended area of the target characteristic pixel as the target extended area, and taking the standard deviation of the grayscale values of all pixels in the target extended area as the grayscale chaos parameter of the target extended area;
[0021] The absolute value of the difference between the grayscale value of each other pixel point except the target characteristic pixel point in the target extension area and the target characteristic pixel point is used as the initial grayscale difference of each other pixel point, and the average value of the initial grayscale difference of all other pixel points except the target characteristic pixel point in the target extension area is used as the overall grayscale difference of the target extension area;
[0022] Performing negative correlation mapping on the product value of the grayscale chaos parameter of the target extension area and the overall grayscale difference to obtain the grayscale distribution similarity of the target extension area;
[0023] The maximum value of the grayscale distribution similarity of all the extended areas of the target feature pixel is used as the printing expression degree of the target feature pixel.
[0024] Furthermore, obtaining the printing influence degree of the target pixel point according to the distance between the characteristic pixel points in the preset neighborhood and the difference in the printing expression degree of the characteristic pixel points includes:
[0025] Take any two feature pixels as a feature point group;
[0026] The Euclidean distance between two feature pixels in each feature point group in the grayscale image is used as the position difference value of each feature point group;
[0027] The absolute value of the difference between the printing performance degree of two characteristic pixel points in each characteristic point group is used as the printing performance difference value of each characteristic point group;
[0028] taking the product of the position difference value and the printing performance difference value as the printing influence parameter of each feature point group;
[0029] The average values of the printing influence parameters of all feature point groups are normalized to obtain the printing influence degree of the target pixel point.
[0030] Further, obtaining the adjusted brightness consistency of the target pixel point according to the printing influence degree and the local brightness consistency of the target pixel point includes:
[0031] The product value of the printing influence degree of the target pixel and the local brightness consistency is used as the adjustment amount of the target pixel;
[0032] The local brightness consistency of the target pixel and the sum of the adjustment amount are normalized to obtain the adjusted brightness consistency of the target pixel.
[0033] Furthermore, the adjusting brightness consistency of each pixel point and performing region growing on the grayscale image to obtain different growing regions include:
[0034] The adjusted brightness consistency is used as a parameter used by a region growing algorithm to determine pixel merging, and the grayscale image is processed based on the region growing algorithm to obtain different growing regions.
[0035] Furthermore, the step of performing image segmentation on each growth region in the grayscale image to obtain a segmented image comprises:
[0036] Based on the Otsu threshold segmentation algorithm, threshold segmentation is performed on each of the growth regions to obtain a segmented image.
[0037] Furthermore, the detecting of printing defects on the surface of the fabric based on the segmented image includes:
[0038] The segmented image is input into a trained convolutional neural network to obtain the pattern printing defects on the surface of the fabric.
[0039] Furthermore, selecting characteristic pixels from a preset neighborhood according to the grayscale value of each pixel in the preset neighborhood includes:
[0040] A preset number of pixels with maximum grayscale values in a preset neighborhood are taken as feature pixels.
[0041] The present invention has the following beneficial effects:
[0042] The present invention takes into account that due to uneven illumination, different areas of the fabric surface have different brightness performances, resulting in the inability to accurately segment printing defects. Therefore, the present invention first analyzes the grayscale values of pixels in a preset neighborhood of a target pixel, and preliminarily reflects the uniformity of the brightness performance in the preset neighborhood of the target pixel through the obtained local brightness consistency. Considering that the grayscale difference between the printing area and other areas in the preset neighborhood is relatively obvious, it is impossible to accurately reflect the consistency of the brightness performance of the local area of the pixel only through the local brightness consistency. Therefore, the distribution of the grayscale values of pixels in different extended areas of the characteristic pixel is analyzed, and the possibility of the existence of the printing phenomenon in the local area of the characteristic pixel is reflected through the obtained printing performance degree, and the degree of influence of the printing area on the brightness performance of the preset neighborhood where the target pixel is located is reflected through the obtained printing influence degree, and the local brightness consistency is adjusted according to the printing influence degree of the target pixel to obtain more accurate adjusted brightness consistency, and then regional growth is performed based on the adjusted brightness consistency of each pixel to obtain growth areas with different brightness performances, so that image segmentation is performed on different growth areas respectively, and a better quality segmented image is obtained, and the printing area can be more clearly distinguished in the segmented image, thereby improving the accuracy of subsequent detection of printing defects on the surface of the fabric. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 A flow chart of a method for detecting defects caused by improper printing of a pattern on a surface of a cloth provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation method, structure, features and effects of a defect detection method for incorrectly printed patterns on the surface of a cloth proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0046] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0047] An embodiment of a method for detecting defects of incorrectly printed patterns on a cloth surface:
[0048] The following is a detailed description of a method for detecting defects of incorrectly printed patterns on a surface of a cloth provided by the present invention in conjunction with the accompanying drawings.
[0049] See also Figure 1 , which shows a flow chart of a method for detecting defects of incorrectly printed patterns on a surface of a cloth provided by an embodiment of the present invention, the method comprising:
[0050] Step S1: Obtain a grayscale image of the cloth surface.
[0051] During the production process of fabric, various shapes of patterns are usually printed on its surface. However, during the printing process, the fabric pattern is often not printed correctly due to uneven placement or wrinkles of the fabric, resulting in uncolored areas in some areas, which affects the appearance of the fabric surface and reduces the quality of the fabric product. In the related art, a threshold segmentation method is usually used to segment the printed area of the fabric surface image, and the segmented image is input into a neural network to identify printing defects. However, due to the influence of uneven illumination, the brightness of different areas on the fabric surface is different. Directly performing threshold segmentation on the entire image cannot accurately distinguish the printed area in the image, resulting in inaccurate segmentation results, resulting in poor quality of the segmented image, and further reducing the accuracy of detecting printing defects of the fabric surface pattern. Therefore, an embodiment of the present invention proposes a defect detection method for incorrect printing of a fabric surface pattern to solve this problem.
[0052] The embodiment of the present invention first uses an industrial camera to shoot the surface of the fabric to be tested, thereby collecting the original image of the fabric surface. Since the collected original image is usually a multi-channel RGB image, it is not conducive to the subsequent processing efficiency. Therefore, in order to reduce the calculation amount of subsequent image processing and improve the processing speed, in one embodiment of the present invention, the collected RGB image is grayed and converted into a single-channel gray image. It should be noted that graying is a technical means well known to those skilled in the art and will not be described in detail here.
[0053] After obtaining the grayscale image of the fabric surface, the grayscale image can be analyzed in the subsequent process to detect printing defects on the fabric surface.
[0054] Step S2: Take any pixel in the grayscale image as the target pixel, and obtain the local brightness consistency of the target pixel in a preset neighborhood centered on the target pixel according to the difference in the grayscale value distribution of pixels in different preset directions with the target pixel as the starting point in the preset neighborhood.
[0055] Considering that in the prior art, the grayscale image of the cloth surface is usually segmented by threshold value, and the segmented image that can represent the printing area is input into the neural network to identify printing defects. However, due to the influence of factors such as uneven lighting and fixed camera position, there are large differences in the brightness performance of different areas of the cloth. Directly performing threshold segmentation on the entire grayscale image will result in the inability to clearly identify various layout printing areas in the segmented image, and the quality of the segmented image is poor, which reduces the accuracy of subsequent detection of layout printing defects on the cloth surface. At the same time, in order to facilitate analysis, the embodiment of the present invention takes any pixel point in the grayscale image as the target pixel point. Since there are differences in brightness in different areas of the fabric surface, which are manifested as different grayscale values of pixels in different areas in the grayscale image, the differences in the grayscale value distribution of pixels in different preset directions with the target pixel as the starting point can be analyzed in the preset neighborhood centered on the target pixel. The local brightness consistency obtained can preliminarily reflect the uniformity of the brightness performance caused by the influence of light in the preset neighborhood of the target pixel, which is convenient for subsequent regional growth based on the local brightness consistency of each pixel to obtain multiple regions, and threshold segmentation is performed on the multiple regions respectively, so as to eliminate the influence of uneven lighting and improve the quality of the segmented image and the accuracy of printing defect detection.
[0056] The size of the preset neighborhood is set to The size of the preset neighborhood can also be set by the implementer according to the specific implementation scenario, which is not limited here. The number of preset directions is set to 8, that is, 360° is divided into 8 equal parts, and 8 different preset directions are obtained, which are 8 preset directions with angles of 0°, 45°, 90°, 135°, 180°, 225°, 270°, and 315° with the horizontal direction, which are also the 8 neighborhood directions of the target pixel point. The number of preset directions can also be set by the implementer according to the specific implementation scenario, which is not limited here.
[0057] Preferably, in an embodiment of the present invention, a method for acquiring local brightness consistency of a target pixel point specifically includes:
[0058] In a preset neighborhood, the standard deviation of the grayscale values of all pixels in each preset direction is used as the grayscale discrete parameter of each preset direction, and the average value of the grayscale discrete parameters of all preset directions is used as the overall discrete value; the average value of the grayscale values of all pixels in each preset direction is used as the initial grayscale mean of each preset direction, and the average value of the initial grayscale means of all preset directions is used as the overall grayscale mean; the absolute value of the difference between the grayscale discrete parameter of each preset direction and the overall discrete value is used as the grayscale discrete deviation value of each preset direction; the absolute value of the difference between the initial grayscale mean of each preset direction and the overall grayscale mean is used as the grayscale distribution deviation value of each preset direction; the product value of the range of the grayscale values of all pixels in each preset direction, the grayscale discrete deviation value and the grayscale distribution deviation value is used as the distribution difference characteristic value of each preset direction; the cumulative value of the distribution difference characteristic values of all preset directions is negatively correlated and normalized to obtain the local brightness consistency of the target pixel. The expression of local brightness consistency can be specifically, for example, as follows:
[0059]
[0060] in, Indicates the local brightness consistency of the target pixel; Indicates The standard deviation of the grayscale values of all pixels in the preset direction, that is, Grayscale discrete parameters of preset directions; Represents the average value of the grayscale discrete parameters of all preset directions, that is, the overall discrete value; Indicates The average grayscale value of all pixels in the preset direction, i.e. The initial grayscale mean of the preset directions; Represents the average of the initial grayscale means of all preset directions, that is, the overall grayscale mean; Indicates The extreme difference of the grayscale values of all pixels in a preset direction; Indicates the number of preset directions. In one embodiment of the present invention, ; Represents the normalization function.
[0061] In one embodiment of the present invention, the normalization processing can be specifically, for example, maximum and minimum value normalization processing, and the normalization in subsequent steps can all adopt maximum and minimum value normalization processing. In other embodiments of the present invention, other normalization methods can be selected according to the specific range of numerical values, which will not be described in detail.
[0062] In the process of obtaining the local brightness consistency of the target pixel, the local brightness consistency The larger the value, the more uniform the brightness of the preset neighborhood of the target pixel after being affected by the light. The different brightness caused by the uneven light is manifested as the difference in the grayscale value of the pixel in the grayscale image, so the grayscale discrete deviation value The smaller the value, the closer the discrete characteristics of the grayscale values of the pixels in the preset direction are to those in other preset directions, which further indicates that the brightness performance in the preset direction is more similar to that in other preset directions, and the local brightness consistency is higher. The larger the grayscale distribution deviation value is, the larger the grayscale distribution deviation value is. The smaller the value, the more similar the distribution of the grayscale values of the pixels in the preset direction is to that in other preset directions, and the more similar the brightness performance in the preset direction is to that in other preset directions, the more similar the local brightness consistency is. The bigger, the worse The smaller the value, the smaller the fluctuation range of the grayscale value of the pixel in the preset direction is, which further indicates that the grayscale values of the pixels in the preset direction are closer, that is, the more similar the brightness performance in the preset direction is, the greater the local brightness consistency is. The larger the distribution, the greater the eigenvalue The smaller the value, the more consistent the brightness performance in the preset direction. Then, the distribution difference characteristic values of all preset directions are combined for analysis. The accumulated values of the distribution difference eigenvalues in all preset directions are negatively correlated and normalized to obtain the local brightness consistency. Limited to range, facilitating subsequent analysis.
[0063] At this point, the local brightness consistency of the target pixel is obtained.
[0064] Step S3: According to the grayscale value of each pixel in the preset neighborhood, feature pixels are selected from the preset neighborhood, and expansion is performed with each feature pixel as the center to obtain different expansion areas for each feature pixel; according to the distribution of the grayscale values of each pixel in each expansion area, the printing performance degree of each feature pixel is obtained; according to the distance between the feature pixels in the preset neighborhood and the difference in the printing performance degree of the feature pixels, the printing influence degree of the target pixel is obtained.
[0065] The local brightness consistency of the target pixel is obtained through the above steps. However, when there is a printing area in the preset neighborhood of the target pixel, the grayscale difference between the printed area and the non-printed area is large, which will lead to inaccurate analysis of the local brightness consistency of the target pixel. The local brightness consistency alone cannot accurately reflect the consistency of the brightness performance of the preset area of the target pixel caused by the influence of light, which leads to large errors in the subsequent analysis process. Therefore, it is necessary to further adjust the local brightness consistency obtained above according to the printing area that may exist in the preset neighborhood of the target pixel. Considering that the grayscale value of the printed area on the surface of the cloth is larger than that of the non-printed area, the characteristic pixel can be selected from the preset neighborhood according to the grayscale value of each pixel in the preset neighborhood. Subsequently, the possibility of printing in the local area of the characteristic pixel can be further analyzed.
[0066] Preferably, in one embodiment of the present invention, a preset number of pixels with maximum grayscale values in a preset neighborhood are used as feature pixels. The feature pixels in the preset neighborhood can be further analyzed subsequently to obtain the degree to which the brightness performance of the preset neighborhood of the target pixel is affected by the printing area, and the local brightness consistency of the target pixel obtained above is adjusted, wherein the preset number is set to 10, and the specific value of the preset number can also be set by the implementer according to the specific implementation scenario, which is not limited here.
[0067] After selecting the characteristic pixel points from the preset neighborhood of the target pixel point, the possibility of printing phenomenon existing in the local area of the characteristic pixel point can be analyzed. The embodiment of the present invention expands with each characteristic pixel point as the center to obtain multiple extended areas centered on the characteristic pixel point. Subsequently, the distribution of the grayscale values of the pixels in the extended area can be analyzed to obtain the possibility of printing phenomenon existing in the local area of the characteristic pixel point.
[0068] Preferably, in one embodiment of the present invention, each characteristic pixel is taken as the center and each time the characteristic pixel is expanded outwards, The area composed of the feature pixel and the pixels expanded each time is taken as the first pixel of each feature pixel. expansion area, of which , Indicates the preset maximum number of layers, which is also the number of expansion areas. Set to 5, preset maximum number of layers The specific value of can also be set by the implementer according to the specific implementation scenario, and is not limited here. For example, when one layer of pixels is expanded outward with the feature pixel as the center, When the expansion area is expanded outward by 2 layers of pixels, we get When the expansion area is expanded outward by 3 layers of pixels, we get expansion area, etc.
[0069] Through the above expansion process, each characteristic pixel point can obtain multiple expansion areas of different sizes. Since the grayscale value of the characteristic pixel point is large, and the grayscale value between the characteristic pixel point and the pixel point in the printing area is relatively close, and the distribution of the grayscale value of the pixel point in the printing area is relatively uniform and consistent, it is possible to analyze the distribution of the grayscale value of each pixel point in each expansion area, and reflect the possibility of printing phenomenon in each expansion area of the characteristic pixel point through the obtained printing performance degree, so as to facilitate the subsequent accurate analysis of the degree to which the preset neighborhood of the target pixel point is affected by the printing area.
[0070] Preferably, in an embodiment of the present invention, the method for obtaining the printing performance degree of each characteristic pixel point specifically includes:
[0071] Take any feature pixel as the target feature pixel, take any extended area of the target feature pixel as the target extended area, take the standard deviation of the grayscale values of all pixels in the target extended area as the grayscale confusion parameter of the target extended area; take the absolute value of the difference between the grayscale value of each other pixel in the target extended area except the target feature pixel and the target feature pixel as the initial grayscale difference of each other pixel, take the average of the initial grayscale differences of all other pixels in the target extended area except the target feature pixel as the overall grayscale difference of the target extended area; negatively correlate the product value of the grayscale confusion parameter of the target extended area and the overall grayscale difference to obtain the grayscale distribution similarity of the target extended area; take the maximum value of the grayscale distribution similarity of all extended areas of the target feature pixel as the printing performance degree of the target feature pixel. The expression of the printing performance degree can be specifically, for example, as:
[0072]
[0073]
[0074] in, Indicates the printing performance of the target feature pixel; The first pixel representing the target feature Similarity of grayscale distribution of the extended areas; The first pixel representing the target feature The standard deviation of the grayscale values of all pixels in the extended area; Represents the gray value of the target feature pixel; The first pixel representing the target feature The first pixel in the extended area except the target feature pixel Grayscale values of other pixels; The first pixel representing the target feature The number of pixels in the extended area, The first pixel representing the target feature The number of pixels other than the target feature pixels in the extended area; represents the maximum value function; Indicates the preset maximum number of layers, which is also the number of expansion areas of the target feature pixel points; Indicates the adjustment parameter to prevent the denominator from being 0. Set to 0.01, The specific value of can also be set by the implementer according to the specific implementation scenario and is not limited here.
[0075] In the process of obtaining the printing performance degree of the target feature pixel point, the printing performance degree The larger the value, the less likely it is that the target feature pixel will be printed in the local area during the expansion process. Since the grayscale value of the feature pixel is representative of the grayscale value of the printed area, the initial grayscale difference The smaller it is, the smaller the grayscale difference between other pixels and the feature pixels is, so the overall grayscale difference The smaller the grayscale difference between the overall pixel points and the characteristic pixel points in the extended area is, the more similar the grayscale distribution of the pixel points in the extended area is to the printed area. The larger the value, the greater the possibility of printing in the extended area. The larger the grayscale value of the pixels in the printing area is, the more uniform the grayscale chaos parameter is. The smaller the value, the more uniform the distribution of the grayscale values of the pixels in the extended area. The larger the value, the greater the possibility of printing in the extended area. The larger the grayscale distribution similarity of all the extended areas of the target pixel is, the greater the grayscale distribution similarity of all the extended areas of the target pixel is. ,pass Select the optimal solution as the printing performance of the target feature pixel point .
[0076] After obtaining the printing performance degree of the target feature pixel point in the preset neighborhood, the printing performance degree of other feature pixel points in the preset neighborhood can be obtained by the same method, and then the distance between the feature pixel points in the preset neighborhood and the difference in the printing performance degree between the feature pixel points are analyzed. The obtained printing influence degree reflects the degree to which the brightness performance of the preset neighborhood of the target pixel point is affected by the printing area, which facilitates the subsequent adjustment of the local brightness consistency obtained above based on the printing influence degree.
[0077] Preferably, in an embodiment of the present invention, the method for obtaining the printing influence degree of the target pixel point specifically includes:
[0078] Any two feature pixels in the preset neighborhood of the target pixel are taken as feature point groups; the Euclidean distance between the two feature pixels in each feature point group in the grayscale image is taken as the position difference value of each feature point group; the absolute value of the difference in the printing performance degree between the two feature pixels in each feature point group is taken as the printing performance difference value of each feature point group; the product value of the position difference value and the printing performance difference value is taken as the printing influence parameter of each feature point group; the average value of the printing influence parameters of all feature point groups is normalized to obtain the printing influence degree of the target pixel. The expression of the printing influence degree can be specifically, for example, as follows:
[0079]
[0080] in, Indicates the printing impact of the target pixel; Indicates the first pixel in the preset neighborhood of the target pixel. The Euclidean distance between two feature pixels in the feature point group in the grayscale image, that is, The position difference value of feature point groups; and Respectively represent the first The printing performance of two feature pixels in a feature point group; Represents the number of feature point groups in a preset neighborhood of a target pixel; Represents the normalization function.
[0081] In the process of obtaining the printing influence degree of the target pixel point, the printing influence degree It is used to adjust the local brightness consistency of the target pixel points obtained above and the printing impact degree The larger the value, the greater the brightness of the preset neighborhood of the target pixel is affected by the printing area. The larger the value is, the farther the distance between the two feature pixels in the feature point group is, which means that the two feature pixels are more likely to be in different printing areas. The brightness of the preset neighborhood of the target pixel is more affected by the printing area, and the degree of printing influence is higher. The larger the difference in printing performance The larger the value is, the greater the difference in the printing performance of the two feature pixels in the feature point group is, the greater the difference in the printing phenomenon characteristics in the local area of the two feature pixels is, and the more likely the two feature pixels are in different printing areas, the greater the brightness performance of the preset neighborhood of the target pixel is affected by the printing area, and the greater the printing influence is. The larger the value, the greater the printing effect of all feature pixels. The average value is normalized to the printing impact Limited to range, which is convenient for subsequent calculation and analysis.
[0082] At this point, the printing influence degree of the target pixel point is obtained. In the subsequent process, the local brightness consistency of the target pixel point can be adjusted based on the printing influence degree to improve the accuracy of the subsequent threshold segmentation results and the accuracy of the detection of printing defects in the fabric pattern.
[0083] Step S4: According to the printing influence degree and local brightness consistency of the target pixel point, the adjusted brightness consistency of the target pixel point is obtained; based on the adjusted brightness consistency of each pixel point, regional growth is performed on the grayscale image to obtain different growth areas; and each growth area in the grayscale image is segmented to obtain a segmented image.
[0084] Due to the influence of the printed area in the grayscale image, the local brightness consistency of the target pixel points obtained through the above process cannot accurately reflect the brightness performance caused by the light. Therefore, the local brightness consistency of the target pixel points can be further adjusted according to the obtained printing influence degree. The obtained adjusted brightness consistency accurately reflects the brightness performance caused by the light on the preset neighborhood of the target pixel point, which facilitates the subsequent regional growth based on the adjusted brightness consistency of the pixel points, obtains areas with different brightness performance, and improves the image segmentation effect.
[0085] Preferably, in an embodiment of the present invention, a method for obtaining the adjusted brightness consistency of a target pixel point specifically includes:
[0086] The product of the target pixel printing impact and the local brightness consistency is used as the target pixel adjustment amount; the sum of the local brightness consistency of the target pixel and the adjustment amount is normalized to obtain the target pixel adjustment brightness consistency. The expression for adjusting the brightness consistency can be specifically, for example, as follows:
[0087]
[0088] in, Indicates the adjusted brightness consistency of the target pixel; Indicates the local brightness consistency of the target pixel; Indicates the printing impact of the target pixel; Represents the normalization function.
[0089] In the process of obtaining the brightness consistency of the target pixel point, the printing influence degree is used Local brightness consistency Make adjustments and use the product of the two as the adjustment amount , printing impact The larger the value, the more consistent the local brightness. The greater the adjustment, the more local brightness consistency Normalize with the sum of the adjustment values to get the adjusted brightness consistency .
[0090] After obtaining the adjusted brightness consistency of the target pixel point, the adjusted brightness consistency of other pixel points in the grayscale image of the fabric surface can be obtained by the same method as above. Considering that the traditional image segmentation method usually processes the entire image directly, the uneven illumination has a greater impact on the segmentation result, making it impossible to accurately distinguish the printing area in the segmented image, thereby reducing the subsequent detection effect of printing defects. Therefore, in one embodiment of the present invention, the adjusted brightness consistency is used as a parameter used by the region growing algorithm to judge the merging of pixels, and the grayscale image is processed based on the region growing algorithm to obtain different growth areas, and the degree of brightness performance of different growth areas is different. Subsequently, image segmentation can be performed on different growth areas respectively to eliminate the impact of uneven illumination and improve the image segmentation effect. The region growing algorithm is a technical means well known to those skilled in the art and will not be described in detail here.
[0091] After obtaining multiple growth areas with different brightness, in order to improve the final image segmentation effect, each growth area in the grayscale image can be segmented separately to obtain a corresponding segmented image, so that the printing area of the plate existing in the segmented image can be displayed more clearly, which is convenient for the subsequent identification and detection of plate printing defects. Therefore, in one embodiment of the present invention, each growth area can be threshold segmented based on the Otsu threshold segmentation algorithm to obtain a segmented image. The Otsu threshold segmentation algorithm is a technical means well known to those skilled in the art and will not be elaborated here.
[0092] At this point, through the threshold segmentation of the grayscale image of the cloth surface, a better quality segmented image is obtained, and the printing defects of the publication can be detected in the segmented image later.
[0093] Step S5: Detecting printing defects on the surface of the fabric based on the segmented image.
[0094] Through the above process, a segmented image with better quality is obtained, and the printed area in the segmented image can be displayed more clearly. Therefore, the printed defects on the surface of the fabric are detected based on the segmented image, thereby improving the accuracy of defect detection.
[0095] Preferably, in one embodiment of the present invention, the segmented image can be input into a trained convolutional neural network, and the convolutional neural network is used to extract and detect the printing defects in the segmented image, thereby realizing the detection of printing defects on the surface of the fabric. The convolutional neural network is a technical means well known to those skilled in the art and will not be elaborated here.
[0096] In summary, the embodiment of the present invention first obtains a grayscale image of the surface of the fabric, takes any pixel point in the grayscale image as a target pixel point, and obtains the local brightness consistency of the target pixel point according to the difference in the grayscale value distribution of the pixel points in different preset directions with the target pixel point as the starting point in the preset neighborhood; selects feature pixels from the preset neighborhood according to the grayscale value of each pixel point in the preset neighborhood, and expands with each feature pixel point as the center to obtain different expansion areas of each feature pixel point; obtains the printing performance degree of each feature pixel point according to the distribution of the grayscale values of each pixel point in each expansion area; obtains the printing influence degree of the target pixel point according to the distance between the feature pixels and the difference in the printing performance degree of the feature pixels; obtains the adjusted brightness consistency of the target pixel point according to the printing influence degree and the local brightness consistency of the target pixel point; performs regional growth on the grayscale image based on the adjusted brightness consistency of each pixel point to obtain different growth areas; performs image segmentation on each growth area in the grayscale image to obtain a segmented image; and inputs the segmented image into a neural network to detect printing defects of the surface pattern of the fabric.
[0097] An image segmentation method for identifying printing defects of fabric patterns:
[0098] In the related art, image segmentation methods are usually used to identify printing defects in fabric surface images. However, due to the influence of uneven lighting, the brightness of different areas on the fabric surface is different. Directly segmenting the entire image will result in poor quality of the segmented image.
[0099] In order to solve this problem, this embodiment provides an image segmentation method for identifying printing defects of a cloth pattern, comprising:
[0100] Step S1: Obtain a grayscale image of the cloth surface.
[0101] Step S2: Take any pixel in the grayscale image as the target pixel, and obtain the local brightness consistency of the target pixel in a preset neighborhood centered on the target pixel according to the difference in the grayscale value distribution of pixels in different preset directions with the target pixel as the starting point in the preset neighborhood.
[0102] Step S3: According to the grayscale value of each pixel in the preset neighborhood, feature pixels are selected from the preset neighborhood, and expansion is performed with each feature pixel as the center to obtain different expansion areas for each feature pixel; according to the distribution of the grayscale values of each pixel in each expansion area, the printing performance degree of each feature pixel is obtained; any two feature pixels are taken as a feature point group, and the printing influence degree of the target pixel is obtained according to the distance between the two feature pixels in each feature point group and the difference in the printing performance degree of the two feature pixels.
[0103] Step S4: According to the printing influence degree and local brightness consistency of the target pixel point, the adjusted brightness consistency of the target pixel point is obtained; based on the adjusted brightness consistency of each pixel point, regional growth is performed on the grayscale image to obtain different growth areas; and each growth area in the grayscale image is segmented to obtain a segmented image.
[0104] Among them, steps S1 to S4 have been described in detail in the above-mentioned method for detecting defects of improperly printed patterns on the surface of a cloth, and will not be repeated here.
[0105] The beneficial effects brought by this embodiment are as follows: the present invention takes into account that the brightness performance of different areas on the surface of the fabric is different due to uneven illumination. Directly performing threshold segmentation on the entire image will result in poor quality of the segmented image. Therefore, the present invention first analyzes the grayscale values of the pixels in the preset neighborhood of the target pixel point, and preliminarily reflects the uniformity of the brightness performance in the preset neighborhood of the target pixel point by obtaining the local brightness consistency. Considering that the grayscale difference between the printed area and other areas in the preset neighborhood is relatively obvious, it is impossible to accurately reflect the consistency of the brightness performance of the local area of the pixel point only by the local brightness consistency. Therefore, the grayscale values of the pixels in different extended areas of the feature pixel point are analyzed. The distribution is analyzed, and the possibility of printing phenomenon in the local area of the feature pixel is reflected by the obtained printing performance degree, and the degree of influence of printing is reflected by the obtained printing influence degree. The local brightness consistency is adjusted according to the printing influence degree of the target pixel to obtain more accurate adjusted brightness consistency, and then regional growth is performed based on the adjusted brightness consistency of each pixel, and growth areas with different brightness performance are obtained, so that different growth areas are threshold segmented respectively, so that the printed area of the layout in the segmented image is displayed more clearly, which improves the effect of threshold segmentation and the quality of the segmented image.
[0106] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0107] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
Claims
1. A method for detecting defects caused by improper printing of a pattern on a fabric surface. It is characterized in that The method comprises: Get a grayscale image of the cloth surface; Taking any pixel in the grayscale image as the target pixel, in a preset neighborhood centered on the target pixel, the local brightness consistency of the target pixel is obtained according to the difference in the grayscale value distribution of the pixels in different preset directions with the target pixel as the starting point in the preset neighborhood; According to the gray value of each pixel point in the preset neighborhood, feature pixels are selected from the preset neighborhood, and expansion is performed with each feature pixel point as the center to obtain different expansion areas for each feature pixel point; according to the distribution of the gray value of each pixel point in each of the expansion areas, the printing performance degree of each feature pixel point is obtained; according to the distance between the feature pixels in the preset neighborhood and the difference in the printing performance degree of the feature pixels, the printing influence degree of the target pixel point is obtained; According to the printing influence degree of the target pixel and the local brightness consistency, the adjusted brightness consistency of the target pixel is obtained; based on the adjusted brightness consistency of each pixel, the grayscale image is subjected to region growth to obtain different growth regions; each growth region in the grayscale image is subjected to image segmentation to obtain a segmented image; Detecting printing defects on the surface of the fabric based on the segmented image; The obtaining of the local brightness consistency of the target pixel point according to the difference in the grayscale value distribution of the pixel points in different preset directions with the target pixel point as the starting point in the preset neighborhood includes: In a preset neighborhood, the standard deviation of the grayscale values of all pixels in each preset direction is used as the grayscale discrete parameter of each preset direction, and the average value of the grayscale discrete parameters of all preset directions is used as the overall discrete value; Taking the average grayscale value of all pixels in each preset direction as the initial grayscale mean value of each preset direction, and taking the average grayscale mean value of all preset directions as the overall grayscale mean value; The absolute value of the difference between the grayscale discrete parameter and the overall discrete value in each preset direction is used as the grayscale discrete deviation value in each preset direction; the absolute value of the difference between the initial grayscale mean value and the overall grayscale mean value in each preset direction is used as the grayscale distribution deviation value in each preset direction; The product value of the range of the grayscale values of all pixels in each preset direction, the grayscale discrete deviation value and the grayscale distribution deviation value is used as the distribution difference characteristic value of each preset direction; Performing negative correlation mapping and normalization processing on the accumulated values of the distribution difference characteristic values in all preset directions to obtain the local brightness consistency of the target pixel point; The obtaining of the printing performance level of each characteristic pixel point includes: Taking any characteristic pixel as the target characteristic pixel, taking any extended area of the target characteristic pixel as the target extended area, and taking the standard deviation of the grayscale values of all pixels in the target extended area as the grayscale chaos parameter of the target extended area; The absolute value of the difference between the grayscale value of each other pixel point except the target characteristic pixel point in the target extension area and the target characteristic pixel point is used as the initial grayscale difference of each other pixel point, and the average value of the initial grayscale difference of all other pixel points except the target characteristic pixel point in the target extension area is used as the overall grayscale difference of the target extension area; Performing negative correlation mapping on the product value of the grayscale chaos parameter of the target extension area and the overall grayscale difference to obtain the grayscale distribution similarity of the target extension area; The maximum value of the grayscale distribution similarity of all the extended areas of the target feature pixel point is used as the printing performance degree of the target feature pixel point; The obtaining of the printing influence degree of the target pixel point according to the distance between the characteristic pixel points in the preset neighborhood and the difference in the printing expression degree of the characteristic pixel points includes: Take any two feature pixels as a feature point group; The Euclidean distance between two feature pixels in each feature point group in the grayscale image is used as the position difference value of each feature point group; The absolute value of the difference between the printing performance degree of two characteristic pixel points in each characteristic point group is used as the printing performance difference value of each characteristic point group; taking the product of the position difference value and the printing performance difference value as the printing influence parameter of each feature point group; Normalizing the average values of the printing influence parameters of all feature point groups to obtain the printing influence degree of the target pixel point; The obtaining the adjusted brightness consistency of the target pixel point according to the printing influence degree of the target pixel point and the local brightness consistency includes: The product value of the printing influence degree of the target pixel and the local brightness consistency is used as the adjustment amount of the target pixel; The local brightness consistency of the target pixel and the sum of the adjustment amount are normalized to obtain the adjusted brightness consistency of the target pixel.
2. A method for detecting defects of incorrectly printed patterns on a cloth surface according to claim 1, It is characterized in that The expansion is performed with each characteristic pixel as the center to obtain different expansion areas for each characteristic pixel, including: Taking each feature pixel as the center, expand outward by layers of pixels each time, and use the area consisting of the feature pixel and the pixels expanded each time as the th expanded area of each feature pixel, where represents the preset maximum number of layers.
3. A method for detecting defects of incorrectly printed patterns on a fabric surface according to claim 1, It is characterized in that The adjusting brightness consistency of each pixel point and performing region growing on the grayscale image to obtain different growing regions include: The adjusted brightness consistency is used as a parameter used by a region growing algorithm to determine pixel merging, and the grayscale image is processed based on the region growing algorithm to obtain different growing regions.
4. A method for detecting defects of incorrectly printed patterns on a cloth surface according to claim 1, It is characterized in that The performing image segmentation on each growth region in the grayscale image to obtain a segmented image comprises: Based on the Otsu threshold segmentation algorithm, threshold segmentation is performed on each of the growth regions to obtain a segmented image.
5. A method for detecting defects of incorrectly printed patterns on a fabric surface according to claim 1, It is characterized in that The detecting of printing defects on the surface of the cloth based on the segmented image comprises: The segmented image is input into a trained convolutional neural network to obtain the pattern printing defects on the surface of the fabric.
6. A method for detecting defects of incorrectly printed patterns on a fabric surface according to claim 1, It is characterized in that The step of selecting a feature pixel point from a preset neighborhood according to the gray value of each pixel point in the preset neighborhood includes: A preset number of pixels with maximum grayscale values in a preset neighborhood are taken as feature pixels.
