Plant protection droplet detection method based on HSV color model
Through the fog droplet detection method based on the HSV color model, the problems of complexity and low accuracy of fog droplet detection in the existing technology are solved, and accurate statistics of fog droplets and rapid evaluation of pesticide spraying effects are achieved.
Patent Information
- Application Number
- CN202011420835.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-07
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-12-07
AI Technical Summary
Existing fog droplet detection methods have problems such as complex operation, low accuracy, high cost and slow detection speed. In particular, they cannot accurately and quickly analyze fog droplets in specific scenarios.
A plant protection droplet detection method based on the HSV color model is adopted. The droplet area on the water-sensitive paper is split into RGB three-channels and converted into an HSV model. A mask image is generated to remove the background. It combines grayscale, Gaussian filtering, and morphology. Scientific operation and contour detection, calculation of droplet deposition density, coverage and particle size spectrum.
It achieves accurate statistics of the number, diameter, volume diameter, deposition density and coverage of droplets in an environment with dense droplets, simplifies the detection process, and improves the accuracy and speed of detection.
Smart Images

Figure CN112381819B
Abstract
Description
Technical Field
[0001] The invention relates to the field of pesticide spraying effect detection, and specifically discloses a plant protection droplet detection method based on an HSV color model. Background Art
[0002] During the growth of plants, pesticides need to be sprayed to protect plants from pests. At this time, it is necessary to judge the effect of pesticide spraying. The commonly used judgment method is to collect droplets first, then detect the droplets, calculate the droplet deposition density, droplet deposition coverage and droplet particle size spectrum, and then make a judgment. The existing droplet detection methods mainly include laser method, mechanical method and image method. The laser method is relatively convenient to operate, but the cost of the measuring instrument is expensive, and the detection conditions are relatively strict, which has certain limitations; for mechanical methods, such as the oil pan method, the operator needs to perform a lot of manual operations. After obtaining the collected droplets, it is necessary to measure, calculate and correct them through a microscope. The operation process is complicated and the accuracy is very low; the image method can be divided into traditional image method and image method based on deep learning. The traditional image method cannot remove the background information well when extracting the image of the droplets, and it is easy to introduce the background to cause detection errors. The method based on deep learning is more cumbersome in implementation method, and it is necessary to pre-train the network model and then detect it through the model. The speed is slow and it is easy to have false detection during the detection process. The above-mentioned laser method, mechanical method and image method cannot accurately and quickly analyze the droplets in certain special scenes. Summary of the invention
[0003] In view of this, an object of the present invention is to provide a method for detecting plant protection droplets based on the HSV color model.
[0004] In order to achieve the above object, the present invention provides the following technical solutions:
[0005] A method for detecting plant protection droplets based on the HSV color model comprises the following steps:
[0006] Step S1, using pesticide spraying equipment to spray the test liquid onto the water-sensitive paper to form a droplet area on the water-sensitive paper;
[0007] Step S2, obtaining the image information of the water-sensitive paper as the original image of the mist droplets, and performing RGB three-channel decomposition on the original image of the mist droplets to obtain image information of the three channels of R, G, and B;
[0008] Step S3, extracting the image information of the R channel, using the image information of the R channel to replace the image information of the G channel and the B channel, and merging the image information of the three channels to obtain an R three-channel model;
[0009] Step S4, converting the R three-channel model into an HSV color model, obtaining the hue component H, saturation component S, and lightness component V corresponding to each part of the droplet image through the HSV color model, adjusting the maximum value of the lightness component V, and generating a mask image that removes the background area and retains the droplet area;
[0010] Step S5, converting the original image of the fog droplets into a BGR color mode and superimposing it with the mask image, thereby removing the background area of the BGR color mode image to obtain a mask image;
[0011] Step S6, performing grayscale operation and Gaussian filtering on the mask image in sequence to obtain a Gaussian filtered image;
[0012] Step S7, performing binarization operation, morphological operation and opening operation denoising on the Gaussian filter image in sequence to obtain a droplet denoising image;
[0013] Step S8, performing contour detection on the droplet denoising image, extracting the droplet contour, and obtaining a droplet contour image;
[0014] Step S9, calculating the center and radius of the minimum enclosing circle of the droplet outline, and calculating the droplet deposition density, droplet deposition coverage and droplet particle size spectrum according to the droplet outline radius and center information.
[0015] Furthermore, in step S4, when generating the mask image, a value is first selected between the brightness component value of the background part of the water-sensitive paper and the brightness component value of the droplet part as the brightness threshold value V max , extract the brightness component value less than or equal to the brightness threshold V from the image information of the HSV color model max area to generate a mask map.
[0016] Furthermore, in step S6, when performing the grayscale operation, the grayscale value of a single pixel in the image in the BGR mode is first defined as Y, and then the grayscale value Y of each pixel is calculated by the following formula:
[0017] Y=0.299R+0.587G+0.114B
[0018] Among them, R represents the value of the red component of a single pixel; G represents the value of the green component of a single pixel; B represents the value of the blue component of a single pixel.
[0019] Furthermore, in step S7, the method of binarization operation is: presetting a grayscale threshold T1, and setting the grayscale value of pixels with grayscale values less than T1 to 0; and setting the grayscale value of pixels with grayscale values greater than or equal to T1 to the grayscale maximum value maxVal.
[0020] Furthermore, in step S8, the method for performing contour detection and extracting droplet contours is: compressing the horizontal, vertical and diagonal elements of the binary image of the droplet image, retaining only the end point coordinates in this direction, obtaining the outer contour information of the droplet, and drawing the droplet contour through the contour information.
[0021] Further, after executing step S8, the following steps are first performed:
[0022] Step S801, presetting a minimum area threshold T2 and a maximum area threshold T3; calculating the area enclosed by each droplet outline, and filtering out droplet outlines whose enclosed area is smaller than T2 or larger than T3.
[0023] Furthermore, the calculation formula of droplet deposition density is as follows:
[0024]
[0025] In the above formula, K is the droplet deposition density; N is the number of droplets after filtration; A t The actual area of water-sensitive paper, in cm 2 ,A t =w t ×h t ;w t Indicates the actual width of water-sensitive paper, h t Indicates the actual height of the water-sensitive paper.
[0026] Furthermore, the calculation formula of droplet deposition coverage is as follows:
[0027]
[0028] In the above formula, C is the droplet deposition coverage; A is the sum of the areas of all droplets enclosed after filtration; p is the pixel area of the water-sensitive paper image, A p =w p ×h p ;w p Indicates the pixel width of water-sensitive paper, h p Indicates the pixel height of water-sensitive paper.
[0029] The working principle and beneficial effects of this solution are as follows: the present invention has been improved on the basis of the traditional image method, by merging the three R channels to generate a mask image, and using the mask method to detect droplets. It can more accurately count the important technical indicators for measuring the effect of pesticide spraying, such as the median diameter of the number of droplets, the median diameter of the volume, the deposition density, and the deposition coverage on water-sensitive paper with dense droplets, and the detection process is simple. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is a flow chart of a preferred embodiment of the plant protection droplet detection method based on the HSV color model of the present invention;
[0031] Figure 2 is a schematic diagram of the original image of the droplets described in step S2;
[0032] Figure 3 is a schematic diagram of the R, G, and B three-channel comparison diagram described in step S2;
[0033] Figure 4 is a schematic diagram of the R three-channel map described in step S3;
[0034] Figure 5 is a schematic diagram of the mask image described in step S4;
[0035] Figure 6 is a schematic diagram of the mask image described in step S5;
[0036] Figure 7 is a schematic diagram of the grayscale image described in step S6;
[0037] Figure 8 is a schematic diagram of the Gaussian filter image described in step S6;
[0038] Fig. 9 is a schematic diagram of the droplet binary image described in step S7;
[0039] Fig.10 is a schematic diagram of the droplet denoising image described in step S7;
[0040] Fig.11 is a schematic diagram of the droplet profile diagram described in step S8;
[0041] Fig.12 It is a schematic diagram of the detection result diagram described in step S9. DETAILED DESCRIPTION
[0042] The following is further described in detail through specific implementation methods:
[0043] Example
[0044] A preferred embodiment of the plant protection droplet detection method based on the HSV color model of the present invention comprises the following steps:
[0045] Step S1: Use pesticide spraying equipment to spray the test liquid onto the water-sensitive paper to form a droplet area on the water-sensitive paper.
[0046] Step S2: Obtain the image information of the water-sensitive paper as the original image of the fog droplets, such as Figure 2 As shown in the figure, the original fog drop image is split into three channels of RGB to obtain the image information of the three channels of R, G, and B, as shown in the figure. Figure 3 shown.
[0047] Step S3: By comparison, it can be seen that the R channel image can better highlight the difference between the background and the droplets of the original image of the droplets, which is more conducive to the extraction of the droplet contour. Therefore, the image information of the R channel is extracted, and the image information of the R channel is used to replace the image information of the G channel and the B channel, and the image information of the three channels is combined to obtain the R three-channel model to generate the R three-channel image of the droplets, such as Figure 4 shown.
[0048] Step S4: convert the R three-channel model into the HSV color model, obtain the H hue component, S saturation component, and V lightness component corresponding to each part of the droplet image through the HSV color model, adjust the maximum value of the lightness component V, and generate a mask image that removes the background area and retains the droplet area, such as Figure 5 The specific method is to select a value between the brightness component value of the background part of the water-sensitive paper and the brightness component value of the droplet part as the brightness threshold value V max When selecting the brightness threshold V max When the R three-channel model is used, a value that can effectively remove the background and retain the fog droplet area can be selected as the brightness threshold V through multiple experiments. max For example, the brightness threshold V max = 200. Extract the brightness component value less than or equal to the brightness threshold V from the image information of the HSV color model max The mask map is generated in the area of the mask map; the formula for generating the mask map is as follows:
[0049]
[0050] The above formula can be used to change the color of the fog droplets to white and the background area to black, thus generating a mask image. The mask image can only display black and white, that is, the target area is white and the background is black. Of course, white can also be changed to other colors as needed, just by merging and superimposing the images.
[0051] Step S5: convert the original fog droplet image into BGR color mode and superimpose it with the mask image, thereby removing the background area of the BGR color mode image to obtain a mask image, such as Figure 6As shown. The specific method is to use the mask shielding effect to shield certain areas on the image so that they do not participate in the processing or the calculation of the processing parameters. When the two images are superimposed, the original image will be retained and displayed in the non-shielded area of the mask image, and the masked part will be displayed in the shielded area of the mask image. The mask image is used to perform an "AND" operation with the original image, that is, the white area of the mask image is the reserved image pixels that need to be processed, and the black area is the eliminated image pixels that need to be processed. By superimposing the two, the background information of the water-sensitive paper can be effectively filtered and the droplet information can be kept to the maximum extent.
[0052] Step S6: performing grayscale operation and Gaussian filtering on the mask image in sequence.
[0053] After removing the background, the image needs to be further grayscaled. The grayscale conversion completes the conversion of the color space from BGR mode to grayscale mode, reduces the amount of original image data, reduces the amount of calculation and accelerates subsequent processing, while avoiding stripe distortion and maintaining the integrity of the image information. The specific method is: define the grayscale value of a single pixel in the BGR mode image as Y, and calculate the grayscale value Y of each pixel by the following formula:
[0054] Y=0.299R+0.587G+0.114B
[0055] Among them, R represents the value of the red component of a single pixel; G represents the value of the green component of a single pixel; B represents the value of the blue component of a single pixel. Through the grayscale operation, a grayscale image is obtained, such as Figure 7 shown.
[0056] In the later application of digital images, noise will cause great errors, and the errors will accumulate and propagate in different processing operations. In order to obtain a better image, a Gaussian filter is needed to remove Gaussian noise and make the image smoother. The Gaussian filter can select a linear smoothing filter with weights according to the shape of the Gaussian function. The Gaussian filter is very effective for noise that obeys the normal distribution. The calculation method is to establish a two-dimensional UV coordinate system, define the input image as S(u, v), and obtain G(u, v) after processing with a two-dimensional Gaussian function. Use a template to scan each pixel in the grayscale image, and determine the weighted average grayscale value of the pixels in the neighborhood to replace the value of the template center pixel. The formula is:
[0057]
[0058] In the above formula, σ is the standard deviation of the normal distribution. After Gaussian filtering, the Gaussian filter graph is obtained, such as Figure 8 shown.
[0059] Step S7: performing binarization operation, morphological operation and opening operation denoising on the Gaussian filter image in sequence.
[0060] The specific method of performing the binarization operation is: preset a grayscale threshold T1 (for example, T1 can be set to 40), and for pixels with grayscale values less than T1, set their grayscale values to 0; for pixels with grayscale values greater than or equal to T1, set their grayscale values to the grayscale maximum value maxVal, and the grayscale maximum value maxVal can be set to 255. After the binarization operation, the grayscale value of the background area in the image becomes 0, and the grayscale value of the fog drop area becomes 255, so that the amount of data is greatly reduced, so that the outline of the fog drop can be highlighted. The Gaussian filter image is obtained after the binarization operation. The fog drop binary image is as follows Fig. 9 shown.
[0061] The core of morphological processing is to define the structural element, including its size and shape. When performing morphological operations on the droplet binary image, first define a 3×3 cross-shaped structural element. Returns the structure element of the specified shape and size, and performs morphological operations on the image through the structure element. Then, the opening operation is used to first erode, and then to dilate, to separate the fog droplets from the small area, remove the irrelevant external white pixels around the fog droplets that interfere with the small area, and keep the other parts unchanged. After processing, the fog drop denoising image is obtained, such as Fig.10 shown.
[0062] Step S8, performing contour detection on the fog droplet denoising image to extract the fog droplet contour; the specific method is: compressing the horizontal, vertical and diagonal elements of the fog droplet image binary image, retaining only the end point coordinates in the direction, obtaining the outer contour information of the fog droplet, and drawing the fog droplet contour through the contour information to generate a fog droplet contour map, such as Fig.11 shown.
[0063] Step S801, presetting a minimum area threshold T2 and a maximum area threshold T3; calculating the area enclosed by each droplet outline, filtering out droplet outlines whose enclosed area is smaller than T2 or larger than T3, and removing interference information.
[0064] Step S9: Detect the center and radius information of the minimum enclosing circle of the droplet contour through the filtered contour information, and circle it on the droplet image to obtain a detection result diagram, such as Fig.12 The center and radius of the minimum enclosing circle of the droplet outline are calculated, and the droplet deposition density, droplet deposition coverage and droplet size spectrum are calculated based on the droplet outline radius and center information.
[0065] 1. Droplet deposition density
[0066] The droplet deposition density K is an important parameter that affects the droplet control effect. It refers to the number of droplets received per unit area of the droplet collection device. The unit is: droplets / cm 2 ; The calculation formula is as follows:
[0067]
[0068] In the above formula, N is the number of droplets after filtration; A t The actual area of water-sensitive paper, in cm 2 ,A t =w t ×h t ;w t Indicates the actual width of water-sensitive paper, h t Indicates the actual height of the water-sensitive paper.
[0069] 2. Droplet deposition coverage
[0070] The droplet deposition coverage rate C represents the percentage of the droplet coverage area to the total statistical area, and its calculation formula is as follows:
[0071]
[0072] In the above formula, A is the sum of the areas of all droplets enclosed after filtration; p is the pixel area of the water-sensitive paper image, A p =w p ×h p ;w p Indicates the pixel width of water-sensitive paper, h p Indicates the pixel height of water-sensitive paper.
[0073] 3. Droplet size spectrum
[0074] The droplet size spectrum mainly includes the number median diameter and the volume median diameter; of course, the droplet size spectrum also includes other parameters. Since other parameters of the droplet size spectrum can be ignored when judging the effect of pesticide spraying, only the number median diameter and the volume median diameter are calculated in this embodiment.
[0075] In a spray sample, all droplets are accumulated in order from small to large droplet diameters. When the accumulated droplet number is equal to 50% of the total droplet number, the corresponding droplet diameter is the number median diameter of the droplets in this droplet sample, and its unit is μm (micrometer). The calculation formula of the number median diameter NMD is expressed as:
[0076]
[0077] In the above formula, r p Indicates the pixel radius corresponding to the median diameter in the image.
[0078] In a spray sample, all droplets are accumulated in order from small to large volume. When the accumulated volume value is equal to 50% of the total droplet volume, the corresponding droplet diameter is the volume median diameter of the droplets in this droplet sample, and its unit is μm (micrometer). The calculation formula of volume median diameter VMD is expressed as:
[0079]
[0080] In the above formula, R represents the pixel diameter corresponding to the volume median diameter, and its calculation formula is:
[0081]
[0082] In the above formula, V represents the cumulative superposition volume value; Vm represents half of the sum of all droplet volumes, and its calculation formula is:
[0083]
[0084] Afterwards, the spraying effect of pesticides can be judged based on the droplet deposition density, droplet deposition coverage and droplet particle size spectrum.
[0085] The above is only an embodiment of the present invention, and the common knowledge such as the known specific structure and characteristics in the scheme is not described in detail here. It should be pointed out that for those skilled in the art, several modifications and improvements can be made without departing from the structure of the present invention, which should also be regarded as the protection scope of the present invention, and these will not affect the effect of the implementation of the present invention and the practicality of the present invention.
Claims
1. A method for detecting plant protection droplets based on the HSV color model, characterized in that: The following steps are involved: Step S1, using pesticide spraying equipment to spray the test liquid onto the water-sensitive paper to form a droplet area on the water-sensitive paper; Step S2, obtaining the image information of the water-sensitive paper as the original image of the mist droplets, and performing RGB three-channel decomposition on the original image of the mist droplets to obtain image information of the three channels of R, G, and B; Step S3, extracting the image information of the R channel, using the image information of the R channel to replace the image information of the G channel and the B channel, and merging the image information of the three channels to obtain an R three-channel model; Step S4, convert the R three-channel model into the HSV color model, obtain the hue component H, saturation component S and lightness component V corresponding to each part of the droplet image through the HSV color model, and select a value between the lightness component value of the water-sensitive paper background part and the lightness component value of the droplet part as the lightness threshold V max , with the brightness threshold V max As the maximum value of the brightness component V, the brightness component value is extracted from the image information of the HSV color model, which is less than or equal to the brightness threshold V max area, generate a mask image that removes the background area and retains the droplet area; Step S5, converting the original fog droplet image into a BGR color mode and superimposing it with the mask image, thereby removing the background area of the BGR color mode image to obtain a mask image; Step S6, performing grayscale operation and Gaussian filtering on the mask image in sequence to obtain a Gaussian filtered image; Step S7, performing binarization operation, morphological operation and opening operation denoising on the Gaussian filter image in sequence to obtain a droplet denoising image; Step S8, performing contour detection on the droplet denoising image, extracting the droplet contour, and obtaining a droplet contour image; Step S9, calculating the center and radius of the minimum enclosing circle of the droplet outline, and calculating the droplet deposition density, droplet deposition coverage and droplet particle size spectrum according to the droplet outline radius and center information.
2. The method for detecting plant protection droplets based on the HSV color model according to claim 1, characterized in that: In step S6, when performing the grayscale operation, the grayscale value of a single pixel in the image in the BGR mode is first defined as Y, and then the grayscale value Y of each pixel is calculated by the following formula: Y=0.299R+0.587G+0.114B Among them, R represents the value of the red component of a single pixel; G represents the value of the green component of a single pixel; B represents the value of the blue component of a single pixel.
3. The method for detecting plant protection droplets based on the HSV color model according to claim 1, characterized in that: In step S7, the method of binarization operation is: presetting a grayscale threshold T1, setting the grayscale value of pixels with grayscale values less than T1 to 0; and setting the grayscale value of pixels with grayscale values greater than or equal to T1 to the grayscale maximum value maxVal.
4. The method for detecting plant protection droplets based on the HSV color model according to claim 1, characterized in that: In step S8, the method for performing contour detection and extracting droplet contours is: compressing the horizontal, vertical and diagonal elements of the binary image of the droplet image, retaining only the end point coordinates in this direction, obtaining the outer contour information of the droplet, and drawing the droplet contour through the contour information.
5. The method for detecting plant protection droplets based on the HSV color model according to claim 1, characterized in that: After executing step S8, first perform the following steps: Step S801, presetting a minimum area threshold T2 and a maximum area threshold T3; calculating the area enclosed by each droplet outline, and filtering out droplet outlines whose enclosed area is smaller than T2 or larger than T3.
6. The method for detecting plant protection droplets based on the HSV color model according to claim 1, characterized in that: The calculation formula for droplet deposition density is as follows: In the above formula, K is the droplet deposition density; N is the number of droplets after filtration; A t The actual area of water-sensitive paper, in cm 2 ,A t =w t ×h t ;w t Indicates the actual width of water-sensitive paper, h t Indicates the actual height of the water-sensitive paper.
7. The method for detecting plant protection droplets based on the HSV color model according to claim 1, characterized in that: The calculation formula of droplet deposition coverage is as follows: In the above formula, C is the droplet deposition coverage; A is the sum of the areas of all droplets enclosed after filtration; p is the pixel area of the water-sensitive paper image, A p =w p ×h p ;w p Indicates the pixel width of water-sensitive paper, h p Indicates the pixel height of water-sensitive paper.
Citation Information
Patent Citations
Corn ear symmetry-based row number automatic detection method
CN108764294A
Fogdrop deposition image detection system and method based on yolo network
CN110689519A
Method for measuring particle size of liquid drops sprayed by industrial nozzle
CN111986175A
Background removal for document images
US9251614B1
