A single leaf area detection method and system suitable for healthy leaves and diseased leaves
By designing methods for photographing the base plate, image segmentation and channel brightness curve analysis, combined with the erosion expansion algorithm and adaptive threshold method, the problem of insufficient detection accuracy of sick leaves in the existing technology has been solved, and rapid and accurate detection of healthy leaves and sick leaves has been achieved. Accurate detection improves detection accuracy and universality.
Patent Information
- Application Number
- CN202111590774.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-23
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-12-23
AI Technical Summary
The existing single-leaf leaf area detection technology has insufficient accuracy when detecting diseased leaves, and has poor applicability to different leaf types and diseased leaves, making it difficult to quickly and accurately detect healthy leaves and diseased leaves.
A method is designed that includes photographing the base plate, image segmentation, corrosion expansion algorithm and channel brightness curve analysis. The leaf area is calculated by extracting the ratio of the reference rectangle and the number of pixels of the blade, and the blade types are divided according to the channel brightness characteristics, using the adaptive threshold method. and debris filtering methods to reduce shading errors and enable accurate detection of healthy and diseased leaves.
It achieves rapid and accurate detection of healthy leaves and diseased leaves, improves detection accuracy and universality, is suitable for different diseased leaves, is easy to operate, has strong practicability and broad application prospects.
Smart Images

Figure CN114332199B
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of leaf area detection, and in particular relates to a single leaf area detection method and system suitable for healthy leaves and diseased leaves. Background Art
[0002] Leaves are the main site for photosynthesis and transpiration of plants, and are also the main site for plants to obtain nutrients and neutralize CO2. The state of leaves can reflect the growth and health of plants, and can usually be used as the main basis for the diagnosis of plant diseases and insect pests. Leaf area is one of the important physiological parameters of plants and one of the main indicators for determining the growth status of plants. It is of great significance for analyzing the carbon storage capacity of plants. Accurate determination of this indicator has far-reaching scientific research and production application value. In recent years, leaf area detection technology has developed rapidly, especially single leaf area detection technology has gradually matured, mainly including direct detection and indirect detection methods. The direct detection methods mainly include grid method, paper sample weighing method, punch weighing method, fresh weight method, leaf area meter method, etc. Among them, the grid method and weighing method are time-consuming and labor-intensive, and are rarely used in actual work; the leaf area meter method is widely used, but errors often occur during detection due to changes in leaf position, petiole length, extraction speed, etc., and the purchase and maintenance costs also limit the application of leaf area meters to a certain extent. The indirect detection methods mainly include coefficient regression method, image processing method, etc. Among them, the coefficient regression method for measuring leaf area has the characteristics of simplicity, convenience, and low cost, but this method also has its typical defects. For example, different plants have different leaf shapes, and even the leaf shapes of the same plants are different. To achieve "one leaf shape, one coefficient" for different leaf shapes, the workload is large and the stability is low; in addition, for pathological leaves, the estimation effectiveness of the regression model is obviously insufficient. In recent years, with the rapid development of related technologies such as image recognition and machine learning algorithms, leaf area detection methods based on image processing have become mainstream. However, the current methods mostly focus on the detection of leaf area and shape parameters of healthy leaves, and these methods are not applicable to pathological leaves. Summary of the invention
[0003] The object of the present invention is to provide a method and system for detecting the single leaf area of healthy leaves and diseased leaves, which method and system are conducive to quickly and accurately detecting the single leaf area of healthy leaves and diseased leaves.
[0004] To achieve the above object, the technical solution adopted by the present invention is: a single leaf area detection method applicable to healthy leaves and diseased leaves, characterized in that it includes the following steps:
[0005] (1) Designing a shooting base plate, wherein the shooting base plate is mainly composed of a background and a reference rectangle;
[0006] (2) Place the leaf on a photographic plate and take a photo, then perform image segmentation to extract the reference rectangle and leaf.
[0007] (3) Use the erosion and dilation algorithm to reduce the error caused by shadows during image segmentation;
[0008] (4) Count the number of pixels in the leaf region and the number of pixels in the reference rectangle respectively, and calculate the leaf area using the ratio of the number of pixels in the two regions.
[0009] Furthermore, the reference rectangle is located above the background and has a known area.
[0010] Furthermore, according to the characteristics of the channel brightness curve, leaves in healthy state, yellowed state and partially defective state are divided into four types: 1) channel brightness satisfies G>R and G>B, which is referred to as Type I; 2) channel brightness satisfies R>G and G>B, which is referred to as Type II; 3) channel brightness satisfies R>G and B>G, which is referred to as Type III; 4) channel brightness satisfies R>G and G<B, which is referred to as Type IV. The areas of the leaves corresponding to the four types of channel brightness curves are extracted, and then the areas corresponding to each type of channel brightness curve are superimposed to obtain the area of the entire leaf.
[0011] Furthermore, the area of the part of the leaf corresponding to the brightness curves of the four types of channels is extracted and superimposed to obtain the area of the entire leaf, which specifically includes the following steps:
[0012] 1) Detect the reference rectangle and the type III part of the leaf; the channel brightness curve of the type III part of the leaf is easily confused with the channel brightness curve of the reference rectangle, so they are detected together and then separated; the red channel brightness of the reference rectangle and the type III part of the leaf is greater than the green channel brightness, and the red channel brightness of the background, the type I part of the leaf, and the type IV part is less than the green channel brightness; subtract the green channel brightness from the red channel brightness, and use 0 as the threshold, and the background, the type I part of the leaf, and the type IV part are removed; similarly, subtract the green channel brightness from the blue channel brightness, and the type II part of the leaf is removed; at this time, only the reference rectangle and the type III part of the leaf are left. Since the reference rectangle has a larger area and the type III part of the leaf has a smaller area, they are separated by debris filtering;
[0013] 2) Detection of other types of leaves; including two steps: ① Detection of type I and type II parts of leaves; the green channel brightness of type I and type II parts of leaves is higher than that of blue channel, which is opposite to the channel brightness characteristics of background, reference rectangle, type III and type IV parts of leaves. Directly subtract the blue channel brightness from the green channel brightness, and use 0 as the threshold to detect type I and type II parts of leaves; ② Detection of type IV parts of leaves; the channel brightness curve of type IV parts of leaves has the same change trend as the channel brightness curve of the background, and the brightness difference of the three channels of this type is small; the adaptive threshold method is used to extract such leaves;
[0014] 3) Area superposition: The areas of the detected type I, type II, type III and type IV parts of the leaf are superimposed to obtain the area of the entire leaf.
[0015] Furthermore, the error caused by shadows in the image segmentation process is reduced by using the corrosion-then-expansion algorithm. The specific method is as follows:
[0016] Perform an “AND” operation with the n×n structural element and the covered binary image. If both are 1, the resulting pixel is 1, otherwise it is 0. Use the corrosion algorithm to remove the “burrs” phenomenon and some broken spots will be separated from the main body of the leaf. At this time, the broken spots are filtered out to obtain a complete leaf after corrosion.
[0017] Use the n×n structure element to perform an "OR" operation with the covered binary image. If both are 0, the resulting pixel is 0, otherwise it is 1; the binary image is restored to its original size through the dilation algorithm, but the burrs have been removed.
[0018] Furthermore, the leaf area calculation is to count the number of pixels in the leaf area and the number of pixels in the reference rectangle respectively, and the calculation formula is:
[0019]
[0020] Where N rectangle Represents the number of pixels of the reference rectangle in the image, N leaf Indicates the number of pixels in the leaf area in the image, S rectangle Represents the area of the actual reference rectangle.
[0021] The present invention also provides a single leaf area detection system suitable for healthy leaves and diseased leaves, including a memory, a processor, and computer program instructions stored in the memory and capable of being executed by the processor. When the processor executes the computer program instructions, the above-mentioned method steps can be implemented.
[0022] Compared with the prior art, the present invention has the following beneficial effects: a method and system for detecting the area of a single leaf suitable for healthy leaves and pathological leaves are provided, which can accurately and quickly detect the area of a single leaf of healthy leaves and pathological leaves, and is not only suitable for healthy leaves, but also for leaves with different pathological conditions, has good universality, high detection accuracy, and is easy to operate, and has strong practicality and broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 is a flow chart of a method implementation of an embodiment of the present invention;
[0024] Figure 2 is a comparison diagram of the bottom plate and the blades in an embodiment of the present invention;
[0025] Figure 3is the average channel brightness curve in the embodiment of the present invention;
[0026] Figure 4 It is the removal of burrs caused by shadows in the embodiment of the present invention and the before and after comparison;
[0027] Figure 5 It is the leaf area calculation result in the embodiment of the present invention. DETAILED DESCRIPTION
[0028] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0029] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.
[0030] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0031] like Figure 1 As shown, this embodiment provides a single leaf area detection method applicable to healthy leaves and diseased leaves, comprising the following steps:
[0032] (1) Design a shooting plate, which is mainly composed of a background and a reference rectangle.
[0033] (2) Place the leaf on a photographic plate and take a photo. Use band calculation, fragment filtering, adaptive thresholding and other methods to perform image segmentation to extract the reference rectangle and leaf.
[0034] (3) Use the erosion and dilation algorithm to reduce the error caused by shadows during image segmentation.
[0035] (4) Count the number of pixels in the leaf region and the number of pixels in the reference rectangle respectively, and calculate the leaf area using the ratio of the number of pixels in the two regions.
[0036] This embodiment takes healthy and different pathological bamboo leaves as examples, including: 1) Healthy state: The leaves are not affected by pests and diseases, and the color is emerald green or dark green; 2) Yellowing state: Due to the stress of pests and diseases or lack of nutrition, the edges or inside of the leaves turn white or yellow locally, and there are a small number of spots on the surface of the leaves, and the color of the spots may include brown, brownish yellow, grayish white, reddish gray, black, etc.; 3) Local defect state: The leaves are partially defective due to pests gnawing, etc. The edge color of the defective part may change to a certain extent, and the other parts are normal.
[0037] (1) Design of shooting baseplate: Photos taken with mobile phones, cameras, etc. usually only have three channels: red (R), green (G), and blue (B). The images required by the present invention can be obtained by ordinary mobile phones, cameras, and other devices, so the baseplate is designed starting from the three channels of R, G, and B. The baseplate is mainly composed of a background and a reference rectangle. The reference rectangle is located above the background and has a known area (the size of the background and the reference rectangle can be adjusted according to the size of the blade to be detected). The following issues are considered when designing the baseplate: 1) How to separate the baseplate from the blade; 2) How to separate the reference rectangle from the background. To this end, based on the analysis of the brightness characteristics of the leaf channels, the R, G, and B channel brightness of the background are designed to be 0, 125, and 255, respectively, and the R, G, and B channel brightness of the reference rectangle are designed to be 255, 0, and 125, respectively (such as Figure 2 The designed base plate can be directly printed on A4 paper for use, or it can be made of other materials into a standard base plate that is easy to carry and maintain in the field.
[0038] (2) Image segmentation: The main purpose of image segmentation is to extract the reference rectangle and the leaf. The channel brightness of the reference rectangle is artificially designed, and the channel brightness feature remains unchanged, making extraction easier. However, the channel brightness feature of the leaf is more complex. This embodiment selects leaves in various states and extracts their channel brightness curves for comparative analysis. It is found that: leaves in a healthy state usually contain only one type of channel brightness curve (channel brightness: G>R and G>B); leaves in a yellowed state usually have three types of channel brightness curves, one type of channel brightness curve for yellowed parts that are yellowish or white in color (channel brightness: R>G and G>B), and the other two types of channel brightness curves for spots in this state (① channel brightness: R>G and B>G, ② channel brightness: R>G and G<B); leaves in a partially defective state usually contain two types of channel brightness curves, one type of channel brightness curve for non-defective parts whose color has not changed (consistent with the channel brightness curve type of leaves in a healthy state), and one type of channel brightness curve for defective parts whose color has changed (consistent with the channel brightness curve type of yellowed parts of leaves). In summary, no matter the leaves are in a healthy state, yellowed state or partially defective state, they contain no more than 4 types of channel brightness curves. Therefore, the leaves in a healthy state, yellowed state and partially defective state are divided into 4 types according to the characteristics of the channel brightness curves: 1) The channel brightness satisfies G>R and G>B, which is referred to as Type I; 2) The channel brightness satisfies R>G and G>B, which is referred to as Type II; 3) The channel brightness satisfies R>G and B>G, which is referred to as Type III; 4) The channel brightness satisfies R>G and G<B, which is referred to as Type IV. The area of the part of the leaf corresponding to the 4 types of channel brightness curves is extracted (if the leaf does not have a certain channel brightness curve, the extracted area is 0), and then the area corresponding to each type of channel brightness curve is superimposed to obtain the area of the entire leaf. The specific process is as follows:
[0039] 1) Detection of the reference rectangle and the type III part of the leaf. The channel brightness curve of the type III part of the leaf is easily confused with the channel brightness curve of the reference rectangle, so they are detected together and then separated. The red channel brightness of the reference rectangle and the type III part of the leaf is greater than the green channel brightness, and the red channel brightness of the background, the type I part of the leaf, and the type IV part is less than the green channel brightness (e.g. Figure 3 ). Subtract the green channel brightness from the red channel brightness, and use 0 as the threshold. The background, type I and type IV parts of the leaves can be removed. Similarly, subtract the green channel brightness from the blue channel brightness, and the type II part of the leaves can be removed. At this time, only the reference rectangle and the type III part of the leaves are left. Since the reference rectangle has a larger area and the type III part of the leaves has a smaller area, they are separated by debris filtering.
[0040] 2) Detection of other types of leaves. The detection is carried out in two steps: ① Detection of Type I and Type II parts of the leaves. The green channel brightness of Type I and Type II parts of the leaves is higher than that of the blue channel, which is opposite to the channel brightness characteristics of the background, reference rectangle, Type III and Type IV parts of the leaves. Simply subtract the blue channel brightness from the green channel brightness and use 0 as the threshold to detect Type I and Type II parts of the leaves. ② Detection of Type IV parts of the leaves. The channel brightness curve of the Type IV part of the leaves has the same change trend as the channel brightness curve of the background (such as Figure 3 ), and the brightness difference of the three channels of this type is small. Statistics show that the difference between the background green channel brightness and the red channel brightness is more than 5 times the difference between the type IV part of the leaf. Therefore, by setting the threshold method to extract this type of leaves, it is found that: when using a fixed threshold to extract leaves, the detection accuracy will change with the change of external lighting conditions, and the algorithm stability is poor. For this reason, this embodiment uses an adaptive threshold method, and the specific method is: select a background area containing n pixels, and calculate the difference between the green channel brightness and the red channel brightness of n pixels. After testing, using 1 / 4 of the median value of the calculation result as the threshold can obtain a better extraction effect.
[0041] 3) Area superposition: The areas of the detected type I, type II, type III and type IV parts of the leaf are superimposed to obtain the area of the entire leaf.
[0042] (3) Reduced shadow effects
[0043] Plant leaves have a certain thickness. When the light direction is inconsistent with the shooting direction, shadows will be generated. It is difficult to ensure that the leaves are completely attached to the base plate during shooting. The edges of the leaves may be lifted, which will produce a more significant shadow effect. The present invention adopts an adaptive threshold method, which can extract spot information, but also mixes in shadow information, resulting in burrs. To this end, this problem is solved by using an erosion-then-expansion algorithm to reduce the error caused by shadows during image segmentation. The basic process of the erosion algorithm is as follows:
[0044] The n×n structural element is used to perform an “AND” operation with the covered binary image. If both are 1, the resulting pixel is 1, otherwise it is 0. The “burrs” phenomenon can be removed by the corrosion algorithm, and some broken spots can be separated from the main body of the leaf. At this time, the broken spots are filtered out to obtain a complete leaf after corrosion.
[0045] However, after the binary image is eroded, the outermost layer is reduced by n layers, and the area will be reduced accordingly, so it must be restored through the expansion algorithm. The expansion algorithm can be regarded as the dual operation of the erosion algorithm. The basic process is: use the n×n structural element to perform an "or" operation with the covered binary image. If both are 0, the result pixel is 0, otherwise it is 1. The binary image can be restored to its original size through the expansion algorithm, but the burrs have been removed (such as Figure 4 ).
[0046] (4) Leaf area calculation
[0047] Leaf area calculation is to count the number of pixels in the leaf area and the number of pixels in the reference rectangle respectively. The calculation formula is:
[0048]
[0049] Where N rectangle Represents the number of pixels of the reference rectangle in the image, N leaf Indicates the number of pixels in the leaf area in the image, S rectangle Represents the area of the actual reference rectangle.
[0050] Based on this, the leaf area of a single leaf is calculated. The calculation results are shown in the following example. Figure 5 .
[0051] This embodiment also provides a single leaf area detection system suitable for healthy leaves and diseased leaves, including a memory, a processor, and computer program instructions stored in the memory and capable of being executed by the processor. When the processor executes the computer program instructions, the above-mentioned method steps can be implemented.
[0052] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0053] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0054] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0055] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0056] The above is only a preferred embodiment of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosed technical content to change or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.
Claims
1. A method for detecting the leaf area of a single leaf suitable for healthy leaves and diseased leaves, characterized in that: The following steps are involved: (1) Designing a shooting base plate, wherein the shooting base plate is mainly composed of a background and a reference rectangle; (2) Place the leaf on a photographic plate and take a photo, then perform image segmentation to extract the reference rectangle and leaf. (3) Use the erosion and dilation algorithm to reduce the error caused by shadows during image segmentation; (4) Count the number of pixels in the leaf area and the number of pixels in the reference rectangle respectively, and calculate the leaf area using the ratio of the number of pixels in the two areas; According to the characteristics of the channel brightness curve, leaves in healthy state, yellow state and partially defective state are divided into four types: 1) The channel brightness satisfies G>R and G>B, which is referred to as Type I; 2) The channel brightness satisfies R>G and G>B, which is referred to as Type II; 3) The channel brightness satisfies R>G and B>G, which is referred to as Type III; 4) The channel brightness satisfies R<G and G<B, which is referred to as Type IV. The areas of the leaves corresponding to the four types of channel brightness curves are extracted, and then the areas corresponding to each type of channel brightness curve are superimposed to obtain the area of the entire leaf. The area of the leaf corresponding to the brightness curves of the four types of channels is extracted and superimposed to obtain the area of the entire leaf, which specifically includes the following steps: 1) Detect the reference rectangle and the type III part of the leaf; the channel brightness curve of the type III part of the leaf is easily confused with the channel brightness curve of the reference rectangle, so they are detected together and then separated; the red channel brightness of the reference rectangle and the type III part of the leaf is greater than the green channel brightness, and the red channel brightness of the background, the type I part of the leaf, and the type IV part is less than the green channel brightness; subtract the green channel brightness from the red channel brightness, and use 0 as the threshold, and the background, the type I part of the leaf, and the type IV part are removed; similarly, subtract the green channel brightness from the blue channel brightness, and the type II part of the leaf is removed; at this time, only the reference rectangle and the type III part of the leaf are left. Since the reference rectangle has a larger area and the type III part of the leaf has a smaller area, they are separated by debris filtering; 2) Detection of other types of leaves; including two steps: ① Detection of type I and type II parts of leaves; the green channel brightness of type I and type II parts of leaves is higher than that of blue channel, which is opposite to the channel brightness characteristics of background, reference rectangle, type III and type IV parts of leaves. Directly subtract the blue channel brightness from the green channel brightness, and use 0 as the threshold to detect type I and type II parts of leaves; ② Detection of type IV parts of leaves; the channel brightness curve of type IV parts of leaves has the same change trend as the channel brightness curve of the background, and the brightness difference of the three channels of this type is small; the adaptive threshold method is used to extract such leaves; 3) Area superposition: The areas of the detected type I, type II, type III and type IV parts of the leaf are superimposed to obtain the area of the entire leaf.
2. A single leaf area detection method applicable to healthy leaves and diseased leaves according to claim 1, characterized in that: The reference rectangle is located above the background and has a known area.
3. A single leaf area detection method applicable to healthy leaves and diseased leaves according to claim 1, characterized in that: The error caused by shadows in the image segmentation process is reduced by the erosion-then-expansion algorithm. The specific method is as follows: Perform an "AND" operation with the n×n structural element and the covered binary image. If both are 1, the resulting pixel is 1, otherwise it is 0. Use the corrosion algorithm to remove the "burrs" phenomenon and some broken spots will be separated from the main body of the leaf. At this time, the broken spots are filtered out to obtain a complete leaf after corrosion. Use the n×n structure element to perform an "OR" operation with the covered binary image. If both are 0, the resulting pixel is 0, otherwise it is 1; the binary image is restored to its original size through the dilation algorithm, but the burrs have been removed.
4. The method for detecting the leaf area of a single leaf applicable to healthy leaves and diseased leaves according to claim 1, characterized in that: Leaf area calculation is to count the number of pixels in the leaf area and the number of pixels in the reference rectangle respectively. The calculation formula is: Where N rectangle Represents the number of pixels of the reference rectangle in the image, N leaf Indicates the number of pixels in the leaf area in the image, S rectangle Represents the area of the actual reference rectangle.
5. A single leaf area detection system suitable for healthy leaves and diseased leaves, characterized in that: The method comprises a memory, a processor and computer program instructions stored in the memory and capable of being executed by the processor. When the processor executes the computer program instructions, the method steps as described in any one of claims 1 to 4 can be implemented.
