CN117953491B - Leaf vegetable disease diagnosis method and system - Google Patents

Leaf vegetable disease diagnosis method and system Download PDF

Info

Publication number
CN117953491B
CN117953491B CN202410355569.3A CN202410355569A CN117953491B CN 117953491 B CN117953491 B CN 117953491B CN 202410355569 A CN202410355569 A CN 202410355569A CN 117953491 B CN117953491 B CN 117953491B
Authority
CN
China
Prior art keywords
area
leaf
vegetable
texture
infected
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410355569.3A
Other languages
Chinese (zh)
Other versions
CN117953491A (en
Inventor
刘中良
高俊杰
张文倩
王婷
陈震
韩珑
闫伟强
谷端银
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tai'an Academy Of Agricultural Sciences Tai'an Branch Of Shandong Academy Of Agricultural Sciences
Original Assignee
Tai'an Academy Of Agricultural Sciences Tai'an Branch Of Shandong Academy Of Agricultural Sciences
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tai'an Academy Of Agricultural Sciences Tai'an Branch Of Shandong Academy Of Agricultural Sciences filed Critical Tai'an Academy Of Agricultural Sciences Tai'an Branch Of Shandong Academy Of Agricultural Sciences
Priority to CN202410355569.3A priority Critical patent/CN117953491B/en
Publication of CN117953491A publication Critical patent/CN117953491A/en
Application granted granted Critical
Publication of CN117953491B publication Critical patent/CN117953491B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/68Food, e.g. fruit or vegetables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/28Quantising the image, e.g. histogram thresholding for discrimination between background and foreground patterns
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/32Normalisation of the pattern dimensions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • G06V10/457Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components by analysing connectivity, e.g. edge linking, connected component analysis or slices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/54Extraction of image or video features relating to texture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/56Extraction of image or video features relating to colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a leaf vegetable disease diagnosis method and a system, which relate to the technical field of vegetable disease diagnosis and specifically comprise the following steps: s1, collecting leaf images of vegetables, performing image scaling on the leaf images of the vegetables, uniformly adjusting the sizes of the leaf images to 224 x 224, copying the leaf images into two groups of identical images, and performing graying treatment on one group to obtain a first identification image. Compared with the method for calculating the average value of the texture characteristic values of all pictures as the threshold value point, the method is more localized, the influence of abnormal values can be reduced, the threshold value is determined by pertinently considering the characteristics of the leaf in the healthy state, the change of an infected area can more accurately reflect the development condition of diseases, the accuracy of diagnosis is improved, the possibility of misjudgment is reduced, the color and texture characteristics of the vegetable leaf in the healthy area are used as the threshold value, and the characteristic distribution of the leaf in the healthy state can be more accurately reflected.

Description

Leaf vegetable disease diagnosis method and system
Technical Field
The invention relates to the technical field of vegetable disease diagnosis, in particular to a leaf vegetable disease diagnosis method and system.
Background
When vegetables are ill, some changes can occur in the leaf, including colour or texture changes, and some diseases can also lead to the leaf surface to appear spots, and the influence of different pathologies of vegetables are different to the leaf, and the influence to the leaf is mainly reflected in leaf colour, edge colour, spot colour size etc. for example, when the leaf receives the disease that early epidemic disease caused, colour characteristics: the leaf initially appears dark green water stain-like spots, then turns to yellow or brown, the edges of the spots are clear, the center of the spots is brown, irregular patches are formed, and the texture features are as follows: the surfaces of the blades are provided with water-immersed spots, and when the infection is serious, the blades may be provided with mould substances; when the leaf is affected by a disease caused by a late blight, the color characteristics when the leaf is affected by a disease caused by a late blight: the initial stage of the leaf has water-immersed spots, and then under the moist environment, white mould layers appear on the surfaces of the spots, and the leaf gradually withers and turns yellow, and finally decays, and has the texture characteristics: when the infection is serious, the leaves are covered with villous mould, the texture of the leaves is softened, and withered textures are presented; when the leaf is subjected to the disease caused by Huang Qushe disease, the color characteristics: the blade has the symptoms of yellowing, bending, deformity and the like, the color of the blade gradually changes from dark green to yellow, even brown, and the texture characteristics are that: the blade texture softens and sometimes collapses and yellow spots or streaks may appear on the blade surface.
In the prior art, the method for diagnosing the leaf vegetable diseases provided by the publication No. CN104680524B comprises the following steps: s1: noise reduction treatment is carried out on the leaf surface image of the leaf vegetables, so that a first tone image of the leaf surface image of the leaf vegetables is obtained; s2: extracting color characteristics of the first tone image to obtain characteristic information values of leaf surface images of the leaf vegetables and a second tone image; s3: extracting texture features of the second tone image to obtain texture feature values of the second tone image; s4: calculating the average value of texture characteristic values of all pictures in a preset leaf vegetable disease picture library; s5: obtaining a disease threshold point according to the average value of the texture characteristic values; s6: and according to a preset discriminant function and a disease threshold point, diagnosing the leaf vegetables with characteristic information values of leaf images of the leaf vegetables being linear correlation as the disease leaf vegetables. The leaf vegetable disease diagnosis method of the invention realizes the diagnosis of leaf vegetable disease more rapidly and accurately through the image processing and pattern recognition technology by better fusion of disease expertise and computer technology.
However, as can be seen from the above statement, when the preset average value of texture characteristic values of all pictures in the leaf vegetable disease picture library is calculated, and a disease threshold point is obtained according to the average value of the texture characteristic values, the measurement error and the data input error may cause the existence of an abnormal value, and when the average value is calculated, the central position of the whole data is pulled by the abnormal value, so that the accuracy of the average value is affected, and then the determination of the disease threshold point is affected.
The above information disclosed in the background section is only for enhancement of understanding of the background of the disclosure and therefore it may include information that does not form the prior art that is already known to a person of ordinary skill in the art.
Disclosure of Invention
The invention aims to provide a leaf vegetable disease diagnosis method and system, which are used for solving the problems in the background technology.
In order to achieve the above purpose, the present invention provides the following technical solutions:
A leaf vegetable disease diagnosis method comprises the following specific steps:
s1, collecting leaf images of vegetables, performing image scaling on the leaf images of the vegetables, uniformly adjusting the sizes of the leaf images to 224 x 224, copying the leaf images into two groups of identical images, performing graying treatment on one group to obtain a first identification image, converting the other group from an RGB color space to an HSV color space to obtain a second identification image, and mapping pixel point positions of the first identification image and the second identification image one by one;
S2, threshold segmentation is carried out on the first identification image, each pixel in the first identification image is compared with a set threshold value, the pixel with the gray value higher than the threshold value is set to be white, the white represents a healthy area, the pixel with the gray value lower than the threshold value is set to be black, the black represents an infected area, an HSV image of the infected area is extracted according to the threshold segmentation result, so that the pixel value of the infected area is reserved, the connected area of the infected area is analyzed, the spot number and the spot area of the infected area are identified and measured, the spot distance is obtained through the spot number and the spot size, the HSV image of the healthy area is extracted, the connected area of the healthy area is analyzed, the spot number and the spot area are obtained, and the spot distance is obtained through the spot number and the spot area;
S3, acquiring color data and texture data of an infected area in a second identification image according to the data of the infected area segmented by the threshold value, acquiring the color data and the texture data of the healthy area in the second identification image according to the data of the healthy area segmented by the threshold value, wherein the color data comprises an average value of hue, an average value of saturation and an average value of brightness, and the texture data comprises the spot number, the spot area and the spot spacing;
s4, carrying out data processing on color data of an infection area of the vegetable leaf, carrying out correlation analysis, generating a first color change coefficient of the vegetable leaf of the infection area, carrying out data processing on texture data of the infection area of the vegetable leaf, carrying out correlation analysis, generating a first texture change coefficient of the vegetable leaf of the infection area, carrying out data processing on color data of a health area of the vegetable leaf, carrying out correlation analysis, generating a second color change coefficient of the vegetable leaf of the health area, carrying out data processing on texture data of the health area of the vegetable leaf, carrying out correlation analysis, and generating a second texture feature coefficient of the vegetable leaf of the health area;
S5, taking the second color change coefficient of the vegetable leaves in the healthy area as a threshold value of the first color change coefficient of the vegetable leaves in the infected area, and taking the second texture characteristic coefficient of the vegetable leaves in the healthy area as a threshold value of the first texture characteristic coefficient of the vegetable leaves in the infected area;
s6, generating a relative change rate of the first color change coefficient according to the first color change coefficient of the vegetable leaves in the infected area and the threshold value of the first color change coefficient of the vegetable leaves in the infected area, and generating a relative change rate of the first texture change coefficient according to the first texture change coefficient of the vegetable leaves in the infected area and the threshold value of the first texture change coefficient of the vegetable leaves in the infected area;
S7, judging the disease type of the vegetables according to the value interval of the change rate of the first color change coefficient and the value interval of the change rate of the first texture change coefficient of the vegetable leaves and combining the disease conditions of the vegetable leaves of early leaf blight, late leaf blight and black rot.
Further, in step S1, the blade image is subjected to graying processing to obtain a first identification image according to the following formula:
Wherein, Is the gray value of the pixel in the first recognition image,Respectively obtaining a pixel red component value, a pixel green component value and a pixel blue component value of the blade image after image scaling;
In step S2, the collected leaf image of the vegetable is detected, and threshold segmentation is performed, so that the process of identifying the healthy area and the infected area of the leaf of the vegetable is as follows:
Traversing all possible thresholds, dividing the vegetable leaves into a healthy area and an infected area according to the numerical value of each threshold, counting the number of pixels of the healthy area and the infected area, calculating the average value of gray values of the pixels of the healthy area and the infected area, and calculating the inter-class variance of the corresponding threshold according to the following formula:
Wherein, Representing a threshold value asInter-class variance of time,And,Threshold values are/>, respectivelyNumber of pixels in healthy and infected areas,Threshold values are/>, respectivelyThe mean value of gray values of pixels of the healthy area and the infected area;
calculating the value of the threshold value when the inter-class variance reaches the maximum, defining the value as the optimal separation threshold value, and dividing the pixel point into a healthy area and an infected area, wherein the gray value of the pixel point is smaller than or equal to Judging that the pixel belongs to a healthy area, which is larger thanThen it is determined that the pixel belongs to the infected area.
Further, in step S2, the connected region of the infected area is analyzed, and the process of identifying and measuring spots is as follows:
Initializing a flag and a count: creating an empty mark image with the same size as the input image, for marking the connection areas, and initializing a counter for calculating the number of the found connection areas;
traversing the pixels: traversing each pixel of the input image starting from the upper left corner;
judging pixel connectivity: for the currently traversed pixel, judging connectivity of the pixel with the pixels above and to the left;
If the upper and left pixels both belong to the same connected region, the current pixel is marked as the same mark as the upper and left pixels;
If the upper pixel and the left pixel belong to different connected areas, marking the current pixel as a new mark, and adding 1 to a counter;
if neither the upper nor the left pixel belongs to any connected region, marking the current pixel as a new mark, and adding 1 to the counter;
and (3) finishing traversing: after traversing all pixels, each connected region in the label image is assigned a unique label.
Further, the color of the infected area of the vegetable leaf is subjected to data processing and correlation analysis, and a first color change coefficient of the vegetable leaf of the infected area is generated according to the following formula:
Wherein, For the first color change coefficient,For the sum of the hues of all pixels in the affected area,To sum the saturation of all pixels in the affected area,For the sum of the brightness of all pixels within the affected area,For the total number of all pixels in the affected area,Factor of hue for all pixels in the affected area,Is a factor of saturation of all pixels in the affected area,Is a factor of brightness of all pixels in the infected area,And (2) andIs a constant correction coefficient.
Further, the number of connected areas in the infected area is the number of spots, after the number of spots is obtained, the distance between adjacent spots is calculated to obtain the spot distance, and the center points of the connected areas A and B are assumed to be respectively [ ],) And (/ >),) The spot spacing can be calculated by the euclidean distance S:
processing the texture data of the infected area of the vegetable leaf, processing the data, performing correlation analysis, and generating a first texture change coefficient according to the following formula:
Wherein, For the first texture change factor,For the number of spots in the leaf infected area,For the spot area of the leaf infected area,Factor coefficient for the number of spots in the infected area of the leaf,Is a factor of the spot spacing of the leaf infected area,Is the factor of the spot area of the leaf infected area,And (2) andIs a constant correction coefficient.
Further, in step S4, the second color characteristic parameters of the vegetable leaves in the healthy area are subjected to data processing, and correlation analysis is performed to generate a second color change coefficient according to the following formula:
Wherein, For the second color change coefficient,Is the sum of the hues of all pixels in the healthy area,Is the sum of the saturation of all pixels in the healthy area,Is the sum of the brightness of all pixels in the healthy area,Is the total number of all pixels in the healthy area.
Further, in step S4, the second texture feature parameters of the vegetable leaves in the healthy area are subjected to data processing and correlation analysis, so as to generate the second texture feature coefficients of the vegetable leaves in the healthy area according to the following formula:
Wherein, For the second texture feature coefficient,For the number of spots in healthy area of leaf,Is the spot area of the healthy area of the leaf.
Further, in step S6, according to the first color change coefficient of the vegetable leaves in the infected areaAnd threshold value of first color change coefficient of vegetable leaves in infected areaGenerating a relative rate of change of the first color change coefficientThe formula according to is as follows:
Wherein, A relative rate of change that is a first color change coefficient;
according to the first texture change coefficient of the vegetable leaves in the infected area And a threshold value of a first coefficient of texture variation of the vegetable leaves of the infected areaThe relative rate of change of the first texture change coefficient is generated according to the following formula:
Wherein, Is the relative rate of change of the first texture change coefficient.
Further, in step S7, according to the value interval of the relative change rate of the first color change coefficient and the value interval of the relative change rate of the first texture change coefficient of the vegetable leaf, the process of determining the disease type of the vegetable is as follows in combination with the disease conditions of the vegetable leaf of early leaf blight, late leaf blight and black rot:
When (when) 10%,20, Judging that the vegetables are suffering from diseases caused by early blight;
When (when) 15%,20%, Judging that the vegetables are ill caused by late blight;
When (when) 10%,20%, The vegetables are judged to be suffering from diseases caused by black rot.
A leaf vegetable disease diagnosis system comprising:
The image preprocessing module is used for carrying out image scaling on the leaf images of the vegetables, uniformly adjusting the sizes of the leaf images to 224 x 224, copying the leaf images into two groups of identical images, carrying out graying treatment on one group to obtain a first identification image, converting the other group from an RGB color space to an HSV color space to obtain a second identification image, and carrying out one-to-one mapping on the pixel point positions of the first identification image and the second identification image;
The image recognition module is used for carrying out threshold segmentation on the first recognition image, comparing each pixel in the first recognition image with a set threshold value, setting a pixel with a gray value higher than the threshold value as white, wherein white represents a healthy area, setting a pixel with a gray value lower than the threshold value as black, wherein black represents an infected area, extracting an HSV image of the infected area according to the threshold segmentation result so as to reserve the pixel value of the infected area, analyzing the connected area of the infected area to identify and measure the spot number and the spot area of the infected area, acquiring the spot distance through the spot number and the spot size, extracting the HSV image of the healthy area, analyzing the connected area of the healthy area to acquire the spot number and the spot area, and acquiring the spot distance through the spot number and the spot area;
The feature extraction module is used for acquiring color data and texture data of the infected area in the second identification image according to the data of the infected area segmented by the threshold value, acquiring the color data and the texture data of the healthy area in the second identification image according to the data of the healthy area segmented by the threshold value, wherein the color data comprises the average value of hue, the average value of saturation and the average value of brightness, and the texture data comprises the spot number, the spot area and the spot spacing;
The data processing module is used for carrying out data processing on the color data of the infected area of the vegetable leaf, carrying out correlation analysis, generating a first color change coefficient of the vegetable leaf of the infected area, carrying out data processing on the texture data of the infected area of the vegetable leaf, carrying out correlation analysis, generating a first texture change coefficient of the vegetable leaf of the infected area, carrying out data processing on the color data of the healthy area of the vegetable leaf, carrying out correlation analysis, generating a second color change coefficient of the vegetable leaf of the healthy area, carrying out data processing on the texture data of the healthy area of the vegetable leaf, carrying out correlation analysis, and generating a second texture characteristic coefficient of the vegetable leaf of the healthy area;
The threshold setting module is used for taking the second color change coefficient of the vegetable leaves in the healthy area as a threshold value of the first color change coefficient of the vegetable leaves in the infected area, and taking the second texture characteristic coefficient of the vegetable leaves in the healthy area as a threshold value of the first texture characteristic coefficient of the vegetable leaves in the infected area;
The data analysis module is used for generating the relative change rate of the first color change coefficient according to the first color change coefficient of the vegetable leaves in the infected area and the threshold value of the first color change coefficient of the vegetable leaves in the infected area, and generating the relative change rate of the first texture change coefficient according to the first texture change coefficient of the vegetable leaves in the infected area and the threshold value of the first texture change coefficient of the vegetable leaves in the infected area;
the judging module is used for judging the disease type of the vegetables according to the value interval of the change rate of the first color change coefficient and the value interval of the change rate of the first texture change coefficient of the vegetable leaves and combining the disease conditions of the vegetable leaves of the early leaf blight, the late leaf blight and the black rot.
Compared with the prior art, the invention has the beneficial effects that:
According to the invention, the collected leaf images of the vegetables are detected and subjected to threshold segmentation, the healthy area and the infected area of the vegetable leaves are identified, the first color characteristic parameters and the first texture characteristic parameters of the vegetable leaves in the infected area are extracted, data processing and correlation analysis are performed to generate a first color change coefficient and a first texture change coefficient, the second color characteristic parameters of the vegetable leaves in the healthy area are subjected to data processing and correlation analysis to generate a second color change coefficient of the vegetable leaves in the healthy area, the second texture characteristic parameters of the vegetable leaves in the healthy area are subjected to data processing and correlation analysis to generate a second texture characteristic coefficient of the vegetable leaves in the healthy area, the second color change coefficient of the vegetable leaves in the healthy area is used as a threshold value of the first color change coefficient of the vegetable leaves in the infected area, and the second texture characteristic coefficient of the vegetable leaves in the healthy area is used as a threshold value of the first texture characteristic coefficient of the vegetable leaves in the infected area. Therefore, compared with the method for calculating the average value of the texture characteristic values of all pictures as a threshold value point, the method is more localized, the influence of abnormal values can be reduced, the threshold value is determined by pertinently considering the characteristics of the leaf in a healthy state, the change of an infected area more accurately reflects the development condition of diseases, the diagnosis accuracy is improved, the possibility of misjudgment is reduced, the color and texture characteristics of the vegetable leaf in the healthy area are used as the threshold value, the characteristic distribution of the leaf in the healthy state can be more accurately reflected, the threshold value can be adjusted according to the specific condition, and the change of the infected area is more sensitive and accurate.
Drawings
FIG. 1 is a schematic flow chart of the overall method of the present invention;
FIG. 2 is a block diagram of the modules of the present invention.
Detailed Description
The present invention will be further described in detail with reference to specific embodiments in order to make the objects, technical solutions and advantages of the present invention more apparent.
It is to be noted that unless otherwise defined, technical or scientific terms used herein should be taken in a general sense as understood by one of ordinary skill in the art to which the present invention belongs. The terms "first," "second," and the like, as used herein, do not denote any order, quantity, or importance, but rather are used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that elements or items preceding the word are included in the element or item listed after the word and equivalents thereof, but does not exclude other elements or items. The terms "connected" or "connected," and the like, are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "up", "down", "left", "right" and the like are used only to indicate a relative positional relationship, and when the absolute position of the object to be described is changed, the relative positional relationship may be changed accordingly.
Examples:
referring to fig. 1 to 2, the present invention provides a technical solution:
a leaf vegetable disease diagnosis method, as shown in figure 1, specifically comprises the following steps:
s1, collecting leaf images of vegetables, performing image scaling on the leaf images of the vegetables, uniformly adjusting the sizes of the leaf images to 224 x 224, copying the leaf images into two groups of identical images, performing graying treatment on one group to obtain a first identification image, converting the other group from an RGB color space to an HSV color space to obtain a second identification image, and mapping pixel point positions of the first identification image and the second identification image one by one;
S2, threshold segmentation is carried out on the first identification image, each pixel in the first identification image is compared with a set threshold value, the pixel with the gray value higher than the threshold value is set to be white, the white represents a healthy area, the pixel with the gray value lower than the threshold value is set to be black, the black represents an infected area, an HSV image of the infected area is extracted according to the threshold segmentation result, so that the pixel value of the infected area is reserved, the connected area of the infected area is analyzed, the spot number and the spot area of the infected area are identified and measured, the spot distance is obtained through the spot number and the spot size, the HSV image of the healthy area is extracted, the connected area of the healthy area is analyzed, the spot number and the spot area are obtained, and the spot distance is obtained through the spot number and the spot area;
S3, acquiring color data and texture data of an infected area in a second identification image according to the data of the infected area segmented by the threshold value, acquiring the color data and the texture data of the healthy area in the second identification image according to the data of the healthy area segmented by the threshold value, wherein the color data comprises an average value of hue, an average value of saturation and an average value of brightness, and the texture data comprises the spot number, the spot area and the spot spacing;
s4, carrying out data processing on color data of an infection area of the vegetable leaf, carrying out correlation analysis, generating a first color change coefficient of the vegetable leaf of the infection area, carrying out data processing on texture data of the infection area of the vegetable leaf, carrying out correlation analysis, generating a first texture change coefficient of the vegetable leaf of the infection area, carrying out data processing on color data of a health area of the vegetable leaf, carrying out correlation analysis, generating a second color change coefficient of the vegetable leaf of the health area, carrying out data processing on texture data of the health area of the vegetable leaf, carrying out correlation analysis, and generating a second texture feature coefficient of the vegetable leaf of the health area;
S5, taking the second color change coefficient of the vegetable leaves in the healthy area as a threshold value of the first color change coefficient of the vegetable leaves in the infected area, and taking the second texture characteristic coefficient of the vegetable leaves in the healthy area as a threshold value of the first texture characteristic coefficient of the vegetable leaves in the infected area;
s6, generating a relative change rate of the first color change coefficient according to the first color change coefficient of the vegetable leaves in the infected area and the threshold value of the first color change coefficient of the vegetable leaves in the infected area, and generating a relative change rate of the first texture change coefficient according to the first texture change coefficient of the vegetable leaves in the infected area and the threshold value of the first texture change coefficient of the vegetable leaves in the infected area;
S7, judging the disease type of the vegetables according to the value interval of the change rate of the first color change coefficient and the value interval of the change rate of the first texture change coefficient of the vegetable leaves and combining the disease conditions of the vegetable leaves of early leaf blight, late leaf blight and black rot.
When the vegetable leaves are ill, the color values of the vegetable leaves are changed, and the following are specific reasons:
Chlorophyll degradation: many diseases, especially those caused by fungi and bacteria, can lead to the degradation of chlorophyll, the main pigment in plants responsible for photosynthesis, which degradation can lead to the gradual change of leaves from green to yellow or other colors.
Generating new pigment: some diseases may cause plants to produce new pigments, such as yellow, red or purple compounds, which cover the original chlorophyll, resulting in a change in leaf color.
Cell death and necrosis: disease-induced tissue necrosis and cell death can lead to darkening or browning of leaf color due to disruption of cell internal structures and accumulation of metabolites.
Generating a lesion or a lesion edge: some diseases can form lesions on the surface of the leaf that may have a particular color, such as brown, black or white, which can significantly alter the overall color of the leaf.
Moisture and nutrient absorption problems: diseases may affect moisture uptake and nutrient uptake by plants, which in turn affect leaf growth and pigment synthesis, which may lead to yellowing, chlorosis, etc. of the leaf.
Therefore, accurate monitoring of the color value of the vegetable leaves is particularly important for judging the disease type of vegetables, and if the following effects can be produced:
Early disease diagnosis: the color value monitoring can help to discover the color change of the leaf in time at the early stage of disease, so that measures can be taken early to diagnose and treat, and the early diagnosis can reduce the loss of the disease and prevent the disease from being spread to other plants.
Distinguishing different disease types: different diseases can cause the blades to present different color changes, and the accurate monitoring of the color values can help to distinguish different types of diseases and take corresponding control measures in a targeted manner.
When the vegetable leaves are ill, the brightness value of the vegetable leaves is changed, and the following reasons are specific:
Blade tissue structure changes: diseases may cause changes in the tissue structure of the leaf, such as damage to the cell wall, loss of cell fluid, etc., which affect the light reflection and absorption properties of the leaf, and thus the brightness value of the leaf.
Pigment content changes: diseases affect the pigment content and distribution in leaves, such as chlorophyll, carotenoids, etc. These pigments have an important influence on the absorption and scattering of light, and variations in their content affect the brightness value of the blade.
Disease spot formation: some diseases form spots or necrotic areas on the surface of the blade, which may cause the brightness value of the blade to change in local areas, typically areas affected by the disease are less bright, while healthy areas are brighter.
Illumination condition changes: diseases may cause a coating or damage to the blade surface, affecting the reflection and absorption of light by the blade, and the brightness value of the blade may change under different lighting conditions, for example, the brightness of the affected area may be lower under strong light.
Therefore, the accurate monitoring of the brightness value of the vegetable leaves is particularly important for judging the disease type of the vegetables, and the following effects can be achieved:
Distinguishing different disease types: different disease types can cause different change modes of the brightness value of the blade, and the brightness value can be accurately monitored to help distinguish different types of diseases, so that the method is beneficial to formulating a targeted control strategy.
Early disease detection: by monitoring the change of the brightness value of the leaf, the abnormal brightness of the leaf can be found in time at the initial stage of the disease, and the early disease detection is facilitated, so that the damage of the disease to plants is relieved by adopting timely treatment measures.
Disease severity was assessed: the change of the brightness value can reflect the influence degree of the disease on plants, and the severity degree of the disease can be estimated by monitoring the amplitude and trend of the brightness value.
When a vegetable leaf is diseased, the number of spots on the surface of the vegetable leaf will vary for the following specific reasons:
pathogen invasion: different types of pathogens may cause different types of spots on the surface of the leaf, such as mold, bacteria or viruses, which, after penetration into the leaf, form spots on the surface of the leaf or inside the tissue and spread or increase as the disease progresses.
Spore propagation: some fungal diseases form spores or sporangia on the leaf surface, these structures often appear as white, grey or black spots. As the number of spores increases, the number of spots on the leaf surface increases.
Disease spread: as the disease spreads, the number of spots on the leaf surface may gradually increase, and the pathogen continues to multiply and spread on the leaf, resulting in new spots appearing and possibly merging into a large area of damage.
Therefore, accurate monitoring of the spot number of the vegetable leaves is particularly important for judging the disease type of vegetables, and if the following effects can be produced:
Accurate disease diagnosis: by monitoring the change in the number of spots, the type of vegetable leaf disease can be diagnosed more accurately, and different diseases may be represented by spots of different types, shapes and distributions, thereby helping to determine the specific type of disease.
Differentiating disease severity: the increase in the number of spots is generally related to the severity of the disease, and by accurately monitoring the change in the number of spots, the extent of the disease effect on the plant can be assessed.
When the vegetable leaves are diseased, the spot spacing on the surfaces of the vegetable leaves will change for the following specific reasons:
Disease spread rate: different types of diseases have different propagation speeds and modes, and some diseases can spread rapidly on the surface of the blade, resulting in reduced distance between spots; while other diseases may spread slower, resulting in the distance between spots remaining larger.
Spot fusion: in severe disease conditions, the spots on the leaf may merge with each other, creating a larger area of damage, which may result in the otherwise dispersed spots gradually merging, thereby reducing the distance between the spots.
Therefore, accurate monitoring of the spot spacing of the vegetable leaves is particularly important for judging the disease type of vegetables, and if the following effects can be achieved:
disease type diagnosis: different types of diseases are usually represented by spots of different sizes, shapes and distributions, and by accurately monitoring the variation of the spot spacing, the specific type of disease can be determined, and corresponding therapeutic measures can be facilitated.
Differentiating disease severity: the change in spot spacing may reflect the severity of the disease, a gradual decrease in spot spacing may mean that the disease is spreading rapidly, while a stable spot spacing may indicate that the disease is developing relatively slowly.
When the vegetable leaves are diseased, the spot size on the vegetable leaf surface will change for the following specific reasons:
pathogen type: the size of lesions caused by different types of pathogens may vary, for example, some fungal diseases may form larger spots, while bacterial or viral diseases may result in smaller spots.
Disease severity: the severity of the disease directly affects the size of the spot, a serious disease may result in a larger spot on the leaf, while a slight disease may cause only a smaller spot.
Leaf physiological response: leaves affected by disease may react physiologically, causing the tissue surrounding the spot to expand or shrink, affecting the size of the spot, e.g., cell necrosis may cause the spot to grow large, while tissue proliferation may cause the spot to become small.
Therefore, the accurate monitoring of the spot size of the vegetable leaves is particularly important for judging the disease type of vegetables, and the following effects can be achieved:
Distinguishing disease types: different types of diseases generally result in spots of different sizes, shapes and distributions, and by accurately monitoring the variation in spot size, the specific type of disease can be determined, which can be helpful for taking corresponding therapeutic measures.
In this embodiment, in step S1, adjusting the size of the blade image to 224×224 means that the width and the height of the image are adjusted to the same fixed size, that is, 224 pixels, and the image is adjusted to the same size, so that it can be ensured that each image has the same size when performing the speculative recognition by using the method, the processing procedure of performing the speculative recognition is simplified, a certain distortion or information loss may be introduced in the size adjustment of the image, the image is adjusted to the common 224×224 size, the excessive distortion may be avoided, the important features in the image are reserved, the coordinates of the pixels of the image after the image scaling are marked, the pixel at the lowest side acts as the first row, and the pixel at the leftmost side acts as the first column.
In this embodiment, the pixel positions of the first identification image and the second identification image are mapped one by one, which means that the coordinates of the same position of the first identification image and the second identification image are the same.
In this embodiment, the leaf image of the vegetable is obtained as a color image, and the first identification image is obtained by performing graying processing on the leaf image because the first identification image needs to be subjected to threshold segmentation and gray values are needed, and the following formula is used:
Wherein, Is the gray value of the pixel in the first recognition image,The red component value, the green component value and the blue component value of the pixels of the image scaled blade are respectively.
In this embodiment, HSV is a common color model that represents three attributes of color: hue (H), saturation (S) and brightness (V), hue representing the basic properties of a color, hue ranging from 0 to 360 degrees in HSV color space, encoding other colors in a clockwise direction starting from red, saturation representing the purity or shade of the color, higher saturation representing a brighter color and lower saturation representing a darker color, in HSV color space, saturation ranging from 0% to 100%, wherein 0% represents a gray scale image and 100% represents a fully saturated color, brightness representing the shade of the color, higher brightness value representing a brighter color, lower brightness value representing a darker color, and in HSV color space, brightness ranging from 0% to 100%, wherein 0% represents black, 100% representing white, the HSV color model being closer to human perception of color than the usual RGB color model, it being easier to understand and use.
In this embodiment, in step S2, the collected leaf image of the vegetable is detected, and threshold segmentation is performed, so that the process of identifying the healthy area and the infected area of the leaf of the vegetable is as follows:
Traversing all possible thresholds, dividing the vegetable leaves into a healthy area and an infected area according to the numerical value of each threshold, counting the number of pixels of the healthy area and the infected area, calculating the average value of gray values of the pixels of the healthy area and the infected area, and calculating the inter-class variance of the corresponding threshold according to the following formula:
Wherein, Representing a threshold value asInter-class variance of time,And,Threshold values are/>, respectivelyNumber of pixels in healthy and infected areas,Threshold values are/>, respectivelyThe mean value of gray values of pixels of the healthy area and the infected area;
calculating the value of the threshold value when the inter-class variance reaches the maximum, defining the value as the optimal separation threshold value, and dividing the pixel point into a healthy area and an infected area, wherein the gray value of the pixel point is smaller than or equal to Judging that the pixel belongs to a healthy area, which is larger thanThen it is determined that the pixel belongs to the infected area.
The connected areas of the infected area are analyzed, and the spots are identified and measured as follows:
Initializing a flag and a count: creating an empty mark image with the same size as the input image, for marking the connection areas, and initializing a counter for calculating the number of the found connection areas;
traversing the pixels: traversing each pixel of the input image starting from the upper left corner;
judging pixel connectivity: for the currently traversed pixel, judging connectivity of the pixel with the pixels above and to the left;
If both the upper and left pixels belong to the same connected region (i.e., have been marked), then the current pixel is marked as being the same as they are marked;
If the upper and left pixels belong to different connected regions (i.e. have been marked), the current pixel is marked as a new mark and the counter is incremented by 1;
if neither the upper nor the left pixel belongs to any connected region (i.e. is not marked), marking the current pixel as a new mark and adding 1 to the counter;
and (3) finishing traversing: after traversing all pixels, each connected region in the label image is assigned a unique label.
On the basis of the above embodiment, the color of the infected area of the vegetable leaf is subjected to data processing and correlation analysis, and a first color change coefficient of the vegetable leaf of the infected area is generated according to the following formula:
Wherein, For the first color change coefficient,For the sum of the hues of all pixels in the affected area,To sum the saturation of all pixels in the affected area,For the sum of the brightness of all pixels within the affected area,For the total number of all pixels in the affected area,Factor of hue for all pixels in the affected area,Is a factor of saturation of all pixels in the affected area,For factor coefficients of brightness of all pixels in an affected area, the change of hue means a transition from one color to another, such as red to orange, yellow, hue is very important for identifying and distinguishing different colors, as it is directly related to our knowledge of the color class, so the role of hue in color is most pronounced; saturation refers to the degree of purity or shade of a color, high saturation indicating vivid, full color, low saturation indicating lighter or dull color, variation in saturation affecting vividness and satiety of the color, however, variation in saturation is less capable of identifying and distinguishing colors than hue; lightness represents the brightness or darkness of a color, and changes in lightness mainly affect the brightness or darkness of the color, but do not have a great effect on the type or saturation of the color, and lightness is relatively weak for the recognition and distinction of colors relative to hue and saturation. Thus setAndIs a constant correction coefficient.
In the above formula, the hue, saturation, brightness and first color change coefficient of all pixels in the affected area have a linear functional relationship, and thus the relationship between the hue, saturation, brightness and first color change coefficient of all pixels in the affected area is fitted using a polynomial function.
As can be seen from the above formula, when the hue, saturation and brightness of all pixels in the affected area are higher, the first color change coefficient is higher, which indicates that the hue, saturation, brightness and first color change coefficient of all pixels in the affected area are in positive correlation, and the factor coefficient in the formula is used for balancing the duty ratio of each item of data in the formula, so as to promote the accuracy of the calculation result.
On the basis of the above embodiment, the number of connected areas in the affected area is the number of spots, and after the number of spots is obtained, the distance between adjacent spots is calculated to obtain the spot spacing, assuming that the center points of the connected areas a and B are respectively #,) And (/ >),) The spot spacing can be calculated by the euclidean distance S:
processing the texture data of the infected area of the vegetable leaf, processing the data, performing correlation analysis, and generating a first texture change coefficient according to the following formula:
Wherein, For the first texture change factor,For the number of spots in the leaf infected area,For the spot area of the leaf infected area,Factor coefficient for the number of spots in the infected area of the leaf,Is a factor of the spot spacing of the leaf infected area,As a factor of the area of the spots in the infected area of the leaf, the number of spots may generally reflect the degree of infection of the leaf more directly, so the factor of the number of spots is set higher, the spot pitch may be related to the distribution of the pathogen on the leaf, a smaller spot pitch may indicate a faster diffusion rate of the pathogen, so the factor of the spot pitch is relatively higher, the area of the spots may reflect the degree of infection of the leaf, but in some cases the area of the spots may be affected by other factors such as the growth state of the leaf itself or the nutrient supply, so the factor of the spot size may be relatively lower. Thus setAndIs a constant correction coefficient.
Assuming that each connected region represents one spot, the number of connected regions is equal to the number of connected regions pixels, and the spot area can be known by the number of connected regions pixels, and therefore the number of pixels of each connected region can represent the spot area, and the number of connected regions is known as described above.
In the above formula, the number of spots, the spot pitch, the spot size and the first texture variation coefficient of the leaf infected area have a linear functional relationship, so that the relationship between the number of spots, the spot pitch, the spot size and the first texture variation coefficient of the leaf infected area is fitted by using a polynomial function.
From the above formula, the higher the number of spots and the spot area of the blade infected area, the higher the first texture variation coefficient; when the spot spacing of the blade infection area is higher and the first texture change coefficient is lower, the positive correlation relationship among the spot number, the spot area and the first texture change coefficient of the blade infection area is shown, the negative correlation relationship among the spot spacing of the blade infection area and the first texture change coefficient is shown, and the factor coefficient in the formula is used for balancing the duty ratio of each item of data in the formula, so that the accuracy of a calculation result is promoted.
On the basis of the above embodiment, because the parameters collected and the generated coefficients of the healthy area and the infected area are the same, a formula which is the same as the relation between the first color characteristic parameter and the first color change coefficient is adopted, and a formula which is the relation between the second color characteristic parameter and the second color change coefficient of the healthy area is represented, therefore, the second color characteristic parameter of the vegetable leaf of the healthy area is subjected to data processing and correlation analysis, and a second color change coefficient is generated according to the following formula:
Wherein, For the second color change coefficient,Is the sum of the hues of all pixels in the healthy area,Is the sum of the saturation of all pixels in the healthy area,Is the sum of the brightness of all pixels in the healthy area,Is the total number of all pixels in the healthy area.
Because the parameters collected by the healthy area and the infected area are the same as the generated coefficients, a formula which has the same relation with the first texture characteristic parameters and the first texture change coefficients is adopted, and a formula which has the relation with the second texture characteristic parameters and the second texture change coefficients of the healthy area is adopted, so that the second texture characteristic parameters of the vegetable leaves in the healthy area are subjected to data processing and correlation analysis to generate the second texture characteristic coefficients of the vegetable leaves in the healthy area according to the following formula:
Wherein, For the second texture feature coefficient,For the number of spots in healthy area of leaf,Is the spot area of the healthy area of the leaf.
Based on the above embodiment, according to the first color change coefficient of the vegetable leaves in the infected areaAnd threshold value of first color change coefficient of vegetable leaves in infected areaGenerating a relative rate of change of the first color change coefficientThe formula according to is as follows:
Wherein, A relative rate of change that is a first color change coefficient;
according to the first texture change coefficient of the vegetable leaves in the infected area And a threshold value of a first coefficient of texture variation of the vegetable leaves of the infected areaThe relative rate of change of the first texture change coefficient is generated according to the following formula:
Wherein, Is the relative rate of change of the first texture change coefficient.
In this embodiment, the first color change coefficient of the vegetable leaves in the infected area is definitely greater than the threshold value of the first color change coefficient of the vegetable leaves in the infected area, and the first texture change coefficient of the vegetable leaves in the infected area is definitely greater than the threshold value of the first texture change coefficient. Therefore, the relative rate of change of the first color change coefficient and the relative rate of change of the first texture change coefficient are always greater than 0.
On the basis of the above embodiment, according to the value interval of the relative change rate of the first color change coefficient and the value interval of the relative change rate of the first texture change coefficient of the vegetable leaf, the process of judging the disease type of the vegetable by combining the disease conditions of the vegetable leaf of early leaf blight, late leaf blight and black rot is as follows:
When (when) 10%,20, Judging that the vegetables are suffering from diseases caused by early blight;
When (when) 15%,20%, Judging that the vegetables are ill caused by late blight; /(I)
When (when)10%,20%, The vegetables are judged to be suffering from diseases caused by black rot.
In this embodiment, when the vegetable leaves are affected by diseases caused by early blight, the leaves yellow, the infected leaves gradually yellow, and the leaves start from the edges and gradually spread inward, so that the relative change rate of the first color change coefficient is at the value ofBetween 10%; water spots, which are usually dark green or dark brown, appear on the leaves and gradually expand and merge as the disease progresses, so that the relative change rate of the first texture change coefficient is a value20%;
When vegetable leaves are subjected to disease caused by late blight, dark brown spots often appear on infected leaves, which are usually sharp-bordered, deep-colored, sometimes black or brown in color, and spots can occur in any part of the leaf, including the edges and the center. The relative change rate of the first color change coefficient is thus of a valueBetween 15%, the value of the relative rate of change of the first texture change coefficient20%;
When vegetable leaves are subjected to disease caused by black rot, black or dark brown spots are formed on the infected leaves, the boundaries are sharp, and these spots may gradually enlarge and form central dryness and cracks over time. The relative change rate of the first color change coefficient is thus of a valueBetween 10%, the value of the relative rate of change of the first texture change coefficient20%。
In the formulaAndThe specific value of (2) is generally determined by a person skilled in the art according to actual conditions, the formula is essentially weighted summation for comprehensive analysis, a person skilled in the art collects a plurality of groups of sample data, sets corresponding preset proportion coefficients for each group of sample data, substitutes the set preset proportion coefficients and the collected sample data into the formula, observes the accuracy of model output and the rationality of results through repeated test and parameter adjustment, gradually adjusts the factor coefficients, compares the performance and effect of the model under different parameter settings, finds the optimal coefficient combination, screens and averages the calculated factor coefficients to obtainAndIs a value of (a).
In addition, the size of the preset factor coefficient is a specific numerical value obtained by quantizing each parameter, so that the size of the coefficient depends on the number of sample data and the corresponding preset scaling factor preliminarily set by a person skilled in the art, and is not unique, so long as the scaling relation between the parameter and the quantized numerical value is not affected.
A leaf vegetable disease diagnosis system, as shown in fig. 2, comprising:
The image preprocessing module is used for carrying out image scaling on the leaf images of the vegetables, uniformly adjusting the sizes of the leaf images to 224 x 224, copying the leaf images into two groups of identical images, carrying out graying treatment on one group to obtain a first identification image, converting the other group from an RGB color space to an HSV color space to obtain a second identification image, and carrying out one-to-one mapping on the pixel point positions of the first identification image and the second identification image;
The image recognition module is used for carrying out threshold segmentation on the first recognition image, comparing each pixel in the first recognition image with a set threshold value, setting a pixel with a gray value higher than the threshold value as white, wherein white represents a healthy area, setting a pixel with a gray value lower than the threshold value as black, wherein black represents an infected area, extracting an HSV image of the infected area according to the threshold segmentation result so as to reserve the pixel value of the infected area, analyzing the connected area of the infected area to identify and measure the spot number and the spot area of the infected area, acquiring the spot distance through the spot number and the spot size, extracting the HSV image of the healthy area, analyzing the connected area of the healthy area to acquire the spot number and the spot area, and acquiring the spot distance through the spot number and the spot area;
The feature extraction module is used for acquiring color data and texture data of the infected area in the second identification image according to the data of the infected area segmented by the threshold value, acquiring the color data and the texture data of the healthy area in the second identification image according to the data of the healthy area segmented by the threshold value, wherein the color data comprises the average value of hue, the average value of saturation and the average value of brightness, and the texture data comprises the spot number, the spot area and the spot spacing;
The data processing module is used for carrying out data processing on the color data of the infected area of the vegetable leaf, carrying out correlation analysis, generating a first color change coefficient of the vegetable leaf of the infected area, carrying out data processing on the texture data of the infected area of the vegetable leaf, carrying out correlation analysis, generating a first texture change coefficient of the vegetable leaf of the infected area, carrying out data processing on the color data of the healthy area of the vegetable leaf, carrying out correlation analysis, generating a second color change coefficient of the vegetable leaf of the healthy area, carrying out data processing on the texture data of the healthy area of the vegetable leaf, carrying out correlation analysis, and generating a second texture characteristic coefficient of the vegetable leaf of the healthy area;
The threshold setting module is used for taking the second color change coefficient of the vegetable leaves in the healthy area as a threshold value of the first color change coefficient of the vegetable leaves in the infected area, and taking the second texture characteristic coefficient of the vegetable leaves in the healthy area as a threshold value of the first texture characteristic coefficient of the vegetable leaves in the infected area;
The data analysis module is used for generating the relative change rate of the first color change coefficient according to the first color change coefficient of the vegetable leaves in the infected area and the threshold value of the first color change coefficient of the vegetable leaves in the infected area, and generating the relative change rate of the first texture change coefficient according to the first texture change coefficient of the vegetable leaves in the infected area and the threshold value of the first texture change coefficient of the vegetable leaves in the infected area;
the judging module is used for judging the disease type of the vegetables according to the value interval of the change rate of the first color change coefficient and the value interval of the change rate of the first texture change coefficient of the vegetable leaves and combining the disease conditions of the vegetable leaves of the early leaf blight, the late leaf blight and the black rot.
The above formulas are all formulas with dimensions removed and numerical values calculated, the formulas are formulas with a large amount of data collected for software simulation to obtain the latest real situation, and preset parameters in the formulas are set by those skilled in the art according to the actual situation.
The above embodiments may be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented in software, the above-described embodiments may be implemented in whole or in part in the form of a computer program product. Those of skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein can be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application.

Claims (6)

1. The leaf vegetable disease diagnosis method is characterized by comprising the following specific steps:
s1, collecting leaf images of vegetables, performing image scaling on the leaf images of the vegetables, uniformly adjusting the sizes of the leaf images to 224 x 224, copying the leaf images into two groups of identical images, performing graying treatment on one group to obtain a first identification image, converting the other group from an RGB color space to an HSV color space to obtain a second identification image, and mapping pixel point positions of the first identification image and the second identification image one by one;
S2, threshold segmentation is carried out on the first identification image, each pixel in the first identification image is compared with a set threshold value, the pixel with the gray value higher than the threshold value is set to be white, the white represents a healthy area, the pixel with the gray value lower than the threshold value is set to be black, the black represents an infected area, an HSV image of the infected area is extracted according to the threshold segmentation result, so that the pixel value of the infected area is reserved, the connected area of the infected area is analyzed, the spot number and the spot area of the infected area are identified and measured, the spot distance is obtained through the spot number and the spot size, the HSV image of the healthy area is extracted, the connected area of the healthy area is analyzed, the spot number and the spot area are obtained, and the spot distance is obtained through the spot number and the spot area;
S3, acquiring color data and texture data of an infected area in a second identification image according to the data of the infected area segmented by the threshold value, acquiring the color data and the texture data of the healthy area in the second identification image according to the data of the healthy area segmented by the threshold value, wherein the color data comprises an average value of hue, an average value of saturation and an average value of brightness, and the texture data comprises the spot number, the spot area and the spot spacing;
s4, carrying out data processing on color data of an infection area of the vegetable leaf, carrying out correlation analysis, generating a first color change coefficient of the vegetable leaf of the infection area, carrying out data processing on texture data of the infection area of the vegetable leaf, carrying out correlation analysis, generating a first texture change coefficient of the vegetable leaf of the infection area, carrying out data processing on color data of a health area of the vegetable leaf, carrying out correlation analysis, generating a second color change coefficient of the vegetable leaf of the health area, carrying out data processing on texture data of the health area of the vegetable leaf, carrying out correlation analysis, and generating a second texture feature coefficient of the vegetable leaf of the health area;
And processing the data of the color of the infected area of the vegetable leaf, performing correlation analysis, and generating a first color change coefficient of the vegetable leaf of the infected area according to the following formula:
Wherein, For the first color change coefficient,For the sum of the hues of all pixels in the affected area,To sum the saturation of all pixels in the affected area,For the sum of the brightness of all pixels within the affected area,For the total number of all pixels in the affected area,Factor of hue for all pixels in the affected area,Is a factor of saturation of all pixels in the affected area,Is a factor of brightness of all pixels in the infected area,AndIs a constant correction coefficient;
The number of connected areas of the infection area is the number of spots, after the number of spots is obtained, the distance between adjacent spots is calculated to obtain the spot distance, and the central points of the connected areas A and B are assumed to be respectively [ ] ,) And (/ >),) The spot spacing can be calculated by the euclidean distance S:
processing the texture data of the infected area of the vegetable leaf, processing the data, performing correlation analysis, and generating a first texture change coefficient according to the following formula:
Wherein, For the first texture change factor,For the number of spots in the leaf infected area,For the spot area of the leaf infected area,Factor coefficient for the number of spots in the infected area of the leaf,Is a factor of the spot spacing of the leaf infected area,Is the factor of the spot area of the leaf infected area,AndIs a constant correction coefficient;
in step S4, the second color characteristic parameters of the vegetable leaves in the healthy area are subjected to data processing, and correlation analysis is performed to generate a second color change coefficient according to the following formula:
Wherein, For the second color change coefficient,Is the sum of the hues of all pixels in the healthy area,Is the sum of the saturation of all pixels in the healthy area,Is the sum of the brightness of all pixels in the healthy area,Total number of all pixels in the healthy area;
In step S4, data processing is performed on the second texture characteristic parameters of the vegetable leaves in the healthy area, correlation analysis is performed, and the second texture characteristic coefficients of the vegetable leaves in the healthy area are generated according to the following formula:
Wherein, For the second texture feature coefficient,For the number of spots in healthy area of leaf,Spot area for healthy area of leaf;
S5, taking the second color change coefficient of the vegetable leaves in the healthy area as a threshold value of the first color change coefficient of the vegetable leaves in the infected area, and taking the second texture characteristic coefficient of the vegetable leaves in the healthy area as a threshold value of the first texture characteristic coefficient of the vegetable leaves in the infected area;
s6, generating a relative change rate of the first color change coefficient according to the first color change coefficient of the vegetable leaves in the infected area and the threshold value of the first color change coefficient of the vegetable leaves in the infected area, and generating a relative change rate of the first texture change coefficient according to the first texture change coefficient of the vegetable leaves in the infected area and the threshold value of the first texture change coefficient of the vegetable leaves in the infected area;
S7, judging the disease type of the vegetables according to the value interval of the change rate of the first color change coefficient and the value interval of the change rate of the first texture change coefficient of the vegetable leaves and combining the disease conditions of the vegetable leaves of early leaf blight, late leaf blight and black rot.
2. The method according to claim 1, wherein in step S1, the leaf image is subjected to graying processing to obtain a first identification image according to the following formula:
Wherein, Is the gray value of the pixel in the first recognition image,Respectively obtaining a pixel red component value, a pixel green component value and a pixel blue component value of the blade image after image scaling;
In step S2, the collected leaf image of the vegetable is detected, and threshold segmentation is performed, so that the process of identifying the healthy area and the infected area of the leaf of the vegetable is as follows:
Traversing all possible thresholds, dividing the vegetable leaves into a healthy area and an infected area according to the numerical value of each threshold, counting the number of pixels of the healthy area and the infected area, calculating the average value of gray values of the pixels of the healthy area and the infected area, and calculating the inter-class variance of the corresponding threshold according to the following formula:
Wherein, Representing a threshold value asInter-class variance of time,And,Threshold values are/>, respectivelyNumber of pixels in healthy and infected areas,Threshold values are/>, respectivelyThe mean value of gray values of pixels of the healthy area and the infected area;
calculating the value of the threshold value when the inter-class variance reaches the maximum, defining the value as the optimal separation threshold value, and dividing the pixel point into a healthy area and an infected area, wherein the gray value of the pixel point is smaller than or equal to Judging that the pixel belongs to a healthy area, which is larger thanThen it is determined that the pixel belongs to the infected area.
3. The method for diagnosing leaf vegetable diseases according to claim 1, wherein in the step S2, the connected region of the infected area is analyzed, and spots are identified and measured as follows:
Initializing a flag and a count: creating an empty mark image with the same size as the input image, for marking the connection areas, and initializing a counter for calculating the number of the found connection areas;
traversing the pixels: traversing each pixel of the input image starting from the upper left corner;
judging pixel connectivity: for the currently traversed pixel, judging connectivity of the pixel with the pixels above and to the left;
If the upper and left pixels both belong to the same connected region, the current pixel is marked as the same mark as the upper and left pixels;
If the upper pixel and the left pixel belong to different connected areas, marking the current pixel as a new mark, and adding 1 to a counter;
if neither the upper nor the left pixel belongs to any connected region, marking the current pixel as a new mark, and adding 1 to the counter;
and (3) finishing traversing: after traversing all pixels, each connected region in the label image is assigned a unique label.
4. The method according to claim 1, wherein in step S6, the first color change coefficient of the vegetable leaves in the affected area is usedAnd threshold value of first color change coefficient of vegetable leaves in infected areaGenerating a relative rate of change of the first color change coefficientThe formula according to is as follows:
Wherein, A relative rate of change that is a first color change coefficient;
according to the first texture change coefficient of the vegetable leaves in the infected area And a threshold value of a first coefficient of texture variation of the vegetable leaves of the infected areaThe relative rate of change of the first texture change coefficient is generated according to the following formula:
Wherein, Is the relative rate of change of the first texture change coefficient.
5. The method according to claim 4, wherein in step S7, the process of determining the disease type of the vegetable is as follows, based on the value interval of the relative change rate of the first color change coefficient and the value interval of the relative change rate of the first texture change coefficient of the vegetable leaf, in combination with the disease conditions of the vegetable leaf of early leaf blight, late leaf blight and black rot of the leaf:
When (when) 10%,20, Judging that the vegetables are suffering from diseases caused by early blight;
When (when) 15%,20%, Judging that the vegetables are ill caused by late blight;
When (when) 10%,20%, The vegetables are judged to be suffering from diseases caused by black rot.
6. A leaf vegetable disease diagnosis system, comprising:
The image preprocessing module is used for carrying out image scaling on the leaf images of the vegetables, uniformly adjusting the sizes of the leaf images to 224 x 224, copying the leaf images into two groups of identical images, carrying out graying treatment on one group to obtain a first identification image, converting the other group from an RGB color space to an HSV color space to obtain a second identification image, and carrying out one-to-one mapping on the pixel point positions of the first identification image and the second identification image;
The image recognition module is used for carrying out threshold segmentation on the first recognition image, comparing each pixel in the first recognition image with a set threshold value, setting a pixel with a gray value higher than the threshold value as white, wherein white represents a healthy area, setting a pixel with a gray value lower than the threshold value as black, wherein black represents an infected area, extracting an HSV image of the infected area according to the threshold segmentation result so as to reserve the pixel value of the infected area, analyzing the connected area of the infected area to identify and measure the spot number and the spot area of the infected area, acquiring the spot distance through the spot number and the spot size, extracting the HSV image of the healthy area, analyzing the connected area of the healthy area to acquire the spot number and the spot area, and acquiring the spot distance through the spot number and the spot area;
The feature extraction module is used for acquiring color data and texture data of the infected area in the second identification image according to the data of the infected area segmented by the threshold value, acquiring the color data and the texture data of the healthy area in the second identification image according to the data of the healthy area segmented by the threshold value, wherein the color data comprises the average value of hue, the average value of saturation and the average value of brightness, and the texture data comprises the spot number, the spot area and the spot spacing;
The data processing module is used for carrying out data processing on the color data of the infected area of the vegetable leaf, carrying out correlation analysis, generating a first color change coefficient of the vegetable leaf of the infected area, carrying out data processing on the texture data of the infected area of the vegetable leaf, carrying out correlation analysis, generating a first texture change coefficient of the vegetable leaf of the infected area, carrying out data processing on the color data of the healthy area of the vegetable leaf, carrying out correlation analysis, generating a second color change coefficient of the vegetable leaf of the healthy area, carrying out data processing on the texture data of the healthy area of the vegetable leaf, carrying out correlation analysis, and generating a second texture feature coefficient of the vegetable leaf of the healthy area;
And processing the data of the color of the infected area of the vegetable leaf, performing correlation analysis, and generating a first color change coefficient of the vegetable leaf of the infected area according to the following formula:
Wherein, For the first color change coefficient,For the sum of the hues of all pixels in the affected area,To sum the saturation of all pixels in the affected area,For the sum of the brightness of all pixels within the affected area,For the total number of all pixels in the affected area,Factor of hue for all pixels in the affected area,Is a factor of saturation of all pixels in the affected area,Is a factor of brightness of all pixels in the infected area,AndIs a constant correction coefficient;
The number of connected areas of the infection area is the number of spots, after the number of spots is obtained, the distance between adjacent spots is calculated to obtain the spot distance, and the central points of the connected areas A and B are assumed to be respectively [ ] ,) And (/ >),) The spot spacing can be calculated by the euclidean distance S:
processing the texture data of the infected area of the vegetable leaf, processing the data, performing correlation analysis, and generating a first texture change coefficient according to the following formula:
Wherein, For the first texture change factor,For the number of spots in the leaf infected area,For the spot area of the leaf infected area,Factor coefficient for the number of spots in the infected area of the leaf,Is a factor of the spot spacing of the leaf infected area,Is the factor of the spot area of the leaf infected area,AndIs a constant correction coefficient;
And carrying out data processing on the second color characteristic parameters of the vegetable blades in the healthy area, carrying out correlation analysis, and generating a second color change coefficient according to the following formula:
Wherein, For the second color change coefficient,Is the sum of the hues of all pixels in the healthy area,Is the sum of the saturation of all pixels in the healthy area,Is the sum of the brightness of all pixels in the healthy area,Total number of all pixels in the healthy area;
And carrying out data processing on the second texture characteristic parameters of the vegetable leaves in the healthy area, carrying out correlation analysis, and generating second texture characteristic coefficients of the vegetable leaves in the healthy area according to the following formula:
Wherein, For the second texture feature coefficient,For the number of spots in healthy area of leaf,Spot area for healthy area of leaf;
The threshold setting module is used for taking the second color change coefficient of the vegetable leaves in the healthy area as a threshold value of the first color change coefficient of the vegetable leaves in the infected area, and taking the second texture characteristic coefficient of the vegetable leaves in the healthy area as a threshold value of the first texture characteristic coefficient of the vegetable leaves in the infected area;
The data analysis module is used for generating the relative change rate of the first color change coefficient according to the first color change coefficient of the vegetable leaves in the infected area and the threshold value of the first color change coefficient of the vegetable leaves in the infected area, and generating the relative change rate of the first texture change coefficient according to the first texture change coefficient of the vegetable leaves in the infected area and the threshold value of the first texture change coefficient of the vegetable leaves in the infected area;
the judging module is used for judging the disease type of the vegetables according to the value interval of the change rate of the first color change coefficient and the value interval of the change rate of the first texture change coefficient of the vegetable leaves and combining the disease conditions of the vegetable leaves of the early leaf blight, the late leaf blight and the black rot.
CN202410355569.3A 2024-03-27 2024-03-27 Leaf vegetable disease diagnosis method and system Active CN117953491B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410355569.3A CN117953491B (en) 2024-03-27 2024-03-27 Leaf vegetable disease diagnosis method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410355569.3A CN117953491B (en) 2024-03-27 2024-03-27 Leaf vegetable disease diagnosis method and system

Publications (2)

Publication Number Publication Date
CN117953491A CN117953491A (en) 2024-04-30
CN117953491B true CN117953491B (en) 2024-06-04

Family

ID=90805547

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410355569.3A Active CN117953491B (en) 2024-03-27 2024-03-27 Leaf vegetable disease diagnosis method and system

Country Status (1)

Country Link
CN (1) CN117953491B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559511A (en) * 2013-11-20 2014-02-05 天津农学院 Automatic identification method of foliar disease image of greenhouse vegetable
CN104680524A (en) * 2015-02-11 2015-06-03 中国农业大学 Disease diagnosis method for leaf vegetables
CN105320970A (en) * 2015-11-25 2016-02-10 内蒙古科技大学 Potato disease diagnostic device, diagnostic system and diagnostic method
CN113298777A (en) * 2021-05-21 2021-08-24 山东大学 Cotton leaf blight detection method and system based on color features and super-pixel clustering

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559511A (en) * 2013-11-20 2014-02-05 天津农学院 Automatic identification method of foliar disease image of greenhouse vegetable
CN104680524A (en) * 2015-02-11 2015-06-03 中国农业大学 Disease diagnosis method for leaf vegetables
CN105320970A (en) * 2015-11-25 2016-02-10 内蒙古科技大学 Potato disease diagnostic device, diagnostic system and diagnostic method
CN113298777A (en) * 2021-05-21 2021-08-24 山东大学 Cotton leaf blight detection method and system based on color features and super-pixel clustering

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Disease Classification in Eggplant Using Pre-trained VGG16 and MSVM;Aravind Krishnaswamy Rangarajan等;《scientific reports》;20201231;论文第1-11页 *

Also Published As

Publication number Publication date
CN117953491A (en) 2024-04-30

Similar Documents

Publication Publication Date Title
US7995058B2 (en) Method and system for identifying illumination fields in an image
CN104598908B (en) A kind of crops leaf diseases recognition methods
CN104680524B (en) A kind of leafy vegetable disease screening method
Renugambal et al. Application of image processing techniques in plant disease recognition
CN110376202B (en) Tea tree anthracnose lesion identification method based on imaging hyperspectral technology
US8983183B2 (en) Spatially varying log-chromaticity normals for use in an image process
CN110363125A (en) Using the method for Model Transfer identification different cultivars Citrus Huanglongbing pathogen
CN111784764A (en) Tea tender shoot identification and positioning algorithm
CN117670993B (en) Textile production and processing monitoring system based on machine vision
CN109000887B (en) Pattern detection device and method, patterning control system and method
CN113255434A (en) Apple identification method fusing fruit features and deep convolutional neural network
CN111768402A (en) MU-SVM-based method for evaluating freshness of iced pomfret
Mayer et al. Towards autonomous vision self-calibration for soccer robots
CN117974633B (en) Intelligent tomato pest detection method based on image processing
CN112560911A (en) Tongue image classification method and system in traditional Chinese medicine
CN117953491B (en) Leaf vegetable disease diagnosis method and system
CN111199545B (en) Method for identifying color of flue-cured tobacco leaves based on machine vision
CN116646019B (en) Propolis liquid quality detection data processing method and system
CN111192332B (en) Smoke detection-based smoke machine control method and smoke machine
Di et al. The research on the feature extraction of sunflower leaf rust characteristics based on color and texture feature
Yao et al. Study on detection method of external defects of potato image in visible light environment
CN115131349A (en) White balance adjusting method and system based on endocrine test paper color histogram
Varga et al. How does Computer vision compare to standard colorimeter in assessing the seed coat color of common bean (Phaseolus vulgaris L.)?
CN114581660A (en) Plant leaf segmentation identification method and system
US8655099B2 (en) Relationship maintenance in an image process

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant