Cigarette bar end face transparent paper appearance defect detection method
Through the combination of black and white cameras and blue light sources, the length and angle of transparent paper fold lines are calculated and template parameters are generated, which solves the problem that existing equipment is difficult to detect minor defects in transparent paper, and achieves efficient smoke strip packaging quality inspection.
Patent Information
- Application Number
- CN202510566714.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-08-15
AI Technical Summary
It is difficult for existing equipment to effectively detect the slight wrinkles, irregular sealing and packaging offset of transparent paper during the packaging of cigarette strips.
The black and white camera and blue light source are used to slant light. By calculating the length and angle of the transparent paper fold line, combined with Hough transformation technology, template parameters are generated, the deviation between the real-time image and the template is detected, and the quality of transparent paper packaging is judged.
It realizes effective detection of quality problems such as broken, wrinkle, offset, and uneven sealing of transparent paper, and improves the accuracy and efficiency of cigarette strip packaging quality inspection.
Smart Images

Figure CN120495211A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of detection technology, and in particular relates to a method for detecting appearance defects of transparent paper on the end surface of a cigarette rod. Background Art
[0002] After cigarette rods are packaged, they are typically covered with a layer of transparent cellophane to protect the product and provide waterproof and moisture-proof features. This process is typically accomplished by heat-sealing the two ends of the package. However, during the packaging process, common defects can occur: embedded foreign matter, oil stains, damaged cellophane, loose seals, wrinkles in the cellophane due to excessive heat sealing, and package misalignment and hemming. These defects not only weaken the packaging's protective function but also impact the product's brand image and market competitiveness, while increasing production and compliance costs.
[0003] Existing visual inspection equipment is primarily used to detect packaging quality issues in cigarette carton wrappers. Using techniques like grayscale thresholding and template matching, it can identify defects such as torn wrappers, exposed white areas, and missing printed patterns. More serious quality issues, such as embedded foreign matter, oil stains, damaged transparent cellophane, and loose or warped seals, can also be effectively identified by detecting abnormal fluctuations in grayscale values and variance. However, existing equipment has limited detection effectiveness for less serious but equally significant quality issues, such as slight wrinkles in the transparent cellophane caused by excessive heat sealing, uneven seals, and package misalignment. Summary of the Invention
[0004] In view of the above technical problems existing in the prior art, the present invention proposes a method for detecting appearance defects of transparent paper on the end surface of a cigarette rod, which has a reasonable design, overcomes the shortcomings of the prior art, and has good effects.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] A method for inspecting the appearance of transparent paper on the ends of cigarette rods uses a black and white camera and a blue light source at an angle to highlight the folded edges and enhance contrast. If the transparent paper packaging is of acceptable quality, four distinct fold lines of a certain length and angle will be formed. The quality of the transparent paper packaging can be determined by calculating and analyzing the lengths and angles of these fold lines.
[0007] The calculation process is as follows: a certain number of positive sample images are collected and studied, and the lengths and angles of the four fold lines on the end face of each image are calculated. Data with large deviations are removed from the sample data, and the remaining data are averaged to obtain the lengths and angles of the four fold lines on the template end face of the transparent paper. The lengths and angles of the four fold lines on the end face of the transparent paper are calculated in the real-time image to be inspected and compared with the corresponding fold line lengths and angles of the template sample. If the deviation is within the set range, the end face transparent paper packaging quality is qualified; otherwise, it is unqualified.
[0008] The specific steps include:
[0009] Step 1: Capture the end face image of the tobacco rod using a black and white camera and a blue oblique light source;
[0010] Step 2: Collect k positive sample images;
[0011] Step 3: Based on horizontal positioning and vertical positioning, position compensation is performed on the k positive sample images;
[0012] Step 4: Use Hough transform to perform line detection on each region of interest in the positive sample image set, and select the best matching line segment with the smallest error with the reference image polyline;
[0013] Step 5: Eliminate the data whose length and angle deviations in the best matching straight line segment exceed the preset threshold, calculate the average of the remaining data, and generate the template straight line length, template angle and corresponding Hough transform parameters;
[0014] Step 6: After positioning and offset compensation of the real-time image to be inspected, use the template Hough transform parameters to detect its broken line; determine whether the angle deviation between the real-time broken line and the template broken line is less than Δθ, and whether the length deviation is less than ΔL; if both are met, it is judged as qualified, otherwise it is judged as unqualified.
[0015] Preferably, step 2 specifically includes the following steps:
[0016] Step 2.1: Select the reference image and establish the horizontal positioning reference X SamplePos and vertical positioning reference Y SamplePos ;
[0017] Step 2.2: Set the regions of interest in the four polyline areas of the reference image and mark the starting point (x1, y1) and end point (x2, y2) of each polyline.
[0018] Step 2.3: Calculate the annotation lengths and angles of the four polylines in the reference image according to formula (1):
[0019]
[0020] Where i∈(1,4).
[0021] Preferably, step 3 specifically includes the following steps:
[0022] Step 3.1: Calculate the horizontal positioning of each image in the positive image set except the reference image and vertical positioning where j∈(0,k-1);
[0023] Step 3.2: Calculate the horizontal offset of each image based on the positioning information of the reference image and vertical offset
[0024] Step 3.3: Perform corresponding offset compensation processing on the four polyline interest regions of each positive sample image. The calculation formula is shown in (2):
[0025]
[0026] Preferably, step 4 specifically includes the following steps:
[0027] Step 4.1: Use Hough transform to detect the set of straight lines found in the four regions of interest of each image in the positive sample image set;
[0028] Step 4.2: Calculate the length of the broken line marked in the area corresponding to the reference image and the best matching line with the smallest angle error in the line set, obtain the length information and angle information, and record the Hough transform parameter set information at this time; as shown in formula (3):
[0029]
[0030] Where, i∈(1,4), ΔL i is the length difference between the line in the line set and the marked line, Δθ i is the angle difference between the line in the line set and the marked line, ω is the weight, E i is the total error between the line in the line set and the marked line, Lines i The set of straight lines found by Hough transform for each region of each positive sample image, is the best matching straight line length set of k image regions i, is the set of best matching straight line lengths for region i in k images.
[0031] Preferably, step 5 specifically includes the following steps:
[0032] Step 5.1: Calculate the standard deviation of length, angle and Hough parameter for each region data;
[0033] Step 5.2: Eliminate abnormal data that exceeds 1.5 times the standard deviation;
[0034] Step 5.3: According to formula (4), calculate the average value of the remaining data to get the template length Template Angle and template Hough parameters
[0035]
[0036] in, is the mean value of the sample straight line length, angle, and Hough parameter of the corresponding area, is the standard deviation of the sample straight line length, angle, and Hough parameter in the corresponding area, is the sample straight line length, angle, and Hough parameter template value of the corresponding area.
[0037] Preferably, step 6 specifically includes the following steps:
[0038] Step 6.1: Calculate the horizontal and vertical positioning of the real-time image to be inspected, and perform position offset compensation according to formula (2);
[0039] Step 6.2: Use template Hough parameters Calculate the real-time images separately to obtain the set of straight lines in the corresponding area;
[0040] Step 6.3: Find the line in each area's straight line set whose angle deviation from the area's template line is within the set range Δθ, and calculate whether its length is within the set range ΔL. If it is within the set range, it passes; if not, it fails.
[0041]
[0042] The beneficial technical effects brought about by the present invention are:
[0043] The present invention provides a method for detecting appearance defects of transparent paper on the end surface of cigarette rods, which can effectively detect quality problems such as damage, wrinkles, deviation, and uneven sealing of transparent paper during the packaging process of cigarette rods, solves the difficult problem of detecting appearance defects of transparent paper during the packaging process of cigarette rods, and has great market value. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 is a flow chart of the present invention;
[0045] Figure 2 It is the benchmark image in the positive sample image set of the transparent paper of the cigarette rod end surface;
[0046] Figure 3 It is a real-time image showing the transparent paper on the end of the cigarette rod waiting for inspection and passing the inspection;
[0047] Figure 4 This is an image showing the heat sealing process of the transparent paper on the end of the cigarette rod;
[0048] Figure 5 This is an image of the damaged transparent paper on the end of the cigarette rod. DETAILED DESCRIPTION
[0049] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments:
[0050] A method for detecting appearance defects in the transparent paper on the end of a cigarette rod uses a black and white camera and a blue light source to illuminate the oblique edges of the transparent paper on the end of the cigarette rod. When the transparent paper on the end of the cigarette rod is heat-sealed properly, four distinct fold lines of certain lengths and angles will be formed. When the transparent paper is damaged, wrinkled, or offset, the fold lines will be affected. Therefore, the heat seal quality is judged by calculating the lengths and angles of the four fold lines in the heat-sealed image. The following uses the cigarette rod end image collected on the production line as an example to illustrate the specific calculation process. The process is as follows: Figure 1 As shown:
[0051] 1. Collect k positive sample cigarette images wrapped in transparent paper on the production line and select one positive sample image as the reference image, such as Figure 2 As shown, calculate the horizontal positioning X of the reference image SamplePos and vertical positioning Y SamplePos As a position reference.
[0052] 2. Set four regions of interest on the four polyline parts of the reference image, mark the starting point and end point of each polyline in these four regions of interest, and obtain the marked length and angle of the four polylines in the reference image. The calculation formula is as follows:
[0053]
[0054] Where i∈(1,4), (x1, y1) is the starting point of each broken line, and (x2, y2) is the end point of each broken line.
[0055] 3. Calculate the horizontal positioning of each image in the positive image set, except the reference image and vertical positioning Where j∈(0,k-1). Based on the positioning information of the reference image, the horizontal offset of each image is calculated and vertical offset The four polyline interest regions of each positive sample image are subjected to corresponding offset compensation processing. The calculation formula is as follows:
[0056]
[0057] 4. Use Hough transform to detect the set of straight lines found in the four regions of interest of each image in the positive sample image set, and calculate the best matching straight line with the smallest length and angle error of the broken line marked with the corresponding area of the reference image in these straight lines, obtain the length information and angle information, and record the Hough transform parameter set information at this time.
[0058]
[0059] Where, i∈(1,4), ΔL i is the length difference between the line in the line set and the marked line, Δθ i is the angle difference between the line in the line set and the marked line, ω is the weight, E i is the total error between the line in the line set and the marked line, Lines i The set of straight lines found by Hough transform for each region of each positive sample image, is the best matching straight line length set of k image regions i, is the set of best matching straight line lengths for region i in k images.
[0060] 5. Remove the data with large deviations (exceeding 1.5 times the standard deviation) in the length, angle, Hough transform parameter and other data sets, average the remaining data, and obtain the template length, template angle, and corresponding template Hough transform parameters of the four broken lines.
[0061]
[0062] in, is the mean value of the sample straight line length, angle, and Hough parameter of the corresponding area, is the standard deviation of the sample straight line length, angle, and Hough parameter in the corresponding area, is the sample straight line length, angle, and Hough parameter template value of the corresponding area.
[0063] 6. Calculate the real-time image to be inspected (such as Figure 3 As shown) horizontal and vertical positioning, position offset compensation is performed according to the formula in step 3, and Hough transform parameters are used Calculate the real-time image separately to obtain the line set for the corresponding area. In each area's line set, find the line whose angle deviation from the area's template line is within the set range Δθ. Calculate its length to see if it is within the set range ΔL. If it is not, it is qualified. If it is, it is NG.
[0064]
[0065] Figure 4 This is a schematic diagram of the heat sealing process of the transparent paper on the end face of the cigarette rod; Figure 5 Schematic diagram of the damaged transparent paper on the end of the cigarette rod.
[0066] In this example, k = 50, X SamplePos =12, Y SamplePos =24, ΔL=30, Δθ=2°. Figure 3 The calculation result is The deviations from the corresponding templates are all within the range of ΔL=30, Δθ=2°, which is qualified; Figure 4 The calculation result is If the deviation from the corresponding template exceeds ΔL=30, Δθ=2°, it is unqualified; Figure 5 The calculation result is If the deviation from the corresponding template exceeds ΔL=30 and Δθ=2°, it is considered unqualified. Table 1 shows the lengths and angles of the four broken lines of the 50 positive sample images of the end surface of the cigarette rod transparent paper.
[0067] Table 1
[0068]
[0069]
[0070] Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by technicians in this technical field within the essential scope of the present invention should also fall within the scope of protection of the present invention.
Claims
1. A method for detecting appearance defects of transparent paper on the end surface of a cigarette rod, characterized by: The steps include: Step 1: Capture the end face image of the tobacco rod using a black and white camera and a blue oblique light source; Step 2: Collect k positive sample images; Step 3: Based on horizontal positioning and vertical positioning, position compensation is performed on the k positive sample images; Step 4: Use Hough transform to perform line detection on each region of interest in the positive sample image set, and select the best matching line segment with the smallest error with the reference image polyline; Step 5: Eliminate the data whose length and angle deviations in the best matching straight line segment exceed the preset threshold, calculate the average of the remaining data, and generate the template straight line length, template angle and corresponding Hough transform parameters; Step 6: After positioning and offset compensation of the real-time image to be inspected, use the template Hough transform parameters to detect its broken line; determine whether the angle deviation between the real-time broken line and the template broken line is less than Δθ, and whether the length deviation is less than ΔL; if both are met, it is judged as qualified, otherwise it is judged as unqualified.
2. The method for detecting appearance defects of transparent paper on the end surface of a cigarette rod according to claim 1, characterized in that: Step 2 specifically includes the following steps: Step 2.1: Select the reference image and establish the horizontal positioning reference X SamplePos and vertical positioning reference Y SamplePos ; Step 2.2: Set the regions of interest in the four polyline areas of the reference image and mark the starting point (x1, y1) and end point (x2, y2) of each polyline. Step 2.3: Calculate the annotation lengths and angles of the four polylines in the reference image according to formula (1): Where i∈(1,4).
3. The method for detecting appearance defects of transparent paper on the end surface of a cigarette rod according to claim 1, characterized in that: Step 3 specifically includes the following steps: Step 3.1: Calculate the horizontal positioning of each image in the positive image set except the reference image and vertical positioning where j∈(0,k-1); Step 3.2: Calculate the horizontal offset of each image based on the positioning information of the reference image and vertical offset Step 3.3: Perform corresponding offset compensation processing on the four polyline interest regions of each positive sample image. The calculation formula is shown in (2):
4. The method for detecting appearance defects of transparent paper on the end surface of a cigarette rod according to claim 1, characterized in that: Step 4 specifically includes the following steps: Step 4.1: Use Hough transform to detect the set of straight lines found in the four regions of interest of each image in the positive sample image set; Step 4.2: Calculate the length of the broken line marked in the area corresponding to the reference image and the best matching line with the smallest angle error in the line set, obtain the length information and angle information, and record the Hough transform parameter set information at this time; as shown in formula (3): Where, i∈(1,4), ΔL i is the length difference between the line in the line set and the marked line, Δθ i is the angle difference between the line in the line set and the marked line, ω is the weight, E i is the total error between the line in the line set and the marked line, Lines i The set of straight lines found by Hough transform for each region of each positive sample image, is the best matching straight line length set of k image regions i, is the set of best matching straight line lengths for region i in k images.
5. The method for detecting appearance defects of transparent paper on the end surface of a cigarette rod according to claim 1, characterized in that: Step 5 specifically includes the following steps: Step 5.1: Calculate the standard deviation of length, angle and Hough parameter for each region data; Step 5.2: Eliminate abnormal data that exceeds 1.5 times the standard deviation; Step 5.3: According to formula (4), calculate the average value of the remaining data to get the template length Template Angle and template Hough parameters in, is the mean value of the sample straight line length, angle, and Hough parameter of the corresponding area, is the standard deviation of the sample straight line length, angle, and Hough parameter in the corresponding area, is the sample straight line length, angle, and Hough parameter template value of the corresponding area.
6. The method for detecting appearance defects of transparent paper on the end surface of a cigarette rod according to claim 1, characterized in that: Step 6 specifically includes the following steps: Step 6.1: Calculate the horizontal and vertical positioning of the real-time image to be inspected, and perform position offset compensation according to formula (2); Step 6.2: Use template Hough parameters Calculate the real-time images separately to obtain the set of straight lines in the corresponding area; Step 6.3: Find the line in each area's straight line set whose angle deviation from the area's template line is within the set range Δθ, and calculate whether its length is within the set range ΔL. If it is within the set range, it passes; if not, it fails.