A method for detecting textile blending ratio defects
Through high-speed camera equipment and image processing technology, combined with Fourier transform and support vector machine models, the problem of detecting textile blending ratio defects in a vibration environment was solved, and high-precision and efficient defect detection was achieved.
Patent Information
- Application Number
- CN202411385610.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2044-09-30
AI Technical Summary
During the textile blending process, the vibration environment causes deformation and displacement of the textile surface, affecting the arrangement of warp and weft threads and the interweaving structure, increasing the difficulty of detection. In addition, different fibers have different deformation characteristics under vibration conditions, making it difficult to establish a unified detection model, which affects the stability of image acquisition and detection accuracy.
High-speed camera equipment is used for continuous image acquisition, exposure time and frame rate are adjusted, and the image is corrected by combining adaptive histogram equalization and optical flow estimation algorithms. The warp and weft arrangement of textiles is analyzed through Fourier transform, and an abnormality assessment model of support vector machine is constructed. The displacement caused by vibration is tracked and compensated in real time to realize defect detection.
Accurately detecting proportional defects in blended textiles in a vibrating environment improves detection accuracy and efficiency, and can track different types of defect areas in real time to ensure that the detection results correspond to the actual locations.
Smart Images

Figure CN119516242B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology, and in particular to a method for detecting textile blending ratio defects. Background Art
[0002] Textile looms subject textiles to vibration during weaving, creating a complex technical challenge when detecting textile blending defects. Vibration can cause minute deformations and displacements on the textile surface, resulting in subtle changes in the arrangement and interweaving of the warp and weft threads. These changes can affect the accuracy of image processing technology in detecting warp and weft anomalies, particularly when detecting breakage, misalignment, and missing threads. Furthermore, the complex fiber composition of blended textiles, with different fibers exhibiting varying deformation characteristics under vibration, further complicating detection. Furthermore, the frequency and amplitude of vibration on high-speed production lines are often unstable, making the development of a unified detection model difficult. Vibration can also cause jitter in the detection equipment itself, impacting the stability and continuity of image acquisition. In this context, accurately capturing the microstructure of the textile surface in a vibrating environment and extracting effective feature information from it becomes a pressing technical challenge. Summary of the Invention
[0003] The present invention provides a method for detecting textile blending ratio defects, which mainly includes:
[0004] Continuously capture images of the vibrating blended textile, adjust the exposure time and frame rate of the camera according to the vibration frequency and amplitude characteristics, and obtain a sequence of textile surface images;
[0005] The obtained textile surface image sequence is preprocessed and the warp and weft regions are segmented according to the surface texture characteristics of the blended textile;
[0006] Perform frequency domain analysis on the segmented textile warp and weft images, extract the arrangement direction and spacing information of the textile warp and weft by calculating the spectral energy distribution characteristics, and perform matching and comparison with a preset normal textile warp and weft arrangement template to determine whether the warp and weft are abnormal;
[0007] The detected abnormal areas of the textile warp and weft are subjected to edge extraction and connected area marking segmentation. The area and perimeter geometric features of the abnormal areas are calculated. An abnormality degree assessment model is established based on the textile production process parameters to quantitatively analyze the defect type and severity.
[0008] Based on the abnormality assessment model, a blending ratio defect classifier was constructed. Using warp and weft abnormality features, fiber distribution features, and texture features as input, the classifier was trained to identify different types of blending ratio defects.
[0009] Based on the blended proportion defect classifier and the defect positioning requirements in a vibration environment, different types of defect proportion areas are tracked in real time to compensate for the image displacement caused by vibration and ensure that the defect detection results correspond to the actual textile position.
[0010] The technical solution provided by the embodiment of the present invention may have the following beneficial effects:
[0011] The present invention discloses a method for detecting blended proportion defects in textiles. The method uses a high-speed camera to continuously capture images of blended textiles in a vibrating state, performs image preprocessing and warp and weft area segmentation, and uses Fourier transform to perform frequency domain analysis to extract warp and weft arrangement information. For the detected abnormal areas, local affine transformation is used to correct the deviation caused by wrinkles, and fine segmentation is performed in combination with morphological operations and connected region labeling algorithms. By extracting geometric and texture features, an abnormality degree assessment model based on a support vector machine and a blended proportion defect classifier are constructed. Finally, different types of defect areas are tracked in real time, the displacement caused by vibration is compensated, and the defect detection results are accurately corresponded to the actual textile position. The present invention can accurately detect the proportion defects of blended textiles in a vibrating environment, thereby improving detection accuracy and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 The present invention is a flowchart of a method for detecting textile blending ratio defects.
[0013] Figure 2 Schematic diagram of a method for detecting textile blending ratio defects according to the present invention.
[0014] Figure 3 This is another schematic diagram of a method for detecting textile blending ratio defects according to the present invention. DETAILED DESCRIPTION
[0015] To further understand the content of the present invention, the present invention is described in detail with reference to the accompanying drawings and examples. The present application is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the invention are shown in the accompanying drawings.
[0016] like Figure 1 -3. In this embodiment, a method for detecting textile blending ratio defects may specifically include:
[0017] S101 , continuously capturing images of a blended textile in a vibrating state, adjusting the exposure time and frame rate of a camera device according to vibration frequency and amplitude characteristics, and obtaining a sequence of textile surface images.
[0018] A camera is used to capture a continuous image sequence of a vibrating blended textile surface. The camera's exposure time and acquisition frame rate are adjusted according to the vibration frequency and amplitude. The continuous image sequence is preprocessed using adaptive histogram equalization to produce an enhanced textile surface image sequence. An optical flow estimation algorithm is used to calculate the displacement field between adjacent frames, and the image is corrected based on this displacement field to produce a stable textile surface image sequence.
[0019] Specifically, a Phantom v2512 high-speed camera was used to continuously capture images of blended textiles within a vibration frequency range of 10-1000 Hz and a vibration amplitude range of 0.1-10 mm. By adjusting the camera's exposure time from 0.1-1 ms and acquisition frame rate from 1000-10000 fps to adapt to the vibration characteristics, continuous image capture of the vibrating blended textile surface was performed to obtain a clear sequence of textile surface images. The acquired textile surface image sequence was preprocessed using adaptive histogram equalization to improve image clarity and detail visibility by adjusting contrast, brightness, and saturation, resulting in an enhanced textile surface image sequence. Motion compensation was then performed on the enhanced textile surface image sequence, using an optical flow estimation algorithm to calculate the displacement field between adjacent frames. The images were then corrected based on this displacement field to eliminate the effects of vibration on image quality, resulting in a stable textile surface image sequence. A Phantom v2512 high-speed camera was used to continuously capture images of blended textiles. The camera exposure time was set to 0.5 ms and the frame rate was set to 5000 fps to accommodate a vibration frequency of 50 Hz and an amplitude of 5 mm. The resulting textile surface image sequence was processed using adaptive histogram equalization, expanding the grayscale from 256 to 1024 levels to enhance image contrast. Motion compensation was performed on the enhanced image sequence, and the Lucas-Kanade optical flow algorithm was used to calculate the displacement field between adjacent frames. The average value of the displacement field was (2.5 pixels, 1.8 pixels). Based on this displacement field, an affine transformation was applied to the image to eliminate the effects of vibration.
[0020] S102 , pre-processing the obtained textile surface image sequence, and segmenting the warp and weft regions according to the texture features of the blended textile surface.
[0021] A textile surface image sequence is acquired, and the image sequence is filtered to obtain a denoised textile surface image; contrast enhancement is performed on the denoised textile surface image to obtain a contrast enhanced textile surface image; texture features are extracted using a Gabor filter group for the contrast enhanced textile surface image to obtain a filter response; principal component analysis is performed on the filter response, and a preset number of principal components are selected as texture feature representations to obtain a texture feature map after dimensionality reduction; if the texture feature map after dimensionality reduction exists, the texture feature map is binarized; a morphological opening operation is performed on the feature map after binarization to obtain a longitude and latitude area segmentation result.
[0022] Specifically, a Gaussian filter was used to filter the collected textile surface image sequence. Convolution was performed on the image with a Gaussian kernel size of 5×5 and a standard deviation of 1.0 to obtain a denoised textile surface image. Contrast-limited adaptive histogram equalization was then performed on the denoised textile surface image, with a block size of 8×8 pixels and a contrast limit threshold of 0.01, to obtain a contrast-enhanced textile surface image. Texture features were extracted from the contrast-enhanced textile surface image using a Gabor filter bank. The filter bank orientations were set to 0°, 22.5°, 45°, 67.5°, 90°, 112.5°, 135°, and 157.5°, with scales of 1, 2, 4, 8, and 16 pixels, and center frequencies of 0.1, 0.2, 0.3, 0.4, and 0.5, resulting in 40 filter responses. Principal component analysis was performed on the Gabor filter responses, and the first three principal components were selected as texture feature representations to obtain a texture feature map after dimensionality reduction. Apply Otsu threshold segmentation algorithm to the texture feature map after dimensionality reduction, calculate the optimal threshold, and divide the feature Figure 2The image was then quantized and then morphologically opened using a 3×3 pixel rectangular structuring element to remove connected regions smaller than 10 pixels, resulting in a segmentation map along the longitude and latitude lines. The collected textile surface image sequence was Gaussian filtered using a 5×5 kernel and a standard deviation of 1.0, reducing the image noise level from 15 to 3. The filtered image was enhanced using contrast-limited adaptive histogram equalization with a block size of 8×8 pixels and a threshold of 0.01, resulting in a 40% increase in image contrast and a more uniform grayscale distribution. Texture features were extracted from the enhanced image using a Gabor filter bank with eight orientation angles (0° to 157.5°, with intervals of 22.5°), five scales (1, 2, 4, 8, and 16 pixels), and five center frequencies (0.1 to 0.5, with intervals of 0.1). Forty response maps were generated. Principal component analysis was performed on these 40 response maps, and the first three principal components were selected, explaining 95% of the variance, thus compressing the 40-dimensional features into three dimensions. The feature map after dimensionality reduction is segmented by Otsu algorithm, and the best threshold is calculated to be 127. Figure 2 The binary image is morphologically opened using a 3×3 rectangular structuring element, removing connected regions smaller than 10 pixels. This results in warp and weft segmentation. The segmentation results show that warp threads account for 45% of the image area and weft threads account for 35%, achieving an accuracy of 92% and an average frame time of 1.2 seconds, meeting real-time requirements. This method is applicable to blended textiles of various materials, such as cotton-polyester and wool-acrylic blends, and is highly effective for fabrics with warp and weft thread densities of 30-120 threads per inch.
[0023] S103, performing frequency domain analysis on the segmented textile warp and weft images, extracting arrangement direction and spacing information of the textile warp and weft by calculating spectrum energy distribution characteristics, and performing matching and comparison with a preset normal textile warp and weft arrangement template to determine whether the warp and weft are abnormal.
[0024] A two-dimensional fast Fourier transform is performed on the segmented textile warp and weft images to obtain a frequency domain representation representing the structural characteristics of the textile warp and weft. The amplitude spectrum of the spectrogram is calculated based on the frequency domain representation and expressed in polar coordinates. For the amplitude spectrum represented in polar coordinates, multiple directions are taken at preset angle intervals within a preset angle range, and the energy distribution in each direction is calculated to obtain a feature vector representing the direction and spacing of the textile warp and weft arrangement. The cosine similarity is calculated between the feature vector and samples in a pre-established template library of normal textile warp and weft arrangement. If the similarity is less than a preset threshold, the warp and weft arrangement is determined to be abnormal. For warp and weft regions determined to be abnormal, the Euclidean distance between the feature vector and the template sample is calculated. The type of anomaly is determined based on this Euclidean distance, and the specific type of abnormal warp and weft is determined.
[0025] Specifically, the segmented textile warp and weft images were transformed into the frequency domain using a 512×512-point two-dimensional fast Fourier transform (FFT). The complex-valued frequency spectrum of the Fourier-transformed image was calculated to obtain a frequency-domain representation of the textile's warp and weft structural characteristics. The Fourier-transformed frequency spectrum was then subjected to energy distribution analysis, and its amplitude spectrum was calculated. Using polar coordinates, the energy distribution in each direction, taken every 5° from 0° to 180°, was calculated to generate a 36-dimensional feature vector representing the direction and spacing of the textile's warp and weft arrangements. Based on a pre-established template library of normal textile warp and weft arrangements, the cosine similarity was calculated to determine the similarity between the feature vector and samples in the template library. A similarity threshold of 0.95 was set to determine whether the warp and weft arrangements were abnormal. For warp and weft regions identified as abnormal, the Euclidean distance between the feature vector and the template was calculated. Based on the distance, the type of abnormality, such as missing warp threads or uneven weft spacing, was determined, and the specific type of abnormal warp and weft was determined. A 512×512-point two-dimensional fast Fourier transform (FFT) was applied to the segmented 1024×1024 pixel textile warp and weft image, resulting in a complex spectrogram. The magnitude spectrum of the spectrogram was calculated using polar coordinates. The energy distribution in each direction was calculated every 5° between 0° and 180°, yielding a 36-dimensional feature vector. Specifically, the magnitude spectrum was divided into 36 sectors, each covering a 5° angle range. The average energy of the pixels in each sector was calculated to form a feature vector. For example, for cotton textiles, the energy values of the feature vector for a normal sample were 0.8 and 0.75 at 0° and 90°, respectively, while the energy values for all other directions were below 0.2. The resulting feature vector was then compared with a pre-established library of 100 normal sample templates using the cosine similarity method with a threshold of 0.95. If the calculated similarity fell below the threshold, the sample was identified as abnormal. For each abnormal sample, the Euclidean distance between its feature vector and each sample in the template library was calculated. The template with the smallest distance was identified as the most similar normal sample. If the Euclidean distance component in the 5° direction exceeds 0.3, it is determined that the warp is missing; if the component in the 85°-95° direction exceeds 0.2, it is determined that the weft spacing is uneven. This can detect abnormalities such as warp density deviation exceeding 5% or weft spacing coefficient of variation exceeding 10%, meeting textile quality control requirements.
[0026] The anomaly detection threshold is dynamically adjusted based on the textile type and production process parameters to determine whether the current warp and weft arrangement is abnormal. A local affine transformation model is used to perform geometric correction on detected local deformation areas to eliminate spectral analysis deviations caused by wrinkles.
[0027] The system obtains baseline thresholds corresponding to textile types and production process parameters from a preset parameter library. Real-time statistical analysis is performed on samples from the current batch, calculating the mean and standard deviation of the warp and weft density and spacing of the samples. Based on the mean, standard deviation, and baseline threshold, a dynamic anomaly detection threshold for the current batch is generated. The textile image is then segmented into regions. The statistics of the gray-level co-occurrence matrix and the eigenvectors of the local binary patterns of each subregion are calculated to obtain eigenvectors representing the local texture structure. These eigenvectors are used to construct a local affine transformation model, which is then mapped to the parameters of the affine transformation. The affine transformation matrix parameters are estimated, and geometric correction is performed on detected local deformed areas. The corrected image is Fourier transformed, and its spectral energy distribution characteristics are calculated. These characteristics are normalized and then compared element-by-element with the dynamic anomaly detection threshold. If the number of elements exceeding the threshold exceeds a preset percentage, the current warp and weft arrangement is determined to be abnormal.
[0028] Specifically, the corresponding baseline thresholds are extracted from a preset parameter library based on the textile type and production process parameters. The library contains baseline thresholds for different textile types (cotton, polyester, and blended) and process parameter combinations such as weaving speed and tension. A sliding window method is used to perform real-time statistics on the current batch of samples, calculating the mean and standard deviation of the warp and weft density and spacing. Combined with the baseline thresholds, an anomaly detection threshold suitable for the current batch is dynamically generated. A K-means clustering algorithm is used to segment the textile image into regions. Four statistics of the gray-level co-occurrence matrix (energy, contrast, correlation, entropy, and a 59-dimensional eigenvector of the local binary pattern) are calculated for each subregion to obtain a eigenvector representing the local texture structure. The eigenvectors are used to construct a local affine transformation model, which is then mapped to the six parameters of the affine transformation. The least-squares method is used to solve an overdetermined system of equations and estimate the affine transformation matrix parameters. Geometric correction is then performed on the detected local deformed regions to eliminate image distortion caused by wrinkles. The rectified image is Fourier transformed to calculate the spectral energy distribution features. After normalization, the features are compared element-by-element with dynamically generated thresholds. If the number of elements exceeding the threshold exceeds a preset percentage, the warp and weft alignment is considered abnormal, resulting in a corrected and optimized anomaly detection result. For a batch of cotton-polyester blended fabrics, benchmark thresholds are extracted from a parameter library, such as a ±5% deviation threshold for warp and weft density and a 10% threshold for spacing coefficient of variation. Using a 100×100 pixel sliding window with a step size of 50 pixels, real-time statistics are performed on a 1000×1000 pixel image. The calculated warp density is a mean of 120 strands / inch with a standard deviation of 3 strands / inch, and the weft density is a mean of 80 strands / inch with a standard deviation of 2 strands / inch. Combined with the benchmark thresholds, the dynamic anomaly detection thresholds for the current batch are set as 114-126 strands / inch for warp density and 76-84 strands / inch for weft density. The image is then partitioned into regions using the K-means clustering algorithm with k = 5 clusters. For each subregion, four statistics—energy, contrast, correlation, and entropy—of the gray-level co-occurrence matrix, as well as the 59-dimensional eigenvector of the local binary pattern, are calculated to obtain a 63-dimensional eigenvector. This 63-dimensional eigenvector is converted into the six parameters of an affine transformation (a11, a12, a21, a22, tx, ty) through a linear mapping. The system of equations Ax = b is constructed, where A is the eigenvalue matrix, x is the affine parameter to be solved, and b is the ideal coordinate. The overdetermined system of equations is solved using the least squares method to obtain the optimal affine transformation matrix. This matrix is applied to the detected local deformed areas for geometric correction to eliminate distortion caused by wrinkles. A 512×512-point two-dimensional fast Fourier transform is performed on the corrected image to calculate the spectral energy distribution features. After normalization, the features are compared element-by-element with a dynamic threshold, with a threshold of 10% for the number of elements exceeding the threshold. If this threshold is exceeded, the alignment of the longitude and latitude lines is considered abnormal.
[0029] S104. Perform edge extraction and connected region marking segmentation on the detected abnormal areas of the warp and weft lines of the textile, calculate the area and perimeter geometric features of the abnormal areas, establish an abnormality degree assessment model based on the textile production process parameters, and conduct quantitative analysis on the defect type and severity.
[0030] Based on the image of the abnormal area of the warp and weft lines of the textile, edge extraction is performed to obtain an edge binary image of the abnormal area; the edge binary image is segmented into connected regions to obtain a marked abnormal area image; for the marked abnormal area image, the area and perimeter of the abnormal area are calculated; based on the area and perimeter of the abnormal area, the circularity and rectangular shape factors are calculated to determine the geometric feature vector of the abnormal area; an abnormality degree assessment model is constructed, and the type and severity of the detected defect are judged through the geometric feature vector and the weaving speed and yarn tension process parameters to obtain an abnormality assessment result.
[0031] Specifically, the Canny edge detection algorithm was used to extract edges from abnormal warp and weft regions detected in the textile. By setting the low threshold to 50, the high threshold to 150, and the standard deviation of the Gaussian filter to 1.4, the edge contours of the abnormal regions were extracted, resulting in a binary edge image. The eight-connected component labeling algorithm was then applied to the binary edge image for connected region segmentation. A two-pass scanning method was used: the first pass was from top to bottom and from left to right, and the second pass was from the opposite direction to solve the equivalent labeling problem. This resulted in a labeled abnormal region image. Based on the labeled abnormal region image, the area of each abnormal region was calculated using pixel counting, and the perimeter of the abnormal region was calculated using the Freeman chain code method. The geometric feature vector of the abnormal region was obtained by calculating shape factors such as circularity (4π*area / (perimeter^2)) and rectangularity (area / (area of the minimum bounding rectangle)). In combination with textile production process parameters such as weaving speed and yarn tension, a support vector machine-based abnormality assessment model was constructed. A radial basis kernel function was used with a penalty parameter C set to 1.0 and a gamma parameter set to 0.1. The optimal parameters were selected through cross-validation. The geometric feature vectors and process parameters of the abnormal regions are input, and the types of defects detected, such as broken warp, broken weft, and stains, as well as their severity (minor, moderate, and severe), are quantitatively analyzed to obtain the abnormality assessment results. For a 1024×1024 pixel textile image, the Canny edge detection algorithm is first applied, with a low threshold of 50, a high threshold of 150, and a Gaussian filter standard deviation of 1.4, to extract the edges of the abnormal regions. Three major abnormal regions are detected in the resulting edge binary image. Subsequently, the eight-connected component labeling algorithm is used, with a two-pass scanning method for connected region segmentation. The first pass marks five potential abnormal regions, and the second pass, after a reverse scan, merges the equivalent labels to ultimately identify three independent abnormal regions. Geometric features were calculated for each of the three regions. The first region had an area of 2500 pixels, a perimeter of 200 pixels, a circularity of 0.78, and a rectangularity of 0.85. The second region had an area of 1800 pixels, a perimeter of 180 pixels, a circularity of 0.69, and a rectangularity of 0.79. The third region had an area of 3200 pixels, a perimeter of 240 pixels, a circularity of 0.70, and a rectangularity of 0.82. These features were then fed into a support vector machine model based on the production process parameters of a weaving speed of 200 m / min and a yarn tension of 2.5 cN. The model used a radial basis kernel function with a penalty parameter C of 1.0 and a gamma of 0.1, optimized using 5-fold cross-validation. The model output indicated that the first region represented a warp break with a moderate severity score of 0.75; the second region represented a stain with a mild severity score of 0.35; and the third region represented a weft break with a severe severity score of 0.92.
[0032] The size and shape of the structural elements are selected according to the complexity of the textile texture. Based on the morphological operation parameters, the rough outline of the abnormal area along the longitude and latitude lines is extracted. The connected component labeling algorithm is used to introduce local texture features for fine segmentation of the abnormal area.
[0033] The gray level co-occurrence matrix features of the textile image are obtained, and a texture complexity index is calculated based on the gray level co-occurrence matrix features, wherein the texture complexity index includes four features: contrast, correlation, energy, and entropy. If the texture complexity index is greater than a preset threshold, the corresponding structure element size and shape are selected to obtain the initial value of the morphological operation parameter. The morphological operation parameters are adjusted using the gradient descent method, and a rough contour map of the abnormal area is obtained through opening and closing operations. A connected region labeling algorithm is applied to the rough contour map. The connected region labeling algorithm introduces local binary pattern features based on the scanning method to calculate the characteristic distance between the central pixel and the neighboring pixels. If the characteristic distance is less than a preset distance threshold, the regions are merged to obtain a preliminary segmented abnormal region image. The preliminary segmented abnormal region image is finely segmented using a region growing algorithm, and the preliminary segmented abnormal region is used as a seed point to determine whether the gray level difference and the texture feature similarity meet a preset growth criterion. If the growth criterion is met, the abnormal region boundary is expanded until the rate of change of the number of pixels at the region boundary is less than a preset stop threshold, thereby obtaining a fine segmentation result image of the longitude and latitude abnormal region.
[0034] Specifically, the texture complexity index is calculated based on the gray-level co-occurrence matrix features of the textile image. The complexity index is calculated using four features: contrast, correlation, energy, and entropy. By setting a complexity threshold and selecting the corresponding structural element size and shape, the initial values of the morphological operation parameters suitable for the current textile texture characteristics are obtained. The morphological operation parameters are adjusted using the gradient descent method, with a learning rate set to 0.01 and a maximum number of iterations set to 100. Opening and closing operations are repeated until the abnormal region contour extraction results stabilize, resulting in a rough outline of the abnormal region along the longitude and latitude lines. A connected component labeling algorithm is applied to this rough outline. Based on the traditional two-pass scanning method, the local binary pattern features of a 3x3 neighborhood are introduced. The characteristic distance between the center pixel and the neighboring pixels is calculated. The distance threshold is set to 0.2, and the regions are merged to obtain a preliminary segmented image of the abnormal region. Based on the preliminary segmentation results, the region growing algorithm is used for fine segmentation. The preliminary segmented area is used as the seed point. The growth criterion is set to be grayscale difference less than 10 and texture feature similarity greater than 0.8. The stopping condition is that the change rate of the number of pixels at the region boundary is less than 1%. The abnormal region boundary is gradually expanded to finally obtain the fine segmentation result image of the abnormal longitude and latitude region. For a 1024×1024 pixel textile image, its grayscale co-occurrence matrix features are first calculated to obtain the contrast
[0035] 0.8, correlation 0.6, energy 0.3, and entropy 4.5. Based on these features, the texture complexity index was calculated to be 0.75. Because the complexity index was greater than 0.7, a 5×5 diamond-shaped structuring element was selected as the initial parameters for the morphological operation. The morphological operation parameters were optimized using gradient descent, with an initial learning rate of 0.01. After 73 iterations, the parameters converged, resulting in an optimized structuring element size of 7×7. Opening and closing operations were performed on this optimized structuring element to extract the rough outlines of the abnormal regions. Next, an improved connected component labeling algorithm was applied to the contour map. Local binary pattern features were calculated within a 3×3 neighborhood, resulting in a 59-dimensional feature vector. A feature distance threshold of 0.2 was set, and adjacent pixels were merged. This process identified five potential abnormal regions. These five regions were then used as seed points for fine segmentation using the region growing algorithm. The grayscale difference threshold was set to 10, and the texture feature similarity threshold was set to 0.8. After an average of 12 iterations, three of the five regions met the stopping criterion (a change in the number of boundary pixels of less than 1%) and were ultimately identified as abnormal regions. These three abnormal regions were 1200, 800, and 1500 square pixels, respectively, accounting for 0.28% of the total image area.
[0036] The geometric and texture features of the abnormal area are extracted. The geometric features include area, perimeter, and circularity. The principal component analysis method is used to reduce the dimension of the features and obtain the feature vector of the abnormal area to construct an abnormality degree assessment model based on support vector machine.
[0037] An image of the abnormal region is acquired, and the area and perimeter are calculated using a pixel counting method; the circularity is calculated based on the area and perimeter to obtain a geometric feature vector of the abnormal region. A gray-level co-occurrence matrix is calculated for the abnormal region image, and four statistical quantities, namely energy, contrast, correlation, and entropy, are extracted; local binary pattern features are calculated to obtain a texture feature vector. The geometric feature vector and the texture feature vector are merged; the principal component analysis method is used to reduce the dimension of the merged features to obtain a reduced-dimensional abnormal region feature vector. The reduced-dimensional feature vector is used as input to construct an abnormality degree assessment model based on a support vector machine; an RBF kernel function is used, and the kernel parameter γ and penalty parameter C are set. The optimal parameters are determined using a grid search method; the abnormal region is classified and the degree of abnormality is quantitatively assessed based on the optimal parameters to obtain an assessment result of the abnormal region.
[0038] Specifically, for the extracted abnormal regions, the area is calculated using the pixel counting method, the perimeter is calculated using the 8-connected Moore boundary tracking algorithm, and the circularity is calculated using the area and perimeter to obtain the geometric feature vector of the abnormal region. The gray-level co-occurrence matrix is calculated for the abnormal region image, with the distance set to 1 and the directions selected as 0°, 45°, 90°, and 135°. Four statistics, energy, contrast, correlation, and entropy, are extracted. Local binary pattern features are calculated simultaneously, using a circular 8-neighborhood with a radius of 2 to obtain a 59-dimensional histogram feature. These two features are then spliced into a texture feature vector. The geometric feature vector and texture feature vector are merged, and the merged features are reduced in dimensionality using principal component analysis. The cumulative contribution rate threshold is set to 95%, and the number of principal components is selected to obtain the reduced dimensionality feature vector of the abnormal region. Using the reduced eigenvector as input, a support vector machine-based anomaly assessment model was constructed. The RBF kernel function was used, with the kernel parameter γ set to 0.1 and the penalty parameter C set to 1. Grid search and cross-validation were used to determine the optimal parameters. Abnormal regions were classified and their degree of abnormality was quantitatively assessed. The SVM decision function value was used as the anomaly degree indicator to obtain the abnormal region assessment results. Three abnormal regions were detected in a 1024×1024 pixel textile image. The areas of the first, second, and third regions were calculated using the pixel counting method, with the first region measuring 1200 pixels, the second 750 pixels, and the third 980 pixels. The perimeters were calculated using the 8-connected Moore edge tracing algorithm, yielding 140, 95, and 120 pixels, respectively. The circularity was calculated to 0.76, 0.83, and 0.85. The gray-level co-occurrence matrix was calculated for each abnormal region, with the distance set to 1 and the orientations selected as 0°, 45°, 90°, and 135°. Energy, contrast, correlation, and entropy statistics were extracted. At the same time, local binary pattern features are calculated, and a circular 8-neighborhood with a radius of 2 is used to obtain 59-dimensional histogram features. The geometric features and texture features are merged to obtain a 66-dimensional feature vector. Principal component analysis is applied, and the cumulative contribution rate threshold is set to 95%. Finally, 12 principal components are selected to reduce the 66-dimensional features to 12 dimensions. A support vector machine model is constructed, using the RBF kernel function, and the optimal parameters are determined to be γ = 0.08 and C = 1.2 through grid search. Using 5-fold cross validation, the model accuracy reached 92%. Three abnormal areas were evaluated, and the SVM decision function values were 1.5, 0.8 and 2.3, corresponding to slight, mild and moderate abnormalities, respectively. It took 1.8 seconds, meeting the real-time requirements.
[0039] S105. Based on the abnormality degree assessment model, a blending ratio defect classifier is constructed. The warp and weft abnormality features, fiber distribution features, and texture features are used as inputs to train the classifier to identify different types of blending ratio defects.
[0040] Anomaly features of warp and weft lines are extracted from textile images, including the area, perimeter, and circularity of the abnormal region. The warp and weft directions are evenly divided into several regions, and the proportion of the abnormal area within each region is calculated to obtain warp and weft anomaly feature vectors. Fiber regions are segmented from textile images using a clustering method, with the number of clusters set to the expected number of fiber types. A fiber distribution feature vector characterizing the blending ratio is obtained by calculating the area ratio and spatial distribution characteristics of different fiber types. Texture features of textile images are extracted using a gray-level co-occurrence matrix, and energy, contrast, correlation, and entropy statistics are calculated. Combined with local binary pattern histogram features, a texture feature vector is obtained. The warp and weft anomaly feature vectors, fiber distribution feature vectors, and texture feature vectors are fused using a feature cascade approach to construct a blending ratio defect classifier based on a random forest. The classifier parameters are optimized using a multi-fold cross-validation method to obtain a blending ratio defect classification model.
[0041] Specifically, based on the output of the anomaly assessment model, warp and weft anomaly features were extracted, including the area, perimeter, and circularity of the anomaly region. Ten regions were evenly divided in the warp and weft directions, and the proportion of the anomaly area within each region was calculated to obtain warp and weft anomaly feature vectors. A K-means clustering algorithm was used to segment the textile images into fiber regions, with the number of clusters set to the expected number of fiber types. The area ratios and spatial distribution characteristics of different fiber types were calculated to obtain a fiber distribution feature vector representing the blending ratio. Texture features of textile images were extracted using a gray-level co-occurrence matrix and a local binary pattern algorithm. The gray-level co-occurrence matrix distance was set to 1, and the directions were selected as 0°, 45°, 90°, and 135°. Statistics such as energy, contrast, correlation, and entropy were calculated, and combined with the histogram features of the local binary pattern to obtain a texture feature vector. A random forest-based blending ratio defect classifier was constructed by fusing warp and weft anomaly features, fiber distribution features, and texture feature vectors using a feature cascade approach. The number of trees was set to 100, the maximum depth to 10, and the minimum number of leaf node samples to 5. A 5-fold cross-validation method was used to optimize the classifier parameters, resulting in a final blending ratio defect classification model that can identify defects such as uneven fiber ratio and uneven fiber distribution. For a 2048×2048 pixel blended fabric image, the anomaly assessment model outputs three anomaly regions with areas of 1200, 800, and 1500 square pixels, perimeters of 140, 110, and 180 pixels, and circularities of 0.76, 0.83, and 0.73, respectively. The image was divided into 10 regions in both the warp and weft directions, and a 20-dimensional anomaly area ratio feature vector was calculated. The image was segmented using the K-means algorithm, with the number of clusters set to 3, corresponding to cotton, polyester, and viscose fibers. The area ratios of the three fibers were found to be 45%, 35%, and 20%, respectively. Spatial distribution features were calculated to produce a 15-dimensional feature vector. A gray-level co-occurrence matrix was calculated, with a distance of 1 and orientations of 0°, 45°, 90°, and 135°. Four statistics, energy, contrast, correlation, and entropy, were extracted to produce a 16-dimensional feature vector. Combined with the 59-dimensional local binary pattern histogram features, a 75-dimensional texture feature vector was obtained. The three feature classes were concatenated to form a 110-dimensional hybrid feature vector. A random forest classifier was constructed with 100 trees, a maximum depth of 10, and a minimum leaf node size of 5. Training was performed using 1000 annotated images, and parameter optimization was performed using 5-fold cross-validation. The final model achieved an identification accuracy of 94.5% on the test set, successfully distinguishing four categories: uneven fiber proportions (37%), uneven fiber distribution (25%), mixed fibers (18%), and normal samples (20%).
[0042] S106. Based on the blending ratio defect classifier and the defect positioning requirements in a vibration environment, different types of defect ratio areas are detected and tracked in real time to compensate for the image displacement caused by vibration, thereby ensuring that the defect detection results correspond to the actual textile positions.
[0043] According to the output results of the blending ratio defect classifier, the defect area boundary is extracted, and the center position coordinates of different types of defect areas are obtained by calculating the centroid coordinates of the boundary pixels. The displacement field between adjacent frames is calculated, and the global motion vector is obtained by statistical analysis of the displacement field. The center position of different types of defect areas is predicted and updated using a Kalman filter, wherein the defect center position and speed are set as state variables, and the detected defect center position is set as an observation variable. The global motion vector is obtained, and the prediction result of the Kalman filter is corrected in combination with the global motion vector to obtain the real-time position of each type of defect area after vibration compensation. The affine transformation matrix is calculated based on the real-time position of each type of defect area after vibration compensation and the original detection position, and the original image is affine transformed. The image is resampled using a bilinear interpolation algorithm to obtain an image that eliminates the influence of vibration.
[0044] Specifically, based on the output of the blending ratio defect classifier, the Canny edge detection algorithm was used to extract the boundaries of the defect regions. A low threshold of 50 and a high threshold of 150 were set. The centroid coordinates of the boundary pixels were calculated to obtain the center coordinates of different types of defect regions. The Lucas-Kanade optical flow algorithm was used to calculate the displacement field between adjacent frames, with a window size of 15x15 pixels. Statistical analysis of the displacement field was performed to extract the global motion vector and determine the overall image displacement caused by vibration. A Kalman filter was used to predict and update the center positions of various defect regions. The defect center position and velocity were set as state variables, and the detected defect center position was set as the observation variable. The predicted results were corrected by combining the overall displacement estimated by optical flow to obtain the real-time positions of various defect regions after vibration compensation. An affine transformation matrix was calculated based on the Kalman filter-predicted positions and the original detected positions. The original image was then affine transformed and resampled using a bilinear interpolation algorithm to obtain a stabilized image that eliminates the effects of vibration, ensuring accurate correspondence between the detection results of different types of defects and the actual positions of the textile. For a 2048×2048 pixel blended fabric image, the blended proportion defect classifier detects three defects: uneven fiber proportion, uneven fiber distribution, and fiber intermingling. Edge detection is performed using the Canny algorithm with a low threshold of 50 and a high threshold of 150 to obtain the boundaries of the three defect regions. The centroid coordinates are calculated as (512, 768), (1024, 1536), and (1536, 512), respectively. Optical flow is calculated using the Lucas-Kanade algorithm with a window size of 15×15 pixels, resulting in a global displacement vector of (5, -3) pixels. A separate Kalman filter is applied to each defect type, with the state vector [x, y, vx, vy] and the observation vector [x, y]. The initial state covariance matrix P is set to the identity matrix × 100, the process noise covariance Q is set to the identity matrix × 0.1, and the measurement noise covariance R is set to the identity matrix × 10. After the filter prediction step, corrections are made using optical flow displacement to obtain the new positions of the three defect regions: (517, 765), (1029, 1533), and (1541, 509). An affine transformation matrix is calculated based on the original and new positions. The warpAffine function in the OpenCV library is used for image transformation, and the INTER_LINEAR bilinear interpolation method is selected for interpolation. The resulting image is stabilized, and the positions of the three defects in the image precisely correspond to the actual positions on the textile, with a positional error of less than 2 pixels. The process takes approximately 50 milliseconds, meeting real-time requirements.
[0045] The above embodiment is only one of the preferred implementation methods of the present invention and should not be used to limit the scope of protection of the present invention. Any changes or modifications that have no substantive meaning made to the main design concept and spirit of the present invention, as long as the technical problems they solve are still consistent with the present invention, should be included in the scope of protection of the present invention.
Claims
1. A method for detecting textile blending ratio defects, characterized in that: The method comprises: continuously capturing images of a blended textile in a vibrating state, adjusting the exposure time and frame rate of a camera device according to vibration frequency and amplitude characteristics, and obtaining a sequence of textile surface images; pre-processing the obtained sequence of textile surface images, and segmenting warp and weft regions according to surface texture features of the blended textile; performing frequency domain analysis on the segmented textile warp and weft images, extracting arrangement direction and spacing information of the textile warp and weft by calculating spectrum energy distribution features, performing matching and comparison according to a preset normal textile warp and weft arrangement template, and determining whether the warp and weft are abnormal; performing edge extraction and connected region marking segmentation on the detected abnormal warp and weft regions of the textile, calculating the area and perimeter geometric features of the abnormal regions, establishing an abnormality degree assessment model in combination with textile production process parameters, and quantitatively analyzing the type and severity of defects; constructing a blended proportion defect classifier based on the abnormality degree assessment model, using abnormal warp and weft features, fiber distribution features, and texture features as inputs, and training the classifier to identify different types of blended proportion defects, comprising: extracting abnormal warp and weft features according to the textile image, the warp and weft features being abnormal ... The warp and weft anomaly features include the area, perimeter and circularity of the abnormal region; the warp and weft directions are evenly divided into several regions, the abnormal area ratio in each region is calculated, and the warp and weft anomaly feature vectors are obtained; the textile image is segmented into fiber regions by a clustering method, and the number of clusters is set to the expected number of fiber types; the fiber distribution feature vector characterizing the blending ratio is obtained by calculating the area ratio and spatial distribution characteristics of different fiber types; the texture features of the textile image are extracted using the gray-level co-occurrence matrix, and the energy, contrast, correlation and entropy statistics are calculated; the texture feature vector is obtained by combining the local binary pattern histogram features; the warp and weft anomaly feature vectors, the fiber distribution feature vectors and the texture feature vectors are fused using a feature cascade method to construct a blending ratio defect classifier based on random forest; the classifier parameters are optimized using a multi-fold cross-validation method to obtain a blending ratio defect classification model; according to the blending ratio defect classifier, combined with the defect positioning requirements under a vibration environment, different types of defect ratio areas detected are tracked in real time, and the image displacement caused by vibration is compensated to ensure that the defect detection results correspond to the actual textile position.
2. The method according to claim 1, wherein The method involves performing continuous image acquisition on a blended textile in a vibrating state, adjusting the exposure time and frame rate of a camera device according to the vibration frequency and amplitude characteristics, and obtaining a textile surface image sequence, including: using a camera device to acquire a continuous image sequence of the blended textile surface in a vibrating state, wherein the exposure time and acquisition frame rate of the camera device are adjusted according to the vibration frequency and vibration amplitude; preprocessing the continuous image sequence through adaptive histogram equalization to obtain an enhanced textile surface image sequence; and using an optical flow estimation algorithm to calculate a displacement field between adjacent frames, and correcting the image according to the displacement field to obtain a stable textile surface image sequence.
3. The method according to claim 1, wherein The obtained textile surface image sequence is preprocessed, and the warp and weft regions are segmented according to the surface texture features of the blended textile, including: obtaining a textile surface image sequence, filtering the image sequence to obtain a denoised textile surface image; performing contrast enhancement processing on the denoised textile surface image to obtain a contrast-enhanced textile surface image; extracting texture features of the contrast-enhanced textile surface image using a Gabor filter group to obtain a filter response; performing principal component analysis on the filter response, selecting a preset number of principal components as texture feature representations, and obtaining a texture feature map after dimensionality reduction; if the texture feature map after dimensionality reduction exists, binarizing the texture feature map; and performing a morphological opening operation on the binarized feature map to obtain a warp and weft region segmentation result.
4. The method according to claim 1, wherein The method performs frequency domain analysis on the segmented warp and weft images of the textile, extracts the arrangement direction and spacing information of the warp and weft of the textile by calculating the spectrum energy distribution characteristics, performs matching and comparison according to a preset normal warp and weft arrangement template of the textile, and determines whether the warp and weft are abnormal, including: performing a two-dimensional fast Fourier transform on the segmented warp and weft images of the textile to obtain a frequency domain representation representing the structural characteristics of the warp and weft of the textile; calculating the amplitude spectrum of the spectrum graph according to the frequency domain representation, and expressing the amplitude spectrum in polar coordinates; for the amplitude spectrum represented by the polar coordinates, taking multiple directions at preset angle intervals within a preset angle range, calculating the energy distribution in each direction, and obtaining a frequency domain representation representing the arrangement direction and spacing of the warp and weft of the textile. The method comprises the following steps: calculating a characteristic vector of spacing information; using cosine similarity to calculate the similarity between the characteristic vector and samples in a pre-established normal textile warp and weft arrangement template library; and judging the warp and weft arrangement as abnormal if the similarity is less than a preset threshold; calculating the Euclidean distance between the characteristic vector and the template sample for the warp and weft area judged as abnormal, judging the abnormality type according to the Euclidean distance, and determining the specific type information of the abnormal warp and weft; and further comprising: dynamically adjusting the abnormality detection threshold according to the textile type and production process parameters to judge whether the current warp and weft arrangement is abnormal, and using a local affine transformation model to perform geometric correction on the detected local deformation area to eliminate the spectrum analysis deviation caused by the wrinkle factor.
5. The method according to claim 4, wherein The method dynamically adjusts the anomaly detection threshold based on the textile type and production process parameters to determine whether the current warp and weft arrangement is abnormal, uses a local affine transformation model to geometrically correct the detected local deformation area, and eliminates spectral analysis deviations caused by wrinkle factors. The method includes: obtaining a baseline threshold corresponding to the textile type and production process parameters in a preset parameter library; performing real-time statistical analysis on the current batch of samples, calculating the mean and standard deviation of the warp and weft density and spacing of the samples, and generating a dynamic anomaly detection threshold for the current batch based on the mean, standard deviation, and baseline threshold; dividing the textile image into regions, and obtaining a feature vector representing the local texture structure by calculating the statistics of the gray-level co-occurrence matrix and the eigenvector of the local binary pattern of each subregion; constructing a local affine transformation model using the feature vector, mapping the feature vector to the parameters of the affine transformation, estimating the affine transformation matrix parameters, and geometrically correcting the detected local deformation area; performing a Fourier transform on the corrected image, calculating the spectral energy distribution characteristics of the image, normalizing the characteristics, and comparing them element-by-element with the dynamic anomaly detection threshold. If the number of elements exceeding the threshold exceeds a preset percentage, the current warp and weft arrangement is determined to be abnormal.
6. The method according to claim 1, wherein The method includes performing edge extraction and connected region marking segmentation on the detected abnormal warp and weft areas of the textile, calculating the area and perimeter geometric features of the abnormal areas, establishing an abnormality degree assessment model based on textile production process parameters, and quantitatively analyzing the defect type and severity, including: Based on the image of the abnormal area of the warp and weft lines of the textile, edge extraction is performed to obtain an edge binary image of the abnormal area; connected area segmentation is performed on the edge binary image to obtain a marked abnormal area image; for the marked abnormal area image, the area and perimeter of the abnormal area are calculated; based on the area and perimeter of the abnormal area, the circularity and rectangularity shape factors are calculated to determine the geometric feature vector of the abnormal area; an abnormality degree assessment model is constructed, and the type and severity of the detected defect are judged by the geometric feature vector and the weaving speed and yarn tension process parameters to obtain an abnormality assessment result; it also includes: selecting the corresponding structural element size and shape according to the complexity of the textile texture, extracting the rough outline of the abnormal area of the warp and weft lines based on the morphological operation parameters, applying the connected area marking algorithm, and introducing local texture features to perform fine segmentation of the abnormal area; extracting the geometric features and texture features of the abnormal area, the geometric features including area, perimeter, and circularity; using the principal component analysis method to reduce the dimension of the features, and obtaining the feature vector of the abnormal area to construct an abnormality degree assessment model based on the support vector machine.
7. The method according to claim 6, wherein: The method selects the corresponding size and shape of the structural element according to the complexity of the textile texture, extracts the rough outline of the abnormal area of the longitude and latitude lines based on the morphological operation parameters, uses the connected region marking algorithm, introduces the local texture features to perform fine segmentation of the abnormal area, including: obtaining the grayscale co-occurrence matrix features of the textile image, calculating the texture complexity index according to the grayscale co-occurrence matrix features, and the texture complexity index includes four features: contrast, correlation, energy and entropy; if the texture complexity index is greater than a preset threshold, selecting the corresponding size and shape of the structural element to obtain the initial value of the morphological operation parameter; using the gradient descent method to adjust the morphological operation parameters, and obtaining the rough outline of the abnormal area through opening and closing operations. contour map; for the rough contour map, a connected region labeling algorithm is applied, which introduces local binary pattern features based on the scanning method to calculate the characteristic distance between the central pixel and the neighboring pixels; if the characteristic distance is less than a preset distance threshold, the regions are merged to obtain a preliminary segmented abnormal region image; the preliminary segmented abnormal region image is finely segmented using a region growing algorithm, and the preliminary segmented abnormal region is used as a seed point to determine whether the grayscale difference and texture feature similarity meet the preset growth criteria; if the growth criteria are met, the abnormal region boundary is expanded until the rate of change of the number of pixels at the region boundary is less than the preset stop threshold, to obtain a fine segmentation result image of the longitude and latitude abnormal region.
8. The method according to claim 6, wherein: The method extracts geometric features and texture features of the abnormal area, wherein the geometric features include area, perimeter, and circularity; adopts a principal component analysis method to reduce the dimension of the features to obtain a feature vector of the abnormal area to construct an abnormality degree assessment model based on a support vector machine, including: obtaining an image of the abnormal area, calculating the area and perimeter by a pixel counting method; calculating the circularity according to the area and the perimeter to obtain a geometric feature vector of the abnormal area; calculating a gray level co-occurrence matrix for the abnormal area image, and extracting four statistics of energy, contrast, correlation, and entropy; calculating local binary pattern features to obtain a texture feature vector; merging the geometric feature vector and the texture feature vector; adopting a principal component analysis method to reduce the dimension of the merged features to obtain a feature vector of the abnormal area after the dimension reduction; using the feature vector after the dimension reduction as input to construct an abnormality degree assessment model based on a support vector machine; adopting an RBF kernel function, setting a kernel parameter γ and a penalty parameter C; determining the optimal parameters by a grid search method; classifying the abnormal area and quantitatively evaluating the abnormality degree according to the optimal parameters to obtain an assessment result of the abnormal area.
9. The method according to claim 1, wherein According to the blending ratio defect classifier and the defect positioning requirements in a vibration environment, different types of defect ratio areas detected are tracked in real time, image displacement caused by vibration is compensated, and the defect detection results are ensured to correspond to the actual textile positions, including: extracting the defect area boundary according to the output result of the blending ratio defect classifier, and obtaining the center position coordinates of different types of defect areas by calculating the centroid coordinates of the boundary pixels; calculating the displacement field between adjacent frames, and obtaining the global motion vector by performing statistical analysis on the displacement field; using a Kalman filter to predict and update the center positions of different types of defect areas, wherein the defect center position and speed are set as state variables, and the detected defect center position is set as an observation variable; obtaining the global motion vector, and then correcting the prediction result of the Kalman filter in combination with the global motion vector to obtain the real-time positions of various defect areas after vibration compensation; calculating the affine transformation matrix according to the real-time positions of various defect areas after vibration compensation and the original detection positions, performing affine transformation on the original image, and resampling the image through a bilinear interpolation algorithm to obtain an image without the influence of vibration.
Citation Information
Patent Citations
Fabric flaw detection method based on image projection and singular value decomposition
CN103489182A
Method and system for detecting defects of textile surface based on significance detection
CN107064160A