Tobacco shredding result prediction method and prediction system
By predicting the results of tobacco shredding, the problem of controlling the length and width of the shredding process is solved, and the precise control of the quality of cigarettes is achieved.
Patent Information
- Application Number
- CN202311622330.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-30
- Publication Date
- 2025-05-30
AI Technical Summary
The prior art is difficult to effectively control and adjust the length and width of the shredding process in the shredding process, which affects the quality characteristics of cigarette products.
A tobacco shredding result prediction method is used to obtain a two-dimensional image of regular-shaped sheet smoke, encode and fit the prediction model, and then predict the shredding result parameters of irregular-shaped sheet smoke, guiding the adjustment of shredding angle and width.
It realizes a good prediction of the shredding result parameters of irregularly shaped sheet cigarettes in actual production, improves the control accuracy of cigarette quality, and solves the data error caused by occlusion and overlapping factors.
Smart Images

Figure CN120069143A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of cigarette manufacturing, and specifically relates to a method and a system for predicting the tobacco cutting result. Background Art
[0002] The cutting process is the top priority in the cigarette leaf-making process. The main technological task is to cut the moistened tobacco leaves or tobacco sheets into cut tobacco of a certain width. The control of the cutting length and width in the cutting process affects the quality characteristics of the cut tobacco, and further affects the rolling quality and sensory quality of the cigarette products.
[0003] Therefore, how to simulate the cutting result to adjust parameters such as the cutting angle and width has become an urgent problem to be solved.
[0004] In view of this, the present invention is specifically proposed. Summary of the Invention
[0005] An object of the present invention is to overcome the deficiencies of the prior art and provide a method for predicting the tobacco cutting result, which can predict the cutting result parameters of the irregular-shaped tobacco slices in actual production, so as to guide the staff to adjust the cutting parameters such as the cutting angle and cutting width accordingly to ensure the cigarette quality.
[0006] Another object of the present invention is to provide a prediction system adopting the above method for predicting the tobacco cutting result.
[0007] To achieve the first object of the invention, the following technical solutions are adopted:
[0008] A method for predicting the tobacco cutting result includes:
[0009] S1. Obtain the two-dimensional image of the to-be-processed tobacco slice with a regular shape and encode and label it;
[0010] S2. Obtain the cutting intersection points of any to-be-processed tobacco slice and the blade according to the encoding and labeling order and the cutting parameters to obtain its cutting result parameters;
[0011] S3. Fit the first prediction model according to the features of the obtained two-dimensional image of the to-be-processed tobacco slice and its corresponding cutting result parameters;
[0012] S4. Obtain the two-dimensional image of the to-be-processed tobacco slice with an irregular shape and predict its cutting result parameters based on the first prediction model.
[0013] Further, the step S4 includes:
[0014] S41. Obtain the two-dimensional image of the to-be-processed tobacco slice and extract the edge contour of the leaf;
[0015] S42. Code and label the to-be-processed cut tobacco, and capture and calculate the connected regions of the to-be-processed cut tobacco according to the coding and labeling order;
[0016] S43. Predict the independent cut tobacco result parameters of the to-be-processed cut tobacco with irregular shapes according to the number, geometric features of the connected regions and the first prediction model;
[0017] S44. Obtain the total cut tobacco result parameters in a superimposed form.
[0018] Further, the extraction of the blade edge contour includes:
[0019] S411. Convolve the two-dimensional image pixels of the to-be-processed cut tobacco obtained;
[0020] S412. Perform a threshold operation on the new pixel gray values after convolution to obtain the edge information of the to-be-processed cut tobacco.
[0021] Further, the step S42 includes:
[0022] S421. Scan the two-dimensional image of the extracted blade edge contour and mark the target pixels;
[0023] S422. Merge the connected regions with equivalent relationships but different label values generated during scanning into one connected region, and delete the duplicate equivalent pairs to obtain the number and geometric features of the connected regions;
[0024] The equivalent pair is different label values of the same connected region due to the scanning order.
[0025] Further, the scanning order in the step S421 is from left to right and from top to bottom.
[0026] Further, the step S421 marking the target pixels includes:
[0027] Judge whether the pixel in the upper left corner of the two-dimensional image is a target pixel. If so, its label value is 1. If not, scan the next pixel according to the scanning order;
[0028] When the next pixel is a target pixel, judge whether there are target pixels among the adjacent pixels that have been scanned. If not, add 1 to the previous label value;
[0029] If so, further judge the number of target pixels among the adjacent pixels. If there is only one target pixel, the current pixel label value is equal to the target pixel label value; if there are at least two target pixels, the current pixel label value is equal to the label value of the first scanned target pixel according to the priority of the scanning order.
[0030] Further, the adjacent pixels include one or more of the four positions: left, upper left, upper, and upper right;
[0031] The scanning order priorities are left, upper left, upper, and upper right in sequence.
[0032] Further, the formula for calculating the number of connected regions is:
[0033] Nc = MAXm - En + Er;
[0034] Where Nc represents the number of connected regions, MAXm represents the maximum value of the marker, En represents the number of equivalence pairs, Er represents the number of repeated equivalence pairs, and the repeated equivalence pairs mean that both marker values of the newly added equivalence pair already exist.
[0035] To achieve the second invention objective, the present invention adopts the following technical solutions:
[0036] A prediction system adopting the above-mentioned tobacco cutting result prediction method includes an input module, a calculation module, and an output module;
[0037] The input module is used to obtain a two-dimensional image of a to-be-processed tobacco slice with an irregular shape or a to-be-processed tobacco slice with a drawn regular shape;
[0038] The calculation module is used to calculate the cutting intersection points or predict the cutting result parameters according to the first prediction model;
[0039] The output module is used to display the cutting result parameters.
[0040] Further, the display modes of the output module include at least one of a numerical value and a line chart.
[0041] After adopting the above technical solutions, the present invention has the following beneficial effects compared with the prior art.
[0042] 1. The tobacco cutting result prediction method of the present invention can preferably predict the cutting result parameters of tobacco slices with irregular shapes in actual production, so as to guide the staff to correspondingly adjust cutting parameters such as the cutting angle and the cutting width to ensure the quality of cigarettes.
[0043] 2. The present invention predicts the cutting result parameters of tobacco slices with irregular shapes based on connected region capture, with high calculation accuracy, small calculation amount, and solves data errors caused by factors such as occlusion and overlap, and can efficiently and robustly process the image data of tobacco slices.
[0044] The following further describes in detail the specific embodiments of the present invention with reference to the accompanying drawings. Description of the Drawings
[0045] The accompanying drawings, as part of the present invention, are used to provide a further understanding of the present invention. The schematic embodiments and descriptions thereof of the present invention are used to explain the present invention, but do not constitute an improper limitation to the present invention. Obviously, the accompanying drawings in the following description are only some embodiments, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts. In the drawings:
[0046] Figure 1 It is a schematic flowchart of the method for predicting the tobacco cutting result of the present invention.
[0047] It should be noted that these drawings and textual descriptions are not intended to limit the scope of the concept of the present invention in any way, but to illustrate the concept of the present invention to those skilled in the art by referring to specific embodiments. Detailed Embodiments
[0048] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. The following embodiments are used to illustrate the present invention, but are not used to limit the scope of the present invention.
[0049] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "upper", "lower", "front", "rear", "left", "right", "vertical", "inner", "outer", etc. is based on the orientation or positional relationship shown in the accompanying drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the present invention.
[0050] In the description of the present invention, it should be noted that unless otherwise clearly specified and defined, the terms "installed", "connected", and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0051] As Figure 1 shown, the present invention provides a method for predicting the tobacco cutting result to predict the cutting result parameters of irregular-shaped tobacco slices in actual production, so as to guide the staff to adjust the cutting parameters such as the cutting angle and cutting width accordingly to ensure the cigarette quality.
[0052] Specifically, the method for predicting the tobacco cutting result of the present invention includes:
[0053] S1. Obtain a two-dimensional image of the to-be-processed tobacco slice with a regular shape and perform coding and labeling on it;
[0054] S2. Obtain the cutting intersection points of any to-be-processed tobacco slices and the blades according to the coding annotation order and the cutting parameters, so as to obtain the cutting result parameters thereof.
[0055] S3. Fit a first prediction model according to the features of the two-dimensional image of the to-be-processed tobacco slices obtained and the corresponding cutting result parameters.
[0056] S4. Obtain the two-dimensional image of the to-be-processed tobacco slices with irregular shapes and predict the cutting result parameters thereof based on the first prediction model.
[0057] Considering that a large number of tobacco slices need to be cut simultaneously during actual production, in order to ensure the prediction effect and reduce the statistical error, the present invention performs coding annotation on multiple tobacco slice samples, and then performs simulated cutting in sequence based on the coding annotation order, and obtains the cutting result parameters in a superimposed form.
[0058] In the present invention, the tobacco slices with regular shapes are the tobacco slice shapes directly input by the staff, and their shapes can be any polygon or other shapes. Correspondingly, the tobacco slices with irregular shapes are the to-be-processed tobacco slices obtained during actual production.
[0059] After obtaining the two-dimensional image of the tobacco slices with regular shapes, based on the cutting determination of the parallel blades, the cutting intersection points of the to-be-processed tobacco slices and the blades can be obtained. Then, based on the cutting intersection points, the cutting result parameters of the tobacco slices with regular shapes under the currently set cutting parameters can be obtained, and further a first prediction model that can be applied to actual production and used to predict the cutting result parameters of the tobacco slices with irregular shapes can be fitted.
[0060] Specifically, calculating the cutting intersection points of the two-dimensional image and the blades is defined in the present invention as determining the intersection points between lines and the positional relationship between two lines and solving for the intersection points within the detection plane.
[0061] The positional relationship between two line segments can generally be divided into three categories: having an overlapping part, having no overlapping part but having an intersection point (intersecting), and having no intersection point. To avoid accuracy problems, all cases of overlap need to be excluded first.
[0062] Overlap can be divided into three cases: complete overlap, one-end overlap, and partial overlap. Obviously, when the starting and ending points of two line segments are the same, it is complete overlap; when only the starting points are the same or only the ending points are the same, it is one-end overlap (note: when the ending point of the line segment with a smaller coordinate is the same as the starting point of the line segment with a larger coordinate, it is determined to be intersecting). To determine whether there is partial overlap, it is necessary to first determine whether they are parallel.
[0063] Let line segments L1(p1p2) and L2(p3p4), where p1(x1, y1) is the starting point of the first line segment, p2(x2, y2) is the ending point of the first line segment, p3(x3, y3) is the starting point of the second line segment, and p4(x4, y4) is the ending point of the second line segment. Thus, two vectors can be constructed: v1(x2 - x1, y2 - y1) and v2(x4 - x3, y4 - y3).
[0064] If the cross product v1×v2 of v1 and v2 is 0, then the two line segments are parallel and there may be partial overlap. Then, determine whether the two parallel line segments are collinear. The method is to construct a vector vs with one end of L1 and one end of L2 and take the cross product with v2. If vs is also parallel to v2, then the two line segments are collinear (three points are collinear). On the premise of collinearity, if the ending point of the line segment with the smaller starting point is greater than the starting point of the line segment with the larger starting point, it is determined to be partially overlapping.
[0065] If there is no overlap, it is necessary to determine whether the two lines intersect. First, perform a quick rejection test: regard the two line segments as the diagonals of two rectangles and construct these two rectangles. If there is no overlapping part between these two rectangles (the x - coordinates are separated or the y - coordinates are separated), it can be determined that they do not intersect.
[0066] Then perform the straddle test. Two intersecting line segments must straddle each other, that is, the two points p1 and p2 are on both sides of L2 and the two points p3 and p4 are on both sides of L1. In this way, a judgment can be made using the cross product.
[0067] Construct vectors s1(p3, p1) and s2(p3, p2) respectively. If s1×v2 and s2×v2 have different signs, it means that p1 and p2 are on both sides of L2. Similarly, it can be determined whether p3 and p4 straddle L1. It should be noted that if any one of the above four cross products is 0, it means that the endpoint of one line segment is on the other line.
[0068] After determining that the two line segments intersect, the intersection point can be solved. Of course, the intersection point can be obtained by using plane geometry methods and listing the point - slope form equations. However, this will be difficult to handle special cases where the slope is 0, and there will be multiple divisions in the operation, making it difficult to guarantee the accuracy. Therefore, the present invention uses the vector method to solve.
[0069] Specifically, let the intersection point be (x0, y0), then the following system of equations must hold:
[0070] x0 - x1 = k1(x2 - x1) ①;
[0071] y0 - y1 = k1(y2 - y1) ②;
[0072] x0 - x3 = k2(x4 - x3) ③;
[0073] y0-y3=k2(y4-y3)④;
[0074] Where k1 and k2 are any non-zero constants (if they are 0, it means that there are overlapping endpoints, which has been ruled out above). Relating equation 1 with equation 2, and combining equation 3 with equation 4, eliminating k1 and k2, we get:
[0075] x0(y2-y1)-x1(y2-y1)=y0(x2-x1)-y1(x2-x1);
[0076] x0(y4-y3)-x3(y4-y3)=y0(x4-x3)-y3(x4-x3);
[0077] Move the terms containing the unknowns x0 and y0 to the left and the constant terms to the right, and we get:
[0078] (y2-y1)x0+(x1-x2)y0=(y2-y1)x1+(x1-x2)y1;
[0079] (y4-y3)x0+(x3-x4)y0=(y4-y3)x3+(x3-x4)y3;
[0080] Assume the two constant terms are b1 and b2:
[0081] b1=(y2-y1)x1+(x1-x2)y1;
[0082] b2=(y4-y3)x3+(x3-x4)y3;
[0083] The coefficient determinant is D. Substituting b1 and b2 for the coefficient of x0 gives D1, and substituting b1 and b2 for the coefficient of y0 gives D2. Then we have:
[0084] |D|=(x2-x1)(y4-y3)-(x4-x3)(y2-y1);
[0085] |D1|=b2(x2-x1)-b1(x4-x3);
[0086] |D2|=b2(y2-y1)-b1(y4-y3);
[0087] Thus, the coordinates of the intersection point can be obtained as:
[0088] x0=|D1| / |D|, y0=|D2| / |D|.
[0089] After obtaining multiple intersection points of the blade and the simulated cutting of the tobacco leaf, the length, width, area and other data of the cut tobacco can be further calculated. Combining the geometric characteristics of the cut tobacco and the two-dimensional image of the obtained regular-shaped cut tobacco, the first prediction model of the cut tobacco result parameters can be fitted to predict the cut tobacco result parameters of the actually collected irregular-shaped cut tobacco.
[0090] Further, step S4 in the present invention specifically includes:
[0091] S41. Obtain a two-dimensional image of the to-be-processed cut tobacco and extract the leaf edge contour thereof;
[0092] S42. Perform coding and labeling on the to-be-processed cut tobacco, and capture and calculate the connected regions of the to-be-processed cut tobacco according to the coding and labeling sequence;
[0093] S43. Predict the cut tobacco result parameters of the to-be-processed irregular-shaped cut tobacco independently according to the number, geometric characteristics and the first prediction model of the connected regions;
[0094] S44. Obtain the total cut tobacco result parameters in a superimposed form.
[0095] Among them, the Sobel operator is used for extracting the leaf edge contour. The Sobel operator believes that the influence of the pixels in the neighborhood on the current pixel is not equivalent, so pixels at different distances have different weights, and the influence on the operator result is also different. Generally speaking, the farther the distance, the smaller the influence. Specifically, it includes:
[0096] S411. Convolve the pixels of the two-dimensional image of the to-be-processed cut tobacco obtained;
[0097] S412. Perform a threshold operation on the gray values of the new pixels after convolution to obtain the edge information of the to-be-processed cut tobacco.
[0098] That is:
[0099]
[0100] Where A represents the original image, and Gx and Gy respectively represent the gray values of the images after horizontal and vertical edge detections.
[0101] The horizontal and vertical gray values of each pixel of the image are combined through the following formula to determine the magnitude of the gray value G of this point:
[0102]
[0103] In another embodiment, to improve efficiency, the gray value G can also use an approximate value without taking the square root, that is, |G| = |Gx| + |Gy|.
[0104] After obtaining the edge contour of the leaf, the capture and calculation of the to-be-processed tobacco slice connected region can be carried out based on the coding annotation order. Specifically, the present invention transforms the obtained two-dimensional image of the irregular tobacco slice into a grayscale image, takes its edge binary mask, and then respectively performs dilation, filling holes, and clearing edges on the edge binary mask. The capture and calculation of the connected region are carried out based on the processed binary image.
[0105] Furthermore, the present invention also performs polygon fitting on the edge contour of the binary image to obtain the geometric features and quantities of all input two-dimensional images.
[0106] The binary image contains two colors: black (pixel value is 0) and white (pixel value is 1 or 255), which are used as the background color and the target color respectively. Specifically, it is assumed that the target is white and the background is black. The marking algorithm only marks the target pixels, that is, only the pixels with pixel values of 1 or 255 are marked. The connectivity between pixels is an important concept for determining regions. In a two-dimensional image, assume that there are m (m≤8) adjacent pixels around a target pixel point. If the gray level of this pixel is equal to that of a certain pixel A among these m pixels, then it is said that this pixel has connectivity with A. The commonly used connectivities are 4-connectivity and 8-connectivity. 4-connectivity selects the 4 points above, below, left, and right of the target pixel. 8-connectivity selects all adjacent pixels of the target pixel in the two-dimensional space, that is, in addition to the 4-connected points, it also includes the 4 points in the upper left, upper right, lower left, and lower right.
[0107] Combined with the tobacco slice detection situation and actual requirements, the present invention selects to adopt 8-connected regions. Step S42 includes:
[0108] S421. Scan the two-dimensional image of the extracted leaf edge contour and mark the target pixels;
[0109] S422. Merge the connected regions with equivalent relationships but different marking values generated during scanning into one connected region, and delete the duplicate equivalent pairs to obtain the number and geometric features of the connected regions. The equivalent pairs are the different marking values of the same connected region due to the scanning order.
[0110] Among them, when scanning the binary image, it is necessary to first find the storage address of the image data in the memory, and then compare each 8-bit integer data after the storage address. Assume that the processed image format is 8-bit BMP. The scanning order of the image is from left to right and from top to bottom. For each target pixel point, its connectivity can only be determined based on the pixel points whose connectivity has been determined. Therefore, for an ordinary pixel point, it only needs to scan its own and the pixel points with determined connectivity around it to determine its own connectivity, that is, scan the gray levels of the 4 pixels on the left, upper left, upper, and upper right.
[0111] In an embodiment of the present invention, the binary image scanning step in the connectivity algorithm is summarized as follows:
[0112] First, mark the first pixel in the upper left corner of the image, that is, the point where the first row (the uppermost row) and the first column (the leftmost column) intersect. If the gray value of this pixel is 255, mark the value of this point as 1; if the gray value of this point is not 255, start scanning the next pixel;
[0113] Mark the pixels in the first row of the image. At this time, there will be no equivalent situation, and there is no need to consider recording equivalent pairs; scan each pixel in the first row. If its gray value is 255, check whether the gray value of its left adjacent pixel is 255. If so, the current scanned pixel has the same mark value as the left pixel. If the gray value of the left pixel is not 255, the current scanned pixel is marked as the previous mark value plus 1; if the gray value of the currently scanned pixel is not 255, continue scanning the next pixel;
[0114] Mark the pixels except those in the first row (the uppermost row). At this time, there will be equivalent situations, and equivalent pairs need to be recorded. Specifically,
[0115] ①. First, process the first pixel in each row, which is generally to process the leftmost column of the image; if this pixel is a background pixel, that is, the gray value is 0, scan the next pixel in this row; if this pixel is a target pixel, that is, the gray value is 255, then it is necessary to check the mark values of the two adjacent pixels above and to the upper right of this pixel. If the upper adjacent pixel is marked, the mark value of the currently scanned pixel is equal to the mark value of the upper adjacent point. At this time, check whether the upper right point is marked. If it is also marked, compare whether the mark values of the upper point and the upper right point are the same. If they are different, it is determined that the mark values of the upper adjacent point and the upper right adjacent point are a group of equivalent pairs and are recorded in the equivalent mark table; if the upper adjacent point is not marked, check whether the upper right adjacent point is marked. If it is marked, the mark value of the currently scanned pixel is equal to the mark value of the upper right adjacent point; if neither the upper nor the upper right adjacent point is marked, make the mark value of the currently scanned pixel equal to the previous mark value plus 1.
[0116] ②. Mark the midpoints of each row. If the current pixel is a target point, check the marking status of the 4 adjacent pixels to the left, upper left, above, and upper right (according to the adopted scanning order, these 4 adjacent pixels have been processed when the current pixel is scanned). If the gray values of the above 4 adjacent pixels are all 0, give the current pixel a new mark, equal to the previous mark value incremented by 1; if only one pixel P among the 4 adjacent pixels has a gray value of 255, assign the mark value of pixel P to the current pixel; if there are m (1 < m ≤ 4) pixels among the 4 adjacent pixels with a gray value of 255, determine the mark value of the current pixel in the priority order of left, upper left, above, and upper right. Then perform an equivalence analysis on the mark values owned by these m pixels. If the mark values of the m pixels are different, take the different mark values as equivalence pairs and add them to the equivalence mark table. For example, when the gray values of the 4 pixels are all 255, assign the mark value of the left pixel to the current pixel, then create 3 equivalence pairs: left is equivalent to upper left, left is equivalent to above, and left is equivalent to upper right. Then compare whether the two mark values in each equivalence pair are equal. If not, add the equivalence pair to the equivalence mark table.
[0117] ③. Mark the last point of each row. Generally speaking, it is to process the rightmost column of the image. If the gray value of the current pixel is 255, check the marking status of the 3 adjacent pixels to the left, upper left, and above. The processing method is the same as in ① and ②.
[0118] ④. Repeat step ③ until the connected marking process of the last row of the image is completed. At this time, the entire image is scanned, and the equivalence mark table is obtained simultaneously.
[0119] Furthermore, in the present invention, a data structure AREA is designed according to the characteristics of the connected region to store the geometric feature parameters of the connected region:
[0120]
[0121]
[0122] The calculation formulas are as follows:
[0123] AREA.size = AREA.points.size() (1)
[0124] AREA.center.x = (∑AREA.points.x) / AREA.size (2)
[0125] AREA.center.y = (∑AREA.points.y) / AREA.size (3)
[0126] AREA.rect.left = MIN(AREA.points.x) (4)
[0127] AREA.rect.right = MAX(AREA.points.x) (5)
[0128] AREA.rect.top = MIN(AREA.points.y) (6)
[0129] AREA.rect.bottom = MAX(AREA.points.y) (7)
[0130] Where MIN and MAX are the minimum and maximum value functions, ∑ is the element accumulation operation, and size() is the vector calculation capacity function. While scanning the pixels, the target pixels with the same marked value are saved into the points of the same AREA structure until the scanning ends. Then, according to equations (1) to (7), the geometric feature parameters of each connected region AREA are calculated.
[0131] In an embodiment of the present invention, a recursive method is adopted for the equivalent pairs in the equivalent label table. In each recursive iteration, all equivalent labels belonging to the same connected region are found from the equivalent pair table, reclassified into one category, and the equivalent pairs containing them are deleted from the equivalent pair table. At the same time, it is also analyzed whether there are duplicate equivalent pairs in this type of equivalent pairs. The concept of duplicate equivalent pairs refers to that both marked values of a newly added equivalent pair exist in the equivalent label linked list belonging to the same connected region. For example, the equivalent label linked list has the following marks: 1, 4, 7, 11, 15, and the newly added equivalent pair is (1, 15), then the newly added equivalent pair (1, 15) is called a duplicate equivalent pair. Duplicate equivalent pairs are used to calculate the number of connected regions in the entire frame of the image.
[0132] Specifically, to determine the labels belonging to the same connected region in each recursive iteration, a tree search method is adopted. That is, first, the first equivalence pair in the equivalence pair table for each time is pushed into an empty linked list. Then, taking this as the root of the tree, search for the equivalence pairs containing the elements in the linked list in the equivalence pair table. If found, when only one element of the qualified equivalence pair exists in the linked list, then push the other element into the linked list and delete this equivalence pair from the equivalence pair table; when both elements of the qualified equivalence pair exist in the linked list, increment the number of duplicate equivalence pairs by 1, and at the same time delete this equivalence pair from the equivalence pair table; then search for the next label value in the linked list in the equivalence pair table. Keep searching until all the label values in the linked list are not in the equivalence pair table. At this time, all the connected regions labeled by the label values in the linked list belong to the same connected region, and save this linked list. Then, uniformly store all the points in the AREA represented by the label values in the linked list into the points of a new AREA, and recalculate the geometric feature parameters of the new AREA according to formulas (1) to (7):
[0133] In each recursion, search for all the equivalence pairs belonging to the same connected region from the equivalence pair table, label the regions marked by the elements in these equivalence pairs with one label value, calculate the geometric feature parameters of the new connected region, and save these geometric feature parameters; and delete these equivalence pairs from the equivalence pair table, and the number of equivalence pair elements in the equivalence pair table gradually decreases. Each recursion will return the remaining equivalence pair table after the deletion operation and the current number of duplicate equivalence pairs. After a finite number of recursive iterations, when the number of elements in the equivalence pair table is 0, at this time, the analysis of the equivalence pair table is completed, and the recursive iteration stops running.
[0134] The statistical formula for the number of connected regions is as follows:
[0135] Nc = MAXm - En + Er (8)
[0136] Where: Nc represents the number of connected regions in the image; MAXm represents the maximum label number generated after scanning the image; En represents the number of equivalence pairs in the equivalence pair table; Er represents the number of duplicate equivalence pairs in the equivalence pair table.
[0137] After obtaining the number and geometric features of the connected regions, the cutting result parameters can be predicted based on the first prediction model. Specifically, the present invention performs independent simulation cutting on multiple pieces of to-be-processed cut tobacco respectively based on the coding annotation order, obtains the independent cutting result parameters respectively, and then obtains the final cutting result parameters in a superimposed form and outputs them, with a high calculation success rate and reduced statistical error.
[0138] The present invention also provides a prediction system adopting the above-mentioned tobacco cutting result prediction method, which includes an input module, a calculation module and an output module. Among them, the user can draw a regular-shaped tobacco sheet through the input module to fit the first prediction model, and the input module can also be used to obtain the two-dimensional image of the irregular-shaped tobacco sheet;
[0139] The calculation module is used to calculate the cutting intersection points of the regular-shaped tobacco sheet and the blade, or predict the cutting result parameters of the irregular-shaped tobacco sheet according to the fitted first prediction model, and feedback the total cutting result parameters to the output module;
[0140] The output module is used to display the total cutting result parameters, for example, in the form of numerical values or line charts.
[0141] Furthermore, the output module can also display the two-dimensional image of the regular-shaped tobacco sheet or the irregular-shaped tobacco sheet to have a more intuitive interaction with the user.
[0142] The above are only the preferred embodiments of the present invention, and do not impose any form of limitation on the present invention. Although the present invention has been disclosed above with the preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art of this patent can make some changes or modifications into equivalent embodiments with equivalent changes by using the technical content prompted above within the scope of the technical solution of the present invention. The implementation schemes in the above embodiments can also be further combined or replaced. However, as long as it does not deviate from the content of the technical solution of the present invention, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present invention still fall within the scope of the present invention.
Claims
1. A method for predicting the tobacco cutting result, characterized in that, it includes: S1. Obtain the two-dimensional image of the to-be-processed strip tobacco with regular shape and perform coding annotation on it; S2. Obtain the cutting intersection points of any to-be-processed strip tobacco and the blade according to the coding annotation sequence and cutting parameters to obtain its cutting result parameters; S3. Fit the first prediction model according to the characteristics of the obtained two-dimensional image of the to-be-processed strip tobacco and its corresponding cutting result parameters; S4. Obtain the two-dimensional image of the to-be-processed strip tobacco with irregular shape and predict its cutting result parameters based on the first prediction model.
2. The method for predicting the tobacco cutting result according to claim 1, characterized in that, the step S4 includes: S41. Obtain the two-dimensional image of the to-be-processed strip tobacco and extract the leaf edge contour thereof; S42. Perform coding annotation on the to-be-processed strip tobacco, and capture and calculate the connected regions of the to-be-processed strip tobacco according to the coding annotation sequence; S43. Predict the independent cutting result parameters of the to-be-processed strip tobacco with irregular shape according to the number, geometric features of the connected regions and the first prediction model; S44. Obtain the total cutting result parameters in a superimposed form.
3. The method for predicting the tobacco cutting result according to claim 2, characterized in that, the extraction of the leaf edge contour includes: S411. Convolve the pixels of the obtained two-dimensional image of the to-be-processed strip tobacco; S412. Perform threshold operation on the gray values of the new pixels after convolution to obtain the edge information of the to-be-processed strip tobacco.
4. The method for predicting the tobacco cutting result according to claim 2, characterized in that, the step S42 includes: S421. Scan the two-dimensional image of the extracted leaf edge contour and mark the target pixels; S422. Merge the connected regions with equivalent relationships but different marker values generated during scanning into one connected region, and delete the duplicate equivalent pairs to obtain the number and geometric features of the connected regions; the equivalent pair is the different marker values of the same connected region due to the scanning order.
5. The method for predicting the tobacco cutting result according to claim 4, characterized in that, the scanning order in the step S421 is from left to right and from top to bottom.
6. The method for predicting the tobacco cutting result according to claim 5, characterized in that, the marking of the target pixels in the step S421 includes: Judge whether the pixel in the upper left corner of the two-dimensional image is a target pixel. If so, its marker value is 1. If not, scan the next pixel according to the scanning order; When the next pixel is a target pixel, judge whether there is a target pixel among the adjacent pixels that have been scanned. If not, add 1 to the previous marker value; If so, further judge the number of target pixels among the adjacent pixels. If there is only one target pixel, the current pixel marker value is equal to the target pixel marker value; if there are at least two target pixels, the current pixel marker value is equal to the marker value of the first scanned target pixel in the scanning order priority.
7. The method for predicting the tobacco cutting result according to claim 6, characterized in that, The adjacent pixels include one or more of the four positions: left, upper left, upper, and upper right; The scanning order priorities are, in sequence, left, upper left, upper, and upper right.
8. A method for predicting the tobacco cutting result according to claim 4, characterized in that the formula for calculating the number of connected regions is: Nc = MAXm - En + Er; where Nc represents the number of connected regions, MAXm represents the maximum value of the label values, En represents the number of equivalent pairs, Er represents the number of repeated equivalent pairs, and the repeated equivalent pairs mean that both label values of the newly added equivalent pair already exist.
9. A prediction system using the method for predicting the tobacco cutting result according to any one of claims 1-8, characterized in that it includes an input module, a calculation module, and an output module; the input module is used to obtain a two-dimensional image of the to-be-processed tobacco slice with an irregular shape or a drawn to-be-processed tobacco slice with a regular shape; the calculation module is used to calculate the cutting intersection points or predict the tobacco cutting result parameters according to the first prediction model; the output module is used to display the tobacco cutting result parameters.
10. A prediction system according to claim 9, characterized in that the display modes of the output module include at least one of a numerical value and a line chart.