An evaluation method for the identity characteristics of primary roasted tobacco leaves
Through an identity feature evaluation method for primary tobacco leaves, the identity feature scores of tobacco leaves are extracted using image processing technology, which solves the problem of insufficient automatic evaluation of tobacco leaves in the existing technology, and improves the accuracy of automatic grading of tobacco leaves.
Patent Information
- Application Number
- CN202210094186.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-26
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2042-01-26
AI Technical Summary
The existing automatic grading technology of tobacco leaves is difficult to accurately extract the appearance characteristics related to the quality of tobacco leaves, especially complex features such as texture, leaf tips and leaf veins, resulting in the automatic evaluation of tobacco leaves inaccurate enough.
A method of identity feature evaluation for primary tobacco leaves was adopted. By obtaining the sample pictures and sample weight of primary tobacco leaves, the threshold segmentation based on color, leaf stem removal, tobacco leaf fold extraction and edge detection were performed to calculate the identity feature score of primary tobacco leaves.
The accuracy of the automatic grading results of tobacco leaves is improved, and the identity characteristics of the tobacco leaves can be accurately scored through a complete picture of tobacco leaves and the weight of the destabilized tobacco leaves. The higher the score, the better the quality of the tobacco leaves.
Smart Images

Figure CN114419072B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of tobacco production, and in particular, to a method for evaluating the identity characteristics of flue-cured tobacco leaves. Background Art
[0002] At present, most of the automatic tobacco leaf grading technologies still remain in the demonstration and experimental stages, and no mature, stable and popularizable system has been seen. To achieve automatic identification of the appearance quality of tobacco leaves, it is necessary to accurately extract the tobacco leaf characteristics strongly related to the tobacco leaf quality and study the relevant automatic identification algorithms. One of the main problems is that there are few appearance characteristics representing the tobacco leaf quality, or the characteristics are weakly related to the quality. Due to the limitations of technology and on-site environment, some characteristics cannot be accurately extracted, such as texture, leaf tip angle, vein thickness, etc. How to make a more accurate automatic evaluation of the appearance quality of tobacco leaves is the key problem of the current automatic tobacco leaf grading technology. Summary of the Invention
[0003] The purpose of the present invention is to solve the defects existing in the prior art, and to propose a method for evaluating the identity characteristics of flue-cured tobacco leaves.
[0004] To achieve the above purpose, the present invention adopts the following technical scheme: A method for evaluating the identity characteristics of flue-cured tobacco leaves, which obtains the pictures of flue-cured tobacco leaf samples and the corresponding sample weights; performs threshold segmentation processing based on color on the sample pictures to obtain feature sub-pictures; performs the processing of removing leaf stalks on the feature sub-pictures, and calculates the pixel area of the leaf blade after removing the leaf stalks; extracts the wrinkled part of the tobacco leaf in the picture of the feature sub-picture and calculates the pixel area of its wrinkled part; calculates the identity characteristic score of the flue-cured tobacco leaf sample according to the identity characteristic calculation formula; the identity characteristic calculation formula is:
[0005]
[0006] Preferably, the pictures of the flue-cured tobacco leaf samples are front perspective views of flue-cured tobacco leaves collected by using the same set of image acquisition methods.
[0007] Preferably, the sample weight is the weight of the flue-cured tobacco leaf after removing the leaf stalk.
[0008] Preferably, the wrinkled part of the flue-cured tobacco leaf sample is extracted by performing threshold segmentation based on color on the feature sub-picture once.
[0009] Preferably, the feature sub-picture is subjected to 2 times of opening operation and 2 times of closing operation.
[0010] Preferably, the canny edge algorithm is used to extract the edge information of the initially baked tobacco leaves from the feature sub-images, the circumscribed rectangle of the initially baked tobacco leaves is found, and then an image coordinate system is established. With the help of a straight line with a slope of -1, by calculating the distance values between the intersection points of the straight line and the contour of the initially baked tobacco leaves in region D and between the two intersection points, it is judged whether the current position of the straight line is at the optimal cutting position of the leaf stalk. By looping through each intersection point, the position of the leaf stalk is finally found.
[0011] Preferably, the image coordinate system is a coordinate system u-v in pixels established with the upper left corner of the image as the origin. In the image coordinate system, a region D is defined. The region D is a triangular pixel region enclosed by three points with coordinates a(0,0), b(0,2048), and c(2048,0). The image resolution is 2448*2048. By calculating the distance values between the intersection points of the straight line and the contour of the initially baked tobacco leaves in region D and between the two intersection points, it is judged whether the current position of the straight line is at the optimal cutting position of the leaf stalk.
[0012] Preferably, the minimum number of the initially baked tobacco leaf sample images is one.
[0013] The main objective of the present invention is to score and evaluate the identity characteristics of initially baked tobacco leaves. The identity characteristic score ranges from 0.0 to 10.0 points. The higher the score, the better the quality of the initially baked tobacco leaves. The basic process of this technology is as follows:
[0014] The first step: Input a complete image of initially baked tobacco. Perform a color space conversion on this image, convert the RGB color space of the image into the HSV color space, set the upper limit of the color space of the yellow to be separated as [0,70,70], the lower limit as [100,255,255], and then perform a binary processing on the target image according to this upper and lower limit. Perform a logical "AND" operation on the obtained binary image and the original image to complete the separation of the foreground and background of the initially baked tobacco leaf image, and obtain the feature sub-image of the original image.
[0015] The second step: Convert the feature sub-image into a grayscale image, and perform 2 opening operations and 2 closing operations on this grayscale image successively. First, use the opening operation to remove isolated small dots and burrs, while the shape contour of the object remains basically unchanged. Then use the closing operation to fill the small cracks, discontinuities, and small holes inside the foreground object. Finally, perform a binary processing once, set the minimum value of the threshold range to 10 and the maximum value to 255. When the grayscale value is greater than 10, assign this grayscale value to 255. In the finally obtained image, the leaf part is white and the background part is black, which is convenient for subsequent edge detection.
[0016] Step 3: Use the Canny edge detection algorithm to perform edge detection on the image. Set the low threshold parameter to 120 and the high threshold parameter to 250. Pixel points with gray values lower than 120 (background part) will be considered not to be edges, and pixel points with gray values higher than 250 (tobacco leaf part) are used as the initial segmentation points for strong edges. This algorithm finally obtains a set of complete tobacco leaf contour pixel points. Find the circumscribed rectangle of the tobacco leaf and obtain the starting coordinates (x 0 , y 0 ) of the upper left corner of the rectangle. Establish a direct coordinate system u-v in pixels with the upper left corner of the image as the origin, which is called the image coordinate system. Define a region D in the image coordinate system. Region D is a triangular pixel region enclosed by three points with coordinates a(0,0), b(0,2048), and c(2048,0). The present invention moves a straight line with a slope of -1 in region D of the image. By the intersection points of the straight line and the tobacco leaf contour in region D and the distance values between the two intersection points, it is judged whether the current straight line position is at the optimal cutting position of the leaf stalk. By traversing each intersection point in a loop, the position of the leaf stalk is finally found. Set the gray values of the part above the leaf stalk to 0 to complete the cutting of the leaf stalk. Output the image after cutting the leaf stalk and calculate the number of pixel points of its tobacco leaf part, that is, the pixel area of the initial flue-cured tobacco is initially obtained.
[0017] Step 4: Perform another color-based threshold segmentation process on the image after cutting the leaf stalk, aiming to extract the image of the leaf wrinkles. Set the upper limit of the yellow color space of the wrinkled part to [10,100,100] and the lower limit to [70,190,190]. Perform binary conversion on the image according to this upper and lower limit, and then perform an "AND" operation on the binary image and the original image to obtain the image of the leaf wrinkles and calculate its pixel area of the wrinkled part.
[0018] Step 5: In order to reduce the error of the final calculated identity score, add the pixel area of the stemmed tobacco leaf obtained to the pixel area of the tobacco leaf wrinkled part to obtain the total pixel area of the tobacco leaf part of the final initial flue-cured tobacco. Input the known weight of the stemmed tobacco leaf, and calculate the final identity characteristic score of the initial flue-cured tobacco according to the identity characteristic scoring formula of the present invention.
[0019] Compared with the prior art, the beneficial effects of the present invention are as follows: In order to improve the accuracy of the automatic grading result of tobacco leaves, this method combines computer technology and digital image processing technology to identify the identity characteristics of initial flue-cured tobacco leaves, avoiding complex characteristics such as texture and leaf sharp corners. Only by inputting a picture of a complete tobacco leaf plus the weight of the stemmed tobacco leaf, the identity characteristics of the initial flue-cured tobacco can be scored and evaluated. The higher the identity characteristic score, the better the quality of the initial flue-cured tobacco. The final identity characteristic evaluation result of the initial flue-cured tobacco can be used as one of the basic evaluation scores for the grading of initial flue-cured tobacco leaves, improving the accuracy of the quality judgment of initial flue-cured tobacco. Brief Description of the Drawings
[0020] The accompanying drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation to the present invention.
[0021] Figure 1 : Flow chart for scoring the identity characteristics of primary-cured tobacco leaves;
[0022] Figure 2 : Original data diagram of No. 1 primary-cured tobacco leaf;
[0023] Figure 3 : Foreground and background separation of No. 1 primary-cured tobacco leaf;
[0024] Figure 4 : Picture of No. 1 primary-cured tobacco leaf after cutting the leaf stalk;
[0025] Figure 5 : Extraction of the wrinkled part of No. 1 primary-cured tobacco leaf. Detailed implementation manners
[0026] For a better understanding of the present invention, the following provides a further description of the present invention through specific implementation manners in combination with the accompanying drawings.
[0027] Refer to Figures 1 to 5 :
[0028] 1. Extract the primary-cured tobacco part in the image
[0029] Take the No. 1 primary-cured tobacco as the experimental object, and input the front perspective view of the No. 1 primary-cured tobacco, such as Figure 2 . Convert the RGB color space of the picture into the HSV color space, and perform the color space conversion on this photo according to the following formula:
[0030] V = max(R, G, B)
[0031]
[0032]
[0033] where R / G / B represents the values of the three channels of the image, and V represents the maximum value of these three channel values. After conversion, set the upper limit value of the HSV color space to [0, 70, 70], and the lower limit to [100, 255, 255]. Perform binary processing on the image, and then perform a logical "AND" operation on the binary-processed image and the original image to complete the separation of the foreground and background of the No. 1 primary-cured tobacco leaf image. Finally, obtain the Figure 2 characteristic sub-image, such as Figure 3 .
[0034] 2. Cut the leaf stalk part of the primary-cured tobacco leaf in the image
[0035] Image denoising: Convert Figure 3 it into a grayscale image, and perform two opening operations and two closing operations respectively. The purpose is to remove isolated background noise points and effectively fill small holes inside the foreground of tobacco leaves. Then perform binarization processing on this grayscale image. The foreground grayscale value of the obtained binary image is 225, and the background grayscale value is 0.
[0036] Extract the edge contour information of the first-cured tobacco leaf part No. 1: Based on this binary image, use the Canny edge detection algorithm. The algorithm steps are as follows:
[0037] (1) Gaussian smoothing function
[0038] This algorithm first uses a Gaussian filter to smooth the image to remove noise in the image. The Gaussian smoothing function is as follows:
[0039]
[0040] Among them, x and y represent the template coordinates of pixels. The center position of the template takes the upper left corner of the image as the origin, and σ is the variance of x and y. Let g(x, y) be the smoothed image. The smoothing of the image f(x, y) with h(x, y) can be expressed as:
[0041] g(x, y) = h(x, y, o) * f(x, y)
[0042] Among them, * represents the convolution operation.
[0043] (2) Use the finite difference of the first-order partial derivative to calculate the magnitude and direction of the gradient.
[0044] The gradient of the smoothed g(x, y) can be calculated using the 2*2 first-order finite difference approximation formula for the two arrays f′ x (x, y) and f′ y (x, y):
[0045] f′ x (x, y) ≈ G x = [f(x + 1, y) - f(x, y) + f(x + 1, y + 1) - f(x, y + 1)] / 2
[0046] f′ y (x, y) ≈ G y = [f(x, y + 1) - f(x, y) + f(x + 1, y + 1) - f(x + 1, y)] / 2
[0047] The magnitude and azimuth angle can be calculated using the coordinate transformation formula from the rectangular coordinate system to the polar coordinate system:
[0048]
[0049] θ[x, y] = arctan(G x (x, y) / G y (x, y))
[0050] where M[x, y] reflects the edge intensity of the image, that is, the magnitude of the gradient; θ[x, y] reflects the direction of the edge, and the direction angle θ[x, y] that makes M[x, y] obtain the local maximum value.
[0051] (3) Perform non-maximum suppression on the gradient magnitude
[0052] Merely obtaining the global gradient is not sufficient to determine the edge. Therefore, to determine the edge, it is necessary to retain the points with the largest local gradient to suppress non-maxima. The direction of the gradient can be defined as belonging to one of 4 regions, and each region has different neighboring pixels for comparison to determine the local maximum. These 4 regions and their corresponding comparison directions are shown in the following figure:
[0053] 3 2 1 0 x 0 1 2 3
[0054] For example, if the gradient direction of the central pixel x belongs to the 3rd region, then compare the gradient value of x with the gradient values of its upper left and lower right neighboring pixels to see if the gradient value of x is a local maximum. If not, set the gray level of pixel x to 0. This process is called "non-maximum suppression".
[0055] (4) Detect and connect edges using the double-threshold algorithm
[0056] The method to reduce the number of false edges in the Canny algorithm is to use the double-threshold method. In the present invention, the low-threshold parameter is set to 120 and the high-threshold parameter is set to 250. This algorithm obtains an edge image based on the high threshold. Such an image contains very few false edges. However, due to the high threshold, the generated image edges may not be closed. To solve this problem, another low threshold is used. In the high-threshold image, connect the edges into contours. When reaching the end point of the contour, the algorithm will search for points that meet the low threshold among the 8-neighborhood points of the break point, and then collect new edges based on this point until the entire image edge is closed. Through the canny edge detection algorithm, a set of complete pixel points of the tobacco leaf contour is finally obtained.
[0057] Find the circumscribed rectangle of the tobacco leaf and obtain the starting coordinates (x 0 , y 0):Establish a direct coordinate system u-v in pixels with the upper left corner of the image as the origin, which is called the image coordinate system. Define a region D in the image coordinate system. Region D is a triangular pixel region enclosed by the three points with coordinates a(0,0), b(0,2048), and c(2048,0). Based on the analysis of the initial flue-cured tobacco picture data collected in this project, the tobacco leaves are all placed at an angle of 45° to the u-axis, and the leaf stalks of the tobacco leaves are all distributed in region D of the image (resolution 2448*2048). The present invention moves a straight line with a slope of -1 in region D of the image, and determines whether the current straight line position is at the optimal cutting position of the leaf stalk by the intersection points of the straight line and the leaf contour of region D and the distance value between the two intersection points.
[0058] Finding the intersection points of the straight line and the contour: Take n straight lines with a slope of -1, n = 2048 - (x 0 +y 0 ), and the expression of the straight line is:
[0059] y + x = b, b ∈ [x 0 +y 0 , 2048]
[0060] The expression of the i-th straight line described in the present invention is:
[0061] y + x = 2048 - i, 0 < i < 2048 - (x 0 +y 0 )
[0062] In the image coordinate system, find the coordinate values of the two intersection points of the i-th straight line and the tobacco leaf contour and the intersection point distance value respectively. The two intersection point coordinates are saved in the list p_all, and the corresponding distance values are saved in the list d_all. When the number of intersection points of the straight line and the contour is greater than 2 or the intersection point distance value is less than 10 pixels, it is initially judged that this situation is that the tobacco leaf surface is damaged, which is not conducive to the judgment of the leaf stalk cutting position, and these intersection points need to be discarded.
[0063] Finding the optimal leaf stalk cutting position: Loop through the intersection point distance values in the list d_all, and the loop variable i takes values from 0 to len(d_all) - 2, and return the first pair of intersection point coordinate values that meet the following judgment conditions:
[0064] Condition I: d_all[i + 1] <= d_all[i] <= d[i - 1]
[0065] Condition II:
[0066] Condition III: d_all[-1] - 10 < d_all[i] < d_all[-1] + 15
[0067] Among them, Condition Ⅰ is to prevent the intersection distance value from being less than the distance values of adjacent intersections around when there is damage inside the tobacco leaf; Conditions Ⅱ and Ⅲ are to more accurately identify the position of the leaf stalk and reduce the probability of incorrect cutting. The straight line where the pair of intersections is located is denoted as the Cutting line, and the position where the Cutting line is located is the optimal leaf stalk cutting position.
[0068] Perform leaf stalk cutting on the tobacco leaf at the optimal leaf stalk cutting position: Modify the gray values of the pixel points within the area enclosed by the Cutting line and the image coordinate system to 0. Thus, the leaf stalk cutting of the No. 1 initially cured tobacco leaf image is completed, as Figure 4 .
[0069] Obtain the total pixel area of the stem-removed initially cured tobacco: To make the error of the obtained picture pixel values smaller, Figure 3 is converted into a grayscale image, and then converted into a one-dimensional array to obtain the gray values of each pixel point of the image. The part with a gray value of 0 is the black background part of the picture. Count the number of pixels in the background part, and subtract the number of background pixels from the total number of pixels. The final number of pixels obtained is the pixel area of the stem-removed initially cured tobacco. The pixel area of the stem-removed initially cured tobacco is 1,043,214.
[0070] 3. Obtain the pixel values of the wrinkled part of the initially cured tobacco leaf
[0071] The present invention performs color-based threshold segmentation processing on Figure 4 . First, convert the picture of the stem-removed initially cured tobacco from the RGB color space to the HSV color space. Set the upper limit of the color threshold to [10, 100, 100] and the lower limit to [70, 190, 190]. Perform binary processing on the target image according to the set upper and lower limits, and then perform a logical "AND" operation on the binary processed picture and the original picture. Finally, an image of the wrinkled part of the initially cured tobacco leaf is obtained, as Figure 5 . Convert this image into a grayscale image, and then convert it into a one-dimensional array to obtain the gray values of each pixel point of the image. Count the number of pixels in the background part, and subtract the number of background pixels from the total number of pixels. Finally, the pixel area of the wrinkled part of the initially cured tobacco leaf is obtained as 33,972.
[0072] 4. Calculate the identity characteristic score of the initially cured tobacco
[0073] Add the pixel area 1,043,214 of the No. 1 stem-removed initially cured tobacco to the area 33,972 of the wrinkled part of the tobacco leaf to obtain the final total pixel area 1,077,186 of the initially cured tobacco. Input the weight 7.26 g of the No. 1 stem-removed initially cured tobacco, and perform identity characteristic scoring according to the following formula:
[0074]
[0075] Among them, the identity score is reserved to one decimal place. Finally, according to this formula, the final identity score of the first flue-cured tobacco is 5.5 points.
[0076] The operation of the present invention is simple and does not require extracting complex features of tobacco leaves such as texture, leaf tip angle, vein thickness, etc. Only a complete picture of the first flue-cured tobacco and the weight of the stem-removed first flue-cured tobacco are needed to score the identity characteristics of the first flue-cured tobacco using the present invention. At the same time, the present invention also has the advantage of high precision. Considering that the weight ratio of the stem part of the first flue-cured tobacco leaves to the total weight is relatively large, which is likely to cause a large error in the finally obtained identity score, the present invention performs the processing of identifying and removing the leaf stem on the picture of the first flue-cured tobacco, thereby improving the overall precision.
[0077] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention, according to the technical solution and inventive concept of the present invention, making equivalent substitutions or changes, should be covered within the protection scope of the present invention.
Claims
1. An evaluation method for the identity characteristics of primary roasted tobacco leaves, characterized in that, the method includes: (1) Obtain pictures of primary roasted tobacco leaf samples and the corresponding sample weights; the sample weight is the weight of the stemmed primary roasted tobacco leaves; (2) Perform threshold segmentation processing based on color on the sample pictures to obtain characteristic sub-pictures; (3) Perform the process of removing the leaf stems on the characteristic sub-pictures and calculate the pixel area of the stemmed tobacco leaves; among them, use the canny edge algorithm on the characteristic sub-pictures to extract the edge information of the primary roasted tobacco leaves, find the circumscribed rectangle of the primary roasted tobacco leaves, and then establish an image coordinate system, take multiple lines with a slope of -1, and calculate the distance value between the intersection points of the lines and the contour of the primary roasted tobacco leaves in the D area; when the number of intersection points of the line and the contour is greater than 2 or the intersection point distance value is less than 10 pixels, discard these intersection points; loop through the intersection point distance values in the list d_all of the two intersection point distance values, and the loop variable i takes values from 0 to len(d_all)-2, and return the first pair of intersection point coordinate values that meet the following judgment conditions: Condition Ⅰ: d_all[i+1]<=d_all[i]<=d[i-1] Condition II: Condition Ⅲ: d_all[-1]-10<d_all[i]<d_all[-1]+15; The line where the pair of intersection points is located is the leaf stem cutting position; The image coordinate system is a coordinate system u-v established with the upper left corner of the image as the origin in pixels, and a triangular pixel area D surrounded by three points a(0,0), b(0,2048), and c(2048,0) is defined in it, and the image resolution is 2448×2048; (4) Perform a threshold segmentation based on color on the characteristic sub-pictures once, extract the wrinkled part of the primary roasted tobacco leaf sample and calculate its pixel area of the wrinkled part; (5) Add the pixel area of the stemmed tobacco leaves to the pixel area of the wrinkled part to obtain the total pixel area of the primary roasted tobacco leaves; (6) Calculate the identity characteristic score of the primary roasted tobacco leaf sample according to the identity characteristic calculation formula; the identity characteristic calculation formula is:
2. The method according to claim 1, characterized in that, the picture of the primary roasted tobacco leaf sample is a front perspective view of the primary roasted tobacco leaf collected by using the same set of image acquisition methods.
3. The method according to claim 1 or 2, characterized in that, the number of pictures of the primary roasted tobacco leaf sample is at least one.
Citation Information
Patent Citations
Tobacco leaf thickness and density nondestructive testing system and method
CN113624147A