A method for determining the width of tobacco based on machine vision

By calculating the Euclidean distance between the tobacco skeleton points and the contour points, a width set is formed and the average value is calculated, which solves the problem of inaccurate tobacco width measurement in the prior art and realizes objective and accurate measurement of tobacco width, applicable to tobacco of various shapes.

CN115979134BActive Publication Date: 2026-02-03SHANGHAI TOBACCO GROUP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310010121.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-04
Publication Date
2026-02-03
Estimated Expiration
2043-01-04

AI Technical Summary

Technical Problem

Existing technologies for measuring tobacco width are subjective and inaccurate, especially for non-closed tobacco and irregularly shaped tobacco, which affects cigarette quality and combustion performance.

Method used

By acquiring images of tobacco shreds, preprocessing them, extracting the tobacco shred contours and skeletons, calculating the Euclidean distance between skeleton points and contour points, taking the minimum value as the radius of a circle, forming a width set, and calculating the average value as the tobacco shred width.

Benefits of technology

It enables objective and accurate measurement of tobacco width, applicable to tobacco of various shapes, especially irregularly shaped tobacco, thus improving the accuracy of detection and system efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115979134B_ABST
    Figure CN115979134B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of tobacco processing, and particularly relates to a tobacco shred width determination method based on machine vision, which comprises the following steps in sequence: step S1, collecting a tobacco shred original image; step S2, pre-processing the tobacco shred original image; step S3, extracting a tobacco shred contour and a tobacco shred skeleton; step S4, calculating the Euclidean distance between each skeleton point on the tobacco shred skeleton and all contour points on the tobacco shred contour and taking the minimum value, and taking the skeleton point as the center and the minimum value as the radius to make a circle, taking the diameters of the circles corresponding to all skeleton points on the tobacco shred skeleton as a width set, and calculating the average value of the width set as the width detection value of the tobacco shred. The width of the tobacco shred formed by each skeleton point on the tobacco shred skeleton and the tobacco shred contour is detected, the detection range is wide and has strict objectivity, and the width of the tobacco shred can be more objectively and accurately determined.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of tobacco processing, and particularly relates to a method for measuring the width of cut tobacco based on machine vision. BACKGROUND

[0002] Cut tobacco is formed through multiple processing procedures such as loosening, re-moistening, cutting and drying of sheet tobacco after aging. The length and width of cut tobacco have a great influence on the quality of cigarette rolling, the burning performance of cigarettes and the sensory quality. In the detection aspect, researchers begin to use machine vision to detect the morphological indexes of cut tobacco, that is, to collect images after dispersing cut tobacco, and then to obtain the morphological indexes of cut tobacco such as length, width and curling degree through image transmission and image processing. The technical links in image processing include image preprocessing, background segmentation, cut tobacco contour extraction, cut tobacco center line or skeleton extraction and index detection.

[0003] The patent application with the publication number CN110345874A discloses a new method for measuring the width of cut tobacco based on machine vision detection technology. The method mainly obtains the center line and skeleton of cut tobacco by judging the local features of cut tobacco based on tracking, and forms a cut tobacco width measurement candidate box by setting a width threshold and symmetrically forming the surrounding area of the center line. The width of cut tobacco in the candidate box is calculated. The method has subjectivity in the measurement of the width of cut tobacco because a suitable width threshold range needs to be set, and cannot objectively and accurately reflect the actual width of cut tobacco. Moreover, the system process is complicated.

[0004] The patent application with the publication number CN112330663A discloses a computer vision cut tobacco width detection method based on variable diameter circles. The method starts from one end of the skeleton center line of cut tobacco, makes a variable diameter circle with a certain step length, and when the variable diameter circle is tangent to the contour of cut tobacco, the diameter of the corresponding variable diameter circle is the width of cut tobacco. However, in the actual operation process, the variable diameter circle cannot be tangent to the contour, and will intersect with the contour slightly, which will lead to the fact that the diameter of the selected variable diameter circle cannot accurately measure the width of cut tobacco. In addition, the method needs to start from one end of the skeleton center line to detect the width of cut tobacco, and is only effective for non-closed cut tobacco images. The method cannot effectively measure the closed cut tobacco (such as ring-shaped cut tobacco), and the method needs to perform iterative calculation of the diameter of the circle at the skeleton center point, which affects the efficiency of the system. SUMMARY

[0005] In view of the above-mentioned defects of the prior art, the technical problem to be solved by the present application is to provide a method for measuring the width of cut tobacco based on machine vision, which can more objectively and accurately measure the width of cut tobacco.

[0006] In order to solve the above-mentioned technical problems, the present application adopts the following technical solutions:

[0007] The application provides a method for measuring the width of tobacco based on machine vision, which comprises the following steps in sequence: step S1, collecting a tobacco original image; step S2, preprocessing the tobacco original image; step S3, extracting a tobacco contour and a tobacco skeleton; step S4, calculating the Euclidean distance between each skeleton point on the tobacco skeleton and all contour points on the tobacco contour and taking the minimum value, taking the minimum value as the radius and the skeleton point as the center to make a circle, taking the diameter of the circle corresponding to all skeleton points on the tobacco skeleton as a width set, and calculating the average value of the width set as the width detection value of the tobacco.

[0008] Preferably, in step S1, the tobacco is uniformly dispersed and placed on the object table and flattened by a glass plate, and then the tobacco original image is collected by using a camera device.

[0009] Preferably, in step S2, the preprocessing comprises Gaussian filter denoising processing, background segmentation and binarization.

[0010] Preferably, in step S3, the tobacco contour is extracted from the binarized image by using a canny operator.

[0011] Preferably, in step S3, based on the extracted tobacco contour image, an 8-neighborhood structure check table is generated according to the judgment rule in the Zhang-Suen algorithm, and the 8-neighborhood structure is used to iteratively corrode the tobacco contour to extract a pseudo-skeleton of the tobacco; for tobacco in a regular shape, the pseudo-skeleton is a true tobacco skeleton; for tobacco in an irregular shape, the true tobacco skeleton is obtained by judging and removing the branches of the pseudo-skeleton.

[0012] Preferably, in step S3, the tobacco in an irregular shape comprises non-circular bifurcated tobacco and / or circular bifurcated tobacco.

[0013] Preferably, in step S3, the method for judging and removing the branches of the pseudo-skeleton of the non-circular bifurcated tobacco comprises the following steps in sequence: step a1, generating a 3*3 pixel structure P, wherein the value of P(3, 3) is 0 and the values of the other pixels are all 1; step a2, searching and extracting the 8-neighborhood pixels P0 around the pixels with a pixel value of 1 in the pseudo-skeleton image of the non-circular bifurcated tobacco, calculating the same-position multiplication matrix K of P and P0, summing the matrix K and recording it as Ks, if Ks≥3, the P0 matrix covers the branch node J of the pseudo-skeleton; step a3, setting the positions containing the branch node J in the pseudo-skeleton of the non-circular bifurcated tobacco to 0, dividing the pseudo-skeleton of the non-circular bifurcated tobacco into three parts, traversing all the parts of the skeleton and calculating the corresponding lengths, finding out the shortest branch and marking the length of the shortest branch as Cmin, setting a threshold value R according to the width of the tobacco, if Cmin>R, the shortest branch is retained; if Cmin≤R, the shortest branch is removed by setting the shortest branch to 0.

[0014] Preferably, in step S3, the method of judging and removing the branches of the pseudo skeleton of the annular bifurcated tobacco includes the following steps in sequence: step b1, image hole filling is performed on the pseudo skeleton of the annular bifurcated tobacco, a difference between the formed image matrix and the pseudo skeleton of the annular bifurcated tobacco is obtained, and a difference matrix obtained is an annular region; step b2, image dilation operation is performed on the annular region by using a 3*3 pixel structure, pixel values of the 3*3 pixel structure are all 1, and an annular contour of the dilated annular region is extracted by using a canny operator; step b3, a 3*3 pixel structure P is generated, except that a value of P(3, 3) is 0, pixel values of the rest are all 1; step b4, pixels with a pixel value of 1 in the annular contour image are searched and 8-neighborhood pixels P0 around the pixels with the pixel value of 1 are extracted, a same-position multiplication matrix K of P and P0 is calculated, a sum of the matrix K is recorded as Ks, if Ks is greater than or equal to 2, the P0 matrix covers a branch node J of the pseudo skeleton; step b5, positions containing the branch node J in the annular contour are set to 0 respectively, the annular contour is divided into three parts, all part contours are traversed and corresponding lengths are calculated, the shortest branch is found out and a length of the shortest branch is marked as Cmin, a threshold value R is set according to the width of the tobacco, if Cmin is greater than R, the shortest branch is reserved; if Cmin is less than or equal to R, the shortest branch is set to 0 and removed.

[0015] Preferably, in step S3, the irregular port of the real tobacco skeleton is cut off.

[0016] Preferably, in step S3, the method of cutting off the irregular port of the real tobacco skeleton includes the following steps in sequence: step c1, a 3*3 pixel structure P is generated, except that a value of P(3, 3) is 0, pixel values of the rest are all 1; step c2, pixels with a pixel value of 1 in the real tobacco skeleton image are searched and 8-neighborhood pixels P0 around the pixels with the pixel value of 1 are extracted, a same-position multiplication matrix K of P and P0 is calculated, a sum of the matrix K is calculated, if the sum of the matrix K is equal to 1, corresponding pixels are removed; step c3, a threshold value of searching times is set, step c2 is repeated, and pixels with a pixel value of 1 in the real tobacco skeleton image are cyclically removed.

[0017] Compared with the prior art, the present application has significant progress:

[0018] The machine vision-based tobacco width measuring method of the present application calculates the Euclidean distance between each skeleton point on the tobacco skeleton and all contour points on the tobacco contour, takes the minimum value, and makes a circle with the skeleton point as the center and the minimum value as the radius, so as to form a circle diameter as a width set, and finally calculates the average value of the width set as the width detection value of the tobacco. The tobacco width formed by each skeleton point on the tobacco skeleton and the tobacco contour is detected, the detection range is wide and has strict objectivity, and the width of the tobacco can be more objectively and accurately measured. BRIEF DESCRIPTION OF DRAWINGS

[0019] Figure 1 In the drawings, 1a and 1b are examples of the original image and the binary image of the tobacco in the machine vision-based tobacco width measuring method of the embodiment of the present application.

[0020] Figure 2 In the drawings, 2a, 2b and 2c are examples of the binary image, the tobacco contour image and the tobacco pseudo-skeleton image of a tobacco in a conventional form in the machine vision-based tobacco width measuring method of the embodiment of the present application.

[0021] Figure 3 In the drawings, 3a, 3b and 3c are examples of the original image, the tobacco pseudo-skeleton image and the image after the pseudo-skeleton is removed from the branches of a tobacco in a non-ring bifurcation form in the machine vision-based tobacco width measuring method of the embodiment of the present application.

[0022] Figure 4 In the drawings, 4a, 4b and 4c are examples of the original image, the tobacco pseudo-skeleton image and the image after the pseudo-skeleton is removed from the branches of a tobacco in a ring bifurcation form in the machine vision-based tobacco width measuring method of the embodiment of the present application.

[0023] Figure 5 In the drawings, 5a, 5b, 5c and 5d are examples of the original image, the real tobacco skeleton image, the tobacco skeleton two-end port marking image and the image after the tobacco skeleton two-end port is removed of a tobacco with irregular ports at both ends in the machine vision-based tobacco width measuring method of the embodiment of the present application.

[0024] Figure 6 In the drawings, 6a, 6b, 6c and 6d are examples of the original image, the binary image, the tobacco skeleton minimum width diameter finding image and the tobacco contour inscribed circle image of a tobacco in the machine vision-based tobacco width measuring method of the embodiment of the present application. DETAILED DESCRIPTION

[0025] The specific embodiments of the present application will be further described in detail below with reference to the accompanying drawings. These embodiments are only used to illustrate the present application, and are not limiting to the present application.

[0026] AsFigures 1 to 6 As shown, this invention provides an embodiment of a machine vision-based method for measuring tobacco width. The machine vision-based method for measuring tobacco width in this embodiment includes the following steps.

[0027] Step S1: Acquire the original image of the tobacco shreds.

[0028] Preferably, in step S1, the tobacco shreds are manually and evenly distributed on the stage, ensuring no overlap. A glass plate is used to flatten the tobacco shreds, and then a camera device is used to capture the original image of the tobacco shreds. The camera device is an existing high-definition camera, such as an industrial camera. The captured original image of the tobacco shreds is shown below. Figure 1 As shown in Figure 1a.

[0029] Step S2: Preprocess the original image of the tobacco.

[0030] Preferably, in step S2, the preprocessing includes Gaussian filtering for noise reduction, background segmentation, and binarization. Specifically, Gaussian filtering is applied to the acquired original image of the tobacco shreds for noise reduction. Since the background of the original tobacco shreds image is white, with a large contrast to the tobacco shreds, a thresholding method is used to segment the background. The B channel of the RGB color space is extracted from the image after Gaussian filtering for noise reduction. A threshold of 190 is set, and pixels in the original tobacco shreds image less than or equal to the threshold are marked as 1, while pixels greater than the threshold are marked as 0, achieving preliminary binarization of the original tobacco shreds image. Micropore region filling is then applied to the image after the first binarization to obtain the final binarized image, as shown below. Figure 1 As shown in Figure 1b. Then, the multiple tobacco shreds in the binarized image are separated, so that the detected tobacco shreds are white pixels and other areas are black pixel areas, so that each tobacco shred can be detected individually.

[0031] Step S3: Extract the outline and skeleton of the tobacco shreds.

[0032] In step S3, preferably, the outline of the tobacco shreds is extracted from the binarized image using the Canny operator, such as... Figure 2 As shown in Figures 2a and 2b. Further, based on the extracted tobacco shred contour image, an 8-neighborhood structure checklist is generated according to the judgment rules in the Zhang-Suen algorithm. The 8-neighborhood structure is then used to iteratively erode the tobacco shred contour to extract the pseudo-skeleton of the tobacco shreds, as shown in Figures 2a and 2b. Figure 2 As shown in Figure 2c. The Canny operator and the Zhang-Suen algorithm are well-known in this field and will not be elaborated upon here.

[0033] The pseudo-skeleton of tobacco is the center line of the tobacco shred outline. Based on the shape of the tobacco shreds, they are divided into conventional and unconventional shapes. Conventional tobacco shreds refer to normal strip-shaped tobacco shreds; the pseudo-skeleton extracted from conventional tobacco shreds is a single, unbranched line, such as... Figure 2 2C andFigure 5 As shown in Figure 5b. For tobacco shreds of conventional shape, the extracted pseudo-skeleton is the actual tobacco shred skeleton. Unconventional tobacco shreds refer to non-standard strip-shaped shreds, such as shreds exhibiting one or more combinations of annular, porous, or forked shapes, for example... Figure 3 3a and Figure 4 As shown in Figure 4a, the pseudo-skeleton extracted from non-standard shaped tobacco shreds will exhibit branching, which can be attributed to two situations: the first is due to the tobacco shred width being unacceptable; the second is due to overlapping of the tobacco shreds during cutting or placement for photography. Therefore, for non-standard shaped tobacco shreds, it is necessary to determine and remove the branches of the extracted pseudo-skeleton to obtain the true tobacco shred skeleton.

[0034] In this embodiment, based on whether or not they have a ring-like shape, non-circular tobacco shreds include non-circular branched tobacco shreds (such as...). Figure 3 (as shown in 3a) and / or annular branched tobacco (such as...) Figure 4 (As shown in 4a).

[0035] See Figure 3 The method for determining and removing the branches of the pseudo-skeleton of non-circular branched tobacco shreds includes the following steps in sequence.

[0036] Step a1: Generate a 3×3 pixel structure P. In the 3×3 pixel structure P, except for P(3,3) where the value is 0, all other pixel values ​​are 1.

[0037] Step a2: Create a pseudo-skeleton image of non-circular branched tobacco shreds (e.g., ...). Figure 3 In Figure 3b), the pixel with a pixel value of 1 is retrieved and the 8 neighboring pixels P0 around the pixel with a pixel value of 1 are extracted. The product matrix K of P and P0 at the same position is calculated, and the matrix K is summed and denoted as Ks. If Ks≥3, then the P0 matrix covers the pseudo skeleton branch node J.

[0038] Step a3: Set the branch nodes J in the pseudo-skeleton of the non-circular branched tobacco to 0. Divide the pseudo-skeleton of the non-circular branched tobacco into three parts. Traverse all parts of the skeleton and calculate the corresponding length. Find the shortest branch and mark its length as Cmin. Set a threshold R based on the width of the tobacco. If Cmin > R, keep the shortest branch; if Cmin ≤ R, set the shortest branch to 0 and remove it. Finally, obtain the image of the pseudo-skeleton of the non-circular branched tobacco after removing the branches (e.g., ...). Figure 3 As shown in 3c, the image of the pseudo skeleton of non-circular branched tobacco shreds after removing the branches is used as the real tobacco skeleton image of non-circular branched tobacco shreds.

[0039] join Figure 4 The method for determining and removing the branches of the pseudo-skeleton of annular forked tobacco shreds includes the following steps in sequence.

[0040] Step b1, image hole filling is performed on the pseudo skeleton of the annular bifurcated tobacco (as shown in FIG. 4a), and a difference between the image matrix formed and the pseudo skeleton of the annular bifurcated tobacco is obtained, to obtain a difference matrix as the annular region. Figure 4

[0041] Step b2, image dilation operation is performed on the annular region by using a 3*3 pixel structure, the pixel values of the 3*3 pixel structure are all 1, and a closed region annular contour is obtained by extracting the annular contour of the dilated annular region by using a canny operator.

[0042] Step b3, a 3*3 pixel structure P is generated, and the pixel values of the 3*3 pixel structure P are all 1 except that the value of P(3, 3) is 0.

[0043] Step b4, the pixels with a pixel value of 1 in the annular contour image are searched and the 8-neighborhood pixels P0 around the pixels with a pixel value of 1 are extracted, a same-position multiplication matrix K of P and P0 is calculated, a sum of the matrix K is calculated and recorded as Ks, and if Ks≥2, the P0 matrix covers the pseudo skeleton branch node J.

[0044] Step b5, the positions containing the branch node J in the annular contour are set to 0 respectively, the annular contour is divided into three parts, all the contour parts are traversed and the corresponding lengths are calculated, the shortest branch is found out and the length of the shortest branch is marked as Cmin, a threshold R is set according to the width of the tobacco, if Cmin>R, the shortest branch is reserved, and if Cmin≤R, the shortest branch is set to 0 and removed. Finally, the image of the pseudo skeleton of the annular bifurcated tobacco after removing the branch (as shown in FIG. 4c) is obtained, and the image is taken as the real tobacco skeleton image of the annular bifurcated tobacco. Figure 4

[0045] Therefore, the tobacco width measurement method based on machine vision has applicability to the stripping of tobacco skeletons of any shape, and has better measurement effect accuracy for special-shaped tobaccos such as annular tobaccos and bifurcated tobaccos. Meanwhile, for the branch generated when the tobacco skeleton is stripped, the tobacco width measurement method based on machine vision sets a suitable limited threshold according to the width of the tobacco, removes the branch noise, and increases the accuracy of the tobacco width measurement.

[0046] Since the tobacco may be randomly broken during the processing, irregular ports often appear at the tobacco port, and the end face of the irregular port is inclined relative to the width direction of the tobacco, as shown in FIG. 5a. Figure 5 Therefore, in the tobacco width measurement method based on machine vision, preferably, the irregular port of the real tobacco skeleton is also cut in step S3.​​

[0047] See Figure 5 Preferably, the method for cutting off the irregular ends of the real tobacco skeleton includes the following steps in sequence.

[0048] Step c1: Generate a 3×3 pixel structure P. In the 3×3 pixel structure P, except for P(3,3) where the value is 0, all other pixel values ​​are 1.

[0049] Step c2, for real tobacco skeleton images (such as...) Figure 5 In Figure 5b, for pixels with a value of 1, the 8-neighborhood pixels P0 surrounding the pixel with the value of 1 are retrieved. The product matrix K of the corresponding positions of P and P0 is calculated. The sum of matrix K is calculated. If the sum of matrix K is equal to 1, the corresponding pixel is marked and removed (e.g., ...). Figure 5 (As shown in 5c and 5d).

[0050] Step c3: Set a search count threshold. Repeat step c2 to cyclically remove pixels with a value of 1 from the actual tobacco skeleton image. The search count threshold is set based on the width of the tobacco shreds. The number of pixels equal to one tobacco shred width is set as the search count threshold, and the number of times step c2 is repeated is the set search count threshold. This allows one tobacco shred width to be removed from both ends of the tobacco skeleton.

[0051] Thus, step S3 yields the final tobacco skeleton.

[0052] Step S4: Based on the final tobacco skeleton obtained in step S3, see... Figure 6 The tobacco skeleton is a set of skeleton points, and the tobacco contour is a set of contour points. For each skeleton point on the tobacco skeleton, the Euclidean distance between the skeleton point and all contour points on the tobacco contour is calculated and the minimum value is taken. A circle is drawn with the skeleton point as the center and the minimum value as the radius. The diameter of the circle corresponding to all skeleton points on the tobacco skeleton is taken as the width set. The average value of the width set is calculated as the width detection value of the tobacco.

[0053] Specifically, in step S4, the set of positions of each skeleton point on the tobacco skeleton is extracted as T1(Xi, Yi), and the set of positions of each contour point on the tobacco contour is extracted as T2(Mj, Nj). The Euclidean distance D(i, j) of each point in T1(Xi, Yi) to T2(Mj, Nj) is calculated as follows:

[0054]

[0055] Calculate the minimum Euclidean distance between each point in T1(Xi, Yi) and all points in T2(Mj, Nj). Label this set of minimum values ​​as half-Dz. Construct an inscribed circle with this minimum value as the radius and the corresponding skeleton point as the center. The diameter of this circle is the width of the tobacco shred formed by the corresponding skeleton point. The set Dz of all circle diameters formed by skeleton points is the width set. Calculate the arithmetic mean Kd over Dz; Kd is the detected width value of the tobacco shred.

[0056] The machine vision-based tobacco width measurement method in this embodiment detects the width of the tobacco shreds formed by each skeleton point on the tobacco skeleton and the tobacco shred outline. It has a wide detection range and strict objectivity, and can measure the width of the tobacco shreds more objectively and accurately.

[0057] Taking an application example, the width of dried tobacco shreds with a shred width of 1.00 mm and 0.80 mm was measured using the machine vision-based tobacco shred width measurement method of this embodiment. Three cigarettes of the two sizes were taken respectively, and the tobacco shreds in the cigarettes were manually separated, evenly dispersed, and flattened. The width of the tobacco shreds was measured using the machine vision-based tobacco shred width measurement method of this embodiment. The results are shown in Table 1 below. The detection results of the width of tobacco shreds of the two specifications (1.00 mm and 0.80 mm) are close to the target values, with a consistency of 92.14% and 99.26% with the target values, respectively.

[0058] Table 1. Detection results of tobacco width for two specifications.

[0059] Sample type Width average / mm Width bias / mm 1# (1.00 mm) 1.05 0.40 2# (1.00 mm) 1.11 0.42 3# (1.00 mm) 1.08 0.40 Average (1.00 mm) 1.08 0.41 4# (0.80 mm) 0.79 0.32 5# (0.80 mm) 0.80 0.32 6# (0.80 mm) 0.83 0.33 Average (0.80 mm) 0.81 0.32

[0060] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and substitutions can be made without departing from the technical principles of the present invention, and these improvements and substitutions should also be considered within the scope of protection of the present invention.

Claims

1. A method for measuring the width of tobacco shreds based on machine vision, characterized in that, The steps are as follows: Step S1: Acquire raw images of the tobacco shreds; Step S2: Preprocess the original image of the tobacco shreds; Step S3: Extract the tobacco shred contour and tobacco skeleton. Based on the extracted tobacco shred contour image, generate an 8-neighborhood structure check table according to the judgment rules in the Zhang-Suen algorithm, and use the 8-neighborhood structure to iteratively erode the tobacco shred contour to extract the pseudo skeleton of the tobacco shred. For tobacco shreds with a regular shape, the pseudo skeleton is the real tobacco skeleton. For tobacco shreds with an irregular shape, the branches of the pseudo skeleton are judged and removed to obtain the real tobacco skeleton. The tobacco shreds with an irregular shape include non-annular branching tobacco shreds and / or annular branching tobacco shreds. The irregular ports of the real tobacco skeleton are cut off. Step S4: Calculate the Euclidean distance between each skeleton point on the tobacco skeleton and all contour points on the tobacco contour, and take the minimum value. Draw a circle with the skeleton point as the center and the minimum value as the radius. Use the diameter of the circle corresponding to all skeleton points on the tobacco skeleton as the width set, and calculate the average value of the width set as the width detection value of the tobacco.

2. The method for measuring tobacco width based on machine vision according to claim 1, characterized in that, In step S1, the tobacco shreds are evenly distributed on the stage and flattened with a glass plate, and then the original image of the tobacco shreds is captured using a camera device.

3. The method for measuring tobacco width based on machine vision according to claim 1, characterized in that, In step S2, the preprocessing includes Gaussian filtering for noise reduction, background segmentation, and binarization.

4. The method for measuring tobacco width based on machine vision according to claim 3, characterized in that, In step S3, the outline of the tobacco shreds is extracted from the binarized image using the Canny operator.

5. The method for measuring tobacco width based on machine vision according to claim 1, characterized in that, In step S3, the method for determining and removing the branches of the pseudo-skeleton of the non-annular branched tobacco shreds includes the following steps in sequence: Step a1: Generate a 3×3 pixel structure P, wherein the value of P(3,3) is 0. All other pixel values ​​are 1; Step a2: In the pseudo-skeleton image of the non-circular branched tobacco shreds, retrieve the pixels with a value of 1 and extract the 8-neighborhood pixels P0 surrounding the pixels with a value of 1. Calculate the product matrix K of P and P0 at the same position, and sum the matrices K. Let Ks be the matrix. If Ks ≥ 3, then the P0 matrix covers the pseudo-skeleton branch node J. Step a3: Set the branch node J positions in the pseudo skeleton of the non-circular branched tobacco to 0 respectively. Divide the pseudo skeleton of the non-circular branched tobacco into three parts. Traverse all parts of the skeleton and calculate the corresponding length. Find the shortest branch and mark the length of the shortest branch as Cmin. Set a threshold R according to the width of the tobacco. If Cmin > R, then keep the shortest branch; if Cmin ≤ R, then set the shortest branch to 0 and remove the shortest branch.

6. The method for measuring tobacco width based on machine vision according to claim 1, characterized in that, In step S3, the method for determining and removing the branches of the pseudo-skeleton of the annular branched tobacco shreds includes the following steps in sequence: Step b1: Fill the image hole in the pseudo skeleton of the annular branched tobacco shreds, and calculate the difference between the resulting image matrix and the pseudo skeleton of the annular branched tobacco shreds. The resulting difference matrix is ​​an annular region. Step b2: Perform image dilation on the annular region using a 3×3 pixel structure. The pixel value of the 3×3 pixel structure is 1. Extract the annular contour of the dilated annular region using the Canny operator. Step b3: Generate a 3×3 pixel structure P, wherein the value of P(3,3) is 0. All other pixel values ​​are 1; Step b4: Search for pixels with a value of 1 in the circular contour image and extract the 8 neighboring pixels P0 around the pixels with a value of 1. Calculate the product matrix K of P and P0 at the same position. Sum the matrix K and denote it as Ks. If Ks≥2, then the P0 matrix covers the pseudo skeleton branch node J. Step b5: Set the positions of the branch nodes J in the annular contour to 0 respectively. Divide the annular contour into three parts, traverse all parts of the contour and calculate the corresponding lengths, find the shortest branch and mark the length of the shortest branch as Cmin. Set a threshold R according to the width of the tobacco. If Cmin > R, then keep the shortest branch; if Cmin ≤ R, then set the shortest branch to 0 and remove the shortest branch.

7. The method for measuring tobacco width based on machine vision according to claim 1, characterized in that, In step S3, the method for cutting off the irregular ends of the actual tobacco skeleton includes the following steps in sequence: Step c1: Generate a 3×3 pixel structure P, wherein the value of P(3,3) is 0. All other pixel values ​​are 1; Step c2: Search for pixels with a value of 1 in the real tobacco skeleton image and extract the 8 neighboring pixels P0 around the pixels with a value of 1. Calculate the product matrix K of P and P0 at the same position. Summate the matrix K. If the sum of the matrix K is equal to 1, remove the corresponding pixel. Step c3: Set a threshold for the number of searches, and repeat step c2 to cyclically remove pixels with a value of 1 in the real tobacco skeleton image.

Citation Information

Patent Citations

  • Novel method for measuring width of cut tobacco based on machine vision detection technology

    CN110345874A

  • Computer vision tobacco shred width detection method based on reducing circle

    CN112330663A