Textile fabric texture defect detection method and system based on image processing
By dividing the textile fabric image into image blocks, calculating the bending curvature index, texture direction index and effectiveness, the problem of difficulty in distinguishing feature extraction between normal texture and defect texture in textile fabric is solved, and the accuracy of textile fabric defect detection is improved.
Patent Information
- Application Number
- CN202510265116.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2045-03-07
AI Technical Summary
It is difficult for the prior art to accurately extract the distinguishing feature information of normal texture and defect texture in textile fabrics, affecting the accuracy of texture defect detection.
Texture defect detection is achieved by dividing the textile fabric image into several image blocks, performing edge detection, and calculating arrangement feature indicators, such as bending curvature index, texture direction index and effectiveness.
It improves the accuracy of textile fabric defect detection, prevents excessive attention to the overall fabric arrangement characteristics, ensures the detection of local area defects, and reduces the impact of edge loss on distinguishing feature extraction.
Smart Images

Figure CN119784744A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method and system for detecting texture defects of textile fabrics based on image processing. Background Art
[0002] Textile fabrics are made of natural or chemical fibers through textile technology and are used in many fields such as clothing, home decoration, and industry. During the production process, fabrics occasionally have texture defects such as broken warp, broken weft, and stains. These texture defects will affect the quality and aesthetics of the fabric, reduce product grade and market competitiveness, and therefore texture defect detection of fabrics is required.
[0003] With the development of machine vision technology, machine vision technology is often used in texture defect detection. In the process of texture defect detection using machine vision technology, the extraction of distinguishing features between normal texture and defective texture will affect the accuracy of texture defect detection. Although the traditional image feature description method can extract texture feature information to a certain extent, the distinguishing feature information extracted is relatively small. Therefore, how to accurately extract the distinguishing feature information between normal texture and defective texture becomes the research focus of this invention.
[0004] The patent document with authorization announcement number CN113450350B discloses a detection method based on fabric area texture features. The method in the patent document mainly demonstrates the detection of different texture areas of the fabric. The method in the patent document does not involve the content of extracting distinguishing features between defective textures and non-defective textures. Therefore, the patent document cannot solve the technical problem of this solution. Summary of the invention
[0005] In order to solve the problem of how to accurately extract distinguishing feature information between normal texture and defective texture, the present invention provides a textile fabric texture defect detection method and system based on image processing.
[0006] In a first aspect, the present invention provides a method for detecting texture defects of textile fabrics based on image processing, which adopts the following technical solution: The method for detecting texture defects of textile fabrics based on image processing comprises the following steps: Acquire an edge image of the textile fabric image, and segment the edge image to obtain edge image blocks; Calculate the arrangement feature index to achieve texture defect detection; wherein the arrangement feature index Satisfies the relationship: , , They represent the curvature index and texture direction index of the i-th edge pixel in any edge image block, respectively. represents the effectiveness of the i-th edge pixel in the edge image block, Represents the number of edge pixels of the edge image block; The texture direction index and the curvature index represent the normal direction and curvature of each edge line at each edge pixel point respectively; the method for obtaining the validity is: , Indicates the geometric center of the edge line and the The Euclidean distance between the geometric centers of the other edge lines, Indicates the edge line and the edge image block The dtw distance of the chain code sequence of other edge lines, M represents the number of edge lines in the edge image block, norm() represents the linear normalization function, Indicates the validity of the edge line, and takes the validity of the edge line as the validity of the edge pixel.
[0007] The present invention divides the textile fabric image into a number of image blocks, thereby preventing the subsequent fabric defect analysis from only focusing on the arrangement characteristics of the entire fabric and ignoring the arrangement characteristics of the local fabric, thereby ignoring the defects in the local area of the fabric, thereby improving the accuracy of fabric defect detection; further, by performing edge detection on the image blocks, the texture edge line of each cluster of fabric is obtained, providing a basis for the subsequent description of the fabric arrangement; further, the bending curvature index and the texture direction index can accurately describe the distinguishing features between the fabric defect area and the non-defective area, providing a basis for the subsequent accurate fabric defect detection; further, the effectiveness can reflect the edge loss, and its existence can reduce the influence of the edge loss on the extraction of distinguishing features, thereby improving the accuracy of fabric texture defect detection.
[0008] Preferably, the texture direction index acquisition method includes: A pixel is randomly selected from all edge pixels of the edge image block as a starting pixel. Based on the starting pixel, all edge pixels on each edge line in the edge image block are sorted by using the Moore edge tracking algorithm to obtain an edge pixel sequence of each edge line in the edge image block; a unit vector of a vector formed by the edge pixel in the edge image block and the previous edge pixel in the edge pixel sequence is obtained and recorded as a left vector, and a unit vector of a vector formed by the edge pixel in the edge image block and the next edge pixel in the edge pixel sequence is obtained and recorded as a right vector; a perpendicular bisector of an angle formed by the left vector and the right vector is obtained, and an intersection point of the perpendicular bisector and a line formed by the previous edge pixel and the next edge pixel of the edge pixel in the edge pixel sequence of the edge image block is obtained and recorded as a perpendicular bisector point; a vector formed by the edge pixel in the edge image block and the perpendicular bisector is obtained and recorded as a normal vector, and an arc cosine value of a dot product of the normal vector and a horizontal right unit vector is obtained as a texture direction index of the edge pixel in the edge image block.
[0009] The present invention uses a texture direction index to accurately describe the bending direction of the edge line at each edge pixel, providing a basis for subsequent distinguishing feature descriptions.
[0010] Preferably, the bending curvature index satisfies the relationship: ; in, represents the left side vector of the edge pixel in the edge image block, represents the right side vector of the edge pixel in the edge image block, represents the vector formed by the previous edge pixel and the next edge pixel of the edge pixel in the edge pixel sequence in the edge image block, express The module length, express The module length, express The modulus length, sin() represents the sine function, represents the arccosine function, Represents the curvature index of the edge pixel in the edge image block.
[0011] Preferably, the method for realizing texture defect detection includes: Segment the textile fabric image to obtain a number of image blocks; obtain the LBP feature image of the image block; The image blocks within the 8-neighborhood of the image block are recorded as the adjacent image blocks of the image block, the difference in the value of the arrangement feature index between the edge image block corresponding to an image block and the edge image block corresponding to the adjacent image block is recorded as the first difference of the image block, the difference in the pixel value of the LBP image between the image block and the adjacent image block is recorded as the second difference of the image block, and the arrangement consistency of the image block is calculated, and the arrangement consistency is negatively correlated with the first difference and the second difference; Abnormal arrangement detection is achieved by utilizing the arrangement consistency of image blocks.
[0012] The present invention realizes fabric defect detection by analyzing the similarity between the arrangement features of fabric in an image block and the arrangement features of fabric in surrounding image blocks. This detection method is simpler to operate and has a lower amount of calculation.
[0013] Preferably, the calculating arrangement consistency of the image blocks includes: ; in, Represents the arrangement feature index of the edge image block corresponding to an image block, Represents the arrangement feature index of the edge image block corresponding to the jth adjacent image block of the image block, Represents the pixel value of the t-th pixel in the LBP feature image of the j-th adjacent image block of the image block, Indicates the number of pixels contained in the LBP feature image of the jth adjacent image block of the image block, Represents the pixel value of the tth pixel in the LBP feature image of the image block, Indicates the number of pixels contained in the LBP feature image of the image block, represents the number of adjacent image blocks of the image block, Indicates the arrangement consistency of the image block, represents the first difference of the image block, Represents the second difference of the image block.
[0014] The present invention analyzes the similarity between the arrangement characteristic index of the fabric in each image block and the arrangement characteristic index of the fabric in the surrounding image blocks to accurately reflect the arrangement consistency of the fabric in each image block and the surrounding fabric, providing a basis for subsequent fabric defect arrangement detection. At the same time, the arrangement consistency of the fabric in each image block and the fabric in the surrounding image blocks is analyzed in combination with the LBP features of each image block to prevent a single feature from failing to accurately reflect the arrangement consistency of the fabric in each image block and the fabric in other image blocks, thereby improving the accuracy of fabric defect detection. At the same time, by simply analyzing the similarity of the arrangement characteristics of each image block and the surrounding image blocks to reflect the defects of the fabric in the image block, the detection efficiency is higher.
[0015] Preferably, the method of realizing abnormal arrangement detection by utilizing arrangement consistency of image blocks includes: The normalized value of the arrangement consistency of each image block is compared with the preset consistency threshold Y. When the normalized value of the arrangement consistency of the image block is less than the preset consistency threshold Y, it is determined that there is a defect in the fabric in the image block.
[0016] The present invention screens out fabrics with abnormal arrangement by comparing the arrangement consistency with a preset threshold value, without the need for performing more complicated calculations, and has a high calculation efficiency.
[0017] Preferably, dividing the textile fabric image into a plurality of image blocks comprises: Get the length L and width W of the textile fabric image, divide L by a and round up to get the first length , divide W by a and round up to get the first width , the textile fabric image is evenly divided into several pieces of length , width is image blocks, a represents the preset number.
[0018] In a second aspect, the present invention provides a textile fabric texture defect detection system based on image processing, which adopts the following technical solution: The textile fabric texture defect 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 texture defect detection method based on image processing is implemented.
[0019] By adopting the above technical solution, the above-mentioned textile fabric texture defect 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 terminal device based on the memory and the processor for easy use.
[0020] The present invention has the following technical effects: The present invention divides the textile fabric image into a number of image blocks, thereby preventing the subsequent fabric defect analysis from only focusing on the overall fabric arrangement characteristics and ignoring the arrangement characteristics of the local fabric, thereby ignoring the defects in the local area of the fabric, thereby improving the accuracy of fabric defect detection; Furthermore, by performing edge detection on the image blocks, the texture edge lines of each cluster of cloth are obtained, which provides a basis for the subsequent description of the arrangement of the cloth; Furthermore, the bending curvature index and texture direction index can accurately describe the distinguishing features between the defective area and the non-defective area of the fabric, providing a basis for subsequent accurate fabric defect detection; Furthermore, the effectiveness can reflect the missing edge situation, and its existence can reduce the impact of edge missing on distinguishing feature extraction and improve the accuracy of cloth texture defect detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] 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 invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-restrictive manner, and the same or corresponding reference numerals represent the same or corresponding parts.
[0022] Figure 1 is a flow chart of a method for detecting textile fabric texture defects based on image processing in an embodiment of the present invention; Figure 2 Textile fabric images provided by embodiments of the present invention; Figure 3 This is an edge image provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0024] It should be understood that when the terms "first", "second", etc. are used in the claims, descriptions, and drawings of the present invention, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the description and claims of the present invention 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.
[0025] The embodiment of the present invention discloses a method for detecting textile fabric texture defects based on image processing, referring to Figure 1 , comprising steps S1 to S5: S1: Obtain a textile fabric image and its corresponding edge image.
[0026] Specifically, a textile fabric image is captured by a camera, and the textile fabric image is grayed to obtain a grayscale image of the textile fabric image. For ease of description, the grayscale image of the textile fabric image is still referred to as the textile fabric image in the following. Figure 2 An image of textile fabric is shown.
[0027] Perform edge detection on the textile fabric image to obtain the edge image. Figure 3 Shows edge images of textile cloth images.
[0028] S2: Segment the textile fabric image and the edge image to obtain a plurality of image blocks and a plurality of edge image blocks, and obtain a texture direction index of each edge pixel in each edge image block.
[0029] S20: Segment the textile fabric image and the edge image to obtain a plurality of image blocks and a plurality of edge image blocks respectively.
[0030] Preferably, as an example, the textile fabric image and the edge image are segmented to obtain a plurality of image blocks and a plurality of edge image blocks, respectively, including: The length L and width W of the textile fabric image are obtained. L is divided by a and then rounded up to obtain a first length , divide W by a and round up to get the first width , the textile fabric image is evenly divided into several pieces of length , width is image blocks, a represents a preset number, and this embodiment is described by taking 8 as an example, and other embodiments may take other values, which are not specifically limited in this embodiment.
[0031] In particular, when the edge of the textile fabric image cannot be segmented to obtain an image block that meets the size requirement, the pixels at the edge that cannot be segmented into the image block are simply included in the nearest image block.
[0032] The edge image is segmented in the same way to obtain edge image blocks.
[0033] S22: Obtain a texture direction index of each edge pixel in each edge image block.
[0034] It should be noted that if Figure 2 As shown in the figure, the texture direction of the defective area will be different from the texture arrangement characteristics of the normal area, and the texture arrangement characteristics can be used as the distinguishing feature between the normal area and the abnormal area. The texture direction can reflect the arrangement feature information, so the texture direction needs to be analyzed.
[0035] It should be further explained that the texture direction is mostly obtained based on the connection between the texture and the surrounding texture pixels. Since there are many cross textures in the cloth, there are multiple texture pixels around each texture pixel. The texture direction calculated using different surrounding texture pixels is different. In order to obtain a calculation result, a surrounding texture pixel selection rule needs to be set to select pixels from the surrounding texture pixels to obtain the texture direction, which does not affect the direction determination and simplifies the calculation result.
[0036] Preferably, as an example, calculating the texture direction index of any edge pixel in any edge image block includes: One pixel is randomly selected from all edge pixels of the edge image block as the starting pixel, and based on the starting pixel, all edge pixels on each edge line in the edge image block are sorted using the Moore edge tracing algorithm to obtain an edge pixel sequence for each edge line in the edge image block.
[0037] Obtain a unit vector of a vector formed by the edge pixel in the edge image block and the previous edge pixel in the edge pixel sequence, record it as a left vector, obtain a unit vector of a vector formed by the edge pixel in the edge image block and the next edge pixel in the edge pixel sequence, record it as a right vector; obtain a perpendicular bisector of the angle formed by the left vector and the right vector, obtain an intersection of the perpendicular bisector and a line formed by the previous edge pixel and the next edge pixel of the edge pixel in the edge pixel sequence in the edge image block, record it as a perpendicular bisector point; obtain a vector formed by the edge pixel in the edge image block and the perpendicular bisector point, record it as a normal vector, obtain an arccosine value of the dot product of the normal vector and the horizontal right unit vector as a texture direction index of the edge pixel in the edge image block.
[0038] It can be understood that the texture direction index can reflect the texture direction of each edge pixel.
[0039] S3: Obtain a bending curvature index of each edge pixel in each edge image block.
[0040] It should be noted that the curvature can also reflect the arrangement characteristics, so in order to analyze the arrangement characteristics, the curvature of the pixel needs to be analyzed.
[0041] Preferably, as an example, calculating the curvature index of any edge pixel in any edge image block includes:
[0042] in, represents the left side vector of the edge pixel in the edge image block, represents the right side vector of the edge pixel in the edge image block, represents the vector formed by the previous edge pixel and the next edge pixel of the edge pixel in the edge pixel sequence in the edge image block, express The module length, express The module length, express The modulus length, sin() represents the sine function, represents the arccosine function, Represents the curvature index of the edge pixel in the edge image block.
[0043] It should be noted that this embodiment calculates the bending curvature index of the edge pixel, and draws on the existing method of solving the curvature of the arc at the middle point of the three points based on the three points of a segment arc. This method is existing technology and will not be repeated here.
[0044] S4: Obtain the validity of each edge pixel in each edge image block, calculate the arrangement feature index of each edge image block according to the bending curvature index, texture direction index and validity of each edge pixel in each edge image block, and calculate the arrangement consistency of the corresponding image block according to the arrangement feature index.
[0045] S40: Obtain the validity of each edge pixel in each edge image block.
[0046] It should be noted that due to the presence of noise in the textile fabric image or the low texture contrast in some locations, the edges extracted in some locations are missing, such as Figure 3 As shown. This edge loss will affect the accuracy of abnormality detection. In other words, in some cases, feature inconsistency is likely not a defect, but may be caused by edge loss. Therefore, in order to reduce the impact of edge loss on defect detection, it is necessary to analyze the edge loss of each edge pixel and give a smaller weight to the edge pixels with edge loss, thereby reducing the interference of edge loss on defect detection. This embodiment reflects the edge loss through effectiveness.
[0047] It should be further explained that when an edge is missing, there is a difference between the edge line and the edge line that is not missing, so the edge missing situation can be reflected by the difference between the edge lines.
[0048] Preferably, as an example, obtaining the validity of each edge pixel in each edge image block includes: The relative direction between each edge pixel and the previous edge pixel in the edge pixel sequence of each edge line is obtained, the chain code value of the corresponding edge pixel is set according to the relative direction, and the sequence composed of the chain code values of all edge pixels in the edge pixel sequence is used as the chain code sequence of each edge line.
[0049] It should be added that, with the edge pixel as the center, the edge pixel is evenly distributed in 8 directions; starting from the horizontal right direction, in a counterclockwise direction, the chain code value of each direction is set to 0, 1, 2, 3, 4, 5, 6, 7, 8 in turn.
[0050] ; in, Indicates the geometric center of the edge line and the The Euclidean distance between the geometric centers of the other edge lines, Indicates the edge line and the edge image block The dtw distance of the chain code sequence of other edge lines, M represents the number of edge lines in the edge image block, norm() represents the linear normalization function, exp() represents the exponential function with a natural constant as the base, and max() represents the maximum value function. Indicates the effectiveness of the edge line.
[0051] It is understandable that As a weight, the dtw distance is calculated, so that the edge lines with a smaller distance to the edge lines are more trusted, and the missing conditions of each edge line are more accurately reflected.
[0052] The effectiveness of each edge pixel is taken as the effectiveness of the edge line to which it belongs.
[0053] S41: Calculating an arrangement feature index of each edge image block according to a bending curvature index, a texture direction index and a validity of each edge pixel in each edge image block.
[0054] Preferably, as an example, the arrangement feature index of each edge image block is calculated:
[0055] in, Represents the curvature index of the i-th edge pixel in an edge image block, Represents the texture direction index of the i-th edge pixel in the edge image block, represents the effectiveness of the i-th edge pixel in the edge image block, Indicates the number of edge pixels of the edge image block, sin() indicates the sine function, cos() indicates the cosine function, arctan() indicates the inverse tangent function, Represents the arrangement features of each edge image block.
[0056] S42: Calculate the arrangement consistency of the corresponding image blocks according to the arrangement feature index.
[0057] It should be noted that when the arrangement information of the fabric information in the image block is consistent with the arrangement information of the surrounding image blocks, it means that the possibility of fabric defects in the image block is small, and when the arrangement information of the fabric in the image block is inconsistent with the arrangement information of the surrounding image blocks, it means that the possibility of fabric defects in the image block is large. Therefore, fabric defect detection can be performed based on this.
[0058] Preferably, as an example, calculating the arrangement consistency of the corresponding image blocks according to the arrangement feature index includes: Each image block is processed using the LBP algorithm to obtain the LBP feature image of each image block.
[0059] The formula for calculating alignment consistency is: ; in, Represents the arrangement feature index of the edge image block corresponding to an image block, Represents the arrangement feature index of the edge image block corresponding to the jth adjacent image block of the image block, Represents the pixel value of the t-th pixel in the LBP feature image of the j-th adjacent image block of the image block, Indicates the number of pixels contained in the LBP feature image of the jth adjacent image block of the image block, Represents the pixel value of the tth pixel in the LBP feature image of the image block, Indicates the number of pixels contained in the LBP feature image of the image block, represents the number of adjacent image blocks of the image block, Indicates the arrangement consistency of the image block, represents the first difference of the image block. This value reflects the arrangement information based on the bending direction of the edge line and the description of the bending curvature characteristics. The difference in arrangement information between the image block and the surrounding image blocks is calculated. The larger the value, the greater the difference between the arrangement information of the fabric in the image block and the arrangement information of the fabric in the surrounding image blocks. Therefore, the worse the arrangement consistency of the fabric in the image block and the fabric in the surrounding image blocks is. norm() represents the linear normalization function. Indicates the second difference of the image block. The value reflects the arrangement information based on the LBP feature description, and calculates the difference in arrangement information between the image block and the surrounding image blocks. The larger the value, the greater the difference between the arrangement information of the cloth in the image block and the arrangement information of the cloth in the surrounding image blocks, and thus the worse the arrangement consistency between the cloth in the image block and the surrounding image blocks.
[0060] Furthermore, the above embodiments involve adjacent image blocks. The following describes a method for determining adjacent image blocks, including: Taking the image block as the basic unit, the The other image blocks except the image block in the basic unit are regarded as the adjacent image blocks of the image block.
[0061] It should be noted that the abnormal arrangement of the cloth in each image block is accurately reflected by analyzing the similarity between the arrangement characteristic index of the cloth in each image block and the arrangement characteristic index of the cloth in the surrounding image blocks. At the same time, the arrangement consistency of the cloth in each image block and the cloth in the surrounding image blocks is analyzed in combination with the LBP features of each image block to prevent a single feature from failing to accurately reflect the abnormal arrangement of the cloth in each image block, thereby improving the accuracy of cloth abnormality detection. At the same time, the abnormality of the image block is reflected by simply analyzing the similarity of the arrangement characteristics of each image block and the surrounding image blocks, and its detection efficiency is higher.
[0062] S5: Determine arrangement anomaly based on the arrangement consistency of each image block.
[0063] It should be noted that when the arrangement information of the cloth is consistent with the arrangement information of the surrounding cloth, it means that the arrangement of the cloth is normal, and when the arrangement information of the cloth is inconsistent with the arrangement information of the surrounding cloth, it means that the arrangement of the cloth is abnormal. Therefore, the abnormal arrangement of the cloth can be detected based on this.
[0064] Preferably, as an example, the method for determining abnormal arrangement includes: The normalized value of the arrangement consistency of each image block is compared with the preset consistency threshold Y. When the normalized value of the arrangement consistency of the image block is less than the preset consistency threshold Y, it is determined that there is a defect in the fabric in the image block. This embodiment is described by taking Y as 0.5 as an example. Other embodiments may take other values, and this embodiment does not make any specific restrictions.
[0065] It should be noted that by comparing the arrangement consistency with the preset threshold value, the cloth with abnormal arrangement is screened out without performing more complicated calculations, and the calculation efficiency is relatively high.
[0066] An embodiment of the present invention also discloses a textile fabric texture defect detection system based on image processing, comprising a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a textile fabric texture defect detection method based on image processing according to the present invention is implemented.
[0067] The above-mentioned device also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, whose configuration and functions are known in the art and thus will not be described in detail here.
[0068] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium may be any suitable magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory, a dynamic random access memory, a static random access memory, an enhanced dynamic random access memory, a high bandwidth memory, a hybrid storage 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 the device or accessible or connectable to the device.
[0069] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
[0070] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for detecting texture defects of textile fabrics based on image processing, characterized in that: Includes steps: Acquire an edge image of the textile fabric image, and segment the edge image to obtain edge image blocks; Calculate the arrangement feature index to achieve texture defect detection; wherein the arrangement feature index Satisfies the relationship: , , They represent the curvature index and texture direction index of the i-th edge pixel in any edge image block, respectively. represents the effectiveness of the i-th edge pixel in the edge image block, Represents the number of edge pixels of the edge image block; The texture direction index and the curvature index represent the normal direction and curvature of each edge line at each edge pixel point respectively; the method for obtaining the validity is: , Indicates the geometric center of the edge line and the The Euclidean distance between the geometric centers of the other edge lines, Indicates the edge line and the edge image block The dtw distance of the chain code sequence of other edge lines, M represents the number of edge lines in the edge image block, norm() represents the linear normalization function, Indicates the validity of the edge line, and takes the validity of the edge line as the validity of the edge pixel.
2. The method for detecting textile fabric texture defects based on image processing according to claim 1, characterized in that: The texture direction index obtaining method comprises: A pixel is randomly selected from all edge pixels of the edge image block as a starting pixel. Based on the starting pixel, all edge pixels on each edge line in the edge image block are sorted by using the Moore edge tracking algorithm to obtain an edge pixel sequence of each edge line in the edge image block; a unit vector of a vector formed by the edge pixel in the edge image block and the previous edge pixel in the edge pixel sequence is obtained and recorded as a left vector, and a unit vector of a vector formed by the edge pixel in the edge image block and the next edge pixel in the edge pixel sequence is obtained and recorded as a right vector; a perpendicular bisector of an angle formed by the left vector and the right vector is obtained, and an intersection point of the perpendicular bisector and a line formed by the previous edge pixel and the next edge pixel of the edge pixel in the edge pixel sequence of the edge image block is obtained and recorded as a perpendicular bisector point; a vector formed by the edge pixel in the edge image block and the perpendicular bisector is obtained and recorded as a normal vector, and an arc cosine value of a dot product of the normal vector and a horizontal right unit vector is obtained as a texture direction index of the edge pixel in the edge image block.
3. The method for detecting textile fabric texture defects based on image processing according to claim 1, characterized in that: The bending curvature index satisfies the relationship: ; in, represents the left side vector of the edge pixel in the edge image block, represents the right side vector of the edge pixel in the edge image block, represents the vector formed by the previous edge pixel and the next edge pixel of the edge pixel in the edge pixel sequence in the edge image block, express The module length, express The module length, express The modulus length, sin() represents the sine function, represents the arccosine function, Represents the curvature index of the edge pixel in the edge image block.
4. The method for detecting textile fabric texture defects based on image processing according to claim 1, characterized in that: The method for realizing texture defect detection includes: Segment the textile fabric image to obtain a number of image blocks; obtain the LBP feature image of the image block; The image blocks within the 8-neighborhood of the image block are recorded as the adjacent image blocks of the image block, the difference in the value of the arrangement feature index between the edge image block corresponding to an image block and the edge image block corresponding to the adjacent image block is recorded as the first difference of the image block, the difference in the pixel value of the LBP image between the image block and the adjacent image block is recorded as the second difference of the image block, and the arrangement consistency of the image block is calculated, and the arrangement consistency is negatively correlated with the first difference and the second difference; Abnormal arrangement detection is achieved by utilizing the arrangement consistency of image blocks.
5. The method for detecting textile fabric texture defects based on image processing according to claim 4, characterized in that: The calculating arrangement consistency of the image blocks comprises: ; in, Represents the arrangement feature index of the edge image block corresponding to an image block, Represents the arrangement feature index of the edge image block corresponding to the jth adjacent image block of the image block, Represents the pixel value of the t-th pixel in the LBP feature image of the j-th adjacent image block of the image block, Indicates the number of pixels contained in the LBP feature image of the jth adjacent image block of the image block, Represents the pixel value of the tth pixel in the LBP feature image of the image block, Indicates the number of pixels contained in the LBP feature image of the image block, represents the number of adjacent image blocks of the image block, Indicates the arrangement consistency of the image block, represents the first difference of the image block, Represents the second difference of the image block.
6. The method for detecting textile fabric texture defects based on image processing according to claim 4, characterized in that: The method of realizing abnormal arrangement detection by utilizing arrangement consistency of image blocks includes: The normalized value of the arrangement consistency of each image block is compared with the preset consistency threshold Y. When the normalized value of the arrangement consistency of the image block is less than the preset consistency threshold Y, it is determined that there is a defect in the fabric in the image block.
7. The method for detecting textile fabric texture defects based on image processing according to claim 4, characterized in that: The textile fabric image is segmented to obtain a plurality of image blocks, including: Get the length L and width W of the textile fabric image, divide L by a and round up to get the first length , divide W by a and round up to get the first width , the textile fabric image is evenly divided into several pieces of length , width is image blocks, a represents the preset number.
8. A textile fabric texture defect detection system based on image processing, characterized in that: 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 method for detecting texture defects of textile fabrics based on image processing according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
A detection method based on fabric region texture features
CN113450350B
Detection method based on texture features of cloth area
CN113450350A
Textile defect self-adaptive detection method based on spectral analysis
CN113643294A
Method for detecting textile defects on surface of bed sheet
CN115861310A
Visual inspection method for textile quality
CN116843688A
Cited By
Cloth overexposure light-color line intelligent repairing method and system
CN121921211A