A method for detecting appearance defects of cigarette packet transparent paper based on machine vision

CN122736992APending Publication Date: 2026-09-11CHINA TOBACCO SHAANXI IND
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610843475.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-11
Publication Date
2026-09-11

AI Technical Summary

Technical Problem

[0004]为了解决相关技术中,依赖折线的长度和角度等几何特征对烟包的缺陷特征进行识别,导致烟包缺陷的误检率较高的技术问题,本申请提供一种基于机器视觉的烟包透明纸外观缺陷检测方法

Benefits of technology

通过工业相机获取多个光照角度下的烟包图像数据,基于烟包图像数据的投影特征以及边缘反光特征,定位折线区域,并提取折线区域的多维度缺陷特征,通过自适应模板对多维度缺陷特征进行缺陷检测,得到缺陷检测结果,通过自适应模板对几何特征、纹理特征以及光学特征进行折线区域的缺陷检测,减少因为不同光照条件以及纹理而对烟包缺陷进行误判的情况,提高烟包缺陷的检测准确率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122736992A_ABST
    Figure CN122736992A_ABST
Patent Text Reader

Abstract

This application discloses a machine vision-based method for detecting appearance defects in the transparent paper of cigarette packs, relating to the field of image processing technology. The method includes the following steps: acquiring cigarette pack image data under multiple illumination angles using an industrial camera; locating zigzag regions based on the projection features and edge reflection features of the cigarette pack image data; extracting multi-dimensional defect features from the zigzag regions; and performing defect detection on the multi-dimensional defect features using an adaptive template to obtain the defect detection result. The multi-dimensional defect features include geometric features, texture features, and optical features. This application improves the detection accuracy of cigarette pack defects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, specifically to a machine vision-based method for detecting appearance defects in the transparent paper of cigarette packs. Background Technology

[0002] In the cigarette manufacturing process, the appearance quality of cigarette packs is a crucial product indicator. After packaging, cigarette packs are usually covered with a layer of transparent cellophane to protect the product, providing waterproofing and moisture protection. The appearance quality of this cellophane directly affects the product's market image. During the heat-sealing process, the cellophane may suffer various defects such as damage, heat-sealing wrinkles, and uneven seals.

[0003] Existing technologies mainly rely on geometric features such as the length and angle of broken lines to identify defects in cigarette packs. However, in actual testing, defects in cigarette packs may be misjudged due to different lighting conditions and textures, resulting in a high false detection rate. Summary of the Invention

[0004] To address the technical problem in related technologies that rely on geometric features such as the length and angle of broken lines to identify defects in cigarette packs, resulting in a high false detection rate, this application provides a machine vision-based method for detecting appearance defects in the transparent paper of cigarette packs.

[0005] The specific technical solution adopted is as follows: Acquire image data of cigarette packs under multiple lighting angles using an industrial camera; Based on the projection features and edge reflection features of cigarette pack image data, the polyline region is located; Multi-dimensional defect features of the polyline region are extracted, and defect detection is performed on the multi-dimensional defect features using an adaptive template to obtain the defect detection results. The multi-dimensional defect features include geometric features, texture features, and optical features.

[0006] In one possible implementation of this application, the polyline region is located based on the projection features and edge reflection features of the cigarette pack image data, including: Acquire the first image data under preset low-angle side light source illumination and the second image data under coaxial light source illumination from the cigarette pack image data; Feature extraction is performed on the first image data to obtain projection features, and feature extraction is performed on the second image data to obtain edge reflection features and contrast features; The projection features, edge reflection features, and contrast features are weighted and fused to obtain the fused positioning signal. The local maximum point corresponding to the fused positioning signal is used as the center to locate the polyline region.

[0007] In one possible implementation of this application, feature extraction is performed on the first image data to obtain projection features, including: Extract pixel gradients from the first image data; The pixel gradients are accumulated to obtain the gradient projection sequence; The gradient projection sequence is normalized to obtain the projection features.

[0008] In one possible implementation of this application, feature extraction is performed on the second image data to obtain edge reflection features and contrast features, including: Extract the pixel grayscale values ​​from the second image data, and use the average value of the pixel grayscale values ​​within the preset sliding window that are at the previous preset ratio as the edge reflection feature; The difference between the edge reflective features and the average of the pixel grayscale values ​​of the remaining proportions within the preset sliding window is used as the contrast feature.

[0009] In one possible implementation of this application, the extraction of multi-dimensional defect features of the polyline region includes: Geometric analysis is performed on the polyline region to obtain its geometric features; The grayscale values ​​in the polyline region are analyzed and processed to obtain texture features; The transmittance of the polygonal region under backlight illumination is calculated to obtain its optical characteristics. By combining geometric features, texture features, and optical features, multi-dimensional defect features are obtained.

[0010] In one possible implementation of this application, defect detection is performed on multi-dimensional defect features using an adaptive template to obtain defect detection results, including: Multidimensional defect features are filtered by using the standard gradient sequence in the adaptive template to obtain the filtered sample features; Geometric defect analysis is performed on the features of the screened samples to obtain the geometric defect results; If the geometric defect result shows that the detection is normal, the texture features and optical features are classified and processed by the preset SVM algorithm to obtain the defect detection result.

[0011] In one possible implementation of this application, multi-dimensional defect features are filtered using a standard gradient sequence in an adaptive template to obtain filtered sample features, including: The correlation coefficient is obtained by comparing the gradient projection sequence of the cigarette pack image data with the standard gradient sequence in the adaptive template. If the correlation coefficient is greater than the preset screening threshold, it is determined to be a normal sample and subsequent detection is skipped; If the correlation coefficient is less than or equal to the preset screening threshold, the multi-dimensional defect features corresponding to the correlation coefficient will be used as the features of the filtered samples.

[0012] In one possible implementation of this application, geometric defect analysis is performed on the features of the screened samples to obtain geometric defect results, including: Extract geometric features from the filtered sample features and calculate the deviation between the geometric features and the geometric reference value in the adaptive template; Based on the deviation value, the geometric defect result of the polygonal region is determined.

[0013] In one possible implementation of this application, after classifying texture features and optical features using a preset SVM algorithm to obtain defect detection results, the method further includes: Obtain the instantaneous detection score of the current defect detection results; The instantaneous detection score and the detection confidence score over the historical time period are input into the persistent defect confidence accumulation function to obtain the cumulative confidence score; If the cumulative confidence level is greater than the preset judgment threshold, the defect detection result and its corresponding type label will be output. If the cumulative confidence level is less than or equal to the preset judgment threshold, and the defect classification label is normal, the current sample features are fed back to the adaptive template to update the adaptive template.

[0014] In one possible implementation of this application, updating the adaptive template includes: Receive samples with defect classification labels that are normal; The overall quality score is calculated by combining the image sharpness and polyline features of the sample. The template quality index of the current adaptive template is calculated based on the comprehensive quality score; If the template quality index is lower than the preset update threshold, the sample features and the adaptive templates in the historical time period are weighted and fused based on the comprehensive quality score of each sample feature to obtain the updated adaptive template.

[0015] This application has, but is not limited to, the following technical effects: By acquiring cigarette pack image data under multiple lighting angles using an industrial camera, and based on the projection features and edge reflection features of the cigarette pack image data, the polyline region is located, and multi-dimensional defect features of the polyline region are extracted. Defect detection is performed on the multi-dimensional defect features using an adaptive template to obtain the defect detection results. The adaptive template is used to perform defect detection on the polyline region based on geometric features, texture features, and optical features, reducing the possibility of misjudging cigarette pack defects due to different lighting conditions and textures, and improving the detection accuracy of cigarette pack defects. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating the first embodiment of the machine vision-based method for detecting appearance defects in cigarette pack transparent paper according to this application. Figure 2 This is a schematic diagram of the overall implementation process of the machine vision-based method for detecting appearance defects in cigarette pack transparent paper in this application. Figure 3 This is a schematic diagram of the feature fusion involved in the machine vision-based method for detecting appearance defects in cigarette pack transparent paper in this application. Figure 4 This is a schematic diagram illustrating the multi-dimensional defect feature extraction involved in the machine vision-based method for detecting appearance defects in cigarette pack transparent paper in this application. Figure 5 This is a schematic diagram of the adaptive template construction process involved in the machine vision-based method for detecting appearance defects in cigarette pack transparent paper in this application; Figure 6 This is a schematic diagram of the hierarchical defect detection framework involved in the machine vision-based cigarette pack transparent paper appearance defect detection method of this application; Figure 7 This is a schematic diagram illustrating the spatiotemporal consistency verification involved in the machine vision-based method for detecting appearance defects in cigarette pack transparent paper in this application. Detailed Implementation

[0017] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.

[0018] This application provides a machine vision-based method for detecting appearance defects in the transparent paper of cigarette packs. In the first embodiment of this machine vision-based method for detecting appearance defects in the transparent paper of cigarette packs, referring to... Figure 1 and Figure 2 The methods include: Step S10: Acquire image data of the cigarette pack under multiple lighting angles using an industrial camera; As an example, the machine vision-based method for detecting appearance defects in cigarette pack transparent paper can be applied to a machine vision-based device for detecting appearance defects in cigarette pack transparent paper. This machine vision-based device for detecting appearance defects in cigarette pack transparent paper belongs to a machine vision-based system for detecting appearance defects in cigarette pack transparent paper, which in turn belongs to a machine vision-based equipment for detecting appearance defects in cigarette pack transparent paper.

[0019] As an example, an end-face image of a cigarette pack is acquired using a color industrial camera in conjunction with a multi-angle adjustable light source system, resulting in cigarette pack image data. This data includes multiple video frames corresponding to the acquired cigarette pack. The multi-angle adjustable light source system includes a low-angle side light source (used to enhance the folded edge contour of the transparent paper), a coaxial light source (used to suppress reflections), and a backlight source (used to detect light transmission uniformity).

[0020] Step S20: Locate the polyline region based on the projection features and edge reflection features of the cigarette pack image data; As an example, the polyline region is an area that may have defects. Based on the projection features and edge reflection features of the acquired image, a comprehensive analysis is performed to accurately identify the polyline region.

[0021] The step S20 of detecting appearance defects in the transparent paper of cigarette packs based on machine vision also includes steps S21 to S24, including: Step S21: Obtain the first image data under preset low-angle side light source illumination and the second image data under coaxial light source illumination from the cigarette pack image data; As an example, the preset low angle can be 15 degrees or 30 degrees, and the specific angle is not limited. The first image data and the second image data belong to the cigarette pack image data under different lighting angles.

[0022] Step S22: Extract features from the first image data to obtain projection features, and extract features from the second image data to obtain edge reflection features and contrast features; As an example, the first image data under low-angle side lighting is used as the reference image for gradient calculation. The image is analyzed to obtain projection features. The second image data under coaxial lighting is used as the reference image for reflection calculation. Then, edge reflection features and contrast features are extracted.

[0023] The step of extracting features from the first image data to obtain the projected features includes: Extract pixel gradients from the first image data; The pixel gradients are accumulated to obtain the gradient projection sequence; The gradient projection sequence is normalized to obtain the projection features.

[0024] As an example, the edge detection operator is used to extract pixel gradients from the gradient calculation reference image, and one-dimensional pixel gradients are accumulated along the direction parallel to the preset polyline to generate a one-dimensional gradient projection sequence. The gradient projection sequence is normalized to the [0,1] interval to obtain the projection feature G.

[0025] The steps of extracting features from the second image data to obtain edge reflection features and contrast features include: Extract the pixel grayscale values ​​from the second image data, and use the average value of the pixel grayscale values ​​within the preset sliding window that are at the previous preset ratio as the edge reflection feature; As an example, a sliding window is set along a preset broken line direction in the second image data to generate a preset sliding window. The average gray value of the pixels whose gray values ​​are in the top 10% within the preset sliding window is counted as the edge reflection feature R.

[0026] The difference between the edge reflective features and the average of the pixel grayscale values ​​of the remaining proportions within the preset sliding window is used as the contrast feature.

[0027] As an example, the difference between the mean gray value and the mean gray value of the remaining pixels in the preset sliding window is calculated as the contrast feature C, and the edge reflection feature and the contrast feature are normalized to the [0,1] interval respectively.

[0028] Step S23: Perform weighted fusion calculation on projection features, edge reflection features, and contrast features to obtain the fused positioning signal; As an example, fusing positioning signals The corresponding fusion localization function is expressed as: in, For projection features, It is characterized by edge reflectivity. For contrast characteristics, , , These are adaptive weighting coefficients based on prior sample calibration. , , The sum of is 1. For example, the values ​​are 0.6, 0.3, and 0.1 in the order of the parameters. x represents the horizontal coordinate direction of the pixel and y represents the vertical coordinate direction of the pixel.

[0029] Step S24: Locate the polyline region centered on the local maximum point corresponding to the fused positioning signal.

[0030] As an example, peak-finding processing is performed on the one-dimensional fused positioning signal to extract local maxima. The spatial pixel coordinates corresponding to these local maxima are used as the center of the transparent paper fold line. A preset pixel width is then extended outwards in both directions to extract a rectangular fold line region. The specific flowchart for fold line region positioning is shown below. Figure 3 As shown.

[0031] Step S30: Extract multi-dimensional defect features of the polyline region, perform defect detection on the multi-dimensional defect features using an adaptive template, and obtain the defect detection results. The multi-dimensional defect features include geometric features, texture features, and optical features.

[0032] As an example, features are extracted from the polyline region from multiple dimensions to obtain geometric features, texture features, and optical features. These features are then integrated to obtain multi-dimensional defect features. A schematic diagram of the multi-dimensional defect feature extraction process is shown below. Figure 4 As shown.

[0033] As an example, the adaptive template is used as a benchmark template for defect detection. The template is used to perform defect detection processing on the multi-dimensional defect features of the polyline region to determine the defect type and defect location in the polyline region.

[0034] Among them, the extraction of multi-dimensional defect features of the polyline region in step S30 includes: Geometric analysis is performed on the polyline region to obtain its geometric features; As an example, the polyline region is used as the region of interest (ROI). The ROI image is uniformly resampled to a preset standard size (such as 200×50 pixels) to eliminate the scaling effect caused by the different placement distances of the cigarette packs.

[0035] Geometric features include polyline length, angle deviation, and mean curvature. The extraction steps are as follows: The length of the polyline L is used to perform edge detection and thinning of the ROI and to count the total number of connected pixels after skeletonization.

[0036] Angle deviation θ: The main direction of the polyline is extracted using Hough transform, and the difference between its actual angle and the preset angle of the standard template is calculated.

[0037] Curvature κ: Piecewise polynomial fitting is performed on the thinned polyline, the absolute value of curvature at each sampling point is calculated and the arithmetic mean is taken, which is used to characterize the local deformation caused by the folds.

[0038] The grayscale values ​​in the polyline region are analyzed and processed to obtain texture features; As an example, texture features include LBP histogram and GLCM contrast, which can be extracted in the following ways: LBP histogram features: The rotation-invariant local binary mode operator is used to calculate the histogram distribution of the broken line region to describe the subtle texture anomalies on the surface of transparent paper.

[0039] GLCM Contrast: Calculates the contrast and energy of the gray-level co-occurrence matrix of the polyline region. Parameter settings: distance d=1, direction is the average of 4 directions, gray-level quantization is 16 levels. Used to characterize the roughness at the sealing point, distinguishing between flat areas and heat-sealed wrinkles.

[0040] The transmittance of the polygonal region under backlight illumination is calculated to obtain its optical characteristics. As an example, optical features include a light transmission uniformity index. This involves calling up the ROI image corresponding to the folded area under backlight illumination, calculating the variance of the pixel grayscale values ​​within that area, and the larger the variance, the lower the light transmission uniformity index (which can be the reciprocal of the variance). This is used to identify impurities, bubbles, or multi-layer overlap defects inside the transparent paper.

[0041] By combining geometric features, texture features, and optical features, multi-dimensional defect features are obtained.

[0042] As an example, the extracted geometric features, texture features, and optical features are concatenated in a preset order to form a multi-dimensional original feature vector. Then, the aforementioned Z-score normalization process is performed to map the feature vector to a standard normal distribution range, outputting multi-dimensional defect features.

[0043] The step of detecting defects by using an adaptive template to analyze multi-dimensional defect features and obtaining the defect detection results includes steps S31 to S33: Step S31: The multi-dimensional defect features are filtered using the standard gradient sequence in the adaptive template to obtain the filtered sample features. As an example, the adaptive template is a set of "benchmark feature datasets" extracted from recent normal production samples (positive samples), including the benchmark gradient projection curves and benchmark geometric parameters of normal transparent paper. This dataset is not statically fixed, but dynamically updated with its feature data and weights according to the quality evolution model as the production environment changes and new positive samples are added.

[0044] As an example, the defect detection process mainly consists of four steps. First, the gradient projection sequence of the real-time cigarette pack image data is filtered using the standard gradient sequence in the adaptive template to perform the preliminary defect detection process. Second, the geometric feature defect detection process is performed. If there are undetectable defects after the second step, the third step is performed, which uses the SVM algorithm to classify the multi-dimensional defect features of the polyline region. Finally, the corresponding defect detection results are output through confidence calculation. A schematic diagram of the hierarchical defect detection process is shown below. Figure 6 As shown.

[0045] Step S31 includes: The correlation coefficient is obtained by comparing the gradient projection sequence of the cigarette pack image data with the standard gradient sequence in the adaptive template. If the correlation coefficient is greater than the preset screening threshold, it is determined to be a normal sample and subsequent detection is skipped; If the correlation coefficient is less than or equal to the preset screening threshold, the multi-dimensional defect features corresponding to the correlation coefficient will be used as the features of the filtered samples.

[0046] As an example, the gradient projection sequence of real-time cigarette pack image data is correlated with the standard gradient sequence in the adaptive template to obtain the correlation coefficient. If the correlation coefficient is greater than a preset screening threshold (e.g., 0.85), it is determined to be a normal sample and skips subsequent detection; otherwise, it proceeds to the second step. This step uses the dynamic benchmark of the template to filter out global false alarms caused by ambient light fluctuations.

[0047] Step S32: Perform geometric defect analysis on the selected sample features to obtain geometric defect results; Step S32 includes: Extract geometric features from the filtered sample features and calculate the deviation between the geometric features and the geometric reference value in the adaptive template; Based on the deviation value, the geometric defect result of the polygonal region is determined.

[0048] As an example, the extracted geometric features (polyline length L, angle deviation θ, curvature κ) are called to calculate the deviation between them and the corresponding geometric reference values ​​in the adaptive template.

[0049] If the angle deviation θ exceeds the angle tolerance threshold, it is marked as a candidate for "uneven sealing". If the curvature κ is significantly higher than the mean of the adaptive template, it is marked as a candidate for "heat-sealing wrinkle". By quantifying the deviation between the two, the geometric properties of the defect are initially determined, thereby outputting the geometric defect result of the polygonal region.

[0050] As an example, the geometric defect detection step utilizes low-computational-power geometric parameters (length, angle, curvature) to quickly intercept macroscopic deformations. If the geometric defect detection can clearly determine that the sample belongs to "uneven sealing" (simple physical misalignment), the result is directly output without triggering the high-energy-consuming computation of the third step; only when the geometric parameters are abnormal but the defect category cannot be clearly determined, or when the geometric parameters are critical, is the sample sent to the third step for judgment.

[0051] Step S33: If the geometric defect result shows that the detection is normal, the texture features and optical features are classified and processed by the preset SVM algorithm to obtain the defect detection result.

[0052] As an example, geometric defects can serve as "prior candidate labels" for the SVM algorithm. For instance, when an anomaly in curvature is detected in the second step, the sample is labeled "suspected wrinkle" and sent into the algorithm's detection process. During classification, SVM focuses on combining LBP and GLCM texture features to cross-validate whether the anomaly in curvature is a genuine "heat-sealed wrinkle" or an edge curling caused by "torn transparent paper," thereby improving the accuracy of the final classification.

[0053] As an example, standardized texture features (LBP, GLCM) and optical features (transmittance uniformity U) are concatenated into a high-dimensional vector, which is then input into a pre-trained SVM classifier. The SVM, based on the current batch feature distribution patterns, accurately classifies candidate samples as: heat-sealed wrinkles, damage, impurities, or scratches. This yields the defect detection results. This step utilizes the nonlinear combination of multi-dimensional features to address the problem that a single geometric feature cannot distinguish between defect types.

[0054] After step S33, the following is included: Obtain the instantaneous detection score of the current defect detection results; The instantaneous detection score and the detection confidence over the historical time period are input into the persistent defect confidence accumulation function to obtain the cumulative confidence.

[0055] As an example, the instantaneous detection score of the defect detection result in the current frame is obtained, combined with the detection confidence over a historical time period, and substituted into the persistent defect confidence accumulation function: in, Let be the cumulative confidence level of defect d in the polygonal region at time t. For update rate, The instantaneous detection score of defect d in the current frame. The first-order time series rate of change, It is the second-order time series rate of change. This is the trend weighting coefficient. This is the acceleration weighting coefficient.

[0056] If the cumulative confidence level is greater than the preset judgment threshold, the defect detection result and its corresponding type label will be output. If the cumulative confidence level is less than or equal to the preset judgment threshold, and the defect classification label is normal, the current sample features are fed back to the adaptive template to update the adaptive template.

[0057] As an example, if the cumulative confidence score exceeds the preset judgment threshold, the final defect detection result and type label are output; if the cumulative confidence score is less than or equal to the preset judgment threshold and the classification label is normal, the sample features are fed back to the adaptive template construction process for incremental updates of the adaptive template.

[0058] The output includes: defect type label, defect location coordinates, defect severity score, and the current confidence state of the detection system. A schematic diagram of the spatiotemporal consistency verification is shown below. Figure 7 As shown, temporal consistency verification is performed on the results of 5 consecutive frames. This figure can be used to illustrate the changing trends of instantaneous detection scores and persistent confidence.

[0059] The steps for updating the adaptive template include: Receive samples with defect classification labels that are normal; A comprehensive quality score is calculated by combining the image sharpness and polyline features of the sample.

[0060] As an example, the sample features whose defect classification labels are determined to be normal are used as input samples during adaptive template updates. Normal samples include sample features whose correlation coefficient is greater than the preset screening threshold in the first step of defect determination process, as well as sample features whose final defect classification labels are normal.

[0061] As an example, sample scoring evaluation: receive newly collected positive samples during the production process, calculate the image sharpness score based on the Laplacian operator, the clarity of the piecewise linear feature based on the gradient strength, and the time decay factor T, and sum these data by weight. The weight coefficients can be 0.4, 0.4, or 0.2. After the calculation is completed, normalize to [0,1] to obtain the comprehensive quality score S of the new sample.

[0062] The template quality index of the current adaptive template is calculated based on the comprehensive quality score; If the template quality index is lower than the preset update threshold, the sample features and the adaptive templates in the historical time period are weighted and fused based on the comprehensive quality score of each sample feature to obtain the updated adaptive template.

[0063] As an example, the quality evolution model of the adaptive template is represented as: in, Let be the template quality index at time t. This represents the template quality index at time t-1 (the previous time step). The time-varying decay rate is used to characterize the rate at which the reliability of old template features decreases over time. The time decay term causes the quality of historical templates to decay exponentially over time. The new sample quality injection rate represents the contribution weight of newly added positive samples to template updates. : Overall quality score of the new sample.

[0064] Establish a positive sample FIFO (First-In-First-Out) queue. When When the update threshold is lower than the preset update threshold or the queue update count reaches the set number of frames, the update count of each sample in the queue is used. Using [weights], the sample feature data in the queue are weighted and averaged with the historical baseline template to generate a new generation of adaptive templates. After the template update is complete, the current positive sample queue is cleared, and [the template is then updated]. Reset to the initial high-order bits (e.g., 1.0), the construction process diagram of the adaptive template is as follows. Figure 5 As shown.

[0065] Furthermore, the system monitors ambient light intensity in real time. When the light intensity changes by more than 10%, it automatically adjusts the camera exposure time and the light source brightness. The results of this parameter adjustment are fed back to the image acquisition process and the template update process: on the one hand, the adjusted camera exposure parameters and light source brightness parameters are directly applied to the image acquisition process, ensuring that the quality of subsequently acquired images remains stable; on the other hand, after parameter adjustment, the system automatically triggers the template update process, acquiring several frames of adjusted images to recalculate the standard template, ensuring that the detection benchmark remains consistent with the current lighting conditions.

[0066] This application provides a machine vision-based method for detecting defects in the transparent paper of cigarette packs. It acquires cigarette pack image data from multiple lighting angles using an industrial camera. Based on the projection features and edge reflection features of the cigarette pack image data, it locates the zigzag region and extracts multi-dimensional defect features from the zigzag region. An adaptive template is then used to perform defect detection on these multi-dimensional defect features, yielding the defect detection result. The adaptive template utilizes geometric, textural, and optical features to detect defects in the zigzag region, reducing misjudgments of cigarette pack defects due to different lighting conditions and textures, thereby improving the accuracy of cigarette pack defect detection.

[0067] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system 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 system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0068] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0069] The above are merely preferred embodiments of this application and do not limit the scope of this application. Any equivalent structural or procedural transformations made based on the description and drawings of this application, or direct or indirect applications in other related technical fields, are similarly included within the scope of protection of this application.

[0070] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0071] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

Claims

1. A machine vision-based method for detecting appearance defects in the transparent paper of cigarette packs, characterized in that, The method includes: Acquire image data of cigarette packs under multiple lighting angles using an industrial camera; Based on the projection features and edge reflection features of the cigarette pack image data, the polygonal region is located; Multi-dimensional defect features of the polyline region are extracted, and defect detection is performed on the multi-dimensional defect features using an adaptive template to obtain defect detection results. The multi-dimensional defect features include geometric features, texture features, and optical features.

2. The method for detecting appearance defects in cigarette pack transparent paper based on machine vision as described in claim 1, characterized in that, The method of locating the polyline region based on the projection features and edge reflection features of the cigarette pack image data includes: Acquire the first image data under preset low-angle side light source illumination and the second image data under coaxial light source illumination from the cigarette pack image data; Feature extraction is performed on the first image data to obtain projection features, and feature extraction is performed on the second image data to obtain edge reflection features and contrast features; The projection features, edge reflection features, and contrast features are weighted and fused to obtain a fused positioning signal. The polygonal region is located centered on the local maximum point corresponding to the fused positioning signal.

3. The method for detecting appearance defects in cigarette pack transparent paper based on machine vision as described in claim 2, characterized in that, The step of extracting features from the first image data to obtain projection features includes: Extract pixel gradients from the first image data; The pixel gradients are accumulated to obtain a gradient projection sequence; The gradient projection sequence is normalized to obtain the projection features.

4. The method for detecting appearance defects in cigarette pack transparent paper based on machine vision as described in claim 2, characterized in that, The step of extracting features from the second image data to obtain edge reflection features and contrast features includes: Extract the pixel grayscale values ​​from the second image data, and use the average value of the pixel grayscale values ​​within the preset sliding window that is at the previous preset ratio as the edge reflection feature; The difference between the edge reflective feature and the average value of the remaining pixel grayscale values ​​within the preset sliding window is used as the contrast feature.

5. The method for detecting appearance defects in cigarette pack transparent paper based on machine vision as described in claim 1, characterized in that, The extraction of multi-dimensional defect features from the polyline region includes: Geometric analysis is performed on the polyline region to obtain its geometric features; The grayscale values ​​in the polyline region are analyzed and processed to obtain texture features; The transmittance of the polygonal region under backlight illumination is calculated to obtain its optical characteristics. By combining the geometric features, texture features, and optical features, multi-dimensional defect features are obtained.

6. The method for detecting appearance defects in cigarette pack transparent paper based on machine vision as described in claim 1, characterized in that, The step of performing defect detection on the multi-dimensional defect features using an adaptive template to obtain defect detection results includes: The multi-dimensional defect features are filtered by using the standard gradient sequence in the adaptive template to obtain the filtered sample features. The selected sample features are subjected to geometric defect analysis to obtain geometric defect results; If the geometric defect result shows that the detection is normal, the texture features and optical features are classified by a preset SVM algorithm to obtain the defect detection result.

7. The method for detecting appearance defects in cigarette pack transparent paper based on machine vision as described in claim 6, characterized in that, The process of filtering the multi-dimensional defect features using the standard gradient sequence in the adaptive template to obtain the filtered sample features includes: The correlation coefficient is obtained by comparing the gradient projection sequence of the cigarette pack image data with the standard gradient sequence in the adaptive template. If the correlation coefficient is greater than the preset screening threshold, it is determined to be a normal sample and subsequent detection is skipped; If the correlation coefficient is less than or equal to the preset screening threshold, then the multi-dimensional defect features corresponding to the correlation coefficient are used as the filtered sample features.

8. The method for detecting appearance defects in cigarette pack transparent paper based on machine vision as described in claim 6, characterized in that, The geometric defect analysis of the screened sample features to obtain geometric defect results includes: Extract geometric features from the filtered sample features, and calculate the deviation between the geometric features and the geometric reference value in the adaptive template; Based on the deviation value, the geometric defect result of the polygonal region is determined.

9. The method for detecting appearance defects in cigarette pack transparent paper based on machine vision as described in claim 6, characterized in that, After classifying the texture features and optical features using a preset SVM algorithm to obtain the defect detection results, the method further includes: Obtain the instantaneous detection score of the current defect detection results; The instantaneous detection score and the detection confidence score over the historical time period are input into the persistent defect confidence accumulation function to obtain the cumulative confidence score; If the cumulative confidence level is greater than the preset judgment threshold, the defect detection result and its corresponding type label are output. If the cumulative confidence level is less than or equal to the preset judgment threshold, and the defect classification label is normal, then the current sample features are fed back to the adaptive template to update the adaptive template.

10. The method for detecting appearance defects in cigarette pack transparent paper based on machine vision as described in claim 9, characterized in that, The step of updating the adaptive template includes: Receive samples with defect classification labels that are normal; The overall quality score is calculated by combining the image sharpness and polyline features of the sample features. The template quality index of the current adaptive template is calculated based on the comprehensive quality score; If the template quality index is lower than the preset update threshold, the sample features and the adaptive templates in the historical time period are weighted and fused based on the comprehensive quality score of each sample feature to obtain the updated adaptive template.