Method, system, computer readable medium and measuring device for measuring tobacco length

The tobacco wire skeleton is extracted and pixel distance is calculated through image processing technology, which solves the problem of inaccurate measurement of tobacco wire length in the prior art, and achieves fast and accurate measurement of tobacco wire length.

CN114820763BActive Publication Date: 2025-03-28SHANGHAI TOBACCO GROUP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110120320.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-28
Publication Date
2025-03-28
Estimated Expiration
2041-01-28

AI Technical Summary

Technical Problem

It is difficult for the prior art to accurately measure the length of tobacco wire, especially when the tobacco wire has complex forms such as bends, silencing, mesh wires, etc., resulting in inaccurate measurement and inefficient efficiency.

Method used

By obtaining the true color image of the tobacco wire, pre-processing and connecting area segmentation, the skeleton of a single tobacco wire is extracted, the pixel distance between the end points in the skeleton is calculated, and the prediction model is fitted to obtain the length of the tobacco wire.

Benefits of technology

It realizes rapid and accurate measurement of the length of a single tobacco wire, with the tolerance controlled within (reference value ±5%), and the standard deviation is stable, and is suitable for complex forms of tobacco wire.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114820763B_ABST
    Figure CN114820763B_ABST
Patent Text Reader

Abstract

The present invention provides a method, system, computer-readable medium and measuring device for measuring the length of tobacco shreds. The measuring method comprises: obtaining a true color image of tobacco shreds; preprocessing the true color image of tobacco shreds; segmenting the preprocessed tobacco shreds image by connected regions to segment multiple tobacco shreds images into single tobacco shreds images; refining the single tobacco shreds image to extract the skeleton of the single tobacco shreds; finding the two endpoints with the longest distance in the skeleton of the single tobacco shreds, dividing the two endpoints with the longest distance into several segments according to corresponding internal points, calculating the pixel distance between each segment, adding the pixel distance between segments to obtain the pixel value of the length of the single tobacco shreds; fitting a prediction model of the length of tobacco shreds based on the pixel value of the length of the single tobacco shreds. The present invention can replace the vibrating screen, quickly and accurately measure the length of a single tobacco shreds, and provide a data basis for process quality control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of physical measurement in the tobacco industry, and relates to a measuring method and system, and in particular to a measuring method, system, computer-readable medium and measuring equipment for the length of tobacco shreds. Background Art

[0002] In the cigarette manufacturing process, the structure of tobacco has an important impact on the physical indicators and sensory quality of cigarettes. In the past process quality control, the width of the cut was monitored and tested as a key quality characteristic. With the development of cigarette manufacturing technology, fixed-length cutting technology has been increasingly widely used in various manufacturing companies to better control the quality of cigarettes. Many studies have shown the correlation between tobacco length and quality, including the existence of a demarcation point in the correlation polarity between tobacco of a specific length and the physical indicators of cigarettes, and significant differences in the chemical composition and sensory quality of tobacco of different lengths.

[0003] Therefore, it is of practical significance to accurately detect the length of tobacco. However, in actual production applications, tobacco has various forms such as bending, paralleling, and meshing, which brings difficulties to the application of machine vision technology. At present, there is no unified standard and method for tobacco length detection in the tobacco industry. The length distribution of tobacco structure mainly relies on vibration screening, and its size interval distribution is obtained by screening tobacco of different lengths. This method cannot avoid tobacco overlap, entanglement, etc., and the measurement system itself has large random errors. In recent years, some methods have also used visual detection technology to obtain images, shoot and obtain images during the free fall of tobacco, and use the minimum circumscribed rectangle to calculate the length of tobacco, but this algorithm is more suitable for more regular tobacco, and is not very applicable to distortion, paralleling, etc.

[0004] Therefore, how to provide a method, system, computer-readable medium and measuring equipment for measuring the length of tobacco shreds to solve the problem that the existing technology is more suitable for more regular tobacco shreds, but is not very applicable to distortion, parallelization and other situations, resulting in the inability to accurately and quickly measure the length of tobacco shreds has become a technical problem that needs to be urgently solved by technicians in this field. Summary of the invention

[0005] In view of the shortcomings of the prior art described above, an object of the present invention is to provide a method, system, computer-readable medium and measuring equipment for measuring the length of tobacco shreds, so as to solve the problem that the prior art is more suitable for more regular tobacco shreds, but is not very applicable to distortion, parallelization and the like, resulting in the inability to accurately and quickly measure the length of tobacco shreds.

[0006] To achieve the above-mentioned purpose and other related purposes, the present invention provides a method for measuring the length of tobacco shreds, comprising: obtaining a true color image of tobacco shreds; preprocessing the true color image of tobacco shreds; performing connected region segmentation on the preprocessed tobacco shreds image to segment multiple tobacco shreds images into single tobacco shreds images; performing refinement processing on the single tobacco shreds image to extract the skeleton of the single tobacco shreds; searching for two endpoints with the longest distance in the skeleton of the single tobacco shreds, dividing the distance between the two endpoints with the longest distance into a number of segments according to corresponding internal points, calculating the pixel distance between each segment, and adding the pixel distances between segments to obtain the pixel value of the length of the single tobacco shreds; fitting a prediction model for the length of tobacco shreds based on the pixel value of the length of the single tobacco shreds.

[0007] In one embodiment of the present invention, the step of preprocessing the tobacco true color image includes: performing average error filtering on the tobacco true color image to replace the pixel value of each point in the tobacco true color image with the difference between the pixel value of the point and the overall pixel average value; performing grayscale and binarization transformation on the tobacco true color image, and filling the image after the transformation to process the tobacco true color image into a black and white image; wherein the white pixel 1 is the image and the black pixel 0 is the background.

[0008] In one embodiment of the present invention, during the image filling process, the method for measuring the length of tobacco shreds also includes determining whether an 8-field around a pixel is a white pixel 1; the step of determining whether an 8-field around a pixel is a white pixel 1 includes: scanning the binarized tobacco shred image through a matrix block centered on the pixel to be filled, and recording the number of pixels covered by the matrix block whose value is 1; when the number of pixels covered by the matrix block whose value is 1 is greater than or equal to a numerical threshold, it indicates that the pixel covered by the matrix block whose value is 1 belongs to the image, and the pixel to be filled is assigned a value of 1, and it is considered that the pixel belongs to the image; when the number of pixels covered by the matrix block whose value is 1 is less than the numerical threshold, it indicates that the pixel covered by the matrix block whose value is 1 belongs to the background, and the pixel to be filled is assigned a value of 0, and it is considered that the pixel belongs to the background.

[0009] In one embodiment of the present invention, the step of performing connected region segmentation on the preprocessed tobacco image to segment multiple tobacco images into single tobacco images includes: searching the preprocessed tobacco image from top to bottom or from left to right for the first non-zero pixel point, when the pixel value of the pixel point is 1, if the pixel values ​​of all pixels in the 8-domain of the pixel point are zero, then assigning 1 to the point label of the pixel point; when the pixel value of the pixel point is 1, if there is a pixel neighborhood with a pixel value greater than 1 in the 8-domain of the pixel point, then assigning the minimum pixel value in the 8-domain to the point label of the pixel point, and recording that each pixel in the 8-domain belongs to a connected region; after the above steps are processed The first non-zero pixel point is searched from top to bottom or from left to right in the tobacco image, and when the pixel value of the pixel point is greater than 1, the minimum pixel value that is equal to the pixel point is found, and the minimum pixel value is assigned to the pixel point as a point label; each pixel point in the preprocessed tobacco image is looped through, and the pixel points with the minimum pixel value in the tobacco image are formed into a connected area; the above steps of searching for connected areas are looped until all non-zero pixels are found; when all connected areas are found, the connected areas in the tobacco image are rectangularly enclosed by an circumscribed rectangle, and the pixel values ​​of the pixels outside the enclosed area are marked as zero, and the tobacco image is segmented according to the enclosed area and the mark.

[0010] In one embodiment of the present invention, the step of performing thinning processing on the image of a single tobacco strand to extract the skeleton of a single tobacco strand includes: setting a 3*3 8-neighborhood matrix template; the pixel value of each position in the 8-neighborhood template depends on the pixels at different positions in the image corresponding to the template, if the pixel value corresponding to a position in the 8-neighborhood template is white, the position on the template is assigned a value of 1; if the pixel value corresponding to a position in the 8-neighborhood template is black, the position on the template is assigned a value of 0; and removing the boundary points on the side of the tobacco strand image to extract the skeleton of a single tobacco strand.

[0011] In one embodiment of the present invention, the step of removing the side boundary points in the tobacco image includes: searching for non-zero pixel points in the segmented tobacco image, determining whether the non-zero pixel points meet the deletion rule, if so, deleting them and setting their pixel values ​​to 0; if not, retaining the non-zero pixel points and defining them as skeleton points; wherein the pixel value of a non-zero pixel point is defined as L1, and the pixel values ​​of the domain points in the 8-neighborhood of the non-zero pixel point are L2, L3, L4, L5, respectively. L6, L7, L8, L9; the pixel value of the domain point in the 8-neighborhood of the non-zero pixel point is 1 or 0; the deletion rules include: among the 8 adjacent pixel points of the non-zero pixel point with pixel value L1, the number of image pixel points is greater than or equal to 2 and less than or equal to 6; the number of pairs of 0 values ​​or 1 values ​​between L2-L9-L2 in the order of front and back is equal to 1; and L2*L4*L6=0; L4*L6*L8=0; L2*L4*L8=0; L2*L6*L8=0.

[0012] In one embodiment of the present invention, the steps of searching for the two endpoints with the longest distance in the skeleton of the single tobacco shred, dividing the area between the two endpoints with the longest distance into several segments according to corresponding internal points, calculating the pixel distance between each segment, and adding the pixel distances between segments to obtain the pixel value of the length of the single tobacco shred include: searching for endpoints, brackets, and internal points in the skeleton of the single tobacco shred; pixel points with a pixel value of 1 are endpoints, pixel points with a pixel value of 2 are brackets, and pixel points with a pixel value greater than 2 are internal points; extracting endpoints with a pixel value of 1, and numbering the endpoints starting from the bottom of the tobacco shred image; traversing the number of internal points between the first endpoint and other endpoint brackets, searching for the endpoint with the longest distance from the first endpoint, and dividing the area between the two endpoints with the longest distance into several segments according to corresponding internal points; calculating the pixel distance between each segment, and adding the pixel distances between segments to obtain the pixel value of the length of the single tobacco shred.

[0013] In one embodiment of the present invention, the step of fitting a prediction model for the length of tobacco shreds based on the pixel value of the length of a single tobacco shred includes: linearly fitting the pixel value of the length of a single tobacco shred with the standard length value of the tobacco shreds to establish a prediction model for the length of tobacco shreds; the prediction model for the length of tobacco shreds is: l=kx+b; wherein x is the pixel value, l is the actual length value of the tobacco shreds, k is the coefficient, and b is the intercept.

[0014] On the other hand, the present invention provides a system for measuring the length of tobacco shreds, comprising: an acquisition module for acquiring a true color image of tobacco shreds; a preprocessing module for preprocessing the true color image of tobacco shreds; a segmentation module for performing connected region segmentation on the preprocessed tobacco shreds image to segment multiple tobacco shreds images into single tobacco shreds images; a refinement processing module for performing refinement processing on the single tobacco shreds image to extract the skeleton of the single tobacco shreds; a calculation module for searching the skeleton of the single tobacco shreds for the two endpoints with the longest distance, dividing the distance between the two endpoints with the longest distance into a plurality of segments according to corresponding internal points, calculating the pixel distance between each segment, and adding the pixel distances between segments to obtain the pixel value of the length of the single tobacco shreds; and a model building module for fitting a prediction model for the length of tobacco shreds based on the pixel value of the length of the single tobacco shreds.

[0015] Another aspect of the present invention provides a computer-readable medium having a computer program stored thereon, which implements the method for measuring the length of tobacco when executed by a processor.

[0016] The last aspect of the present invention provides a measuring device, comprising: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the measuring device executes the method for measuring the length of tobacco.

[0017] As described above, the tobacco length measurement method, system, computer-readable medium and measuring device of the present invention have the following beneficial effects:

[0018] First, the tobacco length measurement method, system, computer-readable medium and measuring device of the present invention can replace the vibrating screen to quickly and accurately measure the length of a single tobacco strand, providing a data basis for process quality control. It has been verified that the detection of tobacco strands of various lengths can control the tolerance of the single strand detection value within (reference value ± 5%), and a single strand of tobacco is randomly detected 20 times at different positions within the detection range, and a single strand of tobacco is repeatedly detected 20 times at the same position, and the standard deviation of the detection results is relatively stable.

[0019] Second, the tobacco length measurement method, system, computer-readable medium and measuring device described in the present invention provide an effective reference for the tobacco industry, which currently has no tobacco length measurement standard, and provide a basis and a beneficial supplement for verifying the feasibility of the calibration measurement method in the future. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 FIG. 1 is a schematic flow chart of a method for measuring tobacco length according to an embodiment of the present invention.

[0021] Figure 2 Shown is a schematic diagram of a true color image of tobacco shreds according to the present invention.

[0022] Figure 3 Shown is a schematic diagram of a tobacco cut image after being filtered by the tobacco cut length measurement method of the present invention.

[0023] Figure 4 Shown is a schematic diagram of an image of tobacco after filling using the method for measuring tobacco length according to the present invention.

[0024] Figure 5 A schematic diagram showing the marking of the connected areas of the tobacco shreds according to the present invention.

[0025] Figure 6 Shown is a schematic diagram of a tobacco cut image segmented by the tobacco cut length measurement method of the present invention.

[0026] Figure 7 Shown is a schematic diagram of the 8-neighborhood matrix template of the present invention.

[0027] Figure 8 Shown is a schematic diagram of endpoints, brackets, and internal points in the tobacco image of the present invention.

[0028] Fig.9A Shown is an example diagram of the combination pattern of neighborhood points 0 and 1 in the tobacco image of the present invention.

[0029] Fig. 9B Shown is a schematic diagram of the combination of neighborhood points in the tobacco image of the present invention.

[0030] Fig.10 Shown is a schematic diagram of removing two sides of pixels in a tobacco cut image according to the present invention.

[0031] Fig.11 It shows a schematic diagram of a tobacco cut image after being refined by the tobacco cut length measurement method of the present invention.

[0032] Fig.12 Shown is a schematic diagram of the tobacco pixel length image of the present invention.

[0033] Fig.13 Shown is a linear fit graph of the prediction model for tobacco cut length of the present invention.

[0034] Fig.14 It is a schematic diagram showing the principle structure of a method for measuring tobacco length in one embodiment of the present invention.

[0035] Component number description

[0036] 1. Measuring system of tobacco length

[0037] 21 Get Module

[0038] 22 Preprocessing Module

[0039] 23 Split Module

[0040] 24 Refinement processing module

[0041] 25 Computing Module

[0042] 26 Model Building Module

[0043] 27 Prediction Module

[0044] Steps S11 to S17 DETAILED DESCRIPTION

[0045] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0046] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0047] The technical principles of the tobacco length measurement method, system, computer-readable medium and measuring device of the present invention are as follows:

[0048] The images of multiple tobacco strands are simultaneously acquired through a machine vision platform, and image processing technology is used to perform pre-processing methods such as binarization, filtering, and thinning to extract the outline of tobacco strands, and the connected region marking segmentation technology is used to segment the images of multiple tobacco strands; endpoints and internal points are marked, and the two endpoints with the longest distance between the two end points and the corresponding internal points are used as the central skeleton of the tobacco strands, and the distance between the two end points with the longest distance is divided according to the corresponding internal points, and the sum of all pixel points in between is used as the pixel distance of the tobacco strands for calculation; by combining with a linear fitting equation, the pixel length is converted into the actual tobacco strand length, and multiple tobacco strands are quickly detected to ensure accuracy while improving efficiency to meet actual production needs. The invented method provides an effective reference for the current method of measuring tobacco strand length that has no calibration, and provides a basis and a beneficial supplement for verifying the feasibility of calibration measurement methods in the future.

[0049] Embodiment 1

[0050] This embodiment provides a method for measuring the length of tobacco shreds, comprising:

[0051] Obtain true color image of tobacco;

[0052] Preprocessing the tobacco true color image;

[0053] Performing connected region segmentation on the preprocessed tobacco image to segment multiple tobacco images into single tobacco images;

[0054] Performing thinning processing on the single tobacco image to extract the skeleton of the single tobacco;

[0055] Finding two endpoints with the longest distance in the skeleton of the single tobacco strand, dividing the distance between the two endpoints with the longest distance into a number of segments according to corresponding internal points, calculating the pixel distance between each segment, and adding the pixel distances between the segments to obtain the pixel value of the length of the single tobacco strand;

[0056] The prediction model of tobacco length is fitted based on the pixel value of the length of a single tobacco stick.

[0057] The following is a detailed description of the method for measuring the length of tobacco provided in this embodiment with reference to the accompanying drawings. Figure 1 , which is a schematic diagram of a method for measuring tobacco length in one embodiment. Figure 1 As shown, the method for measuring the length of tobacco shreds specifically comprises the following steps:

[0058] S11, obtain tobacco true color image, tobacco true color image Figure 2 As shown, the tobacco true color image includes a plurality of tobacco shreds. The expression of the tobacco true color image T is:

[0059] T = f(x, y)

[0060] Where x, y represent the x-axis and y-axis coordinates in a point continuous image, and f represents the pixel value of the image at point (x, y).

[0061] S12, preprocessing the tobacco true color image.

[0062] The S12 specifically includes the following steps:

[0063] The tobacco cut true color image is subjected to average error filtering processing to replace the pixel value of each point in the tobacco cut true color image with the difference between the pixel value of the point and the overall pixel average value. Figure 3 , showing the filtered tobacco image.

[0064] The tobacco cut true color image is grayscaled and binarized, and image filling is performed after the transformation to process the tobacco cut true color image into a black and white image; wherein white pixel 1 is the image and black pixel 0 is the background. Figure 4 , showing the image of tobacco after filling.

[0065] Wherein, during the image filling process, the method for measuring the length of tobacco shreds further includes determining whether an 8-field around a pixel is a white pixel 1; the step of determining whether an 8-field around a pixel is a white pixel 1 includes:

[0066] Scanning the binary tobacco image through a matrix block (e.g., a 3x3 matrix) centered on the pixel point to be filled, and recording the number N of 9 pixel points with a pixel value of 1 covered by the matrix block;

[0067] When the number of pixels covered by the matrix block with a value of 1 is greater than or equal to a threshold, it means that the pixel points with a pixel value of 1 covered by the matrix block belong to the image, and the pixel point (x, y) to be filled is assigned a value of 1, and it is considered that the pixel point belongs to the image;

[0068] When the number of pixels covered by the matrix block with a value of 1 is less than the threshold value, it means that the pixel points with a value of 1 covered by the matrix block belong to the background, and the pixel point (x, y) to be filled is assigned a value of 0, and it is considered that the pixel point belongs to the background.

[0069] S13, performing connected region segmentation on the preprocessed tobacco image to segment the multiple tobacco images into single tobacco images.

[0070] The S13 specifically includes the following steps:

[0071] Search the first non-zero pixel f(x, y) from top to bottom or from left to right for the preprocessed tobacco image. When the pixel value of the pixel is 1 (f(x, y) == 1), if the pixel values ​​of all the pixels in the 8-domain of the pixel are zero, then assign 1 to the point label of the pixel (the point label is to mark the connected area. When there are 5 points in an area that are all the same point label, then the other adjacent points, no matter what pixels they are, will be filled and covered with this point label), that is, f(x, y) = L = 1; when the pixel value of the pixel is 1, if there is a pixel neighborhood M with a pixel value L greater than 1 in the 8-domain of the pixel, then assign the minimum pixel value in the 8-domain to the point label of the pixel, and record that each pixel in the 8-domain belongs to the same connected area, that is, L[i] = {L1, L2.., LM}, all L in L[i] belong to the same connected area; please refer to Figure 5 , showing a schematic image of the markings of the connected areas of tobacco.

[0072] Search the first non-zero pixel f(x, y) from top to bottom or from left to right for the tobacco image processed by the above steps. When the pixel value of the pixel is greater than 1, find the minimum pixel value L of the same type and equal relationship with the pixel (the pixels of the same type and equal relationship with the pixel refer to pixels that are adjacent and the same, for example, pixels that are 1, 2, or 3 are adjacent and the same form a connected area), and assign the minimum pixel value L to the pixel as a point label; loop through each pixel in the preprocessed tobacco image, and form a connected area with the pixel points with the minimum pixel value in the tobacco image; loop through the above steps of searching for connected areas until all non-zero pixels are found;

[0073] When all connected regions are found, the connected regions in the tobacco image are enclosed by a circumscribed rectangle, and the pixel values ​​of the pixels outside the enclosed region are marked as zero. The tobacco image is segmented according to the enclosed region and the mark. Figure 6 , which is the segmented tobacco image. Figure 6 As shown, it is divided into n images.

[0074] in,

[0075] S14, performing a thinning process on the single tobacco strand image to extract the skeleton of the single tobacco strand.

[0076] The image segmented in S13 is thinned, and the image skeleton is extracted by removing the boundaries one by one, while maintaining the connectivity of the small parts of the image, highlighting the shape characteristics and deleting unnecessary contour points, and only retaining the skeleton points. A pixel point is defined as L1, and its 8-neighborhood points are L2, L3, ..., L9. Consider the actual situation of the neighborhood of the L1 point to decide whether to delete the L1 point. The background is black, with a value of 0, and the pixel value of the image object to be thinned is 1. The specific steps are:

[0077] Set a 3*3 8-neighborhood matrix template; for example, Figure 7 Schematic diagram of the 8-neighborhood matrix template is shown.

[0078] The pixel value of each position in the 8-neighborhood template depends on the pixels at different positions in the image corresponding to the template. If the pixel value corresponding to a position in the 8-neighborhood template is white, the value of this position in the template is 1; if the pixel value corresponding to a position in the 8-neighborhood template is black, the value of this position in the template is 0.

[0079] The side boundary points in the tobacco shreds image are removed to extract the skeleton of a single tobacco shred. In this embodiment, the step of removing the side boundary points in the tobacco shreds image includes:

[0080] Find the non-zero pixel points in the segmented tobacco image, and determine whether the non-zero pixel points meet the deletion rule. If so, delete them and set their pixel values ​​to 0; if not, keep the non-zero pixel points and define them as skeleton points;

[0081] The pixel value of a non-zero pixel is defined as L1, and the pixel values ​​of the domain points in the 8-neighborhood of the non-zero pixel are L2, L3, L4, L5, L6, L7, L8, and L9 respectively; the pixel values ​​of the domain points in the 8-neighborhood of the non-zero pixel are 1 or 0; the deletion rules include:

[0082] First, among the eight adjacent pixels of the non-zero pixel whose pixel value is L1, the number N(L1) of image pixels is greater than or equal to 2 and less than or equal to 6.

[0083] Specifically, 2≤N(L1)≤6, where: N(L1) represents the number of tobacco image pixels among the 8 pixels adjacent to L1, N(L1)=L2+L3+L4+L5+L6+L7+L8+L9, N(L1)≥2 will ensure that point L1 is not an endpoint or a separate point, and N(L1)≤6 will ensure that point L1 is a boundary point, not an internal point. N(L1)=0 means there are no points with any pixels of 1 around it, so L1 is a separate point, and N(L1)=1 means there is only one point with a pixel of 1, so it is an endpoint (an endpoint is surrounded by one and only one pixel with a value of 1). In this embodiment, endpoints, separate points, and internal points are not allowed to be deleted.

[0084] like Figure 8 As shown in the figure, N(L1)=0 means that there is no point with any pixel value of 1 around it, and L1 is a single point; N(L1)=1 means it is an endpoint, and an endpoint is a point with only one pixel value of 1 around it. When N(L1)>6, it is an internal point. When thinning, endpoints or single points and internal points are not allowed to be deleted; after a scan of the preprocessed image, not all boundary points, i.e. 2≤N(L1)≤6, need to be deleted, and the connectivity after deleting the points needs to be satisfied;

[0085] Second, the number of pairs of 0 or 1 between L2-L9-L2 in the order of front and back is equal to 1;

[0086] Specifically, T(L1) represents the number of pairs of values ​​0 and 1 in order between L2-L9-L2, for example. Fig.9A The following is an example of the 0 and 1 combination pattern. Fig.9A As shown, the number of 0 and 1 appears twice, T(L1) = 1, which can ensure the connectivity of the area after deleting the current pixel; if T(L1)>1, the current point L1 is deleted and the connectivity cannot be guaranteed.

[0087] like Fig. 9B As shown, the number of 01 combination patterns in the neighborhood of the pixel is not 1. If the point is deleted, the area will be disconnected.

[0088] Third, L2*L4*L6=0;

[0089] Fourth, L4*L6*L8=0;

[0090] Fifth, L2*L4*L8=0;

[0091] Sixth, L2*L6*L8=0.

[0092] Among them: when removing the right boundary points, L4 and L6 appear twice, one of which has a pixel of 0, then the third and fourth meet the conditions at the same time.

[0093] Among them: when removing the left boundary points, L2 and L8 appear twice, one of which has a pixel of 0, then the fifth and sixth meet the conditions at the same time.

[0094] like Fig.10 As shown, when L2*L4*L6=0, L4*L6*L8=0, L2*L4*L8=0, L2*L6*L8=0, the pixels on both sides are deleted;

[0095] In this embodiment, S14 may be iterated multiple times to obtain Fig.11 Skeleton diagram.

[0096] S15, searching for two endpoints with the longest distance in the skeleton of the single tobacco strand, dividing the distance between the two endpoints with the longest distance into a number of segments according to corresponding internal points, calculating the pixel distance between each segment, and adding the pixel distances between segments to obtain the pixel value of the length of the single tobacco strand. Fig.12 , which is an image showing the length of tobacco.

[0097] S15 specifically includes the following:

[0098] The endpoints, brackets, and internal points are searched in the skeleton of the single tobacco strand; the pixel points with a pixel value of 1 are the endpoints, the pixel points with a pixel value of 2 are the brackets, and the pixel points with a pixel value greater than 2 are the internal points.

[0099] Specifically,

[0100] Extract the endpoints with pixel value 1, and number the endpoints starting from the bottom of the tobacco image;

[0101] Traverse the first endpoint and the other endpoints to bracket your number of internal points H i(i=1,2,3,…,H), find the endpoint k with the longest distance from the first endpoint, and divide the distance between the two endpoints into several segments H according to the corresponding internal points i +1;

[0102] Specifically,

[0103] Calculate the pixel distance M between each segment i (j=2, 3, ..., L), add the pixel distances between segments to obtain the pixel value x of the length of a single tobacco strand.

[0104] Where x = x1 + x2 + ... + x H+1 .

[0105] S16, fitting a prediction model of tobacco length based on the pixel value of the length of a single tobacco strand.

[0106] Specifically, the pixel value of the length of a single tobacco shred is linearly fitted with the standard length value of the tobacco shred to establish a prediction model for the length of the tobacco shred; the prediction model for the length of the tobacco shred is l=kx+b;

[0107] Among them, x is the pixel value, l is the actual length of the tobacco, k is the coefficient, and b is the intercept.

[0108] See also Fig.13 , which is a linear fitting diagram of the prediction model of tobacco length. As shown in FIG13, by making linear fitting of different standard length values ​​and their corresponding pixel points, the coefficient of the quadratic equation of 0.1007 and the intercept of 1.641 are obtained, and the quadratic equation model of L = 0.1007x + 1.641 is established.

[0109] S17, predicting the length of the tobacco shreds using the prediction model for the length of the tobacco shreds.

[0110] Five groups of tobacco shreds of 40mm, 35mm, 30mm, 25mm and 20mm were randomly selected, and the length predicted by the model was obtained by the above method. Compared with the actual length, the detection results of tobacco shreds of various specifications can control the tolerance of single detection value within (reference value ± 5%). A single tobacco shred was randomly detected 20 times at different positions within the detection range, and a single tobacco shred was repeatedly detected 20 times at the same position. The standard deviation of the test results was relatively stable.

[0111] Table 1: Testing results of single tobacco of various lengths

[0112] Sample size (mm) 40mm 35mm 30mm 25mm 20mm Detection mean(mm) 39.85 35.20 30.09 24.65 20.04 Deviation limit (mm) 1.88 1.12 1.38 1.19 0.96

[0113] Table 2 Random detection of different positions of a single tobacco strand

[0114] Sample Specifications 40mm 35mm 30mm 25mm 20mm Detection mean(mm) 40.04 35.02 29.95 25.19 20.39 Standard Deviation 0.83 0.41 0.48 0.42 0.39

[0115] Table 3: Repeated testing of the same position of 40mm tobacco

[0116] Detection location A B C D E Detection mean(mm) 40.45 40.60 40.88 40.30 40.21 Standard Deviation 0.16 0.09 0.15 0.25 0.21

[0117] The method for measuring the length of tobacco shreds described in this embodiment has the following beneficial effects:

[0118] First, it can replace the vibrating screen to quickly and accurately measure the length of a single tobacco strand, providing a data basis for process quality control. It has been verified that the detection of tobacco strands of various lengths can control the tolerance of the single strand detection value within (reference value ± 5%), and a single strand of tobacco strand is randomly detected 20 times at different positions within the detection range, and a single strand of tobacco strand is repeatedly detected 20 times at the same position, and the standard deviation of the detection results is relatively stable.

[0119] Second, it provides an effective reference for the tobacco industry, which currently has no standard for measuring tobacco length, and provides a basis and a useful supplement for verifying the feasibility of calibration measurement methods in the future.

[0120] This embodiment also provides a computer-readable medium (also called a computer-readable storage medium) on which a computer program is stored. When the program is executed by a processor, the above-mentioned method for measuring the length of tobacco is implemented.

[0121] A person skilled in the art can understand that a computer-readable storage medium is: all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to the computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes.

[0122] Embodiment 2

[0123] This embodiment provides a tobacco length measurement system, comprising:

[0124] An acquisition module is used to acquire a true color image of tobacco;

[0125] A preprocessing module, used for preprocessing the tobacco true color image;

[0126] A segmentation module is used to perform connected region segmentation on the preprocessed tobacco image, so as to segment multiple tobacco images into single tobacco images;

[0127] A thinning processing module is used to perform thinning processing on the image of a single tobacco strand to extract the skeleton of the single tobacco strand;

[0128] A calculation module, used for finding two endpoints with the longest distance in the skeleton of the single tobacco strand, dividing the distance between the two endpoints with the longest distance into a number of segments according to corresponding internal points, calculating the pixel distance between each segment, and adding the pixel distances between the segments to obtain the pixel value of the length of the single tobacco strand;

[0129] The model building module is used to fit the prediction model of tobacco length based on the pixel value of the length of a single tobacco strand.

[0130] The following will describe in detail the tobacco length measurement system provided by this embodiment in conjunction with the diagram. Fig.14 , which is a schematic diagram showing the principle structure of a tobacco length measurement system in one embodiment. Fig.14 As shown, the tobacco length measurement system 2 includes: an acquisition module 21, a preprocessing module 22, a segmentation module 23, a refinement processing module 24, a calculation module 25, a model building module 26 and a prediction module 27.

[0131] The acquisition module 21 is used to acquire the true color image of the tobacco shreds.

[0132] The steps of preprocessing the tobacco true color image by the preprocessing module 22 include:

[0133] Specifically, the preprocessing module 22 performs average error filtering on the tobacco true color image to replace the pixel value of each point in the tobacco true color image with the difference between the pixel value of the point and the overall pixel average value; performs grayscale and binarization transformation on the tobacco true color image, and fills the image after the transformation to process the tobacco true color image into a black and white image; wherein the white pixel 1 is the image and the black pixel 0 is the background.

[0134] During the image filling process, the preprocessing module 22 determines whether the 8-area around a pixel is a white pixel 1; the preprocessing module 22 scans the binarized tobacco image through a matrix block centered on the pixel to be filled, and records the number of pixels covered by the matrix block with a value of 1; when the number of pixels covered by the matrix block with a value of 1 is greater than or equal to a numerical threshold, it means that the pixel covered by the matrix block with a pixel value of 1 belongs to the image, and the pixel to be filled is assigned a value of 1, and it is considered that the pixel belongs to the image; when the number of pixels covered by the matrix block with a value of 1 is less than the numerical threshold, it means that the pixel covered by the matrix block with a pixel value of 1 belongs to the background, and the pixel to be filled is assigned a value of 0, and it is considered that the pixel belongs to the background.

[0135] The segmentation module 23 is used to perform connected region segmentation on the preprocessed tobacco image, so as to segment multiple tobacco images into single tobacco images.

[0136] Specifically, the segmentation module 23 searches for the first non-zero pixel point from top to bottom or from left to right for the preprocessed tobacco image. When the pixel value of the pixel point is 1, if the pixel values ​​of all the pixels in the 8-domain of the pixel point are zero, then 1 is assigned to the point label of the pixel point; when the pixel value of the pixel point is 1, if there is a pixel neighborhood with a pixel value greater than 1 in the 8-domain of the pixel point, then the minimum pixel value in the 8-domain is assigned to the point label of the pixel point, and it is recorded that each pixel in the 8-domain belongs to a connected area; the tobacco image processed as above is searched for the first non-zero pixel point from top to bottom or from left to right. When the pixel value of the pixel is greater than 1, find the minimum pixel value that is equal to the pixel, and assign the minimum pixel value to the pixel as a point label; loop through the pixels in the preprocessed tobacco image, and form a connected area with the pixel points with the minimum pixel value in the tobacco image; loop through the above steps of finding connected areas until all non-zero pixels are found; when all connected areas are found, use the circumscribed rectangle to enclose the connected areas in the tobacco image, mark the pixel values ​​outside the enclosed area as zero, and segment the tobacco image according to the enclosed area and the mark.

[0137] The thinning processing module 24 is used to perform thinning processing on the image of a single tobacco strand to extract the skeleton of the single tobacco strand.

[0138] Specifically, the refinement processing module 24 sets a 3*3 8-neighborhood matrix template; the pixel value of each position in the 8-neighborhood template depends on the pixels at different positions in the image corresponding to the template. If the pixel value corresponding to a position in the 8-neighborhood template is white, the position on the template is assigned a value of 1; if the pixel value corresponding to a position in the 8-neighborhood template is black, the position on the template is assigned a value of 0; the side boundary points in the tobacco image are removed to extract the skeleton of a single tobacco strand.

[0139] The process of removing the side boundary points in the tobacco image by the thinning processing module 24 includes: searching for non-zero pixel points in the segmented tobacco image, determining whether the non-zero pixel points meet the deletion rule, if so, deleting them and setting their pixel values ​​to 0; if not, retaining the non-zero pixel points and defining them as skeleton points;

[0140] The pixel value of a non-zero pixel is defined as L1, and the pixel values ​​of the domain points in the 8-neighborhood of the non-zero pixel are L2, L3, L4, L5, L6, L7, L8, and L9 respectively; the pixel values ​​of the domain points in the 8-neighborhood of the non-zero pixel are 1 or 0; the deletion rules include:

[0141] Among the 8 adjacent pixels of the non-zero pixel with the pixel value L1, the number of image pixels is greater than or equal to 2 and less than or equal to 6;

[0142] The number of pairs of 0 or 1 between L2-L9-L2 in the order of precedence and follow is equal to 1; and

[0143] L2*L4*L6=0; L4*L6*L8=0; L2*L4*L8=0; L2*L6*L8=0.

[0144] The calculation module 25 is used to find the two endpoints with the longest distance in the skeleton of the single tobacco strand, divide the distance between the two endpoints with the longest distance into a number of segments according to the corresponding internal points, calculate the pixel distance between each segment, and add the pixel distances between the segments to obtain the pixel value of the length of the single tobacco strand. The steps include:

[0145] Specifically, the calculation module 25 searches for endpoints, brackets, and internal points in the skeleton of the single tobacco strand; pixel points with a pixel value of 1 are endpoints, pixel points with a pixel value of 2 are brackets, and pixel points with a pixel value greater than 2 are internal points; endpoints with a pixel value of 1 are extracted, and starting from the bottom of the tobacco strand image, the endpoints are numbered; the number of internal points of the first endpoint and other endpoint brackets is traversed to find the endpoint with the longest distance from the first endpoint, and the two endpoints with the longest distance are divided into several segments according to the corresponding internal points; the pixel distance between each segment is calculated, and the pixel distance between the segments is added to obtain the pixel value of the length of the single tobacco strand.

[0146] The model building module 26 is used to fit a prediction model of tobacco length based on the pixel value of the length of a single tobacco strand.

[0147] Specifically, the model building module 26 performs linear fitting on the pixel value of the length of a single tobacco shred and the standard length value of the tobacco shred to establish a prediction model for the length of the tobacco shred; the prediction model for the length of the tobacco shred is: l=kx+b; wherein x is the pixel value, l is the actual length value of the tobacco shred, k is the coefficient, and b is the intercept.

[0148] The prediction module 27 is used to predict the length of the tobacco shreds using the prediction model of the tobacco shreds length.

[0149] It should be noted that it should be understood that the division of the various modules of the above system is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements, or they can all be implemented in the form of hardware, or some modules can be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example: the x module can be a separately established processing element, or it can be integrated in a certain chip of the above system. In addition, the x module can also be stored in the memory of the above system in the form of program code, and called and executed by a certain processing element of the above system. The implementation of other modules is similar. These modules can be integrated together in whole or in part, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software. The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), one or more digital singnal processors (DSP), one or more field programmable gate arrays (FPGA), etc. When a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. These modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0150] Embodiment 3

[0151] This embodiment provides a measuring device, which includes a camera, an electronic control device, a holding platform and a camera holder. The electronic control device includes: a processor, a memory, a transceiver, a communication interface and / or a system bus; the memory and the communication interface are connected to the processor and the transceiver through the system bus and communicate with each other, the memory is used to store computer programs, the communication interface is used to communicate with other devices, and the processor and the transceiver are used to run computer programs, so that the measuring device performs each step of the method for measuring the length of tobacco as described in Example 1.

[0152] The system bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used to realize the communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM), and may also include non-volatile memory, such as at least one disk storage.

[0153] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0154] The protection scope of the method for measuring tobacco length described in the present invention is not limited to the execution order of the steps listed in this embodiment. All solutions implemented by adding, reducing or replacing steps in the prior art based on the principles of the present invention are included in the protection scope of the present invention.

[0155] The present invention also provides a tobacco length measuring system, which can implement the tobacco length measuring method described in the present invention. However, the implementation device of the tobacco length measuring method described in the present invention includes but is not limited to the structure of the tobacco length measuring system listed in this embodiment. All structural deformations and replacements of the prior art made according to the principles of the present invention are included in the protection scope of the present invention.

[0156] In summary, the tobacco length measurement method, system, computer-readable medium and measuring device of the present invention have the following beneficial effects:

[0157] First, the tobacco length measurement method, system, computer-readable medium and measuring device of the present invention can replace the vibrating screen to quickly and accurately measure the length of a single tobacco strand, providing a data basis for process quality control. It has been verified that the detection of tobacco strands of various lengths can control the tolerance of the single strand detection value within (reference value ± 5%), and a single strand of tobacco is randomly detected 20 times at different positions within the detection range, and a single strand of tobacco is repeatedly detected 20 times at the same position, and the standard deviation of the detection results is relatively stable.

[0158] Second, the tobacco length measurement method, system, computer readable medium and measuring device of the present invention provide an effective reference for the tobacco industry, which currently has no tobacco length measurement standard, and provide a basis and a beneficial supplement for verifying the feasibility of the calibration measurement method in the future. The present invention effectively overcomes various shortcomings in the prior art and has a high industrial utilization value.

[0159] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A method for measuring the length of tobacco shreds, characterized in that: include: Obtain true color image of tobacco; Preprocessing the tobacco true color image; Performing connected region segmentation on the preprocessed tobacco image to segment multiple tobacco images into single tobacco images; Performing thinning processing on the single tobacco image to extract the skeleton of the single tobacco; Finding two endpoints with the longest distance in the skeleton of the single tobacco strand, dividing the distance between the two endpoints with the longest distance into a number of segments according to corresponding internal points, calculating the pixel distance between each segment, and adding the pixel distances between the segments to obtain the pixel value of the length of the single tobacco strand; A prediction model for tobacco length is fitted based on the pixel value of a single tobacco length; The step of performing thinning processing on the single tobacco strand image to extract the skeleton of the single tobacco strand comprises: Set a 3*3 8-neighborhood matrix template; the pixel value of each position in the 8-neighborhood template depends on the pixels at different positions in the image corresponding to the template. If the pixel value corresponding to a position in the 8-neighborhood template is white, the position on the template is assigned a value of 1; if the pixel value corresponding to a position in the 8-neighborhood template is black, the position on the template is assigned a value of 0; Eliminate the side boundary points in the tobacco image to extract the skeleton of a single tobacco strand; The step of removing the side boundary points in the tobacco image comprises: Find non-zero pixel points in the segmented tobacco image, determine whether the non-zero pixel points meet the deletion rule, if so, delete them and set their pixel values ​​to 0; if not, keep the non-zero pixel points and define them as skeleton points; wherein, the pixel value of a non-zero pixel point is defined as L1, then the pixel values ​​of the neighboring points in the 8-neighborhood of the non-zero pixel point are L2, L3, L4, L5, L6, L7, L8, L9 respectively; the pixel values ​​of the neighboring points in the 8-neighborhood of the non-zero pixel point are 1 or 0; the deletion rule includes: among the 8 adjacent pixel points of the non-zero pixel point with the pixel value of L1, the number of image pixel points is greater than or equal to 2 and less than or equal to 6; the number of pairs of 0 values ​​or 1 values ​​between L2-L9-L2 in the order of front and back is equal to 1; and L2*L4*L6=0; L4*L6*L8=0; L2*L4*L8=0; L2*L6*L8=0; The steps of searching for two endpoints with the longest distance in the skeleton of the single tobacco strand, dividing the distance between the two endpoints with the longest distance into a plurality of segments according to corresponding internal points, calculating the pixel distance between each segment, and adding the pixel distances between segments to obtain the pixel value of the length of the single tobacco strand include: Search for endpoints, brackets, and internal points in the skeleton of the single tobacco; the pixel point with a pixel value of 1 is the endpoint, the pixel point with a pixel value of 2 is the bracket, and the pixel point with a pixel value greater than 2 is the internal point; extract the endpoint with a pixel value of 1, and number the endpoints starting from the bottom of the tobacco image; traverse the number of internal points of the first endpoint and other endpoint brackets, find the endpoint with the longest distance from the first endpoint, and divide the distance between the two endpoints into several segments according to the corresponding internal points; The pixel distance between each segment is calculated, and the pixel distances between segments are added together to obtain the pixel value of the length of a single tobacco strand.

2. The method for measuring the length of tobacco according to claim 1, characterized in that: The step of preprocessing the tobacco true color image comprises: Performing average error filtering on the tobacco true color image, so as to replace the pixel value of each point in the tobacco true color image with the difference between the pixel value of the point and the overall pixel average value; The tobacco shreds true color image is subjected to grayscale and binarization transformation, and image filling is performed after the transformation, so as to process the tobacco shreds true color image into a black and white image; wherein the white pixel 1 is the image, and the black pixel 0 is the background.

3. The method for measuring the length of tobacco according to claim 2, characterized in that: During the image filling process, the method for measuring the length of tobacco shreds further includes determining whether an 8-neighborhood around a pixel point is a white pixel 1; The step of determining whether the 8-neighborhood around a pixel is a white pixel 1 comprises: Scan the binary tobacco image through a matrix block centered on the pixel point to be filled, and record the number of pixels covered by the matrix block with a value of 1; When the number of pixels covered by the matrix block with a value of 1 is greater than or equal to a threshold, it means that the pixel points with a pixel value of 1 covered by the matrix block belong to the image, and the pixel points to be filled are assigned a value of 1, and it is considered that the pixel points belong to the image; When the number of pixels covered by the matrix block with a value of 1 is less than the threshold value, it means that the pixel points with a value of 1 covered by the matrix block belong to the background, and the pixel points to be filled are assigned a value of 0, and are considered to belong to the background.

4. The method for measuring the length of tobacco according to claim 2, characterized in that: The step of performing connected region segmentation on the preprocessed tobacco image to segment multiple tobacco images into single tobacco images comprises: The first non-zero pixel point is searched from top to bottom or from left to right for the preprocessed tobacco image. When the pixel value of the pixel point is 1, if the pixel values ​​of all the pixels in the 8-neighborhood of the pixel point are zero, then 1 is assigned to the point label of the pixel point; when the pixel value of the pixel point is 1, if there is a pixel neighborhood with a pixel value greater than 1 in the 8-neighborhood of the pixel point, then the minimum pixel value in the 8-neighborhood is assigned to the point label of the pixel point, and it is recorded that each pixel point in the 8-neighborhood belongs to the same connected area; Search the first non-zero pixel from top to bottom or from left to right for the tobacco image processed by the above steps, and when the pixel value of the pixel is greater than 1, find the minimum pixel value that is equal to the pixel, and assign the minimum pixel value to the pixel as a point label; loop through each pixel in the preprocessed tobacco image, and form a connected region with the pixel points with the minimum pixel value in the tobacco image; loop through the above steps of searching for connected regions until all non-zero pixels are found; When all connected regions are found, the connected regions in the tobacco image are enclosed by a circumscribed rectangle, and the pixel values ​​of the pixels outside the enclosed region are marked as zero, and the tobacco image is segmented according to the enclosed region and the mark.

5. The method for measuring the length of tobacco according to claim 1, characterized in that: The step of fitting a prediction model of tobacco length based on the pixel value of a single tobacco length comprises: Linearly fit the pixel value of the length of a single tobacco shred with the standard length value of the tobacco shred to establish a prediction model for the length of the tobacco shred; The prediction model of tobacco length is: l=kx+b; where x is the pixel value, l is the actual length of tobacco, k is the coefficient, and b is the intercept.

6. A tobacco length measuring system, characterized in that: include: An acquisition module is used to acquire a true color image of tobacco; A preprocessing module, used for preprocessing the tobacco true color image; A segmentation module is used to perform connected region segmentation on the preprocessed tobacco image, so as to segment multiple tobacco images into single tobacco images; A thinning processing module is used to perform thinning processing on a single tobacco strand image to extract the skeleton of a single tobacco strand; the thinning processing on the single tobacco strand image to extract the skeleton of a single tobacco strand includes: setting a 3*3 8-neighborhood matrix template; the pixel value of each position in the 8-neighborhood template depends on the pixels at different positions in the image corresponding to the template, if the pixel value corresponding to a position in the 8-neighborhood template is white, the position on the template is assigned a value of 1; if the pixel value corresponding to a position in the 8-neighborhood template is black, the position on the template is assigned a value of 0; remove the side boundary points in the tobacco strand image to extract the skeleton of a single tobacco strand; the removal of the side boundary points in the tobacco strand image includes: finding The non-zero pixel points in the segmented tobacco image are judged whether the non-zero pixel points meet the deletion rule. If so, delete them and set their pixel values ​​to 0; if not, keep the non-zero pixel points and define them as skeleton points; wherein, the pixel value of a non-zero pixel point is defined as L1, and the pixel values ​​of the neighboring points in the 8-neighborhood of the non-zero pixel point are L2, L3, L4, L5, L6, L7, L8, L9 respectively; the pixel values ​​of the neighboring points in the 8-neighborhood of the non-zero pixel point are 1 or 0; the deletion rule includes: among the 8 adjacent pixel points of the non-zero pixel point with the pixel value of L1, the number of image pixel points is greater than or equal to 2 and less than or equal to 6; the number of pairs of 0 values ​​or 1 values ​​between L2-L9-L2 in the order of front and back is equal to 1; and L2*L4*L6=0; L4*L6*L8=0; L2*L4*L8=0; L2*L6*L8=0; A calculation module is used to find the two endpoints with the longest distance in the skeleton of the single tobacco shred, divide the distance between the two endpoints with the longest distance into a plurality of segments according to corresponding internal points, calculate the pixel distance between each segment, and add the pixel distances between the segments to obtain the pixel value of the length of the single tobacco shred; the finding the two endpoints with the longest distance in the skeleton of the single tobacco shred, divide the distance between the two endpoints with the longest distance into a plurality of segments according to corresponding internal points, calculate the pixel distance between each segment, and add the pixel distances between the segments to obtain the pixel value of the length of the single tobacco shred comprises: Find endpoints, brackets, and internal points in the skeleton; the pixel point with a pixel value of 1 is the endpoint, the pixel point with a pixel value of 2 is the bracket, and the pixel point with a pixel value greater than 2 is the internal point; extract the endpoint with a pixel value of 1, and number the endpoints starting from the bottom of the tobacco image; traverse the number of internal points of the first endpoint and other endpoint brackets, find the endpoint with the longest distance from the first endpoint, and divide the distance between the two endpoints with the longest distance into several segments according to the corresponding internal points; calculate the pixel distance between each segment, and add the pixel distances between segments to obtain the pixel value of the length of a single tobacco strand; The model building module is used to fit the prediction model of tobacco length based on the pixel value of the length of a single tobacco strand.

7. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for measuring the length of tobacco shreds as claimed in any one of claims 1 to 5 is implemented.

8. A measuring device, characterized in that: include: Processor and memory; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the measuring device performs the method for measuring the length of tobacco according to any one of claims 1 to 5.

Citation Information

Patent Citations

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

    CN110345874A

  • Method for measuring aircraft skin surface state physical characteristics

    CN111256594A