Fiber impurity detection method based on machine vision

Through the improved watershed transformation method, combined with local structural coherence and regional stability analysis, the problem of oversegment in cotton fiber images is solved, high-precision impurity detection is achieved, and the accuracy and automation level of detection are improved.

CN120279009APending Publication Date: 2025-07-08SHAANXI WANRONG IND CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510748317.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-06
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

In the prior art, standard watershed algorithms are prone to oversegment when segmenting cotton fiber images, resulting in inaccurate impurity segmentation, increasing the complexity of subsequent processing, and unable to meet the actual application needs.

Method used

Adaptive topographic maps are constructed through local structural coherence and regional structural stability analysis, and combined with multi-dimensional feature extraction and judgment classification to achieve high-precision detection of impurities.

Benefits of technology

It significantly improves the accuracy and robustness of impurity segmentation, reduces the false detection and missed detection rates, and improves the automation level of cotton fiber impurity detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120279009A_ABST
    Figure CN120279009A_ABST
Patent Text Reader

Abstract

The invention relates to the field of image processing, in particular to a fiber impurity detection method based on machine vision, which comprises the following steps: acquiring a loose cotton fiber image and preprocessing; impurity segmentation and feature extraction are carried out on the preprocessed image based on improved watershed transformation, a watershed topographic map is modulated by analyzing local structure coherence and regional structure stability of the image, and over-segmentation is inhibited; and finally, performing impurity judgment and result output based on the extracted features. Finally, cotton fiber background texture interference is effectively overcome, impurities are accurately segmented, and the detection accuracy is improved. The method comprises the following steps: acquiring and preprocessing a cotton fiber image; segmenting impurities by using a watershed algorithm improved based on local structure stability; and judging impurities according to the characteristics and outputting a result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing, and particularly to a fiber impurity detection method based on machine vision. Background Art

[0002] The cotton textile industry is an important people's livelihood industry, and its product quality is closely related to people's lives. During the cotton spinning production process, various non-cotton fiber substances will inevitably be mixed into the raw cotton raw materials, which are collectively referred to as impurities. These impurities are of various types, mainly including plant impurities such as cotton seeds, cotton husks, cotton leaves, and stalks from the cotton itself, as well as foreign impurities such as foreign fibers, plastic film fragments, hair, and even metal scraps mixed in during the picking, transportation, and storage processes. If these impurities cannot be effectively removed before spinning, they will directly affect the smooth progress of the spinning process and will ultimately be reflected in the yarn and fabric, forming yarn defects, seriously reducing the quality, appearance, and wearing performance of the final textile products, etc. Therefore, in the cotton spinning processing flow, the opening and cleaning process (abbreviated as opening and cleaning) is the first main process in cotton spinning processing, and its purpose is to loosen the tightly pressed raw cotton bales into a loose single fiber state and preliminarily remove a part of the larger and more easily separated impurities during this process. It is of great significance to detect impurities in the loose cotton fiber flow at this stage because the impurities are relatively exposed at this time, with a relatively primitive form and are easy to identify.

[0003] Traditional raw cotton impurity control mainly relies on manual sorting and mechanical impurity removal equipment. Mechanical impurity removal equipment mainly separates impurities based on the differences in physical properties such as density, shape, and stiffness between impurities and fibers. The removal effect on some impurities with physical properties similar to fibers or tightly wound is limited, and it may damage the fibers. With the development of machine vision technology, using image processing technology for automated and online impurity detection has become a research hotspot. In the prior art, machine vision methods are often used to separate the impurity regions in the image from the background through image segmentation algorithms. Image segmentation is a key step, and its accuracy directly affects the subsequent recognition results. For the image segmentation task with a complex background and possible adhesion of targets, the Watershed Transform algorithm is a commonly used technical means. However, the standard watershed algorithm has certain defects: it is overly sensitive to noise and texture, and is extremely prone to serious over-segmentation. The rich texture details of the loose cotton fibers themselves will form a large number of local minima on the gradient map. The standard watershed algorithm will misjudge these texture changes that are not real boundaries as segmentation lines, resulting in a large number of redundant and fragmented segmentation blocks within a single impurity or in a pure background region. This over-segmentation not only makes it difficult to accurately extract the impurity contour and features, but also greatly increases the complexity of subsequent processing and cannot meet the actual application requirements. Summary of the Invention

[0004] In view of the problem that the above-mentioned standard watershed algorithm is extremely prone to serious over-segmentation, the present invention proposes a fiber impurity detection method based on machine vision, including: collecting a surface image of a loose cotton fiber flow; performing impurity segmentation and feature extraction on the surface image based on an improved watershed transform, and the improved watershed transform includes: calculating local structural coherence based on the structure tensor of the first neighborhood window of each pixel point of the surface image, and in response to the sum of the two eigenvalues of the structure tensor being greater than a set value, setting that the local structural coherence is positively correlated with the difference between the two eigenvalues of the structure tensor and positively correlated with the sum of the two eigenvalues of the structure tensor; in response to the sum of the two eigenvalues of the structure tensor being less than or equal to the set value, setting the local structural coherence to 0; obtaining the regional structural stability of each pixel point according to the spatial distribution consistency of the local structural coherence within the second neighborhood window; the product of the regional structural stability and the gradient amplitude of the surface image constitutes an improved topographic map; performing a watershed transform on the improved topographic map to obtain a set of segmented regions of the image; identifying the regions corresponding to potential impurities in the set of segmented regions, and extracting multi-dimensional feature vectors of the potential impurity regions; based on the multi-dimensional feature vectors, determining and classifying the potential impurity regions, distinguishing real impurities from background artifacts, and outputting a detection result.

[0005] The method of the present invention collects an image of a loose cotton fiber flow, and innovatively proposes an improved watershed transform segmentation technology based on the analysis of local structural coherence and regional structural stability, constructs an improved topographic map that can adaptively suppress background texture interference, and significantly solves the problem that the standard watershed algorithm in the prior art is prone to serious over-segmentation and inaccurate impurity segmentation when applied to complex texture backgrounds such as cotton fibers; at the same time, combined with subsequent feature extraction and determination classification steps, high-precision and automated on-line detection of impurities in loose cotton fibers is realized. Compared with traditional threshold segmentation or unimproved watershed algorithms, the present invention greatly improves the accuracy and robustness of impurity segmentation in complex texture backgrounds and reduces the false detection and missed detection rates.

[0006] Further, the specific calculation method of the local structural coherence is as follows: ; where represents the local structural coherence of pixel point ; and are respectively the eigenvalues obtained by calculating the structure tensor within the first neighborhood window of ; represents a very small positive number; the structure tensor is ; where is the first-order partial derivative of the image processed by the Sobel operator.

[0007] By utilizing the relative differences of the eigenvalues of the structure tensor to quantify the directional consistency of the local image structure, the present invention can more robustly characterize the directional structure features of cotton fiber bundles and the isotropic or unstructured features of impurity regions compared to simple texture descriptors that only rely on gradient direction or magnitude, providing a more accurate underlying feature basis for subsequent distinguishing of background texture and impurities.

[0008] Further, the calculation method of the regional structure stability is specifically as follows: ; where represents the regional structure stability of pixel point ; represents the standard deviation of all local structure coherences within the second neighborhood window ; represents the mean of all local structure coherences within the second neighborhood window ; represents a very small positive number.

[0009] By evaluating the coefficient of variation of the spatial variation of local structure coherence in a larger neighborhood, the present invention effectively distinguishes regions with truly uniform structures (such as inside fiber bundles or impurities, with high stability) from regions with transitional or complex structures (such as boundaries or texture change points, with low stability). Compared to only using point features or simple neighborhood statistics, this method can better reflect the overall structural homogeneity of the region, providing a more reliable judgment basis for adaptively adjusting the segmentation resistance.

[0010] Further, the calculation method of the improved topographic map is specifically as follows: ; where represents the improved topographic map; represents the gradient magnitude of the surface image at pixel point ; represents the regional structure stability of the second neighborhood window centered at pixel point .

[0011] Further, before performing the watershed transformation on the improved topographic map, it also includes: preliminarily binarizing the preprocessed image; determining the foreground markers representing the impurity regions and the background markers representing the pure background regions by performing distance transformation on the binarized image and combining threshold segmentation.

[0012] Further, capture the surface image of the loose cotton fiber stream, including: above the conveying device of the opening and cleaning cotton equipment, use a line array industrial digital camera to vertically photograph the downward moving loose cotton fiber stream; and configure an overhead LED light source to provide uniform illumination.

[0013] By using a line array camera and an overhead uniform light source and choosing to take pictures at the opening and cleaning cotton stage, the present invention ensures that high-quality and low-interference images reflecting the true state of loose cotton fibers and their surface impurities can be obtained. Compared with collecting images in other processes (such as after drawing or spinning) or using improper lighting (such as side light causing shadows), it is more conducive to the stable operation of subsequent image processing algorithms and the accurate identification of impurities.

[0014] Further, it also includes performing preprocessing operations on the surface image, specifically: sequentially performing grayscale processing on the surface image; applying the Gaussian filtering algorithm for image smoothing to suppress noise; applying the Contrast Limited Adaptive Histogram Equalization (CLAHE) algorithm to enhance the local contrast of the image.

[0015] Further, the multi-dimensional feature vector contains at least one or more of the following categories of feature parameters: geometric feature parameters describing the region size and shape, grayscale or color feature parameters reflecting the region brightness and color information, and texture feature parameters characterizing the internal detail changes of the region.

[0016] By extracting comprehensive features covering multiple dimensions such as geometry, grayscale / color, and texture, the present invention can depict the impurity attributes more comprehensively and meticulously than methods that only rely on a single type of feature (such as only area or color), providing a rich information basis for subsequent accurate impurity determination and classification, and improving the ability to distinguish different types of impurities and impurities from artifacts. Further, determine and classify the potential impurity regions, including: matching the multi-dimensional feature vector of each extracted potential impurity region with a pre-constructed rule library containing multiple discriminant rules based on feature thresholds or logical combinations; or inputting the feature vector into a pre-trained machine learning classifier model to determine whether the region is a real impurity and further distinguish the specific categories of impurities.

[0017] Further, the step of outputting the detection result includes: generating a structured data report, which includes but is not limited to the total number of detected impurities, the number of various types of impurities, the position information of each impurity, the key dimension information, and the classification label; or generating real-time control instructions according to the determination result to drive the automated impurity removal device connected to the downstream station to perform corresponding removal actions.

[0018] The technical effects of the present invention are: The present invention proposes an improved watershed segmentation method to solve the problem of over-segmentation that is prone to occur in the background of loose cotton fibers. Its key innovation points are as follows: First, by analyzing the eigenvalues of the local structure tensor of the image, the local structure coherence reflecting the fiber arrangement directionality and structural consistency is quantitatively calculated; Second, based on the spatial stability of the local structure coherence in a larger neighborhood, an index for measuring the regional structure stability is derived; Finally, the regional structure stability is used to incorporate into the topographic map calculation formula of the watershed algorithm. This mechanism enables the topographic map to intelligently reflect the local structure characteristics, increases the segmentation difficulty in regions with stable structures (such as inside fiber bundles or impurities), and maintains sensitivity in regions with unstable structures (such as real boundaries), thereby effectively suppressing over-segmentation caused by background textures and significantly improving the accuracy and robustness of impurity segmentation. BRIEF DESCRIPTION OF THE DRAWINGS By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features, and advantages of the exemplary embodiments of the present invention will become readily understood. In the drawings, several embodiments of the present invention are shown by way of illustration and not limitation, and like or corresponding reference numerals indicate like or corresponding parts, wherein: Figure 1 is a flowchart of a fiber and impurity detection method based on machine vision according to an embodiment of the present invention; Figure 2 is a grayscale schematic diagram showing the preliminary opened cotton fibers evenly spread on a belt conveyor device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0019] Hereinafter, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0020] The following will describe in detail the specific embodiments of the present invention in conjunction with the accompanying drawings.

[0021] Embodiment of a fiber and impurity detection method based on machine vision: As Figure 1 shown, the fiber and impurity detection method based on machine vision of the present invention includes: S1. Obtain a loose cotton fiber image and perform preprocessing.

[0022] The goal of this step is to stably and clearly obtain a digital image sequence with sufficient information-carrying capacity that bears the loose cotton fiber flow to be detected, and to apply a series of necessary preprocessing operations to these original images, aiming to suppress noise and enhance the contrast between the target and the background, laying a solid foundation for subsequent high-precision impurity segmentation and feature extraction.

[0023] During specific implementation, first, arrange the stations for image information acquisition. Preferably, place the image acquisition device downstream of the cotton outlet of the opener or the bale breaker (for example, the A036 series multi-bin mixing bale breaker or the FA106 series single-axial flow opener). Immediately following is a belt conveyor device (for example, a standard conveyor belt with a width of 1000 mm or 1200 mm) that evenly spreads and conveys the preliminarily opened cotton fibers, as Figure 2 shown. At this station, the cotton fibers have been transformed from the state of tightly pressed raw cotton bales into a fluffy fiber layer or floc flow, and their movement speed on the conveyor belt is relatively controllable and stable. For example, the process speed can be set and maintained at about 15 ± 2 meters per minute.

[0024] Then, use one or more (to cover the full width) industrial-grade high-resolution area array digital cameras. For example, select a 5-megapixel CMOS camera with a global shutter, and its pixel size is about , ensuring sufficient spatial resolution to distinguish fine impurities. The camera is vertically installed at a predetermined height above the center line of the conveyor belt, so that its optical lens (for example, select a fixed-focus industrial lens with a focal length of 25 mm) can clearly focus on the surface of the moving fiber flow, and ensure that its field of view (FOV) effectively covers the main width of the cotton flow on the conveyor belt. To obtain high-quality images, an efficient and uniform lighting system must be configured.

[0025] In this embodiment, it is preferably to use a top-mounted high-brightness, large-area LED flat light source or a linear array light source (for example, using white LEDs with a color temperature of 6500K to ensure uniform and diffused illumination of not less than 5000 Lux within the entire FOV), so as to minimize shadows and make full use of the inherent differences in color and reflectivity between impurities and cotton fibers. The exposure time of the camera needs to be precisely set. For example, according to the material speed and the requirement of avoiding motion blur, it can be set to 100 to 200 microseconds. The frame acquisition rate is set according to the requirement of ensuring at least one complete imaging of any area on the conveyor belt. For example, it can be set to 10 to 15 frames per second. Precise triggering is carried out through an encoder signal synchronized with the conveyor belt drive system or an external photoelectric sensor to ensure the synchronization of image acquisition. The acquired original digital image frames (for example, the format can be 8-bit or 10-bit grayscale images, or 24-bit color images) are transmitted in real-time and losslessly to an industrial computer or an embedded vision processor serving as the core of image processing through an industrial Ethernet interface (such as the GigE Vision protocol) or a USB3.0 interface.

[0026] After obtaining the sequence of original image frames, the preprocessing process is immediately started. For problems such as sensor noise, light perturbation, and insufficient target contrast that may exist in the original images, the following operations are sequentially performed in this embodiment: If the acquired image is a color image, first perform grayscale processing. For example, the standard weighted average method can be used to convert it into a single-channel 8-bit grayscale image. Subsequently, to suppress random noise and smooth the image background texture, Gaussian filtering is used for convolution operation. For example, a Gaussian kernel function is selected, and its standard deviation can be set to the empirical value 1.2. This step can effectively filter out high-frequency noise while better retaining the edge contour information of impurity targets. Immediately afterwards, to improve the distinguishability between impurities and the cotton fiber background, especially for those "hidden" impurities with not very obvious color and brightness differences, the adaptive histogram equalization (CLAHE) technique is applied. When specifically implemented, the image can be divided into several non-overlapping rectangular sub-regions (for example, the grid size is set to pixels), and the gray histogram of each sub-region is independently calculated and equalized, and a contrast limit slope is set at the same time (for example, the Clip Limit parameter is set to 2.5) to prevent excessive amplification of local noise. Through CLAHE processing, the local contrast of the image is significantly enhanced, enabling subsequent segmentation algorithms to more effectively identify potential impurity targets.

[0027] The optimized image frame sequence generated after this series of preprocessing will be used as input data and passed to the next step for processing. The above preprocessing steps are well-known technologies and will not be elaborated here.

[0028] S2. quantify the local structural arrangement characteristics of the image and obtain the local structural coherence based on the structural tensor; obtain a second neighborhood window, and calculate the regional structural stability based on the local structural coherence of all pixels in the second neighborhood window; obtain an improved topographic map of the watershed based on the regional structural stability; complete the watershed transformation based on the improved topographic map; and identify potential impurity areas through the image after the watershed transformation to perform feature extraction.

[0029] The image preprocessed in step S1 is obtained, and an advanced image segmentation algorithm is used to accurately separate each independent impurity region from the complex, loose cotton fiber background with rich textures, and the characteristic parameters of the segmented impurity region are quantitatively extracted to provide a basis for subsequent impurity determination and classification. Considering that the impurities in this application scenario may have various shapes and sizes, and often have complex situations such as adhesion and interweaving with the fiber background, the present invention preferably uses the watershed transform algorithm as the basic segmentation framework. This algorithm has unique topological advantages in dealing with the separation of contact objects.

[0030] However, it is well known to those skilled in the art that the standard watershed algorithm has an inherent limitation when directly applied to images with significant texture features (such as the loose cotton fiber image in this embodiment), that is, it is very easy to produce over-segmentation. The fine and interlaced texture structure formed by loose cotton fibers will appear as a large number of local minima or subtle edge responses in the gradient domain or other "topographic maps" of the image. The standard watershed algorithm is very sensitive to these subtle changes, which often leads to the erroneous generation of a large number of redundant and fragmented segmented areas (i.e., the formation of too many "watershed lines") in the internal area of ​​a single impurity, or more commonly, in the pure cotton fiber background area. This over-segmentation phenomenon not only makes the real impurity boundary submerged in a large number of false boundaries, resulting in serious inaccuracy in the subsequent counting, size measurement, morphological analysis, etc. of impurities, but also greatly increases the complexity of data processing and reduces the overall performance and practicality of the detection system.

[0031] S2.1. Quantify the local structural arrangement characteristics of the image and obtain the local structural coherence based on the structure tensor.

[0032] Therefore, in this embodiment, the local structural characteristics of the image are analyzed to quantitatively distinguish the texture characteristics of the cotton fiber background and the structural characteristics inside the impurities, and then the analysis results are used to dynamically and adaptively correct the topographic map used by the watershed algorithm, as shown below.

[0033] First, extract and quantify the features that can reflect the local structural arrangement characteristics of the image. Considering that the cotton fibers after opening and cleaning often show a certain flow direction or bundle arrangement within a local range, with structural anisotropy, while most solid impurities are relatively uniform inside, showing isotropy or having a structural pattern very different from that of the fibers. In this embodiment, local structure coherence can be constructed to characterize the feature of whether there is a dominant direction structure in the local area of the image. By analyzing the pixel points the local structure coherence is obtained through the structure tensor within the neighborhood, specifically as follows: In this embodiment, a pixel window with a size of 7×7 is determined with the pixel point as the center , which can also be denoted as the first neighborhood window, and its structure tensor can be expressed as: ; where is the first-order partial derivative of the preprocessed image , which can be obtained through the Sobel operator in this embodiment. Then, for the matrix of the above structure tensor, it is necessary to satisfy: ; where represents the determinant of the calculated matrix; represents the identity matrix . By calculating this equation, two eigenvalues of the structure tensor and can be obtained, and there is . Then, the local structure coherence can be further calculated as: ; where represents the local structure coherence of the pixel point , and its normalized value range is [0,1]; and are the eigenvalues obtained by calculating within the neighborhood window of the structure tensor ; represents a very small positive number, used to avoid division-by-zero errors in flat areas with extremely small gradients, and a very low coherence benchmark is set, which can be set as the empirical value 1e-9 in this embodiment.

[0034] When is much larger than , it means that the gradient in a certain direction is much stronger than its orthogonal direction, corresponding to the area where the local fiber arrangement in the image is regular and has strong directionality. At this time ​Approaches 1. Conversely, when and are close, it indicates that the gradient is relatively evenly distributed in all directions (isotropic) or the gradient itself is very weak, corresponding to the interior of impurities, the region where fibers are randomly intertwined, or noise points. At this time, approaches 0. Therefore, the local structure coherence can effectively distinguish the image into regions with fiber flow characteristics and non-fiber structure regions.

[0035] S2.2. Obtain the second neighborhood window, calculate the regional structure stability based on the local structure coherence of all pixels within the second neighborhood window; obtain the improved topographic map of the watershed according to the regional structure stability.

[0036] Since the of a single pixel may be affected by noise. The true structural region (whether it is a stable fiber flow patch or a homogeneous interior of impurities) should exhibit the continuity and consistency of its internal value in space. On the contrary, in the structural transition zone (such as the edge of impurities, the junction of different texture regions), value will change significantly. Therefore, in this embodiment, the regional structure stability is further calculated to evaluate the degree of spatial variation within the local region.

[0037] Specifically, a larger neighborhood window can be determined with the pixel point as the center, and there is . In this embodiment, the size of the second neighborhood window can be set to . The calculation of the regional structure stability of the pixel point is specifically as follows: ; where represents the regional structure stability of the pixel point , and the value range is set in [0, 1]; represents the standard deviation of all local structure coherences calculated within the second neighborhood window ; represents the mean value of all local structure coherences calculated within the second neighborhood window ; represents a very small positive number used to avoid division by zero errors, and can be set to 1e - 8 in this embodiment.

[0038] This formula calculates within the second neighborhood window The coefficient of variation (the ratio of the standard deviation to its mean) within it, which reflects the relative fluctuation amplitude of the coherence value. Then subtract this coefficient of variation from 1 (and truncate at 0 or above) to obtain the stability index . When the values within the region are very consistent (whether inside a fiber bundle with continuously high coherence or inside an impurity with continuously low coherence), the standard deviation relative to the mean is very small, the coefficient of variation tends to 0, tends to 1, indicating a highly stable structure. When the region is in a structural transition zone, the values change drastically, the standard deviation is relatively large, the coefficient of variation increases, decreases and tends to 0, indicating an unstable structure.

[0039] The segmentation behavior of the watershed algorithm should be guided by the regional structural stability. In a region with highly stable structure (high ), the algorithm should be strongly inhibited to prevent internal segmentation; while in a region with unstable structure (low ), segmentation should be allowed or even encouraged. Then the topographic map of the final watershed algorithm is: ; where represents the height value of the point in the final topographic map after adaptive modulation for use in the improved watershed algorithm of the method of the present invention; represents the gradient magnitude of the preprocessed image at the pixel point ; represents the regional structural stability of the second neighborhood window centered on the pixel point .

[0040] When the pixel point is located in a region with highly stable structure (for example, inside a bundle of relatively neatly arranged cotton fibers or inside a large impurity with uniform internal material (such as a plastic sheet)), the value will approach 1. At this time, the modulation factor approaches 2. This means that even if there are some weak original gradients inside these regions (possibly caused by minute undulations on the fiber surface or minor flaws inside the impurity), their values in the improved topographic map will be significantly amplified (close to ). This artificially constructs higher "dams" or "ridges" within these structurally stable regions, making it difficult for the "flood" of the watershed algorithm to cross these elevated regions during its spread, thus greatly suppressing the generation of unnecessary over-segmentation lines within these regions.

[0041] When a pixel is located in a structurally unstable region (e.g., at the clear boundary between impurities and the cotton fiber background, or in a region where the fibers are disordered and the direction changes sharply), its value will approach 0. At this time, the modulation factor approaches 1. This means that the value of the improved topographic map in these regions will be approximately equal to the original gradient magnitude . Since these regions usually correspond to the real edges or structural transition zones in the image, and their original gradients are relatively large themselves, therefore will also remain at a relatively large value. This ensures that the watershed algorithm can maintain sensitivity to real boundaries and is more likely to form correct segmentation lines at these places where the gradients are significant and the structures are unstable.

[0042] S2.3. Complete the watershed transformation based on the improved topographic map; and identify potential impurity regions through the image after the watershed transformation for feature extraction.

[0043] After constructing the improved topographic map , the standard process of the marker-based watershed algorithm can be continued: (a) Foreground / background marker generation: Use methods such as distance transformation combined with threshold processing to automatically identify the determined foreground region (representing the impurity core) and the determined background region (representing the pure fiber region) on the preprocessed image, and generate a marker image. For example, the foreground marker can be obtained by eroding the initial binary image (obtained by Otsu or adaptive thresholding method), and then calculating the distance transformation map and thresholding to obtain the background marker.

[0044] (b) Perform the watershed transformation: Call the standard watershed algorithm implementation, but use the improved topographic map constructed in the present invention and the above-generated marker image as inputs.

[0045] (c) Impurity Region Identification and Feature Extraction: The watershed algorithm outputs a labeled image that marks each segmented region. Based on the initial labeling information, the segmented regions formed by the foreground label expansion, which represent potential impurities, are screened out. Subsequently, for each identified potential impurity region, a series of discriminative feature parameters are systematically calculated. These parameters can include: geometric features (such as pixel area, perimeter, minimum bounding rectangle parameters (center coordinates, length, width, rotation angle), equivalent diameter, circularity, aspect ratio, solidity / density, Hu invariant moment set); gray / color features (such as average gray value within the region, standard deviation of gray value, median gray value, average gray difference from the background region; for color images, the average R / G / B values, component means in the Lab or HSV color space, color difference from the background ); Correlation features of the gray-level co-occurrence matrix (GLCM) can also be calculated, such as energy, contrast, correlation, entropy, etc.). These features will form a multi-dimensional feature vector to characterize the attributes of each potential impurity.

[0046] S3. Make a determination based on the impurity features extracted in step S2 and complete impurity removal.

[0047] In this embodiment, the multi-dimensional feature vector extracted in step S2 is used to intelligently determine each segmented candidate impurity region to distinguish real impurity targets that need attention from possible pseudo-targets (such as slubs and neps formed by cotton fibers themselves, or image noise residues), and the confirmed impurities can be classified according to preset rules or models. Finally, the detection results are output in a structured form to serve the quality monitoring and control of the production process.

[0048] Specifically, the final determination of impurities can be assisted by a pre-constructed criterion system. This system can be a set of expert rules (Rule-based System) established based on domain knowledge and a large amount of experimental data, or a classifier model trained by machine learning methods (such as support vector machine SVM, random forest Random Forest, or simple threshold logic network). In this embodiment, the rule base method is used as an example for illustration. The rule base contains a series of discriminant rules for different impurity types or general impurity attributes, which are logical combinations of the feature parameters extracted in step S2. Exemplary illustration: Initial filtering rules: First, size filtering can be applied. For example, "Any candidate region with an area less than 30 square pixels is regarded as a possible noise point or insignificant micro-defect and is filtered out"; at the same time, "Regions with an area greater than 15,000 square pixels may be large foreign objects or equipment stains, triggering a special alarm and not included in the regular impurity statistics."

[0049] Typical impurity determination rules: Criterion for cottonseed hull impurities: "The candidate region satisfies: the area is between 100 and 1200 square pixels, the circularity is less than 0.6, the solidity is between 0.7 and 0.95, and the average gray value is more than 40 gray levels lower than the average gray of the adjacent background region".

[0050] Criterion for colored foreign fibers (such as PP filaments): "The candidate region satisfies: the aspect ratio is greater than 8.0, the area is greater than 80 square pixels, and the color difference in the Lab color space from the average cotton fiber chromaticity center is greater than 30".

[0051] Criterion for transparent or semi-transparent plastic films: "The candidate region satisfies: the shape is extremely irregular (e.g., measurable by contour complexity or fractal dimension), the standard deviation of gray level is significantly lower than that of the background region, and may be accompanied by specific reflection or transmission characteristics".

[0052] The feature vectors of each candidate impurity region that passes the preliminary filtering are sent one by one to the rule library for matching and evaluation. If the logical conditions of one or several preset rules are met, the region is confirmed as a real impurity and can be assigned the corresponding category label (such as "cottonseed hull", "foreign fiber", "plastic", etc.).

[0053] Finally, the system summarizes, statistics and formats the output of all confirmed impurity information during the current detection period (e.g., corresponding to a certain length of cotton flow or a certain time period). The output results may include but are not limited to: the total number of impurities detected in the current batch or time period, the quantity distribution of various impurities, the precise position coordinates of each impurity (e.g., relative to the center line and starting point of the conveyor belt coordinates), key dimension parameters (such as maximum length, area), confidence score (if a probabilistic classifier is used), and category label. These structured detection results can be presented in real time on the human-machine interface (HMI) for production management personnel to conduct online quality tracking and evaluation.

[0054] More critically, these high-precision detection results (especially the position information of impurities) can be seamlessly integrated into the automated control system to drive the downstream online impurity removal actuators. For example, the system can precisely control an array of air nozzles driven by a group of high-speed solenoid valves according to the detected impurity coordinates, and instantaneously eject strong air currents to blow the impurities away from the main cotton flow when the impurities reach the removal station; or, guide a small industrial robot arm to perform precise grasping and removal.

[0055] In summary, the present invention provides a practical method for efficient and accurate impurity detection of loose cotton fibers in the opening and cleaning process of cotton spinning, which has significant technical value and application prospects for improving the utilization rate of raw cotton and stabilizing and improving the quality of yarns.

Claims

1. A fiber impurity detection method based on machine vision, characterized in that The method includes: Collecting a surface image of a loose cotton fiber stream; performing impurity segmentation and feature extraction on the surface image based on an improved watershed transformation, where the improved watershed transformation includes: Calculating local structural coherence based on the structure tensor of the first neighborhood window of each pixel point in the surface image. In response to the sum of the two eigenvalues of the structure tensor being greater than a set value, setting the local structural coherence to be positively correlated with the difference between the two eigenvalues of the structure tensor and positively correlated with the sum of the two eigenvalues of the structure tensor; in response to the sum of the two eigenvalues of the structure tensor being less than or equal to the set value, setting the local structural coherence to 0; Obtaining the regional structural stability of each pixel point according to the spatial distribution consistency of the local structural coherence within the second neighborhood window; the product of the regional structural stability and the gradient magnitude of the surface image constitutes an improved topographic map; performing a watershed transformation on the improved topographic map to obtain a set of segmented regions of the image; Identifying the regions corresponding to potential impurities in the set of segmented regions, and extracting multi-dimensional feature vectors of the potential impurity regions; based on the multi-dimensional feature vectors, determining and classifying the potential impurity regions, distinguishing real impurities from background artifacts, and outputting a detection result.

2. The method for detecting fiber impurities based on machine vision according to claim 1, wherein The specific calculation method of the local structural coherence is: ; in Represents pixel The local structural coherence of and The structure tensor exist The first neighbor window The eigenvalues ​​obtained by internal calculation; represents a very small positive number; the structure tensor is ;in The first-order partial derivative of the image after being processed by the Sobel operator.

3. The method for detecting fiber impurities based on machine vision according to claim 2, characterized in that The specific calculation method of the regional structural stability is: ; in Represents pixel The stability of regional structures; Indicates in the second neighborhood window The standard deviation of the coherence of all local structures within; Represents the second neighborhood window The mean of all local structural coherences within ; Represents a very small positive number.

4. The method for detecting fiber impurities based on machine vision according to claim 3, wherein, The specific calculation method of the improved topographic map is: ; wherein represents the improved topographic map; represents the gradient magnitude of the surface image at the pixel point ; represents the regional structure stability of the second neighborhood window centered at the pixel point .

5. The method for detecting fiber impurities based on machine vision according to claim 1, characterized in that Before performing the watershed transformation on the improved topographic map, it also includes: Performing preliminary binarization on the preprocessed image; Determining a foreground marker representing the impurity region and a background marker representing the pure background region by performing a distance transformation on the binarized image and combining threshold segmentation.

6. The fiber impurity detection method based on machine vision according to claim 1, characterized in that Collecting a surface image of a loose cotton fiber stream, including: Above the conveying device of the opening and cleaning cotton equipment, using a line array industrial digital camera to vertically photograph the downward moving loose cotton fiber stream; And configuring an overhead LED light source to provide uniform illumination.

7. The method for detecting fiber impurities based on machine vision according to claim 6, characterized in that, It also includes performing preprocessing operations on the surface image, specifically: Successively performing grayscale processing on the surface image; Applying a Gaussian filtering algorithm for image smoothing to suppress noise; Applying an adaptive histogram equalization (CLAHE) algorithm to enhance the local contrast of the image.

8. The method for detecting fiber impurities based on machine vision according to claim 1, characterized in that, The multi-dimensional feature vector includes at least one or more of the following categories of feature parameters: Geometric feature parameters describing the region size and shape, gray-scale or color feature parameters reflecting the region brightness and color information, and texture feature parameters characterizing the internal detail changes of the region.

9. The method for detecting fiber impurities based on machine vision according to claim 8, wherein, Determining and classifying the potential impurity regions includes: Matching the multi-dimensional feature vector of each extracted potential impurity region with a pre-constructed rule library containing multiple discriminant rules based on feature thresholds or logical combinations; Alternatively, inputting the feature vector into a pre-trained machine learning classifier model to determine whether the region is a real impurity and further distinguish the specific categories of impurities.

10. The method for detecting fiber impurities based on machine vision according to claim 9, wherein The step of outputting the detection result includes: Generating a structured data report, which includes but is not limited to the total number of detected impurities, the number of impurities of various categories, the position information of each impurity, key dimension information, and classification labels; Or generate real-time control instructions according to the determination result to drive the automated impurity removal device connected to the downstream station to perform corresponding removal actions.

Citation Information

Cited By

  • Flour impurity screening method and system based on image processing

    CN121391882A

  • A flour impurity screening method and system based on image processing

    CN121391882B