A method of differentiating between side group tobacco leaf colors

By acquiring a sample image set of subgroup tobacco leaf color grading, performing binarization segmentation, and using a voting mechanism for differentiation, the problems of low efficiency and low accuracy in subgroup tobacco leaf color differentiation in existing technologies are solved, achieving fast and accurate color differentiation.

CN115222827BActive Publication Date: 2026-06-26KUNMING UNIV OF SCI & TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
KUNMING UNIV OF SCI & TECH
Filing Date
2022-07-22
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

The lack of standardized methods for distinguishing the color of sub-group tobacco leaves in existing technologies leads to low efficiency, low accuracy, and strong subjectivity in manual grading.

Method used

By acquiring a sample image set of tobacco leaf color grading samples from the subgroup, performing binarization segmentation and coordinate return, extracting the Lab values ​​of pixels in the color images, calculating the contrast set and dividing it into intervals, drawing a percentage threshold line graph, and using a voting mechanism to distinguish colors.

Benefits of technology

It enables rapid and accurate differentiation of the color of tobacco leaves in the secondary group, improving grading efficiency and accuracy while reducing subjectivity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115222827B_ABST
    Figure CN115222827B_ABST
Patent Text Reader

Abstract

The application provides a method for distinguishing the color of sub-group tobacco leaves, applied to the technical field of computer image processing, and comprises the following steps: obtaining a color classification sample image set of sub-group tobacco leaves, performing binary segmentation on the color classification sample of the tobacco leaves, and obtaining a binary image tobacco leaf area; performing coordinate return on the binary image tobacco leaf area, and generating a color image tobacco leaf area; extracting a pixel point Lab value set of the color image tobacco leaf area, combining a pure color pixel point Lab value, and calculating a pixel point contrast set; performing interval division on the pixel point contrast set, and generating a contrast interval division result; traversing the division result, and calculating an interval pixel proportion set; according to the interval pixel proportion set, drawing a proportion threshold point line graph, and then performing color distinction on a to-be-tested tobacco leaf image according to a voting mechanism. The method solves the technical problems that there is no standardized method for distinguishing the color of sub-group tobacco leaves in the prior art, manual classification has low efficiency and low classification accuracy, and is highly subjective.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] A method for distinguishing the color of tobacco leaves in a subgroup

[0002] This invention relates to the field of computer image processing technology, and specifically to a method for distinguishing the colors of tobacco leaves in a subgroup. Background Technology

[0003] Tobacco is one of my country's major agricultural economic crops, and tobacco leaves are the raw material for tobacco product manufacturing. The quality evaluation and grading of tobacco leaves have a crucial impact on the quality and price of finished cigarettes. Differences in tobacco leaf color largely reflect the varying proportions of different pigments present in the leaves, and the appearance color of tobacco leaves is closely related to their internal quality. In existing technologies, the grouping of tobacco leaf color characteristics relies on manual methods to classify the depth of yellow and the proportion of discolored areas, resulting in low grading efficiency and accuracy, and a high degree of subjectivity.

[0004] Therefore, the lack of a standardized method for distinguishing the color of sub-group tobacco leaves in the existing technology leads to technical problems such as low efficiency, low grading accuracy, and high subjectivity in manual grading. Summary of the Invention

[0005] This application provides a method for distinguishing the color of secondary tobacco leaves, which addresses the technical problems of low efficiency, low accuracy, and high subjectivity in manual grading due to the lack of standardized methods for distinguishing the color of secondary tobacco leaves in the prior art.

[0006] In view of the above problems, this application provides a method for distinguishing the color of tobacco leaves in the subgroup.

[0007] The first aspect of this application provides a method for distinguishing the color of tobacco leaves in a subgroup, comprising: traversing three subgroups of tobacco leaves in a tobacco leaf image to be tested to obtain a subgroup tobacco leaf color grading sample image set, wherein the subgroup tobacco leaf color grading sample image set includes frontal images of tobacco leaf color grading samples; performing binarization segmentation on the frontal images of the tobacco leaf color grading samples to generate a binary image tobacco leaf region; performing coordinate return on the binary image tobacco leaf region to generate a color image tobacco leaf region; extracting the set of Lab values ​​of pixels in the color image tobacco leaf region, and calculating a set of pixel contrast values ​​by combining the Lab values ​​of solid color pixels; dividing the set of pixel contrast values ​​into intervals to generate a contrast interval division result; traversing the contrast interval division result to calculate a set of interval pixel proportions; drawing a proportion threshold line graph based on the set of interval pixel proportions; and distinguishing the color of the tobacco leaf image to be tested according to a voting mechanism based on the proportion threshold line graph.

[0008] A second aspect of this application provides a subgroup tobacco leaf color differentiation system, the system comprising: a sample image acquisition module, configured to traverse three subgroups of tobacco leaves in the tobacco leaf image to be tested, and acquire a subgroup tobacco leaf color grading sample image set, wherein the subgroup tobacco leaf color grading sample image set includes front images of tobacco leaf color grading samples. The binary image tobacco leaf region acquisition module is used to perform binarization segmentation on the front image of the tobacco leaf color grading sample to generate a binary image tobacco leaf region; the color image tobacco leaf region generation module is used to return the coordinates of the binary image tobacco leaf region to generate a color image tobacco leaf region; the pixel contrast set acquisition module is used to extract the set of Lab values ​​of pixels in the color image tobacco leaf region and calculate the pixel contrast set by combining the Lab values ​​of solid color pixels; the contrast interval division result generation module is used to divide the pixel contrast set into intervals to generate a contrast interval division result; the interval pixel proportion set acquisition module is used to traverse the contrast interval division result and calculate the interval pixel proportion set; the proportion threshold line graph drawing module is used to draw a proportion threshold line graph based on the interval pixel proportion set; and the color differentiation module is used to differentiate the colors of the tobacco leaf image to be tested according to a voting mechanism based on the proportion threshold line graph.

[0009] One or more technical solutions provided in this application have at least the following technical effects or advantages:

[0010] The method provided in this application acquires a sample image set of tobacco leaf color grading for the secondary group, performs binarization segmentation on the tobacco leaf color grading samples to obtain binary image tobacco leaf regions, and obtains the pixel coordinates of the tobacco leaf regions in the binary image. The pixel coordinates of the tobacco leaf regions in the binary image are returned to obtain the color image tobacco leaf regions. The set of Lab values ​​of the pixels in the color image tobacco leaf regions is extracted, and combined with the Lab values ​​of the solid color pixels, a set of pixel contrast values ​​is calculated based on the difference between the two. The set of pixel contrast values ​​is divided into intervals to generate contrast interval division results. The division results are traversed to calculate the set of pixel proportions in each interval. Subsequently, a threshold line graph of the proportions is drawn based on the set of pixel proportions in each interval. Then, the contrast proportion of the tobacco leaf image to be tested is obtained, and a voting mechanism is used to vote on the contrast proportion of the tobacco leaf image to be tested to complete the color differentiation. The use of the voting mechanism makes the obtained tobacco leaf color differentiation results more accurate and avoids the technical problems of low efficiency, low grading accuracy, and strong subjectivity inherent in manual grading. This achieves the technical effect of quickly and accurately differentiating the colors of secondary group tobacco leaves. This solves the technical problems of low efficiency, low accuracy, and high subjectivity in manual grading caused by the lack of a standardized method for distinguishing the color of sub-group tobacco leaves in existing technologies.

[0011] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0012] Figure 1 A flowchart illustrating a method for differentiating the color of tobacco leaves in a subgroup, provided in this application;

[0013] Figure 2 A flowchart illustrating the process of obtaining the binary image tobacco leaf region in a method for distinguishing the color of subgroup tobacco leaves provided in this application;

[0014] Figure 3 A flowchart illustrating the process of obtaining contrast interval division results in a method for differentiating the color of tobacco leaves provided in this application;

[0015] Figure 4 This application provides a schematic diagram of a subgroup tobacco leaf color differentiation system.

[0016] Figure labeling: Sample image acquisition module 11, Binary image tobacco leaf region acquisition module 12, Color image tobacco leaf region generation module 13, Pixel contrast set acquisition module 14, Contrast interval division result generation module 15, Interval pixel proportion set acquisition module 16, Proportion threshold point line graph drawing module 17, Color differentiation module 18. Detailed Implementation

[0017] This application provides a method for distinguishing the color of secondary tobacco leaves, which addresses the technical problems of low efficiency, low accuracy, and high subjectivity in manual grading due to the lack of standardized methods for distinguishing the color of secondary tobacco leaves in the prior art.

[0018] The technical solutions in this application will now be clearly and completely described with reference to the accompanying drawings. The described embodiments are only a part of what can be achieved by this application, and not all of the contents of this application.

[0019] Example 1

[0020] like Figure 1 As shown, this application provides a method for distinguishing the color of subgroup tobacco leaves, the method comprising:

[0021] Step 100: Traverse the three subgroups of tobacco leaves in the image of the tobacco leaf to be tested, and obtain the subgroup tobacco leaf color grading sample image set, wherein the subgroup tobacco leaf color grading sample image set includes frontal images of tobacco leaf color grading samples.

[0022] Specifically, tobacco is one of my country's major agricultural economic crops, and tobacco leaves are the raw material for tobacco product manufacturing. The quality evaluation and grading of tobacco leaves have a crucial impact on the quality and price of finished cigarettes. Generally, tobacco leaf color characteristics are grouped based on the depth of yellow color as perceived by experts and the proportion of variegated areas. Subgroup tobacco leaves are classified into three categories: greenish-yellow, slightly greenish, and variegated. Specifically, greenish-yellow tobacco leaves are yellow leaves containing any visible green color, with the green area not exceeding 30% of the entire leaf; slightly greenish tobacco leaves are yellow tobacco leaves with green veins or a slight floating green color on the leaf surface, with the area not exceeding 10% of the entire leaf; and variegated tobacco leaves are tobacco leaves with patches of color on the surface that differ from the basic color (except for greenish-yellow tobacco), with any variegated area exceeding 20% ​​of the entire leaf. By acquiring images of tobacco leaves from the three subgroups of greenish-yellow, slightly greenish, and mixed colors, a color grading sample image set for the subgroup tobacco leaves is obtained. The subgroup tobacco leaf color grading sample image set includes frontal images of tobacco leaf color grading samples, and all images in the subgroup tobacco leaf color grading sample image set are RGB images.

[0023] Step 200: Perform binarization segmentation on the front image of the tobacco leaf color grading sample to generate a binary image of the tobacco leaf region;

[0024] Step 300: Return the coordinates of the binary image tobacco leaf region to generate a color image tobacco leaf region;

[0025] Step 400: Extract the set of Lab values ​​of pixels in the tobacco leaf region of the color image, and calculate the set of pixel contrast values ​​by combining the Lab values ​​of solid color pixels;

[0026] Specifically, the frontal image of the tobacco leaf color grading sample is binarized and segmented. This involves binarizing the RGB image of the tobacco leaf color grading sample, extracting the tobacco leaf region from the image, obtaining the coordinates of the tobacco leaf region, and then returning these coordinates to the RGB color image to extract the tobacco leaf region from the RGB color image, generating a color image of the tobacco leaf region. Subsequently, the set of Lab values ​​for the pixels in the color image of the tobacco leaf region is obtained. Since the Lab color space has a wider color gamut, it can better display the colors in the tobacco leaf image. Based on the extracted set of Lab values ​​for the pixels in the color image of the tobacco leaf region and the Lab values ​​of solid color pixels, a Lab value contrast calculation is performed. The Lab values ​​for solid color pixels can be selected as pure yellow or pure red pixels, or set according to the actual situation.

[0027] like Figure 2 As shown, the method step 200 provided in this embodiment further includes:

[0028] Step 210: Convert the front image of the tobacco leaf color grading sample from RGB color space to HSV color space to generate an HSV color space image;

[0029] Step 220: Perform channel segmentation on the HSV color space image to extract the HSV color space image of the chroma channel H;

[0030] Step 230: Apply Gaussian filtering to the HSV color space image of the chroma channel H to obtain the filtered image;

[0031] Step 240: Perform Otsu's method binarization segmentation on the filtered image to generate the binary image tobacco leaf region.

[0032] Specifically, the front image of the tobacco leaf color grading sample is converted from the RGB color space to the HSV color space to generate an HSV color space image. The HSV color space image of the chroma channel H is then filtered using Gaussian filtering to obtain the filtered image. Since the foreground and background of the tobacco leaf image overlap, Otsu's binarization method is used in this invention to convert the image from the RGB color space to the HSV color space. Channel segmentation is then performed on the HSV color space image to extract the chroma channel H. Gaussian filtering is then applied to the extracted H channel, and Otsu's binarization method is used to segment the processed image. The extracted H channel image pixel values ​​show a clear bimodal distribution, thus obtaining the binarized segmented tobacco leaf region. The tobacco leaf region in the image is:

[0033] ;

[0034] in: These are the pixel coordinates in the binarized image. This is the pixel value at that coordinate.

[0035] The method step 200 provided in this application embodiment further includes:

[0036] Step 250: Based on the binary image tobacco leaf region, obtain the coordinates of the binary image pixels and the pixel values ​​of the binary image pixels;

[0037] Step 260: Based on the pixel coordinates and pixel values ​​of the binary image, convert the binarized subgroup tobacco leaf image from the binary image space to the RGB color space, and then to the Lab color space to generate a Lab color space image.

[0038] Step 270: Perform channel segmentation on the Lab color space image to obtain the Lab color space image of the luminance channel L;

[0039] Step 280: Determine the color tobacco leaf region based on the Lab color space image of the brightness channel L.

[0040] Specifically, based on the binary image tobacco leaf region, the coordinates and pixel values ​​of the binary image pixels are obtained. Then, based on these coordinates and pixel values, and since the coordinates of pixels in different image formats are mutually corresponding, the binary subgroup tobacco leaf image is converted from the binary image space to the RGB color space, i.e., the tobacco leaf region corresponding to the binary image tobacco leaf region in the RGB color space is extracted. This region is then converted to the Lab color space to generate a Lab color space image. The Lab color space image is then processed by channel segmentation to obtain the Lab color space image of the luminance channel L. Finally, based on the Lab color space image of the luminance channel L, the color image tobacco leaf region is determined. The color image tobacco leaf region is:

[0041] ;

[0042] in: These are the pixel coordinates in the color image. This represents the brightness at that coordinate. By acquiring the color space image of the brightness channel L, the accuracy of tobacco leaf region acquisition in the color image is further improved.

[0043] Step 500: Divide the pixel contrast set into intervals to generate contrast interval division results;

[0044] Step 600: Traverse the contrast interval division results and calculate the set of interval pixel proportions;

[0045] Step 700: Draw a percentage threshold line graph based on the set of pixel percentages in the specified intervals;

[0046] Step 800: Based on the percentage threshold line graph, the tobacco leaf image to be tested is distinguished by color according to the voting mechanism.

[0047] Specifically, the acquired pixel contrast set is divided into intervals, resulting in multiple equidistant intervals. Then, the interval division results are iterated through, and the interval pixel percentage set is calculated using the interval pixel percentage formula. The pixel percentage for each contrast interval is obtained. Next, a percentage threshold line graph is drawn based on the pixel percentage of each contrast interval, defining the tobacco leaf percentage threshold for each subgroup within each contrast interval. Finally, the tobacco leaf image under test is color-differentiated according to the percentage threshold line graph and a voting mechanism. Before color-differentiating the tobacco leaf image under test according to the percentage threshold line graph and the voting mechanism, the pixel percentage of the tobacco leaf image under test needs to be calculated based on the contrast interval division results. Then, the tobacco leaf image under test is color-differentiated according to the pixel percentage of the tobacco leaf under test and the percentage threshold line graph, using a voting mechanism. In this voting mechanism, each contrast interval division can be voted on once, completing the voting for all contrast interval divisions of the tobacco leaf image under test. The subgroup with the most votes is the final subgroup for the tobacco leaf under test, completing the color-differentiated process for the tobacco leaf image under test.

[0048] The method step 400 provided in this application embodiment further includes:

[0049] Step 410: Obtain the pixel contrast calculation formula:

[0050] ;

[0051] Step 420: Wherein, For any subgroup of tobacco leaves, the first Contrast of individual pixels For the first Lab value of each pixel The Lab value of a solid color pixel. This represents the total number of pixels in the subgroup of tobacco leaves;

[0052] Step 430: Traverse the set of Lab values ​​of pixels in the tobacco leaf region of the color image, combine the Lab values ​​of the solid color pixels, input the pixel contrast calculation formula, and determine the set of pixel contrast values.

[0053] Specifically, the contrast of pixels in the tobacco leaf region of the color image is obtained, where the formula for calculating pixel contrast is:

[0054] ;

[0055] in, For any subgroup of tobacco leaves, the first Contrast of individual pixels For the first Lab value of each pixel The Lab value of a solid color pixel. This represents the total number of pixels in the subgroup of tobacco leaves. The set of Lab values ​​for the pixels in the color image of the tobacco leaf region, along with the Lab values ​​for the solid color pixels, are input into the pixel contrast calculation formula. The set of pixel contrast values ​​is then determined using this formula.

[0056] like Figure 3 As shown, the method step 400 provided in this embodiment further includes:

[0057] Step 440: Obtain the contrast value range according to the pixel contrast calculation formula;

[0058] Step 450: Determine the preset length of the contrast interval based on the contrast value range and the preset number of contrast interval divisions;

[0059] Step 460: Based on the preset length of the contrast interval and the preset number of contrast interval divisions, construct the first contrast interval, the second contrast interval, and so on up to the first... Contrast range;

[0060] Step 470: The first contrast interval, the second contrast interval, and so on up to the first... The contrast range is added to the contrast range division result.

[0061] Specifically, based on the pixel contrast calculation formula, a contrast value range is obtained. A preset length for the contrast interval is determined based on the contrast value range and the preset number of contrast interval divisions. A first contrast interval is constructed based on the preset length and the preset number of contrast interval divisions, and second contrast intervals are constructed up to the [previous range]. Contrast range. For example, the contrast of the subgroup tobacco leaves is all between 0 and 1. Therefore, the range of 0-1 is divided into ten equal parts, meaning the contrast range length d is 0.1. The resulting contrast range is: The first contrast interval, the second contrast interval, and so on up to the first... The contrast range is added to the contrast range division result.

[0062] The method step 470 provided in this embodiment further includes:

[0063] Step 471: Obtain the interval pixel ratio evaluation formula:

[0064] ;

[0065] Step 472: Wherein, The total number of pixels in the tobacco leaf area of ​​the color image. For the first The number of pixels in the contrast range. Total number of intervals For the first The percentage of pixels within the contrast range;

[0066] Step 473: Extract the total number of pixels in the tobacco leaf area from the color image, traverse the contrast interval division results, input the interval pixel ratio evaluation formula, and generate the interval pixel ratio set.

[0067] Specifically, based on the proportion of pixels in each contrast range within the tobacco leaf area, the number of pixels in each contrast range was counted. The percentage of pixels in each interval within the tobacco leaf region is: The formula for evaluating the percentage of pixels in a given area is as follows:

[0068] ;

[0069] in, The total number of pixels in the tobacco leaf area of ​​the color image. For the first The number of pixels in the contrast range. Total number of intervals For the first The pixel percentage within each contrast interval is determined. Subsequently, the total number of pixels in the tobacco leaf region of the color image is extracted. The contrast interval division results are then iterated through, and the interval pixel percentage evaluation formula is input to generate the interval pixel percentage set. By obtaining the interval pixel percentage set, the pixel percentage of other leaf colors in the tobacco leaf region of the color image is obtained.

[0070] Step 474: Traverse the three subgroups of tobacco leaves to generate the set of pixel percentages of multiple intervals for the first subgroup of tobacco leaves, the set of pixel percentages of multiple intervals for the second subgroup of tobacco leaves, and the set of pixel percentages of multiple intervals for the third subgroup of tobacco leaves.

[0071] The method step 470 provided in this embodiment further includes:

[0072] Step 475: Obtain the formula for evaluating the average proportion of contrast intervals:

[0073] ;

[0074] in, This refers to the quantity of tobacco leaves from any one of the three subgroups of tobacco leaves. Characterizing the first The first tobacco leaf Pixel percentage in the contrast range Characterization The first The sum of the pixel percentages of tobacco leaves within the contrast range;

[0075] Step 476: According to the average proportion evaluation formula of the contrast interval, traverse the set of pixel proportions of multiple intervals of the first subgroup tobacco leaves, the set of pixel proportions of multiple intervals of the second subgroup tobacco leaves and the set of pixel proportions of multiple intervals of the third subgroup tobacco leaves to generate the set of average proportions of the contrast intervals of the first subgroup tobacco leaves, the set of average proportions of the contrast intervals of the second subgroup tobacco leaves and the set of average proportions of the contrast intervals of the third subgroup tobacco leaves.

[0076] Step 477: Traverse the average proportion set of the contrast interval of the first subgroup tobacco leaves, the average proportion set of the contrast interval of the second subgroup tobacco leaves, and the average proportion set of the contrast interval of the third subgroup tobacco leaves, and draw the proportion threshold point line graph.

[0077] Specifically, the process iterates through the three subgroups of tobacco leaves, generating sets of pixel proportions across multiple intervals for the first, second, and third subgroups. Then, based on the average proportion evaluation formula for the contrast interval, the average contrast proportion of each subgroup of tobacco leaves is calculated. The formula for the average proportion evaluation formula for the contrast interval is as follows:

[0078] ;

[0079] This refers to the quantity of tobacco leaves from any one of the three subgroups of tobacco leaves. Characterizing the first The first tobacco leaf Pixel percentage in the contrast range Characterization The first The sum of pixel proportions of tobacco leaves within the contrast interval. Based on the aforementioned average proportion evaluation formula for the contrast interval, traverse the pixel proportion sets of multiple intervals for the first subgroup of tobacco leaves, the second subgroup of tobacco leaves, and the third subgroup of tobacco leaves to generate the average proportion sets of the contrast intervals for the first, second, and third subgroups of tobacco leaves. Finally, traverse the average proportion sets of the contrast intervals for the first, second, and third subgroups of tobacco leaves to plot the proportion threshold line graph. Here, the proportion threshold line graph represents the average proportion of the contrast intervals of the classified subgroup tobacco leaf images, i.e., the standardized subgroup contrast proportion.

[0080] The method step 477 provided in this embodiment further includes:

[0081] Step 477-1: Construct a point-line coordinate system with contrast range as the first coordinate axis and proportion as the second coordinate axis;

[0082] Step 477-2: Traverse the average proportion set of the contrast interval of the first subgroup tobacco leaves, the average proportion set of the contrast interval of the second subgroup tobacco leaves, and the average proportion set of the contrast interval of the third subgroup tobacco leaves, and draw three proportion point line graphs in the proportion point line coordinate system.

[0083] Step 477-3: Extract the first coordinate axis based on the first coordinate axis. The average proportion of contrast ratio of the three subgroups of tobacco leaves corresponding to the contrast range;

[0084] Step 477-4: Iterate through the average proportion of the contrast ratio of the tobacco leaves in the three subgroups and calculate the average of the average proportions of tobacco leaves in two adjacent subgroups;

[0085] Step 477-5: Set the average percentage of the tobacco leaves in the two adjacent subgroups as the first... The percentage threshold of the two adjacent subgroups in the contrast interval;

[0086] Step 477-6: Repeat the calculation to obtain the set of contrast interval proportion thresholds, and draw the proportion threshold point line graph.

[0087] Specifically, a percentage point-line coordinate system is constructed using the contrast interval as the first coordinate axis and the percentage as the second coordinate axis. Since the contrast interval obtained when plotting the contrast interval and contrast percentage is a range containing multiple contrast values, to facilitate subsequent data comparison, an average percentage set of the contrast interval is obtained by averaging the percentages of each contrast ratio within the contrast interval of each subgroup of tobacco leaves. Subsequently, the average percentage sets of the contrast intervals of the first subgroup of tobacco leaves, the second subgroup of tobacco leaves, and the third subgroup of tobacco leaves are traversed, and three percentage point-line graphs are plotted in the percentage point-line coordinate system. Based on the first coordinate axis, the first percentage point-line graph is extracted. The average contrast ratio of the three subgroups of tobacco leaves corresponding to the contrast interval is calculated by averaging the m-th contrast interval of the three subgroups of tobacco leaves. Then, the average of the average ratios of adjacent subgroups of tobacco leaves is calculated, i.e., the average pixel ratio of each contrast interval of adjacent subgroups of tobacco leaves is calculated. For example, to calculate the m-th contrast interval of the noisy and slightly bluish subgroups of tobacco leaves, the average contrast ratio of the m-th contrast interval of the noisy and slightly bluish subgroups of tobacco leaves is calculated, and the average of the obtained average contrast ratios is calculated. The average of the obtained average ratios is the average of the average ratios of the adjacent two subgroups of tobacco leaves. Then, the average of the average ratios of the adjacent two subgroups of tobacco leaves is set as the average of the m-th contrast interval of the three subgroups of tobacco leaves. The percentage threshold of the two adjacent subgroups in the contrast interval is calculated repeatedly. The average percentage of tobacco leaves in the two adjacent subgroups of all contrast intervals is calculated, and the percentage threshold of the two adjacent subgroups in all contrast intervals is obtained, resulting in a set of percentage thresholds for each contrast interval. Then, a line graph of the percentage thresholds is plotted based on this set. Plotting this line graph facilitates the subsequent differentiation of adjacent subgroups.

[0088] The method step 800 provided in this application embodiment further includes:

[0089] Step 801: Traverse the contrast interval division results and assign voting rights, wherein the voting rights include a preset number of votes;

[0090] Step 802: Initialize the votes for the three subgroups, wherein the three subgroups receive the same number of votes after the initialization.

[0091] Step 803: Traverse the contrast interval division results to calculate the pixel percentage of the tobacco leaf image to be tested, and obtain a set of pixel percentage calculation results;

[0092] Step 804: Traverse the set of pixel proportion calculation results and the proportion threshold line graph, and extract the pixel proportion calculation results and the first subgroup proportion threshold, the second subgroup proportion threshold and the third subgroup proportion threshold of the same contrast range.

[0093] Step 805: Determine whether the pixel percentage calculation result belongs to the first subgroup percentage threshold, the second subgroup percentage threshold, or the third subgroup percentage threshold;

[0094] Step 806: If the vote belongs to the first subgroup percentage threshold, cast the preset number of votes for the first subgroup; if the vote belongs to the second subgroup percentage threshold, cast the preset number of votes for the second subgroup; if the vote belongs to the third subgroup percentage threshold, cast the preset number of votes for the third subgroup.

[0095] Step 807: When the contrast interval division results have completed voting on the tobacco leaf image to be tested, obtain the total number of votes for the first subgroup, the total number of votes for the second subgroup, and the total number of votes for the third subgroup;

[0096] Step 808: Add the tobacco leaf to be tested to the subgroup with the largest total number of votes among the first subgroup, the second subgroup, and the third subgroup;

[0097] Step 809: Before determining whether the pixel proportion calculation result belongs to the first subgroup proportion threshold, the second subgroup proportion threshold, or the third subgroup proportion threshold, the following steps are included:

[0098] Step 810: Determine whether the adjacent subgroup proportion thresholds among the first subgroup proportion threshold, the second subgroup proportion threshold, and the third subgroup proportion threshold meet the preset proportion threshold difference value;

[0099] Step 811: If satisfied, perform the abstention operation in the corresponding contrast interval.

[0100] Specifically, the contrast interval division results are iterated through, and a voting opportunity is set for each contrast interval, granting the contrast interval division results voting rights, whereby the voting rights include a preset number of votes. Then, the votes for the three sub-groups are initialized, whereby the three sub-groups receive the same number of votes after initialization, where initialization can be done by assigning the same number of votes. The pixel percentage of the tobacco leaf image to be tested is calculated by iterating through the contrast interval division results, obtaining a set of pixel percentage calculation results for the tobacco leaf to be tested. The method for obtaining the pixel percentage of the tobacco leaf image to be tested is the same as the method for obtaining the interval pixel percentage set, and will not be elaborated further here. The set of pixel percentage calculation results for the tobacco leaf to be tested and the percentage threshold dot-line graph are iterated through, extracting the pixel percentage calculation results for the same contrast interval and the percentage thresholds for the first sub-group, the second sub-group, and the third sub-group. The first sub-group percentage threshold is the pixel percentage region of each contrast interval in the tobacco image of the first sub-group. The second sub-group percentage threshold is the pixel percentage region of each contrast interval in the tobacco image of the second sub-group. The third subgroup proportion threshold is the pixel proportion region of each contrast interval in the tobacco image of the third subgroup. Based on the pixel proportion calculation set of the tobacco image to be tested, and the first, second, and third subgroup proportion thresholds, the region where the pixel proportion of each contrast interval in the pixel proportion calculation set of the tobacco image to be tested is located is determined. If it belongs to the first subgroup proportion threshold, the preset number of votes is cast for the first subgroup; if it belongs to the second subgroup proportion threshold, the preset number of votes is cast for the second subgroup; if it belongs to the third subgroup proportion threshold, the preset number of votes is cast for the third group. When all contrast interval division results have completed voting for the tobacco image to be tested, that is, after all contrast intervals have completed voting, the total number of votes for the first subgroup, the total number of votes for the second subgroup, and the total number of votes for the third group are obtained. Then, the total number of votes for the first subgroup, the total number of votes for the second subgroup, and the total number of votes for the third group are compared, and the subgroup with the largest total number of votes is obtained, completing the voting for the tobacco image to be tested. The subgroup with the largest total number of votes is the subgroup into which the tobacco image to be tested is divided. Furthermore, determining whether the calculated pixel proportion falls within the first subgroup proportion threshold, the second subgroup proportion threshold, or the third subgroup proportion threshold includes, beforehand, determining whether the proportion thresholds of adjacent subgroups among the first, second, and third subgroup proportion thresholds meet a preset proportion threshold difference. That is, a preset proportion threshold difference is set. When this preset difference is met, if there are two adjacent subgroup tobacco leaves with excessively close proportion thresholds, the vote for that contrast range is abstained, preventing the proportion thresholds from being too close and affecting the final vote count, thus further ensuring the accuracy of the voting results.

[0101] In summary, the method provided in this application obtains a sample image set of tobacco leaf color grading for the sub-group, performs binarization segmentation on the tobacco leaf color grading samples to obtain a binary image of the tobacco leaf region, and obtains the pixel coordinates of the tobacco leaf region in the binary image. The pixel coordinates of the tobacco leaf region in the binary image are returned to obtain the color image of the tobacco leaf region. The set of Lab values ​​of the pixels in the color image of the tobacco leaf region is extracted, and combined with the Lab values ​​of the solid color pixels, a set of pixel contrast values ​​is calculated based on the difference between the two. The set of pixel contrast values ​​is divided into intervals to generate contrast interval division results. The division results are traversed to calculate the set of pixel proportions in each interval. Subsequently, a threshold line graph of the proportions is drawn based on the set of pixel proportions in each interval. Then, the contrast proportion of the tobacco leaf image to be tested is obtained, and a voting mechanism is used to vote on the contrast proportion of the tobacco leaf image to be tested to complete the color differentiation. The use of the voting mechanism makes the obtained tobacco leaf color differentiation results more accurate and avoids the technical problems of low efficiency, low grading accuracy, and strong subjectivity inherent in manual grading. This achieves the technical effect of quickly and accurately differentiating the colors of sub-group tobacco leaves. This solves the technical problems of low efficiency, low accuracy, and high subjectivity in manual grading caused by the lack of a standardized method for distinguishing the color of sub-group tobacco leaves in existing technologies.

[0102] Example 2

[0103] Based on the same inventive concept as the method for distinguishing the color of subgroup tobacco leaves in the foregoing embodiments, such as Figure 4 As shown, this application provides a subgroup tobacco leaf color differentiation system, the system comprising:

[0104] The sample image acquisition module 11 is used to traverse the three subgroups of tobacco leaves in the tobacco leaf image to be tested and acquire the subgroup tobacco leaf color grading sample image set, wherein the subgroup tobacco leaf color grading sample image set includes the front image of the tobacco leaf color grading sample.

[0105] The binary image tobacco leaf region acquisition module 12 is used to perform binarization segmentation on the front image of the tobacco leaf color grading sample to generate a binary image tobacco leaf region.

[0106] The color image tobacco leaf region generation module 13 is used to return the coordinates of the binary image tobacco leaf region and generate a color image tobacco leaf region.

[0107] The pixel contrast set acquisition module 14 is used to extract the set of Lab values ​​of pixels in the tobacco leaf area of ​​the color image, and calculate the pixel contrast set by combining the Lab values ​​of solid color pixels.

[0108] The contrast interval division result generation module 15 is used to divide the pixel contrast set into intervals and generate contrast interval division results.

[0109] The interval pixel percentage set acquisition module 16 is used to traverse the contrast interval division results and calculate the interval pixel percentage set.

[0110] The percentage threshold line graph drawing module 17 is used to draw a percentage threshold line graph based on the set of pixel percentages in the interval.

[0111] Color differentiation module 18 is used to differentiate the color of the tobacco leaf image to be tested according to the voting mechanism based on the proportion threshold line graph.

[0112] Furthermore, the binary image tobacco leaf region acquisition module 12 is also used for:

[0113] The front image of the tobacco leaf color grading sample is converted from RGB color space to HSV color space to generate an HSV color space image;

[0114] The HSV color space image is subjected to channel segmentation processing to extract the HSV color space image of the chroma channel H;

[0115] The HSV color space image of the chroma channel H is filtered by Gaussian filtering to obtain the filtered image;

[0116] The filtered image is subjected to Otsu's method for binarization segmentation to generate the binary image of the tobacco leaf region.

[0117] Furthermore, the color image tobacco leaf region generation module 13 is also used for:

[0118] Based on the binary image of the tobacco leaf region, obtain the pixel coordinates and pixel values ​​of the binary image pixels.

[0119] Based on the pixel coordinates and pixel values ​​of the binary image, the binarized subgroup tobacco leaf image is converted from the binary image space to the RGB color space, and then to the Lab color space to generate a Lab color space image.

[0120] The Lab color space image is processed by channel segmentation to obtain the Lab color space image of the luminance channel L;

[0121] The color tobacco leaf region is determined based on the Lab color space image of the luminance channel L.

[0122] Furthermore, the pixel contrast set acquisition module 14 is also used for:

[0123] Formula for calculating pixel contrast:

[0124] ;

[0125] in, For any subgroup of tobacco leaves, the first Contrast of individual pixels For the first Lab value of each pixel The Lab value of a solid color pixel. This represents the total number of pixels in the subgroup of tobacco leaves;

[0126] Traverse the set of Lab values ​​of pixels in the tobacco leaf region of the color image, combine them with the Lab values ​​of the solid color pixels, input the pixel contrast calculation formula, and determine the set of pixel contrast values.

[0127] Furthermore, the contrast interval division result generation module 15 is also used for:

[0128] Based on the pixel contrast calculation formula, the contrast value range is obtained;

[0129] The preset length of the contrast interval is determined based on the contrast value range and the preset number of contrast interval divisions.

[0130] Based on the preset length and preset number of contrast interval divisions, a first contrast interval is constructed, and a second contrast interval is constructed up to the first... Contrast range;

[0131] The first contrast interval, the second contrast interval up to the first The contrast range is added to the contrast range division result.

[0132] Furthermore, the interval pixel ratio set acquisition module 16 is also used for:

[0133] Formula for obtaining the evaluation of the pixel proportion in a given range:

[0134] ;

[0135] in, The total number of pixels in the tobacco leaf area of ​​the color image. For the first The number of pixels in the contrast range. Total number of intervals For the first The percentage of pixels within the contrast range;

[0136] From the tobacco leaf region in the color image, extract the total number of pixels in the tobacco leaf region, traverse the contrast interval division results, input the interval pixel ratio evaluation formula, and generate the interval pixel ratio set.

[0137] Furthermore, the proportion threshold line graph drawing module 17 is also used for:

[0138] Traverse the three subgroups of tobacco leaves to generate a set of pixel percentages for multiple intervals of the first subgroup of tobacco leaves, a set of pixel percentages for multiple intervals of the second subgroup of tobacco leaves, and a set of pixel percentages for multiple intervals of the third subgroup of tobacco leaves.

[0139] Formula for obtaining the average proportion of contrast intervals:

[0140] ;

[0141] in, This refers to the quantity of tobacco leaves from any one of the three subgroups of tobacco leaves. Characterizing the first The first tobacco leaf Pixel percentage in the contrast range Characterization The first The sum of the pixel percentages of tobacco leaves within the contrast range;

[0142] According to the average proportion evaluation formula of the contrast interval, the set of pixel proportion of multiple intervals of the first subgroup tobacco leaves, the set of pixel proportion of multiple intervals of the second subgroup tobacco leaves and the set of pixel proportion of multiple intervals of the third subgroup tobacco leaves are traversed to generate the set of average proportion of contrast intervals of the first subgroup tobacco leaves, the set of average proportion of contrast intervals of the second subgroup tobacco leaves and the set of average proportion of contrast intervals of the third subgroup tobacco leaves.

[0143] Traverse the set of average proportions of tobacco leaf contrast intervals in the first subgroup, the second subgroup, and the third subgroup, and plot the proportion threshold line graph.

[0144] Furthermore, the proportion threshold line graph drawing module 17 is also used for:

[0145] Construct a point-line coordinate system with contrast range as the first coordinate axis and proportion as the second coordinate axis;

[0146] Traverse the set of average proportions of the contrast intervals of the first subgroup of tobacco leaves, the set of average proportions of the contrast intervals of the second subgroup of tobacco leaves, and the set of average proportions of the contrast intervals of the third subgroup of tobacco leaves, and draw three proportion point line diagrams in the proportion point line coordinate system.

[0147] Based on the first coordinate axis, extract the first... The average proportion of contrast ratio of the three subgroups of tobacco leaves corresponding to the contrast range;

[0148] Iterate through the three subgroups of tobacco leaves to calculate the average proportion of the contrast ratio, and calculate the average proportion of the tobacco leaves in two adjacent subgroups.

[0149] The average percentage of the tobacco leaves in the two adjacent subgroups is set as the first... The percentage threshold of the two adjacent subgroups in the contrast interval;

[0150] Repeat the calculation to obtain the set of contrast interval proportion thresholds, and draw the proportion threshold point line graph.

[0151] Furthermore, the color differentiation module 18 is also used for:

[0152] Iterate through the contrast interval division results and assign voting rights, wherein the voting rights include a preset number of votes;

[0153] The three subgroups are initialized with votes, wherein the three subgroups have the same number of votes after the initialization.

[0154] The pixel percentage of the tobacco leaf image to be tested is calculated by traversing the contrast interval division results, and a set of pixel percentage calculation results is obtained.

[0155] Traverse the set of pixel percentage calculation results and the percentage threshold line graph, and extract the pixel percentage calculation results and the first subgroup percentage threshold, the second subgroup percentage threshold and the third subgroup percentage threshold for the same contrast range;

[0156] Determine whether the calculated pixel percentage belongs to the first subgroup percentage threshold, the second subgroup percentage threshold, or the third subgroup percentage threshold.

[0157] If the vote belongs to the first subgroup percentage threshold, cast the preset number of votes for the first subgroup; if the vote belongs to the second subgroup percentage threshold, cast the preset number of votes for the second subgroup; if the vote belongs to the third subgroup percentage threshold, cast the preset number of votes for the third subgroup.

[0158] Once the contrast interval division results have completed the voting on the tobacco leaf image to be tested, the total number of votes for the first subgroup, the total number of votes for the second subgroup, and the total number of votes for the third subgroup are obtained.

[0159] The tobacco leaf to be tested is added to the subgroup with the largest total number of votes among the first subgroup, the second subgroup, and the third subgroup.

[0160] Before determining whether the pixel percentage calculation result belongs to the first subgroup percentage threshold, the second subgroup percentage threshold, or the third subgroup percentage threshold, the process further includes:

[0161] Determine whether the adjacent subgroup proportion thresholds among the first subgroup proportion threshold, the second subgroup proportion threshold, and the third subgroup proportion threshold meet the preset proportion threshold difference.

[0162] If the conditions are met, the corresponding contrast interval will be used to abstain from voting.

[0163] The above-described Embodiment 2 is used to execute the method as described in Embodiment 1. Its execution principle and basis can be obtained from the content described in Embodiment 1, and will not be elaborated further here. Although this application has been described in conjunction with specific features and embodiments, this application is not limited to the exemplary embodiments described herein. Based on the embodiments of this application, those skilled in the art can make various modifications and variations to this application without departing from the scope of this application, and the content obtained in this way also falls within the protection scope of this application.

Claims

1. A method for distinguishing the color of subgroup tobacco leaves, characterized in that, include: Traverse the three subgroups of tobacco leaves in the image of the tobacco leaf to be tested to obtain a color grading sample image set of the subgroup tobacco leaves, wherein the subgroup tobacco leaf color grading sample image set includes frontal images of tobacco leaf color grading samples. The front image of the tobacco leaf color grading sample is binarized and segmented to generate a binary image of the tobacco leaf region; The coordinates of the binary image tobacco leaf region are returned to generate a color image tobacco leaf region; Extract the set of Lab values ​​of pixels in the tobacco leaf region of the color image, and combine them with the Lab values ​​of solid color pixels to calculate the set of pixel contrast. The pixel contrast set is divided into intervals to generate contrast interval division results; Traverse the contrast interval division results and calculate the set of pixel proportions in each interval; Based on the set of pixel proportions in the specified intervals, draw a line graph of the proportion threshold points; Based on the percentage threshold line graph, the images of the tobacco leaves to be tested are distinguished by color according to a voting mechanism. The step of drawing a percentage threshold line graph based on the set of pixel percentages in the interval includes: Traverse the three subgroups of tobacco leaves to generate a set of pixel percentages for multiple intervals of the first subgroup of tobacco leaves, a set of pixel percentages for multiple intervals of the second subgroup of tobacco leaves, and a set of pixel percentages for multiple intervals of the third subgroup of tobacco leaves. Formula for obtaining the average proportion of contrast intervals: ; in, This refers to the quantity of tobacco leaves from any one of the three subgroups of tobacco leaves. Characterizing the first The first tobacco leaf Pixel percentage in the contrast range , Characterization The first The sum of the pixel percentages of tobacco leaves within the contrast range; According to the average proportion evaluation formula of the contrast interval, the set of pixel proportion of multiple intervals of the first subgroup tobacco leaves, the set of pixel proportion of multiple intervals of the second subgroup tobacco leaves and the set of pixel proportion of multiple intervals of the third subgroup tobacco leaves are traversed to generate the set of average proportion of contrast intervals of the first subgroup tobacco leaves, the set of average proportion of contrast intervals of the second subgroup tobacco leaves and the set of average proportion of contrast intervals of the third subgroup tobacco leaves. Traverse the set of average proportion of tobacco leaf contrast intervals of the first subgroup, the set of average proportion of tobacco leaf contrast intervals of the second subgroup, and the set of average proportion of tobacco leaf contrast intervals of the third subgroup, and draw the proportion threshold point line graph. The step of traversing the average proportion set of the contrast intervals of the first subgroup of tobacco leaves, the average proportion set of the contrast intervals of the second subgroup of tobacco leaves, and the average proportion set of the contrast intervals of the third subgroup of tobacco leaves, and drawing the proportion threshold point line graph, includes: Construct a point-line coordinate system with contrast range as the first coordinate axis and proportion as the second coordinate axis; Traverse the set of average proportions of the contrast intervals of the first subgroup of tobacco leaves, the set of average proportions of the contrast intervals of the second subgroup of tobacco leaves, and the set of average proportions of the contrast intervals of the third subgroup of tobacco leaves, and draw three proportion point line diagrams in the proportion point line coordinate system. Based on the first coordinate axis, extract the first... The average proportion of contrast ratio of the three subgroups of tobacco leaves corresponding to the contrast range; Iterate through the three subgroups of tobacco leaves to calculate the average proportion of the contrast ratio, and calculate the average proportion of the tobacco leaves in two adjacent subgroups. The average percentage of the tobacco leaves in the two adjacent subgroups is set as the first... The percentage threshold of the two adjacent subgroups in the contrast interval; Repeat the calculation to obtain the set of contrast interval proportion thresholds, and draw the proportion threshold point line graph; The step of color-classifying the tobacco leaf image according to the voting mechanism based on the proportion threshold line graph includes: Iterate through the contrast interval division results and assign voting rights, wherein the voting rights include a preset number of votes; The three subgroups are initialized with votes, wherein the three subgroups have the same number of votes after the initialization. The pixel percentage of the tobacco leaf image to be tested is calculated by traversing the contrast interval division results, and a set of pixel percentage calculation results is obtained. Traverse the set of pixel percentage calculation results and the percentage threshold line graph, and extract the pixel percentage calculation results and the first subgroup percentage threshold, the second subgroup percentage threshold and the third subgroup percentage threshold for the same contrast range; Determine whether the calculated pixel percentage belongs to the first subgroup percentage threshold, the second subgroup percentage threshold, or the third subgroup percentage threshold. If the vote belongs to the first subgroup percentage threshold, cast the preset number of votes for the first subgroup; if the vote belongs to the second subgroup percentage threshold, cast the preset number of votes for the second subgroup; if the vote belongs to the third subgroup percentage threshold, cast the preset number of votes for the third subgroup. Once the contrast interval division results have completed the voting on the tobacco leaf image to be tested, the total number of votes for the first subgroup, the total number of votes for the second subgroup, and the total number of votes for the third subgroup are obtained. The tobacco leaf to be tested is added to the subgroup with the largest total number of votes among the first subgroup, the second subgroup, and the third subgroup. Before determining whether the pixel percentage calculation result belongs to the first subgroup percentage threshold, the second subgroup percentage threshold, or the third subgroup percentage threshold, the process further includes: Determine whether the adjacent subgroup proportion thresholds among the first subgroup proportion threshold, the second subgroup proportion threshold, and the third subgroup proportion threshold meet the preset proportion threshold difference. If the conditions are met, the corresponding contrast interval will be used to abstain from voting.

2. The method as described in claim 1, characterized in that, The step of binarizing the frontal image of the tobacco leaf color grading sample to generate a binary image of the tobacco leaf region includes: The front image of the tobacco leaf color grading sample is converted from RGB color space to HSV color space to generate an HSV color space image; The HSV color space image is processed by channel segmentation to extract the HSV color space image of the chroma channel H; The HSV color space image of the chroma channel H is filtered by Gaussian filtering to obtain the filtered image; The filtered image is subjected to Otsu's method for binarization segmentation to generate the binary image of the tobacco leaf region.

3. The method as described in claim 2, characterized in that, The step of returning the coordinates of the binary image tobacco leaf region to generate a color image tobacco leaf region includes: Based on the binary image of the tobacco leaf region, obtain the pixel coordinates and pixel values ​​of the binary image pixels; Based on the pixel coordinates and pixel values ​​of the binary image, the binarized subgroup tobacco leaf image is converted from the binary image space to the RGB color space, and then to the Lab color space to generate a Lab color space image. The Lab color space image is processed by channel segmentation to obtain the Lab color space image of the luminance channel L; The color image tobacco leaf region is determined based on the Lab color space image of the luminance channel L.

4. The method as described in claim 1, characterized in that, The step of extracting the set of Lab values ​​of pixels in the tobacco leaf region of the color image, and combining them with the Lab values ​​of solid color pixels to calculate the set of pixel contrast includes: Formula for calculating pixel contrast: ; in, For any subgroup of tobacco leaves, the first Contrast of individual pixels , For the first Lab value of each pixel The Lab value of a solid color pixel. This represents the total number of pixels in the subgroup of tobacco leaves; Traverse the set of Lab values ​​of pixels in the tobacco leaf region of the color image, combine them with the Lab values ​​of the solid color pixels, input the pixel contrast calculation formula, and determine the set of pixel contrast values.

5. The method as described in claim 4, characterized in that, The step of dividing the pixel contrast set into intervals to generate contrast interval division results includes: Based on the pixel contrast calculation formula, the contrast value range is obtained; The preset length of the contrast interval is determined based on the contrast value range and the preset number of contrast interval divisions. Based on the preset length and preset number of contrast interval divisions, a first contrast interval is constructed, and a second contrast interval is constructed up to the first... Contrast range; The first contrast interval, the second contrast interval up to the first The contrast range is added to the contrast range division result.

6. The method as described in claim 5, characterized in that, The step of traversing the contrast interval division results and calculating the interval pixel percentage set includes: Formula for obtaining the evaluation of the pixel proportion in a given range: ; in, The total number of pixels in the tobacco leaf area of ​​the color image. For the first The number of pixels in the contrast range. , Total number of intervals For the first The percentage of pixels within the contrast range; From the tobacco leaf region in the color image, extract the total number of pixels in the tobacco leaf region, traverse the contrast interval division results, input the interval pixel ratio evaluation formula, and generate the interval pixel ratio set.

7. A color differentiation system for secondary tobacco leaves, characterized in that, The system is used to perform the method according to any one of claims 1-6, the system comprising: The sample image acquisition module is used to traverse the three subgroups of tobacco leaves in the image of the tobacco leaf to be tested and acquire a sample image set of color grading of the subgroup tobacco leaves, wherein the sample image set of color grading of the subgroup tobacco leaves includes frontal images of tobacco leaf color grading samples. The binary image tobacco leaf region acquisition module is used to perform binarization segmentation on the front image of the tobacco leaf color grading sample to generate a binary image tobacco leaf region. The color image tobacco leaf region generation module is used to return the coordinates of the binary image tobacco leaf region and generate a color image tobacco leaf region; The pixel contrast set acquisition module is used to extract the set of Lab values ​​of pixels in the tobacco leaf area of ​​the color image, and calculate the pixel contrast set by combining the Lab values ​​of solid color pixels. The contrast interval division result generation module is used to divide the pixel contrast set into intervals and generate contrast interval division results. The interval pixel percentage set acquisition module is used to traverse the contrast interval division results and calculate the interval pixel percentage set. The percentage threshold line graph drawing module is used to draw a percentage threshold line graph based on the set of pixel percentages in the interval. The color differentiation module is used to differentiate the color of the tobacco leaf image to be tested according to the voting mechanism based on the proportion threshold line graph.