Method and system for predicting shredding result of single tobacco
By calculating the cutting intersection point and fitting the prediction model of the shredding result parameters, the problem of difficulty in predicting the shredding result in cigarettes in the prior art is solved, and the accurate prediction of the shredding result parameters of irregularly shaped sheet cigarettes is achieved, and the quality control of cigarettes is improved.
Patent Information
- Application Number
- CN202311622209.7
- 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 predict the results of cigarette shredding, which leads to difficulty in adjusting parameters such as shredding angle and width, affecting cigarette quality control.
By obtaining the two-dimensional image and shredding parameters of regular-shaped smoke, calculating the cutting intersection point, and fitting the prediction model of the shredding result parameters of the shredding result parameters based on geometric features, we can predict the shredding result parameters of irregular-shaped smoke.
Accurate prediction of the result parameters of irregularly shaped sheet smoke cut, improve the quality of tobacco production, and solve the data error caused by occlusion and overlapping factors.
Smart Images

Figure CN120069142A_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 cutting result of a single-piece tobacco leaf Background Art
[0002] Cigarette quality control is of great significance to the development of cigarette tipping. To control cigarette quality, in addition to cigarette equipment, cut tobacco is an important influencing factor. Therefore, the cutting process is the top priority in the cigarette making process, and its main technological task is to cut the moistened tobacco leaves or tobacco sheets into cut tobacco of a certain width.
[0003] Therefore, how to simulate the cutting result to adjust parameters such as the cutting angle and width during actual production 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 cutting result parameters of a single-piece tobacco leaf with an irregular shape, so that the cutting parameters during actual production can be adjusted accordingly according to the predicted cutting result parameters, thereby improving the quality of cigarette tipping.
[0006] Another object of the present invention is to provide a prediction system using the above method for predicting the cutting result of a single-piece tobacco leaf.
[0007] To achieve the first object of the invention, the following technical solution is adopted:
[0008] A method for predicting the cutting result of a single-piece tobacco leaf includes:
[0009] S1. Obtain a two-dimensional image of a regular-shaped tobacco leaf and cutting parameters, and calculate the cutting intersection points of the two-dimensional image and the blade according to the cutting parameters, and the cutting intersection points are determined based on parallel blades;
[0010] S2. Calculate the geometric features of the tobacco leaf cutting according to the cutting intersection points, and fit the first prediction model of the cutting result parameters in combination with the two-dimensional image of the tobacco leaf;
[0011] S3. Obtain a two-dimensional image of an irregular-shaped tobacco leaf and predict its cutting result parameters according to the first prediction model.
[0012] Further, calculating the cutting intersection points of the two-dimensional image and the blade in step S1 includes:
[0013] S11. Determine whether the line segment where the blade is located coincides with the line segment where the contour of the regular-shaped tobacco leaf is located. If so, stop the determination; if not, jump to step S12;
[0014] S12. Construct two rectangles with two line segments as diagonals respectively, and determine whether there is an overlapping part between the two rectangles. If so, jump to step S13; if not, stop the determination.
[0015] S13. Determine whether the two line segments straddle each other. If so, determine that the two line segments intersect and calculate the intersection point; if not, stop the determination.
[0016] Further, the determination of whether the two line segments straddle each other in step S13 includes:
[0017] Construct one of the line segments as a target vector, and construct a first vector and a second vector respectively by combining any endpoint of the line segment with the two endpoints of the other line segment, and calculate the outer products of the target vector with the first vector and the second vector respectively.
[0018] If both of the outer products are non-zero and have opposite signs, determine that the two line segments straddle each other.
[0019] Further, step S3 includes:
[0020] S31. Transform the two-dimensional image of the irregular-shaped cut tobacco sheet into a grayscale image, and take its edge binary mask.
[0021] S32. Perform dilation, hole filling, and edge clearing on the edge binary mask respectively.
[0022] S33. Detect the connected regions of the processed binary image to obtain their numbers and geometric features, and predict the cut result parameters in combination with the cutting parameters and the first prediction model.
[0023] Further, step S33 includes:
[0024] S331. Scan the processed binary image and mark the target pixels.
[0025] S332. Merge the connected regions with equivalent relationships but different marked 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.
[0026] The equivalent pair is different marked values of the same connected region due to the scanning order.
[0027] Further, the merging of the connected regions with equivalent relationships and different marked values into one connected region in step S332 includes:
[0028] Set any equivalent pair in the linked list and use it as the root to find the remaining equivalent pairs containing the elements in the linked list. If only one element of the remaining equivalent pairs exists in the linked list, supplement the other element to the linked list. If both elements of the remaining equivalent pairs already exist in the linked list, delete the equivalent pair and increment the number of duplicate equivalent pairs by 1.
[0029] Further, the calculation formula for the number of connected regions is:
[0030] Nc = MAXm - En + Er;
[0031] Where Nc represents the number of connected regions, MAXm represents the maximum value of the marker, En represents the number of equivalent pairs, and Er represents the number of duplicate equivalent pairs.
[0032] Further, the scanning order in step S332 is from left to right and from top to bottom.
[0033] Further, the marking of the target pixel in step S331 includes:
[0034] Determine whether the pixel in the upper left corner of the binary image is a target pixel. If so, its marker value is 1. If not, scan the next pixel according to the scanning order;
[0035] When the next pixel is a target pixel, determine whether there is a target pixel among the adjacent pixels that have been scanned. If not, increment by 1 based on the previous marker value;
[0036] If so, further determine 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 marker value of the target pixel; 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 according to the priority of the scanning order.
[0037] To achieve the second invention objective, the present invention adopts the following technical solutions:
[0038] A prediction system adopting the above single-piece tobacco cutting result prediction method, including an input module, a calculation module, and an output module;
[0039] The input module is used to obtain a two-dimensional image of an irregular-shaped to-be-processed tobacco slice or a drawn regular-shaped to-be-processed tobacco slice;
[0040] The calculation module is used to calculate the cutting intersection points or predict the cutting result parameters according to the first prediction model;
[0041] The output module is used to display the cutting result parameters.
[0042] After adopting the above technical solutions, the present invention has the following beneficial effects compared with the prior art:
[0043] 1. The present invention can output the cutting result parameters according to the obtained two-dimensional image of cut tobacco and the cutting parameters input by the user. During the actual production process, the user can adjust the cutting parameters such as the cutting angle and cutting width according to the output results, thereby improving the quality of tobacco production.
[0044] 2. The present invention predicts the cutting result parameters of irregular-shaped cut tobacco based on connected region capture, with high calculation accuracy, small calculation amount, and solves the data errors caused by factors such as occlusion and overlap, and can efficiently and robustly process the image data of cut tobacco.
[0045] The following further describes in detail the specific embodiments of the present invention with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings, as a 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 those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts. In the drawings:
[0047] Figure 1 is a schematic flow chart of the method for predicting the cutting result of a single piece of tobacco of the present invention.
[0048] It should be noted that these drawings and text 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 DESCRIPTION OF THE EMBODIMENTS
[0049] 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 with reference to 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.
[0050] 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.
[0051] In the description of the present invention, it should be noted that unless otherwise clearly specified and defined, the terms "installation", "connection", and "coupling" should be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may be a mechanical connection or an electrical connection; it may be a direct connection or an indirect connection 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.
[0052] In the prior art, the wire-cutting process is of utmost importance in the cigarette cut tobacco manufacturing process. How to predict the wire-cutting result to adjust parameters such as the wire-cutting angle and wire-cutting width during actual production has become an urgent problem to be solved.
[0053] In view of this, as Figure 1 shown, the present invention provides a method for predicting the wire-cutting result of a single-piece tobacco leaf, including:
[0054] S1. Obtain a two-dimensional image of a strip of tobacco leaf with a regular shape and wire-cutting parameters, and calculate the cutting intersection points of the two-dimensional image and the blade according to the wire-cutting parameters, where the cutting intersection points are determined based on parallel blades;
[0055] S2. Calculate the geometric features of the wire-cut tobacco leaf according to the cutting intersection points, and fit a first prediction model of the wire-cutting result parameters in combination with the two-dimensional image of the strip of tobacco leaf;
[0056] S3. Obtain a two-dimensional image of a strip of tobacco leaf with an irregular shape and predict its wire-cutting result parameters according to the first prediction model.
[0057] Among them, the strip of tobacco leaf with a regular shape is the strip of tobacco leaf drawn by the user, and its shape can be any polygon such as a triangle or other figures. Correspondingly, the strip of tobacco leaf with an irregular shape is the strip of tobacco leaf collected during actual production.
[0058] Calculating the cutting intersection points of the two-dimensional image and the blade 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.
[0059] 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 should be excluded first.
[0060] 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 point is the same or only the ending point is 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.
[0061] 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).
[0062] If the cross product v1×v2 of v1 and v2 is 0, 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 form a vector vs with one end of L1 and one end of L2 and take the cross product with v2. If vs and v2 are also parallel, 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.
[0063] 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.
[0064] 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.
[0065] 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.
[0066] After determining that the two line segments intersect, the intersection point can be solved. Of course, the intersection point can be found 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 it.
[0067] Specifically, let the intersection point be (x0, y0), then the following system of equations must hold:
[0068] x0 - x1 = k1(x2 - x1) ①;
[0069] y0 - y1 = k1(y2 - y1) ②;
[0070] x0 - x3 = k2(x4 - x3) ③;
[0071] y0 - y3 = k2(y4 - y3) ④;
[0072] Where k1 and k2 are arbitrary non - zero constants (if they are 0, it means there are overlapping endpoints, and this situation has been excluded above). Link equation 1 with equation 2, and combine equation 3 with equation 4. By eliminating k1 and k2, we can get:
[0073] x0(y2 - y1) - x1(y2 - y1) = y0(x2 - x1) - y1(x2 - x1);
[0074] x0(y4 - y3) - x3(y4 - y3) = y0(x4 - x3) - y3(x4 - x3);
[0075] Move the terms containing the unknowns x0 and y0 to the left side, and the constant terms to the right side, we get:
[0076] (y2 - y1)x0+(x1 - x2)y0=(y2 - y1)x1+(x1 - x2)y1;
[0077] (y4 - y3)x0+(x3 - x4)y0=(y4 - y3)x3+(x3 - x4)y3;
[0078] Let the two constant terms be b1 and b2 respectively:
[0079] b1=(y2 - y1)x1+(x1 - x2)y1;
[0080] b2=(y4 - y3)x3+(x3 - x4)y3;
[0081] Let the coefficient determinant be D, the coefficient determinant obtained by replacing the coefficient of x0 with b1 and b2 be D1, and the coefficient determinant obtained by replacing the coefficient of y0 with b1 and b2 be D2. Then we have:
[0082] |D|=(x2 - x1)(y4 - y3)-(x4 - x3)(y2 - y1);
[0083] |D1|=b2(x2 - x1)-b1(x4 - x3);
[0084] |D2|=b2(y2 - y1)-b1(y4 - y3);
[0085] Thus, the intersection coordinates can be obtained as:
[0086] x0 = |D1| / |D|, y0 = |D2| / |D|.
[0087] After obtaining multiple intersection points of the blade and the tobacco leaf in the simulated cutting, 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 result parameters can be fitted to predict the cut result parameters of the actually collected irregular-shaped cut tobacco.
[0088] Specifically, step S3 includes:
[0089] S31. Transform the two-dimensional image of the obtained irregular-shaped cut tobacco into a grayscale image, and take its edge binary mask;
[0090] S32. Perform dilation, filling holes and edge clearing on the edge binary mask respectively;
[0091] S33. Detect the connected regions of the processed binary image to obtain their numbers and geometric characteristics, and predict their cut result parameters in combination with the cut parameters and the first prediction model.
[0092] The binary image marking process is to extract the pixel sets with pixel values of "1" or "255" that are adjacent to each other (usually 4-adjacency or 8-adjacency is studied) from a dot matrix image composed of white pixels (usually "1" is used for binary images and "255" is used for grayscale images) and black pixels (usually represented by "0"), and fill different digital marks for different connected regions in the image, and at the same time count the number of connected regions.
[0093] In the present invention, the binary image contains two colors, black (pixel value is 0) and white (pixel value is 1 or 255), which are used as the target color and the background 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, assuming that there are m (m≤8) adjacent pixels around the target pixel point, if the pixel grayscale is equal to that of a certain pixel A among these m pixels, then it is said that the pixel is connected to 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 the 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 of upper left, upper right, lower left and lower right.
[0094] Combined with the cut tobacco detection situation and actual requirements, the present invention selects to adopt 8-connected regions. Step S33 includes:
[0095] S331. Scan the processed binary image and mark the target pixels;
[0096] S332. Merge the connected regions with equivalent relationships but different tag 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 rank pairs are different tag values of the same connected domain due to the number of scans.
[0097] Among them, when scanning a binary image, it is first necessary to find the storage address of the image data in memory, and then compare each 8-bit integer data after the storage address. Assume that the image format being processed 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 is only necessary to scan itself and the pixel points around it whose connectivity has been determined to determine its own connectivity, that is, to scan the gray values of the left, upper left, upper, and upper right 4 pixels.
[0098] In an embodiment of the present invention, the binary image scanning steps in the connectivity algorithm are summarized as follows:
[0099] First, mark the first pixel in the upper left corner of the image, that is, the point where the first row (the topmost 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, then start scanning the next pixel;
[0100] 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, then check whether the gray value of its left adjacent pixel is 255. If so, the tag value of this pixel is the same as that of the left pixel. If the gray value of the left pixel is not 255, the current scanned pixel is marked as the previous tag value plus 1; if the gray value of the current scanned pixel is not 255, then continue scanning the next pixel;
[0101] Mark the pixels except the first row (the topmost row). At this time, there will be an equivalent situation, and it is necessary to record equivalent pairs. Specifically,
[0102] ①. First, process the first pixel of each row, which is generally to process the leftmost column of the image. If the pixel is a background pixel, i.e., the gray value is 0, then scan the next pixel in this row. If the pixel is a target pixel, i.e., the gray value is 255, then it is necessary to check the marker values of the two adjacent pixels above and to the upper right of this pixel. If the upper adjacent pixel is marked, then the marker value of the currently scanned pixel is equal to the marker value of the upper adjacent point. At this time, check whether the upper right point is marked. If it is also marked, then compare whether the marker values of the upper point and the upper right point are the same. If they are different, then it is determined that the marker values of the upper adjacent point and the upper right adjacent point are a group of equivalent pairs and recorded in the equivalent marker table. If the upper adjacent point is not marked, check whether the upper right adjacent point is marked. If it is marked, then the marker value of the currently scanned pixel is equal to the marker value of the upper right adjacent point. If both the upper and upper right adjacent points are not marked, then make the marker value of the currently scanned pixel equal to the previous marker value plus 1.
[0103] ②. Mark the middle points of each row. If the current pixel is a target point, then it is necessary to check the marker situations of the 4 adjacent pixels on the left, upper left, upper, and upper right (according to the adopted scanning order, these 4 adjacent pixels have been processed when scanning to the current pixel). If the gray values of the above 4 adjacent pixels are all 0, give the current pixel a new marker, equal to the previous marker value incremented by 1. If only one pixel P among the 4 adjacent pixels has a gray value of 255, then assign the marker value of pixel P to the current pixel. If there are m (1 < m ≤ 4) pixel points among the 4 adjacent pixels with a gray value of 255, then determine the marker value of the current pixel according to the priority order of left, upper left, upper, and upper right. Then conduct an equivalent analysis on the marker values owned by these m pixels. If the marker values of the m pixels are different, then take the different marker values as equivalent pairs and add them to the equivalent marker table. For example, when the gray values of the 4 pixels are all 255, assign the marker value of the left pixel to the current pixel, and then make 3 equivalent pairs: left equivalent to upper left, left equivalent to upper, and left equivalent to upper right. Then compare whether the two marker values in each of the 3 equivalent pairs are equal. If they are not equal, add the equivalent pair to the equivalent marker table.
[0104] ③. Mark the last point of each row, which is generally to process the rightmost column of the image. If the gray value of the current pixel is 255, then it is necessary to check the marker situations of the 3 adjacent pixels on the left, upper left, and upper. The processing method is the same as that in ① and ②.
[0105] ④. Repeat step ③ until the connected marker processing of the last row of the image is completed. At this time, the scanning of the entire image is completed, and the equivalent marker table is obtained simultaneously.
[0106] 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:
[0107]
[0108]
[0109] The calculation formulas are as follows:
[0110] AREA.size = AREA.points.size() (1)
[0111] AREA.center.x = (∑AREA.points.x) / AREA.size (2)
[0112] AREA.center.y = (∑AREA.points.y) / AREA.size (3)
[0113] AREA.rect.left = MIN(AREA.points.x) (4)
[0114] AREA.rect.right = MAX(AREA.points.x) (5)
[0115] AREA.rect.top = MIN(AREA.points.y) (6)
[0116] AREA.rect.bottom = MAX(AREA.points.y) (7)
[0117] 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, and the geometric feature parameters of each connected region AREA are calculated according to formulas (1) to (7).
[0118] 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 the 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, if the following marks exist in the equivalent label linked list: 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.
[0119] Specifically, a tree - shaped search method is used to determine the labels belonging to the same connected region in each recursive iteration. 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 newAREA, and recalculate the geometric feature parameters of the newAREA according to formulas (1) - (7):
[0120] In each recursion, search out 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. When the number of elements in the equivalence pair table is 0 after a finite number of recursive iterations, at this time, the analysis of the equivalence pair table is completed, and the recursive iteration stops running.
[0121] The statistical formula for the number of connected regions is as follows:
[0122] Nc = MAXm - En + Er (8)
[0123] 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.
[0124] After obtaining the number and geometric features of the connected regions, the cutting result parameters can be predicted based on the first prediction model.
[0125] The present invention also provides a prediction system adopting the above - mentioned single - piece cutting result prediction method, including an input module, a calculation module, and an output module. Among them, the user can draw regular - shaped cut tobacco 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 cut tobacco;
[0126] The calculation module is used to obtain parameters such as the cutting angle and cutting width of regular-shaped cut tobacco slices, calculate the cutting intersection points according to the cutting parameters, or predict the cutting result parameters of irregular-shaped cut tobacco slices based on the fitted first prediction model, and feedback the cutting result parameters to the output module;
[0127] The output module is used to display the cutting result parameters, for example, in the form of numerical values or line charts.
[0128] Furthermore, the output module can also display the two-dimensional images of regular-shaped cut tobacco slices or irregular-shaped cut tobacco slices to interact more intuitively with the user.
[0129] 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 to equivalent embodiments 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 the content does not depart from 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 cutting result of a single piece of tobacco, characterized in that, it includes: S1. Obtain the two-dimensional image of the tobacco slice with regular shape and the cutting parameters, and calculate the cutting intersection points between the two-dimensional image and the blade according to the cutting parameters, and the cutting intersection points are determined based on parallel blades; S2. Calculate the geometric features of the tobacco slice cutting according to the cutting intersection points, and fit the first prediction model of the cutting result parameters in combination with the two-dimensional image of the tobacco slice; S3. Obtain the two-dimensional image of the tobacco slice with irregular shape and predict its cutting result parameters according to the first prediction model.
2. A method for predicting the cutting result of a single piece of tobacco according to claim 1, characterized in that, calculating the cutting intersection points between the two-dimensional image and the blade in step S1 includes: S11. Judge whether the line segment where the blade is located coincides with the line segment where the contour of the tobacco slice with regular shape is located. If so, stop the judgment; if not, jump to step S12; S12. Construct two rectangles with the two line segments as the diagonals respectively, and judge whether there is an overlapping part between the two rectangles. If so, jump to step S13; if not, stop the judgment; S13. Judge whether the two line segments straddle. If so, judge that the two line segments intersect and calculate the intersection point; if not, stop the judgment.
3. A method for predicting the cutting result of a single piece of tobacco according to claim 2, characterized in that, judging whether the two line segments straddle in step S13 includes: Construct one of the line segments as a target vector, and construct a first vector and a second vector respectively by combining any end point of the line segment with the two end points of the other line segment, and calculate the outer products of the target vector with the first vector and the second vector respectively; If the outer products are both non-zero and have opposite signs, judge that the two line segments straddle each other.
4. A method for predicting the cutting result of a single piece of tobacco according to claim 1, characterized in that, step S3 includes: S31. Transform the obtained two-dimensional image of the tobacco slice with irregular shape into a grayscale image, and take its edge binary mask; S32. Perform dilation, hole filling and edge clearing on the edge binary mask respectively; S33. Detect the connected regions of the processed binary image to obtain their numbers and geometric features, and predict their cutting result parameters in combination with the cutting parameters and the first prediction model.
5. A method for predicting the cutting result of a single piece of tobacco according to claim 4, characterized in that, step S33 includes: S331. Scan the processed binary image and mark the target pixels; S332. Merge the connected regions with equivalent relationships but different marked 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 different marked values of the same connected region due to the scanning order.
6. A method for predicting the cutting result of a single piece of tobacco according to claim 5, characterized in that, merging the connected regions with equivalent relationships and different marked values into one connected region in step S332 includes: Set any equivalent pair in the linked list and use it as the root to find the remaining equivalent pairs containing the elements in the linked list. If only one element of the remaining equivalent pairs exists in the linked list, supplement the other element to the linked list. If both elements of the remaining equivalent pairs already exist in the linked list, delete the equivalent pair and increment the number of duplicate equivalent pairs by 1.
7. A method for predicting the result of single-piece tobacco cutting according to claim 6, wherein, the calculation formula for 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 marked values, En represents the number of equivalent pairs, and Er represents the number of duplicate equivalent pairs.
8. A method for predicting the result of single-piece tobacco cutting according to any one of claims 5-7, wherein, the scanning order in step S332 is from left to right and from top to bottom.
9. A method for predicting the result of single-piece tobacco cutting according to claim 8, wherein, the marking of the target pixel in step S331 includes: judging whether the pixel at the upper left corner of the binary image is a target pixel. If so, its marked 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, increment the previous marked value by 1; if so, further judge the number of target pixels among the adjacent pixels. If there is only one target pixel, the marked value of the current pixel is equal to the marked value of the target pixel; if there are at least two target pixels, the marked value of the current pixel is equal to the marked value of the first scanned target pixel according to the scanning order priority.
10. A prediction system using the method for predicting the result of single-piece tobacco cutting according to any one of claims 1-9, wherein, it includes an input module, a calculation module and an output module; the input module is used to obtain a two-dimensional image of an irregular-shaped to-be-processed tobacco slice or a drawn regular-shaped to-be-processed tobacco slice; the calculation module is used to calculate the cutting intersection points or predict the cutting result parameters according to the first prediction model; the output module is used to display the cutting result parameters.