Textile fabric surface stain detection method and system based on image processing
By calculating the light intensity of each pixel point in the textile fabric image and quantifying the possibility of wrinkle shadowing areas, and correcting it with the image difference algorithm, the recognition problems caused by uneven light and wrinkle shadowing in the stain detection of textile fabric are solved, and the accuracy of the detection is improved.
Patent Information
- Application Number
- CN202510185578.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-02-20
AI Technical Summary
The prior art problems of missed or mis-checked stain identification in textile fabric stain detection due to uneven light and fabric wrinkles.
By calculating the illumination intensity of each pixel point in the fabric image and the gradient of the pixel points around the pixel point, the possibility of the pixel points being in the shadow area of the fabric fold is quantified, and the image difference algorithm is used to correct it to reduce the impact of uneven light and wrinkle shadows on stain detection.
It improves the accuracy of stain detection in textile fabrics, and reduces false detection and missed inspections caused by uneven lighting and fabric wrinkles.
Smart Images

Figure CN119672019B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to a method and system for detecting stains on the surface of textile fabrics based on image processing. Background Art
[0002] During the production and use of textile fabrics, due to improper transportation or storage, there are often stains such as mildew, color spots and oil stains on the surface of textile fabrics. Manual inspection of large quantities of textile fabrics obviously cannot meet the needs of rapid inspection. Therefore, machine vision methods are usually used to inspect textile fabrics.
[0003] like Figure 1 As shown in the grayscale image, when a stain with a color similar to that of the fabric appears on the fabric, the stain may not be identified, which may cause the stained textile fabric to flow into subsequent processes, causing defects in the textile product. At the same time, the surface texture of the textile fabric is sometimes mistakenly identified as a stain, interfering with the surface stain detection of the textile fabric.
[0004] The prior art can detect stains on textile fabrics by comparing the difference between textile fabrics and non-stain fabrics through image difference algorithms. For example, Chinese patent application with publication number CN112508917A discloses a method for detecting fluff on textile fabrics based on a deep neural network, which includes: obtaining an image of a textile fabric to be detected, wherein the textile fabric to be detected is a textile fabric in production; calculating the difference between the image of the textile fabric to be detected and the image of a qualified textile fabric at the texture level to obtain a texture difference feature map.
[0005] However, in the textile fabric production process, due to uneven lighting and fabric wrinkles, stain recognition may be missed or misdetected. Summary of the invention
[0006] In order to solve the above-mentioned technical problem of inaccurate fabric stain identification, the present application provides a textile fabric surface stain detection method and system based on image processing.
[0007] In the first aspect, the present application provides a method for detecting stains on the surface of textile fabrics based on image processing, which adopts the following technical solutions:
[0008] The textile fabric surface stain detection method based on image processing comprises the following steps: in the process of fabric image transmission, calculating the difference value and the average value of the difference value of each pixel point on the fabric image of adjacent frames;
[0009] The number of pixels whose differential values are greater than the average differential value is calculated, and the ratio of the number of pixels to the total number of pixels on the fabric image is taken as the differential result; in response to the differential result being greater than a preset threshold, it is determined that there is a stain on the surface of the textile fabric; the calculation formula of the differential value is: , Represents the pixels of adjacent frame images The difference value of Represents the first pixels, the first frame image in the adjacent frame image is the image , the second frame image is image , Representing images Medium pixel The gray value of Representing images Medium pixel Gray value of Representing images Medium pixel The possibility of being in the shadow area of the fabric folds, Representing images Medium pixel The possibility of being in the shadow area of the fabric folds, Representing images Medium pixel The light intensity at Representing images Medium pixel The light intensity at .
[0010] The beneficial effect is that when there is a stain on the fabric, the stain is at different positions in the two images due to the conveyance of the fabric, so that the grayscale difference between two pixels at the same position in the two images is Larger; by dividing by 255 The normalization is performed; according to the possibility that the pixel is in the shadow area of the fabric wrinkles and the light intensity of each pixel, the power law transformation is used to transform Make corrections.
[0011] The present application calculates the illumination intensity of each pixel in the fabric image based on the grayscale value of each pixel in the image, and measures the illumination intensity of the fabric positions corresponding to different pixels, which can reduce the impact of uneven illumination on fabric stain detection. The possibility of a pixel being in the shadow area of fabric wrinkles is calculated based on the illumination intensity of each pixel in the fabric image and the gradient of the pixels around the pixel, and measures the possibility of different pixel positions corresponding to the fabric being in the shadow area of fabric wrinkles, which can reduce the impact of shadows created by wrinkles on fabric stain detection. In summary, the present application can reduce the impact of uneven illumination and fabric wrinkles on stain detection, and improve the accuracy of textile fabric stain detection.
[0012] Optionally, the light intensity is calculated as: , where is the pixel point in the fabric image The light intensity, Represents pixel The gray value of Pixel The average gray value of pixels in the neighborhood. Represents pixel The average gray value of all pixels in the row. Represents pixel The average gray value of all pixels in the row. is a linear normalization function.
[0013] The beneficial effect is: a method for quantifying the light intensity factor is provided. The larger the value, the more likely it is that the pixel is a concentrated white pixel, and the more likely it is that the pixel is in an area with strong light intensity on the fabric, the greater the light intensity of the pixel. Conversely, the more likely it is that the pixel is a black pixel or a white outlier pixel (caused by reflection), and the more likely it is that the pixel is in an area with relatively low light intensity on the fabric, the smaller the light intensity of the pixel. Pixel The average grayscale value of the row and column. The larger the value, the more likely the row and column where the pixel is located are under strong light.
[0014] Optionally, the light intensity is calculated as: , where is the pixel point in the fabric image The light intensity, Represents pixel The gray value of Pixel The average gray value of pixels in the neighborhood. Represents pixel The average gray value of all pixels in the row. Represents pixel The average gray value of all pixels in the row. express and The minimum value of is a linear normalization function.
[0015] The beneficial effect is: providing another method to quantify the factor of light intensity, The larger the value, the more likely it is that the pixel is a concentrated white pixel, and the more likely it is that the pixel is in an area with strong light intensity on the fabric, the greater the light intensity of the pixel. Conversely, the more likely it is that the pixel is a black pixel or a white outlier pixel (caused by reflection), and the more likely it is that the pixel is in an area with relatively low light intensity on the fabric, the smaller the light intensity of the pixel. express and The minimum value of the pixel The smaller one of the row grayscale value of the row and the column grayscale value of the column can be selected as the minimum value to more sensitively capture the area with lower light intensity.
[0016] Optionally, the probability of a fabric wrinkle shadow area is calculated as: , where Pixel Possibility of shadow areas in fabric folds, is the pixel point in the fabric image The light intensity, Pixel The variance of the gradient cosine similarity, It is an exponential function with the natural constant e as its base.
[0017] The beneficial effects are: a method for quantifying the possibility of a pixel being in the shadow area of a fabric wrinkle by combining the illumination intensity with the degree of clutter in the gradient direction of the pixels around the pixel, and the illumination intensity of the pixel The larger the value, the more likely the pixel is in the wrinkle shadow area that affects stain recognition. The smaller it is, the less likely the pixel is in the wrinkle shadow area that affects stain recognition. The smaller it is, the more likely the pixel is in the wrinkle shadow area. The larger the value, the more likely the pixel is in the textile texture area.
[0018] Optionally, the probability of a fabric wrinkle shadow area is calculated as: , where Pixel Possibility of shadow areas in fabric folds, Pixel The variance of the gradient cosine similarity, It is an exponential function with the natural constant e as its base.
[0019] The beneficial effect is: variance It represents the degree of chaos in the gradient direction of the pixels around the pixel point, and is a method for quantifying the possibility of the pixel point being in the shadow area of the fabric wrinkle based on a single dimension. The smaller it is, the more likely the pixel is in the wrinkle shadow area. The larger the value, the more likely the pixel is in the textile texture area.
[0020] Optionally, the gradient cosine similarity is calculated as:
[0021] In the fabric image, the gradient direction of each pixel is calculated; and the cosine similarity between the gradient direction of each pixel and the gradient direction of pixels in the neighborhood of the pixel is calculated.
[0022] Optionally, the gradient direction of each pixel in the fabric image is calculated using a Sobel operator.
[0023] In the second aspect, the present application provides a textile fabric surface stain detection system based on image processing, which adopts the following technical solutions:
[0024] The textile fabric surface stain detection system based on image processing comprises a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the textile fabric surface stain detection method based on image processing is implemented.
[0025] The beneficial effect is that the above-mentioned textile fabric surface stain detection method based on image processing is generated into a computer program and stored in a memory so as to be loaded and executed by a processor, thereby making a system based on the memory and the processor for easy use.
[0026] The present application has the following technical effects: by calculating the illumination intensity of each pixel in the fabric image according to the grayscale value of each pixel in the image, and measuring the illumination intensity of the fabric positions corresponding to different pixels, the influence of uneven illumination on the fabric stain detection can be reduced. By calculating the possibility that the pixel is in the shadow area of the fabric wrinkle according to the illumination intensity of each pixel in the fabric image and the gradient of the pixels around the pixel, and measuring the possibility that the fabric positions corresponding to different pixels are in the shadow area of the fabric wrinkle, the influence of the shadow caused by the wrinkles on the fabric on the fabric stain detection can be reduced. In summary, the present application can reduce the influence of uneven illumination and fabric wrinkles on stain detection, and improve the accuracy of textile fabric stain detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easily understood. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-restrictive manner, and the same or corresponding numbers represent the same or corresponding parts.
[0028] Figure 1 is a background art figure showing a stain similar in color to a fabric.
[0029] Figure 2 It is a method flow chart of the method for detecting stains on the surface of textile fabrics based on image processing in an embodiment of the present application.
[0030] Figure 3 It is a schematic diagram showing the change of the position of stains in adjacent frames of fabric images in the textile fabric surface stain detection method based on image processing in an embodiment of the present application.
[0031] Figure 4 It is a grayscale image showing stains and wrinkles in the method for detecting stains on the surface of textile fabrics based on image processing in an embodiment of the present application.
[0032] Figure 5 It is a line graph showing the average value of the grayscale value of pixels in the textile fabric surface stain detection method based on image processing in an embodiment of the present application.
[0033] Figure 6 It is a line graph showing the average values of the grayscale values of pixels in the textile fabric surface stain detection method based on image processing in an embodiment of the present application.
[0034] Figure 7 It is shown Figure 5 , Figure 6 Lighting distribution map corresponding to the fabric image.
[0035] Explanation of the accompanying drawings: 1. First feature; 2. Second feature. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0037] It should be understood that when the terms "first", "second", etc. are used in the claims, specification and drawings of the present application, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the specification and claims of the present application indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections.
[0038] The present application discloses a method for detecting stains on the surface of textile fabrics based on image processing. Figure 2 , including steps S1-S2, which are as follows:
[0039] S1: During the fabric image transmission process, the difference value and the average value of the difference value of each pixel on the fabric image of adjacent frames are calculated.
[0040] The textile is wound on a cloth roll, unrolled and conveyed, the textile fabric image is collected, and the surface stains of the textile fabric are detected through the collected image. Figure 3 As shown, since the textile is being transported all the time, the stain (first feature 1) is located at different positions in the images of different frames.
[0041] When collecting fabric images of textiles, in order to make the stains in the image easier to identify, the fabrics usually need to be illuminated. However, textile fabrics usually have a large area, so that different parts of the fabric receive different intensities of light. As a result, when a stain appears at a certain position on the fabric, the color of the stain is similar to the color of the normal area of the other parts of the fabric (refer to Figure 1 ), this phenomenon greatly interferes with the detection of stains on textile fabrics, so the present application calculates the light intensity of each pixel in the image based on the grayscale value of each pixel in the fabric image.
[0042] Textile fabrics have a large size. When the fabric is unrolled from the cloth roll, it is inevitable that there will be some wrinkles on the fabric, such as Figure 4The second feature 2 in the method will cause the textile fabric image to be disturbed by a wrinkle shadow area with a similar grayscale value to the stain. Therefore, the present application calculates the possibility that a pixel is in the wrinkle shadow area of the fabric based on the light intensity of each pixel in the fabric image and the gradient of the pixels around the pixel.
[0043] In order to reduce the impact of uneven illumination and wrinkles on the detection of stains on the surface of textile fabrics, this application performs image differentiation based on the possibility of the pixel being in the shadow area of the fabric wrinkles, the illumination intensity of each pixel, and the grayscale value of the pixel. The details are as follows:
[0044] In one embodiment, the calculation formula for light intensity is: , where is the pixel point in the fabric image The light intensity, Represents pixel The gray value of Pixel The average gray value of the pixels in the neighborhood; for example, the value of the neighborhood can be based on the pixel The 5×5 range refers to the pixels within the 5×5 range around the center. A square area centered on the pixel point The surrounding pixels in the up, down, left, right and diagonal directions have a side length of 5 pixels, so a total of 5×5=25 pixels are included. The implementer can also choose the size of this range according to the actual application scenario (such as the texture structure of textile fabrics).
[0045] Stronger illumination will make the textile fabric in the image brighter, thus making the grayscale value of the pixel higher, such as Figure 5 and Figure 6 As shown in the figure, if the row coordinates in the row average line graph are larger and the average grayscale is higher, it means that the lower area in the textile fabric image has relatively high intensity lighting; if the column coordinates in the column average line graph are closer to the middle position and the average grayscale is higher, it means that the middle area in the textile fabric image has relatively high intensity lighting, then Figure 5 and Figure 6 The corresponding lighting conditions in the fabric image are as follows Figure 7 As shown in the figure, the area where white pixels are concentrated is the area with high light intensity, and the area where black pixels are concentrated is the area with relatively low light intensity. When the value is larger, the position of the textile fabric corresponding to the pixel point is more likely to be exposed to strong light. The smaller it is, the more likely that the position of the textile fabric corresponding to the pixel point is subject to relatively weak light.
[0046] However, textile fabrics have complex textures, which may cause light to be reflected toward the image acquisition device when it hits the textile fabric (i.e., reflection), resulting in individual pixels in the image with higher grayscale values in areas with relatively low light intensity on some fabrics ( Figure 7 The position of the outlier white pixel in Participate in the calculation of light intensity, The larger it is, the more likely the pixel is an outlier. The smaller it is, the more likely the pixel is to be a concentrated pixel. The larger it is, the more likely the pixel is a concentrated white pixel. The more likely the pixel is in an area with strong light intensity on the fabric, the greater the light intensity of the pixel. The smaller it is, the more likely the pixel is a black pixel or a white outlier pixel (caused by reflection). The more likely the pixel is in an area with relatively low light intensity on the fabric, the smaller the light intensity of the pixel.
[0047] Represents pixel The average gray value of all pixels in the row. Represents pixel The average grayscale value of all pixels in the row. Pixel The average grayscale value of the row and column. The larger the value, the more likely the row and column where the pixel is located are to be under strong light, and the greater the light intensity of the pixel. The smaller the value, the more likely the row and column where the pixel is located are to be under relatively weak light, and the smaller the light intensity of the pixel. Taking into account the overall light conditions of the row and column where the pixel is located, taking the average value can balance the influence of the row and column. is a linear normalization function.
[0048] In one embodiment, the calculation formula for light intensity is:
[0049] , where is the pixel point in the fabric image The light intensity, Represents pixel The gray value of Pixel The average gray value of pixels in the neighborhood. Represents pixel The average gray value of all pixels in the row. Represents pixel The average gray value of all pixels in the row. express and The minimum value of the pixel The smaller one of the row grayscale value and the column grayscale value is selected. By selecting the minimum value, the area with lower light intensity can be captured more sensitively. is a linear normalization function.
[0050] In one embodiment, the calculation formula for the possibility of the fabric wrinkle shadow area is:
[0051] , where Pixel Possibility of shadow areas in fabric folds, is the pixel point in the fabric image The light intensity, Pixel The variance of the gradient cosine similarity, It is an exponential function with the natural constant e as its base.
[0052] The method for calculating the gradient cosine similarity is as follows: in the fabric image, the gradient direction of each pixel in the fabric image is calculated by the Sobel operator; the gradient direction of each pixel and the gradient direction of the pixels around each pixel are obtained. The cosine similarity of the gradient direction of each pixel and the gradient direction of the pixels in the neighborhood of the pixel is calculated. For example, the neighborhood is the pixel centered around the pixel. The implementer can also select the size of the range according to the actual application scenario (such as the size and texture structure of the textile fabric).
[0053] Wrinkles on textile fabrics may appear anywhere on the fabric, but when the wrinkled part is exposed to strong light, it will appear as a shadow similar to the color of the stain in the image. Therefore, the shadow of the wrinkles that will affect the identification of stains on the fabric in the image usually appears in the area with strong light on the fabric. Therefore, the light intensity of the pixel point The larger the value, the more likely the pixel is in the wrinkle shadow area that affects stain recognition. The smaller it is, the less likely the pixel is to be in the wrinkle shadow area that affects stain identification.
[0054] Variance of the gradient cosine similarity corresponding to the pixel It represents the degree of disorder of the gradient direction of the pixels around the pixel. Since the surface of the textile fabric has a certain texture, the gradient direction of the pixels around each pixel has different directions, making the gradient direction of the pixels around the pixel more disordered. The variance of the gradient cosine similarity corresponding to the pixel is The shadows created by the fabric wrinkles have certain edges, which also makes the gradient of the pixel points at the wrinkle shadows have a distribution trend perpendicular to the edges of the wrinkle shadows, making the gradient direction of the pixels around the pixel points more uniform. Then the variance of the gradient cosine similarity corresponding to the pixel points is Therefore, the variance The smaller it is, the more likely the pixel is in the wrinkle shadow area. The larger the value, the more likely the pixel is in the textile texture area.
[0055] In one embodiment, the calculation formula for the possibility of the fabric wrinkle shadow area can also be: , where Pixel Possibility of shadow areas in fabric folds, Pixel The variance of the gradient cosine similarity, It is an exponential function with the natural constant e as its base.
[0056] In one embodiment, the calculation formula of the difference value is: , Represents the pixels of adjacent frame images The difference value of Represents the first pixels, the first frame image in the adjacent frame image is the image , the second frame image is image , Representing images Medium pixel The gray value of Representing images Medium pixel Gray value of
[0057] The grayscale difference between two pixels at the same position in two images at adjacent moments. Usually, textile fabrics have a uniform single color. Therefore, when there is no stain on the fabric, the grayscale difference between two pixels at the same position in the two images is is a smaller value. When there is a stain on the fabric, the stain is in different positions in the two images due to the transport of the fabric, making the grayscale difference between the two pixels at the same position in the two images Larger, so The smaller, the The smaller the difference value of each pixel, The bigger, the The larger the difference value of the pixels, the larger the difference value of the pixels. Normalized.
[0058] Representing images Medium pixel The possibility of being in the shadow area of the fabric folds, Representing images Medium pixel the possibility of being in the shadowed area of the fabric folds; The difference in light intensity between two pixels at the same position in two images at adjacent moments. Due to the uneven illumination on textile fabrics, different illumination will make the fabric of the same color appear with different brightness in the image. Therefore, when the difference in light intensity between two pixels at the same position in two images is When the value is larger, there may be a certain grayscale difference between the two pixels, but the actual colors of the two pixels in the fabric may be the same. The smaller the grayscale difference between two pixels is, the more likely it is that the colors of the two pixels are the same. When the value is larger, the judgment of the difference between two pixels should be more tolerant, that is, the difference between two pixels with the same actual color is smaller; The smaller the value, the stricter the judgment on the difference between two pixels should be, even if the difference between two pixels with actual color difference is larger.
[0059] Representing images Medium pixel The light intensity at Representing images Medium pixel The light intensity at It is the difference in the probability that two pixels at the same position in two images at adjacent moments are in the shadow area of the fabric wrinkles. Due to the large size of textile fabrics, it is inevitable that certain wrinkles will be generated on the fabric during the transportation of textile fabrics, thus generating certain shadows. When wrinkle shadows exist, two pixels of the same color actually present different brightness in the image. Therefore, when two pixels at the same position in two images at adjacent moments are in the shadow area of the fabric wrinkles, the difference in the probability that two pixels at the same position in two images at adjacent moments are in the shadow area of the fabric wrinkles is When the value is larger, there may be a certain grayscale difference between the two pixels, but the actual colors of the two pixels in the fabric may be the same. The smaller the grayscale difference between the two pixels is, the more likely it is that the two pixels have the same color. When the value is larger, the judgment of the difference between two pixels should be more tolerant, even if the difference between two pixels with the same color is smaller. The smaller the value, the stricter the judgment on the difference between two pixels should be, even if the difference between two pixels with a difference in actual color is relatively larger.
[0060] Use the gamma transform (power law transform) to Make corrections when The more hours, right The greater the degree of correction, the greater the The larger the difference value of the pixel point at each position, the better the image Medium pixel With image Medium pixel The judgment of the gap between The bigger the right The smaller the correction degree is, the smaller the The smaller the difference value of each pixel is, the better the image Medium pixel With image Medium pixel The judgment of the gap is stricter.
[0061] S2: Calculate the number of pixels whose differential values are greater than the average differential value, and take the ratio of the number of pixels to the total number of pixels on the fabric image as the differential result; in response to the differential result being greater than a preset threshold, determine that there is a stain on the surface of the textile fabric.
[0062] Calculate the average difference value of all pixel points in the two frames of fabric images. Count the number of pixels whose difference value is greater than the average difference value and take the ratio of the number of pixels to the total number of pixels on the fabric image as the difference result.
[0063] If the difference result is greater than a threshold value, illustratively, the threshold value may be 0.008, then it is determined that there may be stains on the surface of the current textile fabric, otherwise, it is determined that there are no stains; a test result is generated based on the above determination, and the test result is either with stains or without stains.
[0064] An embodiment of the present application also discloses a textile fabric surface stain detection system based on image processing, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the textile fabric surface stain detection method based on image processing according to the present application is implemented.
[0065] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, and their configuration and functions are known in the art, so they will not be described in detail here.
[0066] In the present application, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high bandwidth memory HBM (High Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that can be used to store the required information and can be accessed by an application, a module, or both. Any such computer storage medium may be part of a device or accessible or connectable to a device.
[0067] Although this specification has shown and described a plurality of embodiments of the present application, it is obvious to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will think of many changes, modifications and alternatives without departing from the thought and spirit of the present application. It should be understood that in the process of practicing the present application, various alternatives to the embodiments of the present application described herein may be adopted.
[0068] The above are all preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Therefore, any equivalent changes made according to the structure, shape, and principle of the present application should be included in the protection scope of the present application.
Claims
1. A method for detecting stains on the surface of textile fabrics based on image processing, characterized in that: Includes steps: In the process of fabric image transmission, the difference value and the average value of the difference value of each pixel on the fabric image of adjacent frames are calculated; Calculate the number of pixels whose difference value is greater than the mean difference value, and take the ratio of the number of pixels to the total number of pixels on the fabric image as the difference result; In response to the difference result being greater than a preset threshold, determining that there is a stain on the surface of the textile fabric; The calculation formula of the difference value is: , Represents the pixels of adjacent frame images The difference value of Represents the first pixels, the first frame image in the adjacent frame image is the image , the second frame image is image , Representing images Medium pixel The gray value of Representing images Medium pixel Gray value of Representing images Medium pixel The possibility of being in the shadow area of the fabric folds, Representing images Medium pixel The possibility of being in the shadow area of the fabric folds, Representing images Medium pixel The light intensity at Representing images Medium pixel The light intensity at .
2. The method for detecting stains on the surface of textile fabrics based on image processing according to claim 1 is characterized in that , The calculation formula for light intensity is: , where is the pixel point in the fabric image The light intensity, Represents pixel The gray value of Pixel The average gray value of pixels in the neighborhood. Represents pixel The average gray value of all pixels in the row. Represents pixel The average gray value of all pixels in the column. is a linear normalization function.
3. The method for detecting stains on the surface of textile fabrics based on image processing according to claim 1, characterized in that: The calculation formula for light intensity is: , where is the pixel point in the fabric image The light intensity, Represents pixel The gray value of Pixel The average gray value of pixels in the neighborhood. Represents pixel The average gray value of all pixels in the row. Represents pixel The average gray value of all pixels in the column. express and The minimum value of is a linear normalization function.
4. The method for detecting stains on the surface of textile fabrics based on image processing according to claim 1, characterized in that: The probability of a fabric wrinkle shadow area is calculated as: , where Pixel Possibility of shadow areas in fabric folds, is the pixel point in the fabric image The light intensity, Pixel The variance of the gradient cosine similarity, It is an exponential function with the natural constant e as its base.
5. The method for detecting stains on the surface of textile fabrics based on image processing according to claim 1, characterized in that: The probability of a fabric wrinkle shadow area is calculated as: , where Pixel Possibility of shadow areas in fabric folds, Pixel The variance of the gradient cosine similarity, It is an exponential function with the natural constant e as its base.
6. The method for detecting stains on the surface of textile fabrics based on image processing according to claim 4 or 5, characterized in that: The calculation method of gradient cosine similarity is: In the fabric image, the gradient direction of each pixel is calculated; and the cosine similarity between the gradient direction of each pixel and the gradient direction of pixels in the neighborhood of the pixel is calculated.
7. The method for detecting stains on the surface of textile fabrics based on image processing according to claim 6, characterized in that: The gradient direction of each pixel in the fabric image is calculated using the Sobel operator.
8. The textile fabric surface stain detection system based on image processing is characterized by: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the textile fabric surface stain detection method based on image processing according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Textile fabric fluff detection method based on deep neural network
CN112508917A
Automatic detection method and system for flaws of quick-dry fabric
CN111709915A
Surface defect detection method for non-woven fabric
CN115588010A