Pest prevention method, system and apparatus based on computer vision
By using a computer vision-based pest prevention method, plant X-ray images are analyzed to identify and calculate the length of pests, solving the problems of large errors in pest age analysis and improper use of pesticides in traditional methods, and achieving precise pest prevention results.
Patent Information
- Application Number
- CN202511475492.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-16
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2045-10-16
AI Technical Summary
Traditional pest control methods lack precise analysis of pest age, leading to improper use of pesticides, affecting crop yield and accelerating pest resistance. Furthermore, existing devices are difficult to accurately collect small pests, resulting in large errors in age analysis.
By acquiring X-ray images of plants, performing texture extraction and gradient analysis, the location of specific pests is identified. Deep learning algorithms are used to obtain pest mask images, and the length of the pest body is determined by distance transformation and guide point calculation, thus realizing pest age analysis.
Accurately calculating the age of pests enables precise pest prevention, avoiding problems such as poor efficacy and increased resistance caused by improper use of pesticides.
Smart Images

Figure CN120953820B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, system and device for pest prevention based on computer vision. Background Technology
[0002] With the rapid development of smart agriculture, pest monitoring and prevention have become increasingly urgent, as pest outbreaks severely reduce crop quality and yield. Currently, traditional pest control methods rely on spraying large amounts of insecticides for prevention. However, due to a lack of analysis of pest age, and the varying insecticide resistance among pests of different ages (older pests are more resistant), insufficient insecticide dosage leads to poor efficacy, while excessive dosage results in residual insecticide adhering to the crop, affecting yield and accelerating pest resistance. Therefore, traditional pest control methods are ineffective in preventing pest infestations.
[0003] Existing methods for calculating the age of pests involve using devices to lure pests into the insect and designing multiple measurement channels to measure the insect's body length. The age of the pest can then be analyzed based on the insect's body length. However, this method has the problem of difficulty in collecting small pests and the risk of damaging the pests during collection, leading to errors in the analysis results of the pest age. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a method, system, and device for pest prevention based on computer vision.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0006] Obtain plant X-ray images, extract texture from plant X-ray images to obtain plant texture images, perform gradient analysis on plant texture images and plant X-ray images to obtain pest mask images, wherein the plant X-ray images include plant regions and pest regions, and the pest regions include at least a specific type of pest.
[0007] Identify the specific location information of a specific type of pest, obtain a mask image of the specific type of pest based on the specific location information and the pest mask image, and obtain a transformed mask image of the specific type of pest through distance transformation;
[0008] Based on the transformed mask image of a specific type of pest, the intersection point of the image boundary and the pest region in the transformed mask image of the specific type of pest is obtained, and the intersection point is used as the current guiding point. The next guiding point is obtained by the maximum value of the pixel value in the neighborhood pixel set of the current guiding point. The next guiding point set is obtained through iterative analysis.
[0009] Based on the current guiding point and the next guiding point set, the distance between all guiding points is calculated to obtain the length of the pest body and analyze the age of the pest to determine the age of the pest. Pest prevention is then carried out based on the age of the pest.
[0010] As one possible implementation, the process of extracting texture from plant X-ray images to obtain plant texture images includes the following steps:
[0011] The pixels in the plant's X-ray image are transformed from Cartesian coordinates to polar coordinates, resulting in a set of transformed coordinate curves, as shown below:
[0012]
[0013]
[0014] in, , Represents variables in polar coordinates. This represents the x-coordinate of a pixel in an X-ray image of a plant. This represents the ordinate of a pixel in an X-ray image of a plant. Represents the angle variable;
[0015] Obtain the set of transformed coordinate curves that intersect at the most points to obtain the set of polar coordinate curves, and transform the set of polar coordinate curves from the polar coordinate system to the Cartesian coordinate system to obtain the initial texture starting coordinate set;
[0016] The slope of the initial texture starting coordinate set is calculated to obtain the texture tilt dataset. A tilt threshold is set, and the initial texture starting coordinates corresponding to the texture tilt data in the texture tilt dataset that do not meet the tilt threshold are filtered.
[0017] Based on the filtered initial texture coordinate set, a set of plant texture lines is constructed. A blank image is then created, and all plant texture lines are extracted into the blank image to obtain the plant texture image.
[0018] As one possible implementation, the step of performing gradient analysis on plant texture images and plant X-ray images to obtain pest mask images includes the following steps:
[0019] Based on the position of plant texture lines in the plant texture image and their corresponding X-ray images, lateral and longitudinal gradient analyses are performed to obtain lateral and longitudinal gradient data, thus generating a texture gradient dataset. The texture gradient data is represented as follows:
[0020]
[0021] Obtain the mutation value of the texture gradient data to get the first gradient change data and the second gradient change data. Set the pixels between the first gradient change data and the second gradient change data in the plant texture image to 0 to get the gradient texture image.
[0022] The pest mask image is obtained by subtracting the plant X-ray image from the gradient texture image.
[0023] in, Represents texture gradient data, Represents lateral gradient data. This represents the longitudinal gradient data.
[0024] As one possible implementation, identifying the specific location information of a particular type of pest includes the following steps:
[0025] A set of plant X-ray images was obtained and the regions of specific pests were labeled to form a plant X-ray image dataset. The plant X-ray image dataset was divided into a training set, a test set, and a validation set.
[0026] A detection model for a specific type of pest was obtained by using a deep learning algorithm and training, testing and validation based on a dataset of plant X-ray images.
[0027] Based on a specific pest detection model, inference analysis is performed on plant X-ray images to obtain the specific location information of specific pests.
[0028] As one possible implementation, obtaining a mask image of a specific type of pest based on specific location information and a pest mask image, and then obtaining a transformed mask image of the specific type of pest through distance transformation, includes the following steps:
[0029] By cropping the corresponding position in the pest masking area using specific location information, a specific type of pest masking image is obtained, wherein the specific type of pest masking image includes the pest area and the background area.
[0030] The distance between pixels in the pest region and pixels in the background region in a mask image of a specific type of pest is obtained. The pixel distance is then set to the pixel distance of the current pest region pixel to obtain the transformed mask image of the specific type of pest.
[0031] As one possible implementation, the step of obtaining the intersection point between the image boundary and the pest region in the transformed mask image of a specific type of pest, and using the intersection point as the current guiding point, includes the following steps:
[0032] Obtain the image boundary of a transformed mask image of a specific type of pest, and determine whether there are any intersections with the pest region in the transformed mask image of the specific type of pest;
[0033] If an intersection point exists, obtain the aspect ratio of the transformed mask image for a specific type of pest, and based on the aspect ratio, obtain the intersection point of the narrower side in the transformed mask image for a specific type of pest as the current guiding point;
[0034] If no intersection point exists, the image boundary of the transformed mask image for a specific type of pest is shrunk inward until the image boundary intersects with the pest region in the transformed mask image for that specific type of pest. Based on the aspect ratio of the image, the intersection point of the narrower side in the transformed mask image for that specific type of pest is obtained as the current guiding point.
[0035] As one possible implementation, the next set of guiding points is obtained through the following steps:
[0036] Get the 8 neighboring pixels of the current guide point, obtain the neighboring pixel set, calculate the neighboring pixel corresponding to the maximum value of the pixel value in the neighboring pixel set, obtain the next guide point, and set the pixel value at the corresponding position of the next guide point to 0;
[0037] Based on the position of the next guide point, a preset neighborhood movement rule is used to obtain the 8 neighboring pixels of the next guide point. The next guide point is then iteratively calculated until the position of the next guide point remains unchanged, thus obtaining the next guide point set.
[0038] As one possible implementation, the length of the pest body is obtained by sequentially adding the distances between the current guide point and the next guide point;
[0039] The age of the pest is obtained by analyzing the direct proportional relationship between the pest's body length and its age.
[0040] A computer vision-based pest prevention system includes a texture analysis module, a mask image acquisition module, a guide point calculation module, and a pest prevention module.
[0041] The texture analysis module acquires plant X-ray images, extracts texture from the plant X-ray images to obtain plant texture images, and performs gradient analysis on the plant texture images and plant X-ray images to obtain pest mask images. The plant X-ray images include plant regions and pest regions, and the pest regions include at least a specific type of pest.
[0042] The mask image acquisition module identifies the specific location information of a specific type of pest, obtains a mask image of a specific type of pest based on the specific location information and the pest mask image, and obtains a transformed mask image of a specific type of pest through distance transformation.
[0043] The guiding point calculation module obtains the intersection point between the image boundary and the pest region in the transformed mask image of a specific type of pest based on the transformed mask image of a specific type of pest, and takes the intersection point as the current guiding point. The next guiding point is obtained by the maximum value of the pixel value in the neighborhood pixel set of the current guiding point, and the next guiding point set is obtained through iterative analysis.
[0044] The pest prevention module calculates the distance between all guiding points based on the current guiding point and the next guiding point set, obtains the length of the pest body, analyzes the age of the pest, determines the age of the pest, and carries out pest prevention based on the age of the pest.
[0045] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the following method:
[0046] Obtain plant X-ray images, extract texture from plant X-ray images to obtain plant texture images, perform gradient analysis on plant texture images and plant X-ray images to obtain pest mask images, wherein the plant X-ray images include plant regions and pest regions, and the pest regions include at least a specific type of pest.
[0047] Identify the specific location information of a specific type of pest, obtain a mask image of the specific type of pest based on the specific location information and the pest mask image, and obtain a transformed mask image of the specific type of pest through distance transformation;
[0048] Based on the transformed mask image of a specific type of pest, the intersection point of the image boundary and the pest region in the transformed mask image of the specific type of pest is obtained, and the intersection point is used as the current guiding point. The next guiding point is obtained by the maximum value of the pixel value in the neighborhood pixel set of the current guiding point. The next guiding point set is obtained through iterative analysis.
[0049] Based on the current guiding point and the next guiding point set, the distance between all guiding points is calculated to obtain the length of the pest body and analyze the age of the pest to determine the age of the pest. Pest prevention is then carried out based on the age of the pest.
[0050] A computer vision-based pest prevention device includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the following method:
[0051] Obtain plant X-ray images, extract texture from plant X-ray images to obtain plant texture images, perform gradient analysis on plant texture images and plant X-ray images to obtain pest mask images, wherein the plant X-ray images include plant regions and pest regions, and the pest regions include at least a specific type of pest.
[0052] Identify the specific location information of a specific type of pest, obtain a mask image of the specific type of pest based on the specific location information and the pest mask image, and obtain a transformed mask image of the specific type of pest through distance transformation;
[0053] Based on the transformed mask image of a specific type of pest, the intersection point of the image boundary and the pest region in the transformed mask image of the specific type of pest is obtained, and the intersection point is used as the current guiding point. The next guiding point is obtained by the maximum value of the pixel value in the neighborhood pixel set of the current guiding point. The next guiding point set is obtained through iterative analysis.
[0054] Based on the current guiding point and the next guiding point set, the distance between all guiding points is calculated to obtain the length of the pest body and analyze the age of the pest to determine the age of the pest. Pest prevention is then carried out based on the age of the pest.
[0055] This invention, by adopting the above technical solutions, has significant technical effects:
[0056] This invention acquires plant texture images from X-ray images of plants, obtains pest mask images through gradient analysis, identifies the specific location information of specific pest species based on deep learning algorithms, and then obtains transformed mask images of specific pest species through distance transformation. It also acquires the current guide point and the next guide point set to determine the pest age and implement pest prevention. In this invention, the guide points determine the pest's skeletal structure, and the skeletal structure accurately calculates the pest's length, thereby achieving accurate pest prevention. This avoids the drawbacks of existing pest prevention methods that do not adjust the insecticide dosage according to the pest's age, resulting in poor control of older pests and accelerated pesticide resistance. Attached Figure Description
[0057] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0058] Figure 1 This is a flowchart illustrating the method of the present invention;
[0059] Figure 2 This is an overall schematic diagram of the system of the present invention;
[0060] Figure 3 This is a schematic diagram of an X-ray image of the plant of the present invention;
[0061] Figure 4-11 This is a schematic diagram of the guide point calculation process of the present invention. Detailed Implementation
[0062] The present invention will be further described in detail below with reference to the embodiments. The following embodiments are explanations of the present invention, but the present invention is not limited to the following embodiments.
[0063] Example 1:
[0064] A computer vision-based pest prevention method, such as Figure 1 As shown, it includes the following steps:
[0065] S100. Obtain plant X-ray images, extract texture from plant X-ray images to obtain plant texture images, perform gradient analysis on plant texture images and plant X-ray images to obtain pest mask images, wherein the plant X-ray images include plant regions and pest regions, and the pest regions include at least a specific type of pest.
[0066] S200. Identify the specific location information of a specific type of pest, obtain a mask image of the specific type of pest based on the specific location information and the pest mask image, and obtain a transformed mask image of the specific type of pest through distance transformation.
[0067] S300. Based on the transformation mask image of a specific type of pest, obtain the intersection point between the image boundary and the pest region in the transformation mask image of the specific type of pest, and take the intersection point as the current guiding point. Obtain the next guiding point by the maximum value of the pixel value in the neighborhood pixel set of the current guiding point, and obtain the next guiding point set through iterative analysis.
[0068] S400. Based on the current guiding point and the next guiding point set, calculate the distance between all guiding points, obtain the insect body length, analyze the insect age, determine the insect age, and carry out pest prevention based on the insect age.
[0069] This invention acquires X-ray images of plants, extracts texture, and performs gradient analysis to obtain pest mask images. It identifies the specific location information of specific pest species, combines these pest mask images to obtain specific pest mask images, and then uses distance transformation to obtain transformed mask images for specific pest species. The intersection of the image boundary of the transformed mask image for specific pest species and the pest region is used as the current guide point. The next guide point is obtained based on the neighboring pixel set of the current guide point. This iterative process is used to obtain the next guide point set, and the distance between all guide points is calculated to obtain the pest body length. Based on the characteristic that the pest body length is proportional to the pest age, the pest age is determined, thereby achieving pest prevention. This invention achieves accurate calculation of pest age, accurately determining the insecticide dosage based on the pest age, avoiding the problems of insufficient insecticide dosage leading to ineffective pest prevention and excessive insecticide dosage leading to increased pest resistance.
[0070] X-ray images of plants are acquired using an X-ray image acquisition device, such as Figure 3 As shown, the plant X-ray image includes a plant region and a pest region. The pest region includes at least a specific type of pest; in this embodiment, the specific pest is the rice stem borer. Texture extraction is performed on the plant X-ray image using the Hough line detection method to obtain a plant texture image. The Hough transform is a method in image processing for detecting simple geometric shapes such as lines and circles. In this embodiment, to obtain the starting position information of texture lines in the plant X-ray image, an asymptotic probabilistic Hough transform is specifically used, including the following steps:
[0071] Step 1: Transform the pixels in the plant X-ray image from Cartesian coordinates to polar coordinates to obtain the transformed coordinate curve set. The pixels in the plant X-ray image transformed to polar coordinates are represented as follows:
[0072]
[0073]
[0074] Step 2: The pixels in the plant X-ray image are represented as curves in the polar coordinate system. Therefore, based on the curve with the most intersections in the polar coordinate system, we determine that these curves lie on a straight line in the Cartesian coordinate system. Based on the transformed coordinate curve with the most intersections, we obtain the set of polar coordinate curves.
[0075] Step 3: Transform the polar coordinate curve set from the polar coordinate system to the Cartesian coordinate system to obtain the initial texture starting coordinate set;
[0076] Step 4: Calculate the straight line trend using the initial texture starting coordinates to obtain the texture tilt dataset. Sort the texture tilt dataset in ascending order and filter out excessively large and small data in the texture tilt dataset, keeping only the texture tilt data near the average value.
[0077] Step 5: Construct a blank image. Calculate the initial coordinate set of the filtered initial texture to obtain the set of plant texture lines. Extract all plant texture lines into the blank image to obtain the plant texture image.
[0078] in, , Represents variables in polar coordinates. This represents the x-coordinate of a pixel in an X-ray image of a plant. This represents the ordinate of a pixel in an X-ray image of a plant. Represents the angle variable.
[0079] The positions of plant texture lines in the plant texture image are obtained. Gradient analysis is performed on the pixels corresponding to the positions of the plant texture lines in the plant X-ray image. The gradient analysis includes horizontal gradient analysis and vertical gradient analysis to obtain horizontal gradient data and vertical gradient data. The gradient texture dataset is obtained by using the horizontal gradient data and vertical gradient data of all corresponding pixels. The gradient texture data is represented as follows:
[0080]
[0081] in, Represents texture gradient data, Represents lateral gradient data. This represents the longitudinal gradient data.
[0082] In plant X-ray images, the gradient changes in the plant area are relatively small. Upon encountering a pest area, the gradient information suddenly increases, gradually decreases after entering the pest area, and then suddenly increases again upon leaving the pest area. Based on this change process, the positions of the first and second abrupt changes in the gradient texture data are recorded to obtain the first and second gradient change data. Pixels in the plant texture image located between the first and second gradient change data and above the plant texture line are set to 0, resulting in a gradient texture image. Subtracting the plant X-ray image from the gradient texture image results in the pixel values of the plant area becoming 0, while the pixel values of the pest area remain unchanged. In this embodiment, to better display the pest area in the plant X-ray image, the pixel values of the pest area are set to 255, resulting in a pest mask image.
[0083] To accurately obtain the location information and mask image of a specific pest species, in this embodiment, the specific pest species is the rice stem borer. The rice stem borer is detected using a deep learning algorithm, specifically the open-source object detection model YOLOv8s, and includes the following steps:
[0084] Step 1: Obtain a set of plant X-ray images and use annotation tools to annotate the areas of rice stem borer in the plant X-ray images to form a plant X-ray image dataset. Divide the plant X-ray image dataset into a training set, a test set, and a validation set.
[0085] Step 2: Using YOLOv8s, the model was trained, tested, and validated based on the plant X-ray image dataset. The training batch size was set to 16, the image input size was 640, the learning rate was 0.01, and the training iterations were 120 epochs. When the model's map value and loss stabilized, the rice stem borer detection model was obtained.
[0086] Step 3: Use the rice stem borer detection model to detect the X-ray images of the plants and obtain the specific location information of the rice stem borer. ,in, The top-left coordinates represent the specific location information of the rice stem borer. The lower right corner coordinates indicate the specific location of the rice stem borer.
[0087] Based on the specific location information of rice stem borer pests The corresponding positions in the pest mask image are cropped. Since the specific location information of the rice stem borer may only include a local area, the image is appropriately expanded outwards before cropping to obtain a mask image of any rice stem borer. This mask image contains both the pest region and the background region. The pixel values in the rice stem borer mask image are then replaced with the minimum distance from the current pixel to the background region, resulting in a transformed mask image of the rice stem borer. In this transformed mask image, pixel values are larger closer to the center of the pest region and smaller at the boundary between the pest region and the background region.
[0088] The image boundary of the transformed mask image of the rice stem borer is shrunk to obtain the intersection point between the image boundary of the transformed mask image of the rice stem borer and the pest region. The intersection point located on the side with the smaller image width is taken as the current guide point. In this process, the current guide point may not be the head or tail of the rice stem borer. Multiple intersection points can be used as the current guide point to calculate the next guide point. In this embodiment, the calculation process of the next guide point is as follows: using... The grid calculation is used to determine the set of neighboring pixels within the current 8-neighborhood of the current guide point. The pixel with the maximum value in the neighboring pixel set is taken as the next guide point, and the pixel value at the next guide point is set to 0. The set of neighboring pixels within the 8-neighborhood of the next guide point is obtained through a neighborhood movement rule. This process is iteratively performed until the position of the next guide point no longer changes, resulting in all the next guide points and forming the next guide point set. In this embodiment, a neighborhood movement rule is specifically provided as follows:
[0089] As the current guiding point, Current guiding point The set of neighboring pixels within the 8-neighborhood;
[0090] When the point with the maximum pixel value in the neighborhood pixel set is At times, such as Figure 4 As shown, the 8-neighborhood of the next guiding point moves two pixels to the left and up respectively, and it is determined whether the position of the next guiding point obtained based on the set of neighboring pixels in the 8-neighborhood has changed. If the position remains unchanged, the process stops; otherwise, the iterative calculation continues.
[0091] When the point with the maximum pixel value in the neighborhood pixel set is At times, such as Figure 5 As shown, the 8-neighborhood of the next guiding point moves up two pixels, and it is determined whether the position of the next guiding point obtained based on the set of neighboring pixels in the 8-neighborhood has changed. If the position remains unchanged, the process stops; otherwise, the iterative calculation continues.
[0092] When the point with the maximum pixel value in the neighborhood pixel set is At times, such as Figure 6 As shown, the 8-neighborhood of the next guiding point moves two pixels to the right and up respectively, and it is determined whether the position of the next guiding point obtained based on the set of neighboring pixels in the 8-neighborhood has changed. If the position remains unchanged, the process stops; otherwise, the iterative calculation continues.
[0093] When the point with the maximum pixel value in the neighborhood pixel set is At times, such as Figure 7 As shown, the 8-neighborhood of the next guiding point moves two pixels to the left, and it is determined whether the position of the next guiding point obtained based on the set of neighboring pixels in the 8-neighborhood has changed. If the position remains unchanged, the process stops; otherwise, the iterative calculation continues.
[0094] When the point with the maximum pixel value in the neighborhood pixel set is At times, such as Figure 8 As shown, the 8-neighborhood of the next guiding point moves two pixels to the right, and it is determined whether the position of the next guiding point obtained based on the set of neighboring pixels in the 8-neighborhood has changed. If the position remains unchanged, the process stops; otherwise, the iterative calculation continues.
[0095] When the point with the maximum pixel value in the neighborhood pixel set is At times, such as Figure 9 As shown, the 8-neighborhood of the next guiding point moves two pixels to the left and down, and it is determined whether the position of the next guiding point obtained based on the set of neighboring pixels in the 8-neighborhood has changed. If the position remains unchanged, the process stops; otherwise, the iterative calculation continues.
[0096] When the point with the maximum pixel value in the neighborhood pixel set is At times, such as Figure 10 As shown, the 8-neighborhood of the next guiding point moves down two pixels, and it is determined whether the position of the next guiding point obtained based on the set of neighboring pixels in the 8-neighborhood has changed. If the position remains unchanged, the process stops; otherwise, the iterative calculation continues.
[0097] When the point with the maximum pixel value in the neighborhood pixel set is At times, such as Figure 11As shown, the 8-neighborhood of the next guiding point moves two pixels to the right and down, and it is determined whether the position of the next guiding point obtained based on the set of neighboring pixels in the 8-neighborhood has changed. If the position remains unchanged, the process stops; otherwise, iterative calculation continues.
[0098] Through iterative calculation, the next set of guiding points is obtained. Based on the current guiding point and the next set of guiding points, the distance between the two guiding points is calculated sequentially according to the acquisition order and accumulated to obtain the length of the pest body. Based on the positive proportional relationship between the age of the pest and its body length, the age of the pest is calculated. Based on the age of the pest, the dosage of the required insecticide is determined to achieve effective pest prevention.
[0099] Example 2:
[0100] A computer vision-based pest prevention system, such as Figure 2 As shown, it includes a texture analysis module 100, a mask image acquisition module 200, a guide point calculation module 300, and a pest prevention module 400;
[0101] The texture analysis module 100 acquires plant X-ray images, performs texture analysis on the plant X-ray images to obtain plant texture images, and performs gradient analysis on the plant texture images and plant X-ray images to obtain pest mask images. The plant X-ray images include plant regions and pest regions, and the pest regions include at least a specific type of pest.
[0102] The mask image acquisition module 200 identifies the specific location information of a specific type of pest, obtains a mask image of a specific type of pest based on the specific location information and the pest mask image, and obtains a transformed mask image of a specific type of pest through distance transformation.
[0103] The guiding point calculation module 300, based on the transform mask image of a specific type of pest, obtains the intersection point between the image boundary and the pest region in the transform mask image of the specific type of pest, and uses the intersection point as the current guiding point. The next guiding point is obtained by the maximum value of the pixel value in the neighborhood pixel set of the current guiding point, and the next guiding point set is obtained through iterative analysis.
[0104] The pest prevention module 400 calculates the distance between all guiding points based on the current guiding point and the next guiding point set, obtains the length of the pest body, analyzes the age of the pest, determines the age of the pest, and performs pest prevention based on the age of the pest.
[0105] Various changes and modifications made without departing from the spirit and scope of this invention, and all equivalent technical solutions, also fall within the scope of this invention.
[0106] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0107] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0108] This invention is described with reference to flowchart illustrations and / or block diagrams of the method, terminal device (system), and computer program product according to the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0109] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0110] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0111] It should be noted that:
[0112] The phrase "an embodiment" or "an embodiment" used in this specification means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the invention. Therefore, the phrase "an embodiment" or "an embodiment" appearing in various places throughout the specification does not necessarily refer to the same embodiment.
[0113] Furthermore, it should be noted that the shapes and names of the parts and components described in the specific embodiments described in this specification may differ. All equivalent or simple variations made to the structure, features, and principles described in this patent concept are included within the protection scope of this patent. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to replace them, as long as they do not depart from the structure of this invention or exceed the scope defined in these claims, they should all fall within the protection scope of this invention.
Claims
1. A computer vision-based pest prevention method, characterized by, The method comprises the following steps: Obtaining a plant X-ray image, performing texture extraction on the plant X-ray image to obtain a plant texture image, performing gradient analysis on the plant texture image and the plant X-ray image to obtain a pest mask image, wherein the plant X-ray image comprises a plant region and a pest region, and the pest region comprises at least a specific type of pest; Identifying specific location information of the specific type of pest, obtaining a specific type of pest mask image based on the specific location information and the pest mask image, and obtaining a specific type of pest transformed mask image through distance transformation; Based on the specific type of pest transformed mask image, obtaining the intersection of the image boundary and the pest region in the specific type of pest transformed mask image, and taking the intersection as a current guide point, obtaining a next guide point through the maximum value of the pixel values of the neighborhood pixel points of the current guide point, and obtaining a next guide point set through iterative analysis; Based on the current guide point and the next guide point set, calculating the distance between all guide points, obtaining the length of the pest body and analyzing the instar to determine the instar of the pest, and preventing the pest through the instar of the pest.
2. The computer vision-based pest prevention method according to claim 1, wherein, The method for performing texture extraction on the plant X-ray image to obtain the plant texture image comprises the following steps: Converting the pixel points in the plant X-ray image from the Cartesian coordinate system to the polar coordinate system to obtain a converted coordinate curve set, which is expressed as follows: wherein , denotes a variable in polar coordinates, denotes the horizontal coordinate of a pixel in the x-ray image of the plant, denotes the vertical coordinate of a pixel in the x-ray image of the plant, denotes an angle variable; Obtaining the most converted coordinate curves in the converted coordinate curve set that intersect at a point to obtain a polar coordinate curve set, and converting the polar coordinate curve set from the polar coordinate system to the Cartesian coordinate system to obtain an initial texture starting coordinate set; Performing slope calculation on the initial texture starting coordinate set to obtain a texture inclination data set, setting an inclination threshold, and filtering the initial texture starting coordinates corresponding to the texture inclination data in the texture inclination data set that do not satisfy the inclination degree threshold; Based on the filtered initial texture starting coordinate set, constructing a plant texture straight line set, constructing a blank image, extracting all plant texture straight lines into the blank image, and obtaining a plant texture image.
3. The computer vision-based pest prevention method according to claim 1, wherein, The method for performing gradient analysis on the plant texture image and the plant X-ray image to obtain a pest mask image comprises the following steps: Based on the position of the plant texture straight line in the plant X-ray image in the plant texture image, performing horizontal gradient analysis and vertical gradient analysis to obtain horizontal gradient data and vertical gradient data, and further obtaining a texture gradient data set, wherein the texture gradient data is expressed as follows: Obtaining the mutation value of the texture gradient data to obtain first gradient change data and second gradient change data, setting the pixel points between the first gradient change data and the second gradient change data in the plant texture image to 0 to obtain a gradient texture image; Performing image subtraction on the plant X-ray image and the gradient texture image to obtain a pest mask image; wherein denotes the texture gradient data, denotes the horizontal gradient data, denotes the vertical gradient data.
4. The computer vision-based pest prevention method according to claim 1, wherein, The method for identifying specific location information of the specific type of pest comprises the following steps: Obtaining a plant X-ray image set and labeling the specific type of pest region to form a plant X-ray image data set, dividing the plant X-ray image data set into a training set, a test set and a validation set; Using a deep learning algorithm and training, testing and verifying based on the plant X-ray image data set to obtain a specific type of pest detection model; Based on the specific kind of pest detection model, the plant X-ray image is inferred and analyzed to obtain the specific position information of the specific kind of pest.
5. The computer vision-based pest prevention method according to claim 1, wherein, Based on the specific position information and the pest mask image, a specific kind of pest mask image is obtained, and through distance transformation, a specific kind of pest transformed mask image is obtained, including the following steps: The specific position information is used to crop the corresponding position in the pest mask area to obtain the specific kind of pest mask image, wherein the specific kind of pest mask image includes a pest area and a background area; The distance between the pixel points of the pest area and the pixel points of the background area in the specific kind of pest mask image is obtained to obtain the pixel distance, and the pixel value of the current pest area pixel point is set to the pixel distance of the current pest area pixel point to obtain the specific kind of pest transformed mask image.
6. The computer vision-based pest prevention method according to claim 1, wherein, Based on the specific kind of pest transformed mask image, the intersection of the image boundary and the pest area in the specific kind of pest transformed mask image is obtained, and the intersection is taken as the current guide point, including the following steps: The image boundary of the specific kind of pest transformed mask image is obtained, and it is judged whether there is an intersection between the image boundary and the pest area in the specific kind of pest transformed mask image; If there is an intersection, the image aspect ratio of the specific kind of pest transformed mask image is obtained, and the intersection of the side with smaller width in the specific kind of pest transformed mask image is taken as the current guide point based on the image aspect ratio; If there is no intersection, the image boundary of the specific kind of pest transformed mask image is contracted inward until the image boundary intersects with the pest area in the specific kind of pest transformed mask image, and the intersection of the side with smaller width in the specific kind of pest transformed mask image is taken as the current guide point based on the image aspect ratio.
7. The computer vision-based pest prevention method according to claim 1, wherein, The next guide point set is obtained by the following steps: The 8-neighborhood pixels of the current guide point are obtained to obtain a neighborhood pixel point set, and the neighborhood pixel point corresponding to the maximum value of the pixel value in the neighborhood pixel point set is calculated to obtain the next guide point, and the pixel value of the position corresponding to the next guide point is set to 0; According to the position of the next guide point, a neighborhood moving rule is preset, the 8-neighborhood pixels of the next guide point are obtained through the neighborhood moving rule, and the next guide point is iteratively calculated until the position of the obtained next guide point is unchanged to obtain the next guide point set.
8. The computer vision-based pest prevention method according to claim 1, wherein, The pest body length is obtained by sequentially superimposing the intervals between the current guide points and the next guide points. The pest instar is obtained by analyzing the proportional relationship between the pest body length and the pest instar.
9. A computer vision-based pest prevention system, characterized by, It includes a texture analysis module, a mask image acquisition module, a guide point calculation module and a pest prevention module. The texture analysis module obtains a plant X-ray image, performs texture extraction on the plant X-ray image to obtain a plant texture image, and performs gradient analysis on the plant texture image and the plant X-ray image to obtain a pest mask image, wherein the plant X-ray image includes a plant area and a pest area, and the pest area includes at least a specific kind of pest. The mask image acquisition module identifies specific position information of a specific type of pest, obtains a specific type of pest mask image based on the specific position information and the pest mask image, and obtains a specific type of pest transformed mask image through distance transformation. The guide point calculation module obtains the intersection of the image boundary and the pest area in the specific type of pest transformed mask image based on the specific type of pest transformed mask image, takes the intersection as a current guide point, obtains a next guide point through the maximum value of pixel values in a neighborhood pixel point set of the current guide point, and obtains a next guide point set through iterative analysis. The pest prevention module calculates the distance between all guide points based on the current guide point and the next guide point set, obtains the length of the pest body and analyzes the instar to determine the instar of the pest, and performs pest prevention through the instar of the pest.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program, when executed by a processor, implements the method of any one of claims 1 to 8. 11.A computer vision-based pest prevention apparatus comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein, The processor, when executing the computer program, implements the method of any one of claims 1 to 8.
Citation Information
Patent Citations
Systems and methods for pest forecasting using historical pesticide usage information
CN107609666A
Cotton pest positioning and classification identification method and system
CN113128514A