Rapid woven bag defect detection method
By employing an adaptive optimal three-father crossover genetic algorithm and image preprocessing techniques, the real-time and adaptive issues in woven bag detection were resolved, enabling rapid and accurate detection of defects in woven bags and improving detection performance and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WENZHOU RUNFA PACKAGING CO LTD
- Filing Date
- 2026-01-31
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies for defect detection in woven bags suffer from real-time bottlenecks, insufficient accuracy and robustness, and a lack of adaptability, making it difficult to meet the real-time requirements of high-speed production lines and adaptability to different materials, weights, and weaving densities.
An adaptive optimal three-father crossover genetic algorithm (AOTPX-GA) is used to optimize the image segmentation threshold. Combined with texture suppression and defect enhancement preprocessing, histogram compression and integral map technology, fast calculation and multi-scale connected component analysis are performed to achieve automatic classification and identification of defects in woven bags.
It enables rapid and accurate detection of defects in woven bags, improves detection performance, supports adaptability to different materials and production line illumination fluctuations, reduces computational complexity, and improves detection efficiency.
Smart Images

Figure CN122023348A_ABST
Abstract
Description
Technical Field
[0001] This invention patent relates to the field of industrial machine vision inspection technology, specifically to an image segmentation and recognition method for surface defects of flexible packaging materials such as woven bags and paper-plastic composite bags. Background Technology
[0002] Woven bags are an important packaging material in the chemical, building materials, and agricultural industries, with an annual output of over 50 billion bags. However, the quality inspection of woven bags still relies on manual visual inspection, which has problems such as high subjectivity, low efficiency, and lack of data traceability.
[0003] While industrial machine vision inspection has been extensively studied, existing image segmentation techniques are insufficient to meet practical needs. For example, the two-dimensional maximum entropy thresholding method requires traversing 65,536 combinations, and a single calculation often takes more than 30 seconds, making it unsuitable for the real-time requirements of high-speed production lines. Although improved genetic algorithms perform well on standard test images, their auxiliary individual generation mechanism consumes resources, the crossover probability is fixed, and the interference of the periodic texture of woven bags (typically 8-12 pixels) is not considered, resulting in a low detection rate of filament defects and insufficient recognition ability for slender filament defects (aspect ratio > 8 and area < 1%). While deep learning methods perform well in general scenarios, their fixed crossover probability and segmented mutation strategy lack adaptability, causing wrinkle defects to be judged as background due to their large area. In addition, the model needs to be retrained for woven bags of different materials (PP, PE, paper-plastic composite), weights, and weaving densities, resulting in high engineering costs.
[0004] The shortcomings of existing technologies are mainly concentrated in the aspects of real-time bottleneck, insufficient accuracy and robustness, and lack of adaptability. How to achieve real-time defect detection of woven bags, improve detection performance, and other key aspects are the key issues. Summary of the Invention
[0005] To overcome the shortcomings of existing technologies, this invention proposes a rapid detection method for defects in woven bags, which includes the following steps: Step 1: Perform texture suppression and defect enhancement preprocessing on the acquired woven bag image to obtain the enhanced image.
[0006] Step 2: The Adaptive Optimal Three-Father Crossover Genetic Algorithm (AOTPX-GA) is used to optimize the image segmentation threshold, obtaining the optimal threshold for two-dimensional maximum entropy segmentation. .
[0007] Step 3: Utilize histogram compression and integral image to quickly calculate the two-dimensional maximum entropy, and then segment using the optimal threshold to obtain a binary image. .
[0008] Step 4, process the binary image Perform multi-scale connected component analysis, and extract feature vectors based on the results of the connected component analysis for defect classification and identification.
[0009] Step 1 specifically includes the following sub-steps: Step 11, first process the original grayscale image I raw Morphological opening operations are performed using a 3×3 square structuring element SE, which is first eroded and then expanded. Step 12: Construct an adaptive window mean filter to estimate the background texture, where the adaptive window k is dynamically calculated based on the image resolution DPI. Step 13: Calculate the local mean based on the adaptive window size described above. ; Step 14: After obtaining the background texture, the background texture is removed by calculating the difference between the opening operation image and the mean image, and a texture suppression coefficient is introduced. and brightness compensation The formula is: ; Step 15: Output the enhanced image by performing a double-threshold linear transformation on the difference image. This further widens the gap between the defects and the background.
[0010] Step 2 specifically includes the following sub-steps: Step 21, Population Initialization: Based on the continuity of the production line video stream, the optimal threshold of the previous frame is set... As elite individuals, they are injected into the current population, and Gaussian perturbations are added to avoid local optima; Step 22, fitness function design, introducing a defect type-aware factor. The fitness of an individual is calculated as follows: ; In the formula, The entropy value of the foreground. Entropy value as background; , These represent the pixel percentages of the foreground and background, respectively. For indicator functions, when hour, If the value is 1, small target compensation is triggered; otherwise... If the value is 0, the entropy value is calculated normally. This fitness function retains the segmentation advantage of the two-dimensional maximum entropy, while avoiding the problem of small-scale defects such as streaks being "diluted" by the background through a small target compensation mechanism.
[0011] Step 23, Dynamic crossover probability design, using dynamically adjusted crossover probabilities. Perform genetic iteration. With iterative algebra and historical feedback The changes are as follows: ; in, These are the weighting coefficients; This represents the maximum number of iterations.
[0012] Step 24, the three-father crossover and dynamic mutation mechanism, utilizes the elite parent X, the guiding parent Z, and the exploratory parent Y to generate offspring, specifically as follows: ; in, To explore step length, This is a disturbance term.
[0013] Mutation probability A sinusoidal oscillation strategy related to iterative algebra is adopted, while incorporating historical feedback. The adjustments are as follows: ; in, The weighting coefficients are used; this strategy causes the mutation probability to fluctuate periodically during the iteration process, while when When the value is low, increase the mutation probability to avoid the algorithm getting trapped in local optima.
[0014] Step 25, Iteration termination condition: When the fitness difference of the best individuals for 5 consecutive generations is less than the preset error, or the number of iterations reaches... When the threshold value reaches 100, the iteration terminates, and the current optimal threshold pair is output. ).
[0015] Compared with existing technologies, the present invention has the following advantages: 1) An adaptive multi-parent genetic algorithm (AOTPX-GA) is provided, which introduces a defect type awareness factor and a dynamic parameter scheduling mechanism to achieve a fast and stable search for the optimal threshold of defect images of woven bags.
[0016] 2) Improve the auxiliary individual generation of the original AITPX operator to direct guidance by the optimal individual, and establish a system based on the iterative algebra G and historical segmentation quality. Dynamic crossover probability model (G, This enables adaptive parameter scheduling. 3) Introduce a defect region strengthening coefficient λ into the two-dimensional maximum entropy function, and use an indicator function... Dynamic activation solves the problem of missed detection of small-area defects (accounting for less than 5%); 4) The 256×256 histogram is compressed to 64×64. Combined with CUDA parallelism and integral graph techniques, the computational complexity of a single fitness iteration is reduced from O(L...). 2 The computational complexity is reduced to O(1), a reduction of 93.75%.
[0017] 5) Design a multi-scale connected domain analysis engine, establish a defect geometric feature library, and support automatic classification and recognition of five types of defects: holes, wire drawing, small wire drawing, missing needles, and wrinkles, greatly improving the classification accuracy. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This invention provides a schematic flowchart of a rapid detection method for defects in woven bags. Figure 2 This is a schematic diagram of the preprocessing process for the present invention; Figure 3 This is a schematic diagram showing the results of preprocessing in this invention; Figure 4 This is a schematic diagram of the optimization process of the adaptive optimal three-father crossover genetic algorithm AOTPX-GA of the present invention; Figure 5 This is a schematic diagram of the optimization operation of the adaptive optimal three-father crossover genetic algorithm AOTPX-GA of the present invention; Figure 6 The figure shows the experimental results of woven bag testing using the detection method proposed in this invention. Detailed Implementation
[0020] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.
[0021] The present invention will now be described in further detail with reference to the accompanying drawings.
[0022] like Figure 1 As shown, this invention proposes a rapid detection method for defects in woven bags, which includes the following steps: Step 1: Perform texture suppression and defect enhancement preprocessing on the acquired woven bag image to obtain the enhanced image.
[0023] In the original woven bag image, the strong periodic texture formed by the warp and weft threads can severely obscure minor defects such as holes and fraying. Meanwhile, sensor noise and ambient light interference are inevitably introduced during image acquisition. Therefore, preprocessing is the primary prerequisite for ensuring detection accuracy. This step achieves the dual goals of interference suppression and defect enhancement through a progressive operation of "morphological denoising - adaptive background estimation - texture difference elimination - threshold enhancement".
[0024] like Figure 2 As shown, step 1 includes the following sub-steps: Step 11, first process the original grayscale image I raw Morphological opening is performed using a 3×3 square structuring element SE, which is first eroded and then dilated. The specific calculation method is as follows: ; This step can effectively eliminate isolated noise and burrs with an area smaller than 10 pixels.
[0025] Step 12: Construct an adaptive window mean filter to estimate the background texture. The adaptive window k is dynamically calculated based on the image resolution DPI. The specific calculation method is as follows: ; Step 13: Calculate the local mean based on the adaptive window size described above. , ; Step 14: After obtaining the background texture, the background texture is removed by calculating the difference between the opening operation image and the mean image, and a texture suppression coefficient is introduced. (1.2-1.8) and brightness compensation (10-20), the formula is: ; Step 15: Output the enhanced image by performing a double-threshold linear transformation on the difference image. This further widens the gap between the defects and the background.
[0026] ; Figure 3 A schematic diagram of the experimental results for performing the above preprocessing procedure.
[0027] Step 2: The Adaptive Optimal Three-Father Crossover Genetic Algorithm (AOTPX-GA) is used to optimize the image segmentation threshold, obtaining the optimal threshold for two-dimensional maximum entropy segmentation. .
[0028] Enhanced image after preprocessing Although defect identification accuracy has been significantly improved, material differences between different batches of woven bags and fluctuations in production line lighting can still cause variations in the grayscale distribution of defects and the background. Fixed threshold segmentation is prone to undersegmentation (missed defect detection) or oversegmentation (false background detection). Therefore, this step uses an improved genetic algorithm (AOTPX-GA) to adaptively optimize the two-dimensional maximum entropy segmentation threshold (s,t). The global search capability of the genetic algorithm is used to find the optimal threshold pair, ensuring the stability and accuracy of segmentation. Since the production line video stream is continuous, the difference in defect distribution and grayscale features between adjacent frames is small. Therefore, an inter-frame elite inheritance mechanism is introduced to improve optimization efficiency, such as... Figure 4 , 5 As shown, the specific steps are as follows: Step 21, Population Initialization: Based on the continuity of the production line video stream, the optimal threshold of the previous frame is set... As an elite individual injected into the current population, and with the addition of Gaussian perturbation to avoid local optima, the formula is: .
[0029] In the formula, For Gaussian perturbation, The standard deviation of the Gaussian perturbation ensures that the fine-tuning range of elite individuals is reasonable, which can both retain historical optimal information and have the ability to explore new thresholds.
[0030] Step 22, fitness function design, introducing a defect type-aware factor. The fitness of an individual is calculated as follows: ; In the formula, The entropy value of the foreground. Entropy value as background; , These represent the pixel percentages of the foreground and background, respectively. For indicator functions, when hour, If the value is 1, small target compensation is triggered; otherwise... If the value is 0, the entropy value is calculated normally. This fitness function retains the segmentation advantage of the two-dimensional maximum entropy, while avoiding the problem of small-scale defects such as streaks being "diluted" by the background through a small target compensation mechanism.
[0031] Step 23, Dynamic crossover probability design, using dynamically adjusted crossover probabilities. Perform genetic iteration. With iterative algebra and historical feedback The changes are as follows: ; in, These are the weighting coefficients; This represents the maximum number of iterations.
[0032] Step 24, the three-father crossover and dynamic mutation mechanism, utilizes the elite parent X, the guiding parent Z, and the exploratory parent Y to generate offspring, specifically as follows: ; in, To explore step length, This is a disturbance term.
[0033] Mutation probability A sinusoidal oscillation strategy related to iterative algebra is adopted, while incorporating historical feedback. The adjustments are as follows: ; in, The weighting coefficients are used; this strategy causes the mutation probability to fluctuate periodically during the iteration process, while when When the value is low, increase the mutation probability to avoid the algorithm getting trapped in local optima.
[0034] Step 25, Iteration termination condition: When the fitness difference of the best individuals for 5 consecutive generations is less than the preset error, or the number of iterations reaches... When the threshold value reaches 100, the iteration terminates, and the current optimal threshold pair is output. Through the above optimization process, the image grayscale changes under different working conditions can be adapted to provide accurate threshold parameters for subsequent rapid segmentation.
[0035] Step 3: Utilize histogram compression and integral image to quickly calculate the two-dimensional maximum entropy, and then segment using the optimal threshold to obtain a binary image. .
[0036] Traditional two-dimensional maximum entropy calculation requires traversing a 256×256 grayscale space, resulting in an extremely large computational load, which is difficult to meet the real-time requirements of high-speed production lines. Combined with the optimal threshold output in step 2 ( This step introduces histogram compression technology and integral image acceleration strategy to significantly reduce computational complexity while ensuring segmentation accuracy, as detailed below.
[0037] Step 31, Calculate the enhanced image The grayscale histogram H is obtained, and then compressed to obtain... .
[0038] Since the gray values of the preprocessed image are mainly concentrated in the range [0, 255], and the probability distribution of adjacent gray levels is continuous, an equal-interval compression strategy is adopted to compress the original 256×256 histogram into a simplified 64×64 histogram. , the compression formula is: ; This compression operation reduces the threshold search space from 65,536 (256×256) to 4,096 (64×64), shrinking the search space by 93.75%, and significantly reducing the amount of entropy value calculation in the fitness calculation process.
[0039] Step 32, construct an integral image to accelerate local summation operations; To further improve the calculation speed of the entropy value in the fitness function 、 of, construct an integral image to accelerate local summation operations. First, for the compressed 64×64 simplified histogram , construct a two-dimensional integral image , where the value of each pixel point on the integral image represents the sum of the probabilities of all pixels in the rectangular area from the upper left corner (0,0) to the current point (i,j) in, that is, the sum of the ratios of the number of pixels corresponding to all gray levels in this area; secondly, when calculating the entropy value by two-dimensional maximum entropy, the core requirement is to obtain the sum of probabilities in the gray level intervals corresponding to the foreground (defects) and the background respectively. The traditional method needs to traverse all pixels in the corresponding interval and sum them one by one, with a time complexity of O(k 2 ); while through the integral image, the property of "sum of probabilities of rectangular area = integral value at the lower right corner - integral value of the related area at the upper left corner" can be used to quickly solve the sum of probabilities of any gray level interval, reducing the calculation time to O(1); finally, based on the quickly obtained foreground and background probability sums, substitute them into the entropy value calculation formula (H = -ΣP·logP, where P is the probability ratio of each gray level) to complete the calculation of the foreground entropy and the background entropy ; this strategy combined with histogram compression technology significantly reduces the complexity of fitness calculation.
[0040] Step 33, perform binary segmentation on the enhanced image using the optimal threshold (s,t) of two-dimensional maximum entropy segmentation, and output a binary image .
[0041] Specifically, when ≤s, it is determined as the background (assigned 0, black); when (x,y)≥t, it is determined as a defect (assigned 255, white); when s< <t, make a supplementary determination according to the probability distribution of the compressed histogram, and preferentially match the probability ratios of the foreground / background; finally, output the binary image , effectively separating the defect area from the background, and providing a clear target area for subsequent connected component analysis.
[0042] Step 4, process the binary image Perform multi-scale connected component analysis, and extract feature vectors based on the results of the connected component analysis for defect classification and identification.
[0043] The binary image I_binary contains defect regions and a small amount of residual background noise. This step extracts the effective defect regions through connected component analysis, and combines multi-dimensional feature vectors with a machine learning classifier to achieve accurate classification and quantification of defects. Specifically, it includes the following sub-steps: Step 41, Connected Component Extraction and Initial Screening: Connected components in the binary image are extracted using a two-scan method. During the first scan, each foreground pixel (grayscale value 255) is assigned a temporary label, and the label association relationship between adjacent pixels is recorded. During the second scan, duplicate labels are merged according to the association relationship to obtain the final connected component label map. This method completes the connected component labeling by traversing the image twice, which has the advantages of high computational efficiency and small memory usage.
[0044] Initial screening is conducted based on the geometric features of common defects in woven bags. These rules include: ① Holes and leaks: minimum area ≥ 50 pixels; ② Strands: minimum area ≥ 100 pixels and aspect ratio ≥ 8; ③ Wrinkles: minimum area ≥ 500 pixels, etc. This initial screening eliminates over 90% of residual noise, retaining only suspected defective connected components, thus reducing the computational load for subsequent feature extraction and classification.
[0045] Step 42, multi-dimensional feature extraction; for each connected component that passes the initial screening, extract an N-dimensional feature vector, covering two core features: geometric shape features and texture features, to ensure the ability to distinguish different types of defects; Geometric features include: area, perimeter, roundness, aspect ratio, eccentricity, principal axis direction, and 7 Hu invariant moments; Texture features include: contrast, energy, entropy, correlation, and inverse difference moment extracted based on the gray-level co-occurrence matrix (GLCM), and uniformity, variance, and peak value extracted based on the local binary pattern (LBP).
[0046] Normalize all features to eliminate the dimensional differences between different feature dimensions and improve the training and recognition efficiency of the classifier.
[0047] Step 43, Defect Classification and Quantization Output: Input the normalized feature vector into the RBF kernel support vector machine (SVM) classifier to identify various defects in the woven bag.
[0048] The SVM was trained by collecting 10,000 images of woven bags containing different defect types. After preprocessing, segmentation, and connected component extraction, the N-dimensional feature vectors of each defect were extracted to construct a training set (8,000 samples) and a test set (2,000 samples). The kernel parameters of the SVM were optimized using a grid search method (γ=0.1, penalty coefficient C=10). The test accuracy of the classifier after training was ≥98.5%.
[0049] Final output: For each detected defect, three core pieces of information are output: ① Defect type (hole / missing needle / fraying / wrinkle); ② Defect location (centroid coordinates (x, y), converted to actual location on the production line based on image pixel coordinates); ③ Classification confidence level (0-1 range, a confidence level ≥ 0.95 indicates a valid defect). When a valid defect is detected, the system immediately triggers an alarm signal (audible and visual alarm) and outputs a rejection signal to the production line control system, achieving real-time separation of defective products.
[0050] The test results on the self-built woven bag defect dataset (10,000 images, 5 defect categories) are shown in the table below or as follows: Figure 6 As shown: Table 1 Comparison of Defect Detection Methods
[0051] Especially for wire drawing defects (2-3 pixels wide), the signal-to-noise ratio is improved by 8.7dB through directional differential enhancement, and the detection rate jumps from 72% to 98.2%.
[0052] Illumination adaptability: Within the illuminance range of 500-1500 Lux, the IoU fluctuation is <3% and the detection rate fluctuation is <2%, which is automatically compensated through grayscale normalization and histogram equalization.
[0053] Raw material compatibility: Supports various materials such as PP, PE, and paper-plastic composites, and is suitable for different basis weights (60-120g / m³). 2 Woven bags with weave density (8×8 to 12×12 threads / inch) and parameters adaptively adjusted without manual intervention.
[0054] This invention reduces single-frame processing time from 0.6-1.2 seconds to 0.326 seconds. On a dataset of 10,000 images, the IoU for hole defects improved from 0.899 to 0.978 (99.5% detection rate), for fraying IoU from 0.807 to 0.986 (98.2% detection rate), for small fraying IoU from 0.914 to 0.963 (97.8% detection rate), for missing needles IoU from 0.713 to 0.899 (96.5% detection rate), and for wrinkles IoU from 0.745 to 0.957 (95.3% detection rate). The average IoU improved by 17.3% to 0.957, with a detection rate of 97.5%. Particularly for 2-3 pixel wide fraying, the signal-to-noise ratio improved by 8.7 dB, and the detection rate jumped from 72% to 98.2%. IoU fluctuation is less than 3% within the illuminance range of 500-1500 Lux, supporting 60-120 g / m². 2 Weight and density of 8×12 threads / inch are adaptive.
[0055] It should also be noted that, in this specification, terms such as "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0056] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0057] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.
[0058] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A rapid detection method for defects in woven bags, characterized in that, The method includes the following steps: Step 1: Perform texture suppression and defect enhancement preprocessing on the acquired woven bag images to obtain the enhanced images; Step 2: The Adaptive Optimal Three-Father Crossover Genetic Algorithm (AOTPX-GA) is used to optimize the image segmentation threshold, obtaining the optimal threshold for two-dimensional maximum entropy segmentation. ; Step 3: Utilize histogram compression and integral plotting to quickly calculate the two-dimensional maximum entropy, and then apply the optimal threshold. Segmentation is performed to obtain a binary image. ; Step 4, process the binary image Perform multi-scale connected component analysis, and extract feature vectors based on the results of the connected component analysis for defect classification and identification.
2. In the rapid defect detection method for woven bags according to claim 1, during the optimization process in step 2, a defect type-aware factor is introduced into the fitness function. The individual fitness is calculated as follows: ; In the formula, The entropy value of the foreground. Entropy value as background; , These represent the pixel percentages of the foreground and background, respectively. For indicator functions, when hour, If the value is 1, small target compensation is triggered; otherwise... If it is 0, the entropy value is calculated normally.
3. The rapid detection method for defects in woven bags according to claim 1, wherein in the optimization process of step 2, a dynamically adjusted cross probability is adopted. Perform genetic iteration. With iterative algebra and historical feedback The changes are as follows: ; in, These are the weighting coefficients; This represents the maximum number of iterations. Offspring are generated using elite parent X, guiding parent Z, and exploratory parent Y, specifically as follows: ; in, To explore step length, This is a disturbance term.
4. The rapid detection method for defects in woven bags according to claim 1, in the optimization process of step 2, Mutation probability A sinusoidal oscillation strategy related to iterative algebra is adopted, while incorporating historical feedback. The adjustments are as follows: ; in, The weighting coefficients are used; this strategy causes the mutation probability to fluctuate periodically during the iteration process, while when When the value is low, increase the mutation probability to avoid the algorithm getting trapped in local optima.
5. The rapid detection method for defects in woven bags according to claim 1, wherein step 1 specifically includes the following sub-steps: Step 11, first process the original grayscale image I raw Morphological opening operations are performed using a 3×3 square structuring element SE, which is first eroded and then expanded. Step 12: Construct an adaptive window mean filter to estimate the background texture, where the adaptive window k is dynamically calculated based on the image resolution DPI. Step 13: Calculate the local mean based on the adaptive window size described above. ; Step 14: After obtaining the background texture, the background texture is removed by calculating the difference between the opening operation image and the mean image, and a texture suppression coefficient is introduced. and brightness compensation The formula is: ; Step 15: Output the enhanced image by performing a double-threshold linear transformation on the difference image. This further widens the gap between the defects and the background.
6. The rapid detection method for defects in woven bags according to claim 1, wherein step 3 specifically includes the following sub-steps: Step 31, Calculate the enhanced image The grayscale histogram H is obtained, and then compressed to obtain... ; Step 32: Construct an integral image to accelerate local summation operations; first, for the compressed simplified histogram... Constructing a two-dimensional integral graph Each pixel on the integral image The value represents First, the probability sum of all pixels within the rectangular region formed by the top-left corner (0,0) to the current point (i,j) is calculated, which is the sum of the proportions of pixels corresponding to each gray level within this region. Second, using the property that "the sum of probabilities of a rectangular region = the integral value of the bottom-right corner - the integral value of the relevant region at the top-left corner", the probability sum of any gray level interval is calculated. Finally, based on the obtained foreground and background probability sums, they are substituted into the entropy calculation formula H = -ΣP·logP, where P is the probability proportion of each gray level, to complete the foreground entropy calculation. and background entropy Calculation; Step 33: Enhance the image using the optimal threshold (s,t) for two-dimensional maximum entropy segmentation. Perform binary segmentation and output a binary image. .
7. The rapid detection method for defects in woven bags according to claim 6, wherein the compression specifically comprises: 。 8. The rapid detection method for defects in woven bags according to claim 6, wherein step 33 specifically comprises: when ≤ When it is determined to be the background, it is assigned a value of 0, which is black; when (x,y)≥ When it is determined to be a defect, a value of 255 is assigned, and it is white; when < < At that time, based on the probability distribution of the compressed histogram, further determination is made, prioritizing the matching of foreground / background probability ratios; the final output is a binary image. .
9. The rapid detection method for defects in woven bags according to claim 1, wherein step 4 specifically includes the following steps: Step 41, Connected Component Extraction and Initial Screening: Connected components in the binary image are extracted using a two-scan method; Step 42, multi-dimensional feature extraction; For each connected component that passes the initial screening, extract an N-dimensional feature vector; Step 43, Defect Classification and Quantization Output: Input the normalized feature vector into the RBF kernel support vector machine classifier to identify various defects in the woven bags.
10. The rapid detection method for defects in woven bags according to claim 9, wherein the multidimensional features include two core features: geometric shape features and texture features; Geometric features include: area, perimeter, roundness, aspect ratio, eccentricity, principal axis direction, and 7 Hu invariant moments; Texture features include: contrast, energy, entropy, correlation, and inverse difference moment extracted based on the gray-level co-occurrence matrix, and uniformity, variance, and peak value extracted based on local binary patterns.