Method and device for grading eggplant coats
Through image processing technology, the lesions and maximum effective use areas in the wrapper image are identified, and the wrapper is automatically graded, which solves the problems of high cost and low efficiency caused by manual cutting, and achieves a more efficient and accurate wrapper grading process.
Patent Information
- Application Number
- CN202411753995.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-04-11
AI Technical Summary
The method of manually cutting wrappers in the prior art leads to high cost and low efficiency, and is prone to waste of wrappers.
The lesions on tobacco leaves in the wrapper image are identified through image processing technology, the center point of the smallest external rectangle of the tobacco leaves is determined, and multiple rectangles are constructed to determine the maximum effective use area of the tobacco leaves, and the grading of the wrappers is automated based on the color difference, the area, number and centralized distribution of the lesions.
The automated grading of wrappers is realized, which reduces the problems of low accuracy and low efficiency caused by human factors, improves the accuracy and efficiency of grading, and saves costs.
Smart Images

Figure CN119810502A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of cigar quality evaluation, and in particular relates to a cigar wrapper grading method and device. Background Art
[0002] The domestic cigar manufacturing industry has developed rapidly, and cigar sales have continued to grow. Among them, detection technology is an important guarantee for improving the quality of traditional handmade cigar products, and it is also one of the indispensable technical research in the cigar manufacturing industry. The quality requirements of cigar wrappers are mainly concentrated on the appearance quality and wrapping characteristics of tobacco leaves. The wrapper is the appearance of the cigar and has a high degree of integrity. A good wrapper has a beautiful and perfect appearance, is extremely elastic, has moderate tightness, good air permeability, and is rich in oiliness. Through the wrapping of the wrapper, the wrapper and the cigar core will not easily fall apart. The wrapper has high requirements for planting, fermentation, and preservation, so most of the cost of cigars comes from the wrapper. Usually, the wrapper tobacco leaves are generally planted in the shade shed using the "shade planting method". By simulating natural cloud cover, direct sunlight is prevented from damaging the tobacco leaves. Moreover, the wrapper is generally selected from the middle section of the tobacco plant. Compared with the leaves of other parts of the plant, the control of the oil content and thickness of the wrapper is more meticulous and strict, and the toughness is excellent. Wrapper tobacco leaves not only have strict requirements on raw materials, but also extremely high requirements on craftsmanship. It usually takes up to 3 years to harvest a perfect wrapper, including a one-year growth period, a 6-month processing cycle, and an 18-month aging cycle.
[0003] The ideal wrapper leaf should be at least 38cm long and 10cm wide, and it is very expensive to produce such a leaf. At present, the effective area of the wrapper is still used in manual cutting, which relies on sensory recognition of defects on the tobacco leaf, determines the effective use area and cuts it. The labor cost is high, the efficiency is low, and it is easy to waste the wrapper. Summary of the invention
[0004] The object of the present invention is to provide a method and device for grading cigar wrappers, so as to solve the problems of high cost and low efficiency caused by manual cutting in the prior art.
[0005] In order to solve the above technical problems, the present invention provides a method for grading citrus wrappers, comprising the following steps:
[0006] 1) Identify the diseased spots on the tobacco leaves in the wrapper image, and determine the area, number and distribution of the diseased spots; calculate the color difference between the color of the diseased part and the color of the normal part in the wrapper image;
[0007] 2) Determine the center point of the minimum circumscribed rectangle of the tobacco leaf on the wrapper image;
[0008] 3) Taking the center point of the smallest circumscribed rectangle of the tobacco leaf as the center point of the rectangle, a plurality of rectangles of different lengths, widths and rotation angles are obtained, and the area of each rectangle is determined; judging whether the lesion is within the rectangle, and determining the rectangle with the largest area and in which all lesions are not within the rectangle as the maximum effective use area of the tobacco leaf;
[0009] 4) Determine the grade of the wrapper based on the color difference, the length and width of the maximum effective use area of the tobacco leaf, the area of the lesions, the number of lesions, and the concentrated distribution of the lesions.
[0010] Furthermore, the means for judging whether the lesion is inside the rectangle is as follows: if the lesion point P satisfies the following formula, the lesion point P is judged to be inside the rectangle; otherwise, the lesion point P is judged not to be inside the rectangle:
[0011]
[0012] Wherein, P1, P2, P3, and P4 represent the four vertices of the rectangle, and P1 and P3 are the coordinates of the two vertices on the diagonal corners of the rectangle, and * represents the dot product.
[0013] Furthermore, in the process of determining the maximum effective use area of the tobacco leaf, all rectangles are sorted from large to small according to their areas and traversed. The first rectangle in which all the disease spots are not inside the rectangle is the maximum effective use area of the tobacco leaf.
[0014] Furthermore, the trained deep learning model is used to identify the spots on the tobacco leaves in the wrapper image.
[0015] Furthermore, the Euclidean distance between the color of the diseased spot part and the color of the normal part in the Lab color space coordinates is calculated as the color difference between the color of the diseased spot part and the color of the normal part on the wrapper image.
[0016] Furthermore, the means for determining the concentrated distribution of lesions is as follows: determining the minimum circumscribed rectangle of each lesion, generating a circle with the center point of the minimum circumscribed rectangle of each lesion as the center, and the radius of each circle is the same; calculating the number of center points of the minimum circumscribed rectangle of each lesion contained in the circle corresponding to each lesion, and if the number is greater than the set number threshold, it is determined that there is a concentrated lesion phenomenon.
[0017] Furthermore, the criteria for determining the grade of the cigar wrapper include: if the color difference is less than a set color difference threshold, the tobacco leaf quality of the cigar wrapper belongs to the H grade, and the category under the H grade is determined based on the length and width of the maximum effective use area of the tobacco leaf; if the color difference is greater than or equal to the set color difference threshold, the area of the lesions is less than the set area threshold, the number of lesions is less than the set number threshold and there is a concentration of lesions, then the tobacco leaf quality of the cigar wrapper belongs to the M grade, and the category under the M grade is determined based on the length and width of the maximum effective use area of the tobacco leaf.
[0018] In order to solve the above technical problems, the present invention also provides a cigar wrapper grading device, comprising a memory and a processor, wherein the processor is used to execute computer program instructions stored in the memory to implement the cigar wrapper grading method introduced above.
[0019] The beneficial effects of the present invention are as follows: the present invention belongs to an improved invention creation, and the present invention uses image processing technology to extract the maximum effective use area of the tobacco leaf in the cigar wrapper image. The specific process is to first identify the lesions, and then obtain multiple rectangles with the center point of the minimum circumscribed rectangle of the tobacco leaf as the center to form a rectangular group, and determine the maximum effective use area of the tobacco leaf in combination with the positional relationship between each rectangle and the lesion in the rectangular group. On this basis, the grade of the cigar wrapper is determined according to the maximum effective use area of the tobacco leaf and other parameters (including color difference, lesion area, number of lesions, and concentrated distribution of lesions). The present invention does not require manual cutting, and can automatically realize cigar wrapper grading, which reduces the problems of low precision and low efficiency caused by human factors, makes the cigar wrapper grading results more accurate, improves grading efficiency, and saves costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a flow chart of cigar wrapper grading of the present invention;
[0021] Figure 2 is an original image of a cigar jacket tobacco leaf in an embodiment of the method of the present invention;
[0022] Figure 3 is a diagram of tobacco leaf defect detection in a cigar jacket in an embodiment of the method of the present invention;
[0023] Figure 4 This is a diagram of the maximum effective use area of the cigar jacket tobacco leaf in the embodiment of the method of the present invention. DETAILED DESCRIPTION
[0024] The present invention applies image processing technology to extract the maximum effective use area of tobacco leaves. Specifically, the diseased spots on the tobacco leaves in the wrapper image are first identified, and then the center point of the minimum circumscribed rectangle of the tobacco leaves is determined. Then, multiple rectangles are constructed with the center point as the center point of the rectangle, and then the rectangle with the largest area and all diseased spots not inside the rectangle is found in combination with the positional relationship between these rectangles and the diseased spots. This rectangle is the maximum effective use area of the tobacco leaves. The maximum effective use area of the tobacco leaves and other parameters are then used to grade the wrappers. The present invention replaces manual labor with machines, improves work efficiency, saves costs, and improves recognition accuracy. Based on this concept, a wrapper grading method and a wrapper grading device of the present invention can be realized. In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.
[0025] Method Example:
[0026] like Figure 1 As shown, the implementation process of a cigar wrapper grading method of the present invention is as follows:
[0027] Step 1: Use deep learning technology to identify the disease spots on the tobacco leaves in the wrapper image (hereinafter referred to as disease spots).
[0028] 1) Get Figure 2 The cigar wrapper image shown in the figure uses the trained deep learning model to identify the spots on the tobacco leaves. The recognition results are as follows: Figure 3 As shown, the number of lesions n was recorded.
[0029] The deep learning model here can be any model in the prior art, such as a convolutional neural network model.
[0030] 2) Select the color of the normal tobacco leaf part on the tobacco leaf of the wrapper image as the reference color; convert the color of the diseased part and the reference color into points in the Lab color space, and use the Euclidean distance formula to calculate the color difference between the color of the diseased part and the reference color. The calculation formula is as follows:
[0031]
[0032] In the formula, L2, a2, and b2 represent the coordinates of the three colors in the Lab color space converted from the color of the lesion, L1, a1, and b1 represent the coordinates of the three colors in the Lab color space converted from the reference color, and ΔE represents the color difference. If the value of ΔE is greater than or equal to 1 (the set color difference threshold), the color difference is judged to be obvious; otherwise, the color difference is not obvious.
[0033] 3) After accurately identifying the lesions on the leaves, the coordinate information of the characteristic points of the lesions is recorded, and the coordinates of the characteristic points of all the lesions constitute a defect point set.
[0034] 4) Determine the minimum bounding rectangle of each lesion in the defect point set and record the vertex coordinates (x 11 ,y 11 )、(x 12 ,y 12 )、(x 13 ,y 13 ) and (x 14 ,y 14 ), calculate the lesion area S and the coordinates of the lesion center N (x n ,y n ). The calculation formula is as follows:
[0035]
[0036] In the formula, (x11 ,y 11 ) and (x 12 ,y 12 ) are vertices on the same edge, (x 13 ,y 13 ) and (x 14 ,y 14 ) are vertices on the same edge, (x 11 ,y 11 ) and (x 13 ,y 13 ) are the coordinates of the two vertices on the opposite corners of the rectangle. n and n The calculation formula is for x 13 >x 11 And y 13 >y 11 situation.
[0037] Step 2: Determine the concentrated distribution of lesions.
[0038] With the center point N of the minimum circumscribed rectangle of each lesion as the center, generate n circles with a radius of 3 cm (this value can also be adjusted according to needs and can be set to 3-5 cm) on the tobacco leaf of the wrapper image, and record the formula of the circle as (xx n ) 2 +(yy n ) 2 =9, determine whether the center point of other lesions (i.e. the center point of the smallest circumscribed rectangle of other lesions) is within the circle, and the calculation formula is:
[0039] (x i -x n ) 2 +(y i -y n ) 2 =R 2
[0040] In the formula, (x i ,y i ) represents the coordinates of the center points of other lesions, and R represents the distance from the center points of other lesions to point N.
[0041] If R>3, it means that the point is not in the circle; otherwise, it means that the point is in the circle. The number of disease spots contained in each disease spot circle is calculated. If the number of disease spots is greater than 4 (4 is the set number threshold, which can generally be set to 3-6. Of course, the setting of this value is related to the radius of the circle set in step 2. If the radius of the circle is set larger, the number threshold should also be appropriately increased), it is determined that the disease spots in this area are concentrated.
[0042] Step 3: extract the minimum circumscribed rectangle and center point coordinates of the tobacco leaf on the wrapper image.
[0043] The obtained cigar wrapper image is processed by image processing technology. First, all the contour points of the outer contour of the cigar wrapper tobacco leaf image are stored. The pixel position difference between two adjacent points does not exceed 1. The point set is composed of the positions of all contour points. The vertex coordinates of multiple rectangles (x 21 ,y 21 )、(x 22 ,y 22 )、(x 23 ,y 23 ) and (x 24 ,y 24 ), the calculated areas of multiple rectangles are calculated as follows:
[0044]
[0045] In the formula, (x 21 ,y 21 ), and (x 22 ,y 22 ) are vertices on the same edge, (x 23 ,y 23 ) and (x 24 ,y 24 ) are vertices on the same edge, (x 21 ,y 21 ) and (x 23 ,y 23 ) are the coordinates of the two vertices on opposite corners of the rectangle.
[0046] By comparing the areas of multiple rectangles, the smallest circumscribed rectangle is obtained, which is the minimum circumscribed rectangle of the leaf. The center point (x, y) of the minimum circumscribed rectangle is obtained by calculation. The specific calculation formula is as follows:
[0047]
[0048] In the formula, (x 21 ,y 21 ) and (x 23 ,y 23 ) are the coordinates of the two vertices on the diagonal corners of the rectangle, where x 23 >x 21 and 23 >y 21 .
[0049] Step 4: Get a rectangular group on the wrapper image.
[0050] Take the center point obtained in step 3 as the center point of the rectangle group, expand from the center point of the rectangle to different angles, and obtain m rectangles with different rotation angles, lengths and widths. These m rectangles form a rectangle group. Use the vertex coordinates of the m rectangles in the rectangle group to calculate the area of each rectangle, and obtain the areas of the m rectangles S1, S2, S3, ... Sm.
[0051] Step 5: Determine whether the lesion is within the rectangular group to determine the maximum effective use area of the leaf.
[0052] 1) Sort the rectangles in the m rectangle group by area from large to small, and then determine whether the points in the defect point set exist inside the rectangle. The points in the point set are recorded as point P, and the four vertices of the rectangle are recorded as P1, P2, P3, and P4. To determine whether point P is inside the rectangle, it can be transformed into determining whether point P is between the upper and lower sides and the left and right sides of the rectangle. Therefore, the directionality of the vector cross product can be used to determine whether the angle exceeds 180°. The specific calculation formula is as follows:
[0053]
[0054] In the formula, P1, P2, P3, and P4 are the four vertices of the rectangle, and P1 and P3 are the coordinates of the two vertices on the diagonal corners of the rectangle, point P is the point to be verified, and * represents the dot product.
[0055] If point P satisfies the above formula, it means that point P is inside the rectangle, otherwise point P is not inside the rectangle.
[0056] 2) Verify the points in the defect point set against the rectangles in the rectangular group one by one from large to small. When the first rectangle does not contain all the points in the defect point set, the rectangle is the maximum effective use area of the blade. Figure 4 shown.
[0057] Step six, classify the wrapper leaves according to the data obtained from steps one to five to determine their grade.
[0058] Specifically:
[0059] If the color difference ΔE is less than 1 (1 is the set color difference threshold), it means that the color difference of the lesions is not obvious and the tobacco leaf quality belongs to the H grade. Furthermore, when the tobacco leaf length is ≥26.0cm and the width is ≥5.0cm, it belongs to the H1 type of wrapper; when 26.0cm>tobacco leaf length ≥20.0cm and width ≥5.0cm, it belongs to the H2 type of wrapper; when 20.0cm>tobacco leaf length ≥16.0cm and width ≥3.0cm, it belongs to the H3 type of wrapper.
[0060] If the color difference ΔE ≥ 1, it means that the color difference of the lesion is obvious. At this time, if the lesion area S < 0.04 cm 2, the number of lesions n<8, and the lesions are concentrated, the tobacco leaf quality belongs to the M grade. Furthermore, when the tobacco leaf length is ≥26.0cm and the width is ≥5.0cm, it belongs to the M1 type of wrapper; when 26.0cm>tobacco leaf length ≥20.0cm and width ≥5.0cm, it belongs to the M2 type of wrapper; when 20.0cm>tobacco leaf length ≥16.0cm and width ≥3.0cm, it belongs to the M3 type of wrapper.
[0061] If the tobacco leaves do not meet the above requirements, but the length of the tobacco leaves is greater than 24.0cm and the width is greater than 40cm, it belongs to Class 4 wrapper.
[0062] The rest that do not meet the above conditions will be recycled.
[0063] The length and width of the tobacco leaves are determined by the maximum effective use area of the leaves.
[0064] In summary, the method of the present invention is used for cigar wrapper selection in tobacco factories. The image processing technology is used to extract the effective area of the cigar wrapper, and the defects on the tobacco leaves are identified by deep learning methods, so that the selection process is more accurate; machines are used instead of manual labor to improve work efficiency and save costs; and the differences caused by manual labor in the selection process are reduced.
[0065] Device Example:
[0066] An embodiment of a cigar peel grading device of the present invention includes a memory, a processor and an internal bus, and the processor and the memory communicate and exchange data with each other through the internal bus. The processor executes various functional applications and data processing by running software programs and modules stored in the memory, thereby realizing a cigar peel grading method introduced in the method embodiment of the present invention. The processor can be a processing device such as a microprocessor MCU, a programmable logic device FPGA, etc. The memory can be various memories that use electrical energy to store information, such as RAM, ROM, etc., or it can be other types of memories.
[0067] Specific implementation methods are given above, but the present invention is not limited to the described implementation methods. The basic idea of the present invention lies in the above basic scheme. For ordinary technicians in this field, it does not take creative work to design various deformed models, formulas, and parameters according to the teachings of the present invention. Changes, modifications, substitutions, and variations of the implementation methods without departing from the principles and spirit of the present invention still fall within the scope of protection of the present invention.
Claims
1. A method for grading cigar wrappers, characterized in that: The steps include: 1) Identify the diseased spots on the tobacco leaves in the wrapper image, and determine the area, number and distribution of the diseased spots; calculate the color difference between the color of the diseased part and the color of the normal part in the wrapper image; 2) Determine the center point of the minimum circumscribed rectangle of the tobacco leaf on the wrapper image; 3) Taking the center point of the smallest circumscribed rectangle of the tobacco leaf as the center point of the rectangle, a plurality of rectangles of different lengths, widths and rotation angles are obtained, and the area of each rectangle is determined; judging whether the lesion is within the rectangle, and determining the rectangle with the largest area and in which all lesions are not within the rectangle as the maximum effective use area of the tobacco leaf; 4) Determine the grade of the wrapper based on the color difference, the length and width of the maximum effective use area of the tobacco leaf, the area of the lesions, the number of lesions, and the concentrated distribution of the lesions.
2. The wrapper grading method according to claim 1, characterized in that: The means of judging whether the lesion is inside the rectangle is: if the lesion point P satisfies the following formula, then the lesion point P is judged to be inside the rectangle; otherwise, the lesion point P is judged not to be inside the rectangle: Wherein, P1, P2, P3, and P4 represent the four vertices of the rectangle, and P1 and P3 are the coordinates of the two vertices on the diagonal corners of the rectangle, and * represents the dot product.
3. The wrapper grading method according to claim 1, characterized in that: In the process of determining the maximum effective use area of the tobacco leaf, all rectangles are sorted from large to small in area and traversed. The first rectangle in which all the lesions are not inside the rectangle is the maximum effective use area of the tobacco leaf.
4. The wrapper grading method according to claim 1, characterized in that: Use the trained deep learning model to identify the spots on tobacco leaves in the wrapper image.
5. The wrapper grading method according to claim 1, characterized in that: The Euclidean distance between the color of the diseased spot part and the color of the normal part in the Lab color space coordinates is calculated as the color difference between the color of the diseased spot part and the color of the normal part on the wrapper image.
6. The wrapper grading method according to claim 1, characterized in that: The means of determining the concentrated distribution of lesions is as follows: determine the minimum circumscribed rectangle of each lesion, generate a circle with the center point of the minimum circumscribed rectangle of each lesion as the center, and the radius of each circle is the same; calculate the number of center points of the minimum circumscribed rectangle of each lesion contained in the circle corresponding to each lesion, and if the number is greater than the set number threshold, it is determined that there is a concentrated lesion phenomenon.
7. The wrapper grading method according to any one of claims 1 to 6, characterized in that: The criteria for determining the grade of the wrapper include: If the color difference is less than the set color difference threshold, the tobacco leaf quality of the wrapper belongs to the H grade, and the category under the H grade is determined according to the length and width of the maximum effective use area of the tobacco leaf; If the color difference is greater than or equal to the set color difference threshold, the lesion area is smaller than the set area threshold, the number of lesions is smaller than the set number threshold and there is a concentration of lesions, then the tobacco leaf quality of the wrapper belongs to the M level, and the category under the M level is determined based on the length and width of the maximum effective use area of the tobacco leaf.
8. A wrapper grading device, comprising a memory and a processor, characterized in that: The processor is used to execute computer program instructions stored in the memory to implement the cigar wrapper grading method according to any one of claims 1 to 7.