An image processing method, system and device for intelligently attracting and trapping pests
Through image processing technology, non-targeted pest interference and water droplet covering problems in intelligent sexually induced pest technology are solved, and accurate identification and analysis of targeted pests is achieved, and image quality is improved.
Patent Information
- Application Number
- CN202510409409.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2045-04-02
Smart Images

Figure CN119919436B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and specifically relates to an image processing method, system and device for intelligently attracting pests. Background Art
[0002] In the agricultural field, traditional pest control methods rely on chemical pesticides. Although it can effectively manage pests to a certain extent, it also brings environmental problems such as pesticide residues, soil and water pollution, and harm to non-target organisms. In contrast, the intelligent attraction technology utilizes the natural tropism of pests and traps pests through sex pheromones, significantly reducing the use of chemical pesticides. Given that pests have unique responses to specific sex pheromones, the intelligent attraction technology can precisely target a certain pest species for prevention and control, thereby reducing the impact on non-target organisms and protecting the natural enemies of pests. This technology not only reduces the number of pests, but also promotes biodiversity in the farmland ecosystem, enhances the self-regulating ability and stability of the system, which is an important symbol of the intelligent development of agriculture and leads agricultural production towards a more intelligent and precise direction.
[0003] The data collected by intelligent devices through the intelligent attraction technology not only directly serves current pest management, but also provides valuable data support for future agricultural production planning, crop variety selection and planting pattern optimization, improving the efficiency and benefits of the entire agricultural production chain. However, when implementing the intelligent attraction technology, some challenges are also faced. For example, other non-target pests may be adsorbed on the sticky board, interfering with the identification and analysis of pests. In addition, under rainy conditions, the water droplets on the sticky board will cover the pests, significantly reducing the accuracy of identifying target pests. Summary of the Invention
[0004] The present invention aims at the disadvantages in the prior art and provides an image processing method, system and device for intelligently attracting pests.
[0005] To solve the above technical problems, the present invention is solved by the following technical solutions:
[0006] An image processing method for intelligently attracting pests includes the following steps:
[0007] Obtain an original pest image, preprocess the original pest image to obtain multiple pest images each containing multiple sub-regions, where the original pest image at least includes a pest region and a water droplet region, and the preprocessing at least includes dimensionality reduction, filling and cropping;
[0008] Perform binarization processing on each pest image containing multiple sub-regions to obtain a binarized image, determine whether there is a non-target pest region, and if so, remove the non-target pest region to obtain a first target pest image;
[0009] Based on the first targeted pest image, multiple sets of edge contour pixel points are obtained. Based on the brightness distribution of the pixel points within each set of edge contour pixel points, the dark area and the bright area of the water droplet region are identified, and the set of pixel points in the dark area and the set of pixel points in the bright area of the water droplet region are obtained;
[0010] The nearest background pixel points of the non-water droplet region are obtained from the set of pixel points in the dark area. Based on the nearest background pixel points, the pixel points in the set of pixel points in the dark area are adjusted to obtain the first targeted pest image after processing the dark area;
[0011] Based on the set of pixel points in the bright area, the edge pixel points of the bright area are determined. Baselines are determined by pairwise edge pixel points, and linear interpolation adjustment is performed on the pixel points on the baselines to obtain the first targeted pest image after processing the bright area. Among them, the first targeted pest image after processing the dark area and the bright area is the final targeted pest image.
[0012] As an implementable manner, the preprocessing of the original pest image to obtain multiple pest images each containing multiple sub-regions includes the following steps:
[0013] Based on the original pest image, a set of pixel point gray values of the original pest image is obtained;
[0014] Dimensionality reduction and rounding processing are performed on the gray value of each pixel point in the set of pixel point gray values to obtain a set of pixel point gray values after dimensionality reduction;
[0015] The pixel points in the set of pixel point gray values after dimensionality reduction are traversed, and the pixel points with equal gray values are copied to a newly created image to obtain multiple separated images with different gray values;
[0016] The contour information of each separated image is extracted to form a contour set, and the area of each contour is obtained. The corresponding contours in the contour set with an area smaller than the preset contour area threshold are removed to obtain a new contour set;
[0017] Hole recognition is performed on each contour in the new contour set to form a hole set, and the area of each hole is obtained. The holes in the hole set with an area smaller than the preset contour area threshold are filled to form a first contour set;
[0018] The first contours in the first contour set are mapped onto the original pest image and cut out according to the first contour regions to obtain multiple pest images each containing multiple sub-regions;
[0019] Among them, the dimensionality reduction and rounding processing is expressed as follows:
[0020]
[0021] Among them, represents the gray value of the pixel in the set of gray values of the pixels after dimensionality reduction, represents the coordinate data of the pixel, represents the preset gray value width, represents the gray value of the pixel in the set of gray values of the pixels, represents the floor function.
[0022] As an implementable manner, the binarization processing of each pest image including multiple sub-regions to obtain a binarized image includes the following steps:
[0023] Based on each pest image including multiple sub-regions, obtain the set of pixel values of each sub-region, and then obtain the pixel value threshold of each sub-region;
[0024] Based on the pixel value threshold of each sub-region, perform binarization processing on each sub-region to obtain multiple binarized region images;
[0025] Fuse multiple binarized region images to obtain a binarized image;
[0026] Among them, the pixel value threshold of each sub-region is represented as follows:
[0027]
[0028] Among them, represents the pixel value threshold of the th sub-region, , represents the mean value of the pixel values of the th sub-region, represents the total number of pixels of the th sub-region, represents the number of sub-regions, represents the number of pixels.
[0029] As an implementable manner, the judgment of whether there is a non-target pest region, and if so, removing the non-target pest region to obtain a first target pest image includes the following steps:
[0030] Extract the contour information of the binarized image to form a binarized contour set, and obtain the area of each binarized contour;
[0031] If the area of the binary contour is smaller than the preset target pest area threshold, the corresponding contour area is filled based on the background color of the original pest image to remove the non-target pest area, and the first target pest image is obtained.
[0032] As an implementable manner, based on the first target pest image, a plurality of edge contour pixel point sets are obtained, and the dark area and the bright area of the water droplet area are identified based on the brightness distribution of the pixel points in each edge contour pixel point set, and the dark area pixel point set and the bright area pixel point set of the water droplet area are obtained, including the following steps:
[0033] Perform image enhancement processing on the first target pest image to obtain a second target pest image, where the image enhancement processing includes at least one or more of contrast enhancement, highlight area enhancement, and dark area suppression;
[0034] Perform median filtering on the second target pest image to obtain a third target pest image;
[0035] Perform edge detection on the third target pest image to obtain a background pixel point set and a plurality of edge contour pixel point sets;
[0036] Take the average of the brightness values of all the pixel points in the background pixel point set to obtain the background brightness value;
[0037] Based on the brightness value distribution of the pixel points in each edge contour pixel point set, obtain a plurality of edge contour average brightness values;
[0038] If the edge contour average brightness value is greater than the background brightness value, the corresponding edge contour pixel point set is the bright area pixel point set, and the other edge contour pixel point sets are the dark area pixel point sets.
[0039] As an implementable manner, obtaining the nearest background pixel point of the non-water droplet area from the dark area pixel point set, and adjusting the pixel points in the dark area pixel point set based on the nearest background pixel point to obtain the first target pest image after processing the dark area, including the following steps:
[0040] Based on the dark area pixel point set, obtain the nearest background pixel point of each pixel point;
[0041] Obtain the RGB value of each pixel point in the first target pest image, obtain the brightness value, saturation value and hue value of the corresponding pixel point in the HSV space, and further obtain the first HSV component set;
[0042] Extract the brightness value and saturation value at the position of the nearest background pixel point in the first HSV component set to obtain the brightness value and saturation value of the nearest background pixel point of each pixel point;
[0043] Based on the brightness value and saturation value of the nearest background pixel for each pixel, adjust the hue value, saturation value, and brightness value of the pixels in the first HSV component set to obtain a second HSV component set;
[0044] Based on the hue value, saturation value, and brightness value of each pixel in the second HSV component set, obtain the RGB value of the corresponding pixel, and then obtain a second RGB set, and further obtain the first targeted pest image after processing the dark area.
[0045] As an implementable manner, the brightness value, saturation value, and hue value of the pixels in the first HSV component set are respectively represented as follows:
[0046]
[0047]
[0048]
[0049] The hue value, saturation value, and brightness value of the pixels in the second HSV component set are respectively represented as follows:
[0050]
[0051] Among them, represents the coordinate data of the pixel, , and respectively represent the brightness value, saturation value, and hue value of the pixels in the first HSV component set, , and respectively represent the R-channel intensity value, G-channel intensity value, and B-channel intensity value of the pixels in the first RGB set, , and respectively represent the hue value, saturation value, and brightness value of the pixels in the second HSV component set, and respectively represent the saturation value and brightness value of the nearest background pixel, and both represent adjustment coefficients.
[0052] As an implementable manner, obtaining the nearest background pixel for each pixel based on the dark area pixel set includes the following steps:
[0053] Taking the pixel in the dark area pixel set as the central pixel, obtain all the pixels within the preset neighborhood range of the central pixel to obtain a first neighborhood pixel set;
[0054] Eliminate the pixel points belonging to the dark surface area pixel point set or the bright surface area pixel point set in the first neighborhood pixel point set to obtain a second neighborhood pixel point set;
[0055] Initialize the distance value between the central pixel point and the background pixel point of the central pixel point to a preset distance threshold;
[0056] Obtain the Euclidean distance between the central pixel point and each pixel point in the second neighborhood pixel point set, and then obtain the minimum Euclidean distance;
[0057] If the minimum Euclidean distance is less than the preset distance threshold, the pixel point corresponding to the minimum Euclidean distance is the nearest background pixel point of the central pixel point;
[0058] Remove the central pixel point from the dark surface area pixel point set, update the dark surface area pixel point set, and iteratively obtain the nearest background pixel point of each pixel point in the dark surface area pixel point set.
[0059] As an implementable manner, determining the edge pixel points of the bright surface area based on the bright surface area pixel point set, determining a baseline by pairwise edge pixel points, and performing linear interpolation adjustment on the pixel points on the baseline to obtain a first targeted pest image after processing the bright surface area, including the following steps:
[0060] Based on the bright surface area pixel point set, extract the edge of each bright surface area to obtain a plurality of bright surface area edge pixel point sets;
[0061] Obtain the pixel point with the smallest horizontal coordinate value in the target bright surface area edge pixel point set as the first end pixel point;
[0062] Based on the target bright surface area edge pixel point set, obtain the pixel point with the same horizontal coordinate value as the first end pixel point as the second end pixel point, and the connection line between the first end pixel point and the second end pixel point is the baseline of the target bright surface area, and then obtain a first baseline pixel point set;
[0063] Based on the RGB values of the first end pixel point and the RGB values of the second end pixel point, perform linear interpolation adjustment on the RGB values of the pixel points in the first baseline pixel point set to obtain a second baseline pixel point set;
[0064] Traverse the pixel points in each bright surface area edge pixel point set, and adjust the pixel points in each bright surface area based on the baseline to obtain a first targeted pest image after processing the bright surface area.
[0065] As an implementable manner, the R channel intensity value, G channel intensity value, and B channel intensity value of the pixel points in the second baseline pixel point set are respectively expressed as follows:
[0066]
[0067] Among them, 、 and respectively represent the R-channel intensity value, G-channel intensity value, and B-channel intensity value of the pixel points in the second baseline pixel point set. 、 and respectively represent the R-channel intensity value, G-channel intensity value, and B-channel intensity value of the first-end pixel points. 、 and respectively represent the R-channel intensity value, G-channel intensity value, and B-channel intensity value of the second-end pixel points. represents the th pixel point in the direction from the first-end pixel point to the second-end pixel point on the baseline. represents the number of pixel points on the baseline except the first-end pixel point and the second-end pixel point. , represents the horizontal coordinate value of the second-end pixel point. represents the horizontal coordinate value of the first-end pixel point. represents rounding down.
[0068] An intelligent image processing system for attracting pests includes a preprocessing module, a binarization module, a water droplet bright side and dark side acquisition module, a water droplet dark side adjustment module, and a water droplet bright side adjustment module;
[0069] The preprocessing module acquires the original pest image, preprocesses the original pest image to obtain multiple pest images containing multiple sub-regions. Among them, the original pest image at least includes a pest region and a water droplet region, and the preprocessing at least includes dimensionality reduction, filling, and cropping;
[0070] The binarization module performs binarization processing on each pest image containing multiple sub-regions to obtain a binarized image, determines whether there is a non-target pest region. If so, the non-target pest region is removed to obtain a first target pest image;
[0071] The water droplet bright side and dark side acquisition module, based on the first target pest image, obtains multiple edge contour pixel point sets, and identifies the dark side region and bright side region of the water droplet region based on the brightness distribution of the pixel points within each edge contour pixel point set to obtain the dark side region pixel point set and bright side region pixel point set of the water droplet region;
[0072] The water droplet dark side adjustment module acquires the nearest background pixel point of the non-water droplet region based on the dark side region pixel point set, and adjusts the pixel points in the dark side region pixel point set based on the nearest background pixel point to obtain the first target pest image after processing the dark side region;
[0073] The water droplet bright surface adjustment module determines the edge pixel points of the bright surface area based on the set of pixel points in the bright surface area, determines the baseline by pairwise edge pixel points, and performs linear interpolation adjustment on the pixel points on the baseline to obtain the first targeted pest image after processing the bright surface area. Among them, the first targeted pest image after processing the dark surface area and the bright surface area is the final targeted pest image.
[0074] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following method is implemented:
[0075] Obtain the original pest image, preprocess the original pest image to obtain multiple pest images including multiple sub-regions. Among them, the original pest image at least includes a pest area and a water droplet area, and the preprocessing at least includes dimensionality reduction, filling, and cropping;
[0076] Perform binary processing on each pest image including multiple sub-regions to obtain a binary image, and determine whether there is a non-target pest area. If so, remove the non-target pest area to obtain the first targeted pest image;
[0077] Based on the first targeted pest image, obtain multiple sets of edge contour pixel points, and identify the dark surface area and the bright surface area of the water droplet area based on the brightness distribution of the pixel points in each set of edge contour pixel points to obtain the set of pixel points in the dark surface area and the set of pixel points in the bright surface area of the water droplet area;
[0078] Obtain the nearest background pixel point of the non-water droplet area from the set of pixel points in the dark surface area, and adjust the pixel points in the set of pixel points in the dark surface area based on the nearest background pixel point to obtain the first targeted pest image after processing the dark surface area;
[0079] Based on the set of pixel points in the bright surface area, determine the edge pixel points of the bright surface area, determine the baseline by pairwise edge pixel points, and perform linear interpolation adjustment on the pixel points on the baseline to obtain the first targeted pest image after processing the bright surface area. Among them, the first targeted pest image after processing the dark surface area and the bright surface area is the final targeted pest image.
[0080] An intelligent image processing device for sex-trapping pests 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, the following method is implemented:
[0081] Obtain the original pest image, preprocess the original pest image to obtain multiple pest images including multiple sub-regions. Among them, the original pest image at least includes a pest area and a water droplet area, and the preprocessing at least includes dimensionality reduction, filling, and cropping;
[0082] Binarize each pest image containing multiple sub - regions to obtain a binarized image, and determine whether there is a non - targeted pest region. If there is, remove the non - targeted pest region to obtain a first targeted pest image;
[0083] Based on the first targeted pest image, obtain multiple sets of edge contour pixel points. Based on the brightness distribution of the pixel points within each set of edge contour pixel points, identify the dark - side region and the bright - side region of the water droplet region to obtain the set of pixel points of the dark - side region and the set of pixel points of the bright - side region of the water droplet region;
[0084] Obtain the nearest background pixel of the non - water - droplet region from the set of pixel points of the dark - side region, and adjust the pixel points in the set of pixel points of the dark - side region based on the nearest background pixel to obtain the first targeted pest image after processing the dark - side region;
[0085] Determine the edge pixels of the bright - side region based on the set of pixel points of the bright - side region, determine the baseline by pairwise edge pixels, and perform linear interpolation adjustment on the pixel points on the baseline to obtain the first targeted pest image after processing the bright - side region. Among them, the first targeted pest image after processing the dark - side region and the bright - side region is the final targeted pest image.
[0086] Due to the adoption of the above - mentioned technical solutions, the present invention has remarkable technical effects: In view of the problems that in the process of intelligent trapping of pests, water droplets are likely to accumulate on the sticky board in rainy weather and non - targeted pests may be mixed in the original image, the present invention innovatively proposes a solution. For the existence of non - targeted pests, the present invention can automatically identify and remove these non - target regions to ensure the accuracy of image analysis. In view of the problem of image brightness difference caused by uneven light source distribution, traditional binarization methods often cause information loss. The present invention adopts an adaptive region binarization technology to independently binarize each region in the image, effectively retaining key information. For the area covered by water droplets, a set of fine image adjustment strategies are proposed. For the dark - side region of the water droplet, the present invention adjusts it according to the nearest background pixel to ensure that while the pixels in the dark - side region maintain the hue unchanged, their saturation and brightness gradually approach the surrounding normal background, realizing a natural transition. For the bright - side region of the water droplet, the present invention determines the baseline through the edge pixels of the bright - side region, performs linear interpolation adjustment on the pixel points on the baseline based on the baseline, and then adjusts all bright - side regions, so as to endow the bright - side region with reasonable color information, make it perfectly blend with the background, eliminate the highlighted and abrupt regions, and greatly improve the overall visual effect and color consistency of the image. Therefore, the present invention can not only effectively restore the area covered by water droplets in the original pest image, provide a basis for improving the recognition and analysis accuracy of targeted pests in the follow - up, but also provide strong technical support for the practical application of intelligent trapping technology. Brief Description of the Drawings
[0087] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0088] Figure 1 is a schematic flowchart of the method of the present invention;
[0089] Figure 2 is the original pest image in the embodiment of the present invention;
[0090] Figure 3 is the final targeted pest image in the embodiment of the present invention;
[0091] Figure 4 is the overall schematic diagram of the system of the present invention. Detailed Description of the Embodiments
[0092] The following further elaborates on the present invention in conjunction with the embodiments. The following embodiments are explanations of the present invention, and the present invention is not limited to the following embodiments. Without conflict, the features in the following embodiments can be combined with each other.
[0093] Embodiment 1:
[0094] An image processing method for intelligent sex pheromone trapping pests, as Figure 1 shown, includes the following steps:
[0095] S100: Obtain the original pest image, preprocess the original pest image to obtain multiple pest images each containing multiple sub-regions, where the original pest image at least includes a pest region and a water droplet region, and the preprocessing at least includes dimensionality reduction, filling, and cropping;
[0096] S200: Binarize each pest image containing multiple sub-regions to obtain a binarized image, determine whether there is a non-targeted pest region, and if so, remove the non-targeted pest region to obtain a first targeted pest image;
[0097] S300: Based on the first targeted pest image, obtain multiple sets of edge contour pixel points, and identify the dark surface region and the bright surface region of the water droplet region based on the brightness distribution of the pixel points within each set of edge contour pixel points to obtain the set of pixel points of the dark surface region and the set of pixel points of the bright surface region of the water droplet region;
[0098] S400: Obtain the nearest background pixel of the non-water-droplet area from the set of pixel points in the dark area, and adjust the pixel points in the set of pixel points in the dark area based on the nearest background pixel to obtain the first targeted pest image after processing the dark area;
[0099] S500: Determine the edge pixel points of the bright area based on the set of pixel points in the bright area, determine the baseline by pairwise edge pixel points, and perform linear interpolation adjustment on the pixel points on the baseline to obtain the first targeted pest image after processing the bright area. Among them, the first targeted pest image after processing the dark area and the bright area is the final targeted pest image.
[0100] In the present invention, the targeted pest is the pest that needs to be studied in this application, and the non-targeted pest is the pest that does not meet the requirements.
[0101] In S100, obtain the original pest image, and preprocess the original pest image to obtain multiple pest images including multiple sub-regions. Among them, the original pest image at least includes a pest area and a water-droplet area, and the preprocessing at least includes dimensionality reduction, filling, and cropping, including the following steps:
[0102] S110: Obtain the original pest image on the sticky moth board containing sex pheromone, as Figure 2 shown, the original pest image includes targeted pests and water droplets, and may include targeted pests. The original pest image is collected by an intelligent sex pheromone trapping device.
[0103] S120: Based on the original pest image, obtain the set of pixel point gray values of the original pest image. The set of pixel point gray values of the original pest image includes the coordinate data of all pixel points in the original pest image and the gray values of the corresponding pixel points.
[0104] S130: Perform dimensionality reduction and rounding processing on the gray value of each pixel point in the set of pixel point gray values to obtain the set of pixel point gray values after dimensionality reduction.
[0105] In this step, perform dimensionality reduction processing on the original pest image based on a fixed width. Because the depth of the collected original pest image is 256, indicating that its gray value range is 0 - 255, with a total of 256 levels. In many actual application scenarios, in order to obtain high-quality images, the gray-scale division of the obtained original pest image is relatively fine. However, such a fine gray-scale division will introduce unnecessary complexity, and the difference between adjacent gray values has little impact on subsequent processing (such as contour extraction, binary decision-making, etc.). By dimensionality reduction, the data structure of the image can be simplified while retaining the overall gray-level characteristics of the image. The dimensionality reduction and rounding processing is to integrate and round the gray value interval of the original pest image according to a fixed width, as shown below:
[0106]
[0107] Among them, represents the gray value of a pixel in the set of pixel gray values after dimensionality reduction, represents the coordinate data of the pixel, represents the preset gray value width, represents the gray value of a pixel in the set of pixel gray values, represents the floor function, which can ensure that are respectively mapped to the corresponding rounded values in the interval.
[0108] S140: Traverse the pixels in the set of pixel gray values after dimensionality reduction, copy the pixels with equal gray values to a newly created image, and obtain multiple separated images with different gray values.
[0109] In this step, only based on the gray values of the pixels in the set of pixel gray values after dimensionality reduction, a gray value set is obtained. Then, the number of elements in the gray value set is limited, and the gray value set is ( is the number of different gray values). First, create blank background images. The gray values of these blank background images do not belong to the gray value set. Traverse the pixels in the set of pixel gray values after dimensionality reduction, copy the pixels with equal gray values to the same newly created blank background image, and adjust the gray value of the pixel at the corresponding coordinate in the corresponding blank background image to the gray value of the pixel in the set of pixel gray values after dimensionality reduction, so as to obtain separated images with different gray values. For a single separated image, the gray values of the pixels in the image (excluding those of the blank background image) are the same.
[0110] S150: Extract the contour information of each separated image to form a contour set, and obtain the area of each contour. Eliminate the corresponding contours in the contour set whose contour areas are less than the preset contour area threshold to obtain a new contour set.
[0111] In this step, obtaining the preset contour area threshold includes the following steps:
[0112] (1) Construct a pre-trained model for worm body area. Among them, the pre-trained model for worm body area can be constructed through a deep learning model, with predicting the worm body area as a regression task. Since the image size is pixels, the input layer is designed to accept (width height Input of the color channel), according to the complexity of pest characteristics and image resolution, select the appropriate number and size of convolutional kernels. Multiple convolutional kernels of different sizes can be used to capture features at different scales, and design the number of neurons in the fully connected layer according to task requirements.
[0113] (2) Obtain images containing insect bodies, process and label the images to obtain an image sample set;
[0114] (3) Train the pre-trained model of insect body area through the image sample set to obtain an insect body area model. The insect body area model can detect the position of pests and calculate the area of its bounding box as the insect body area;
[0115] (4) Infer non-target pest images through the insect body area model to obtain non-target pest areas. The non-target pests include non-target pests with an insect body area significantly larger than that of the target pest and non-target pests with an insect body area significantly smaller than that of the target pest;
[0116] (5) Based on the non-target pest area, obtain a preset contour area threshold , which is expressed as follows:
[0117]
[0118] Among them, represents the preset contour area threshold, represents the non-target pest area, represents the total number of non-target pests, represents the number of non-target pests.
[0119] S160: Identify holes for each contour in the new contour set to form a hole set, and obtain the area of each hole. Fill the holes in the hole set with a hole area smaller than the preset contour area threshold to form a first contour set.
[0120] In this step, it can be filled with the background color of the corresponding separated image. The filling methods include one or more of fixed-value filling, interpolation filling, morphological filling, and contour-based filling, etc. After hole filling, the original hole area will be filled with corresponding pixel values, making the image more complete and coherent visually.
[0121] S170: Map the first contours in the first contour set to the original pest image and cut them out according to the first contour area to obtain multiple pest images containing multiple sub-regions.
[0122] In S200, each pest image containing multiple sub-regions is binarized to obtain a binarized image. It is determined whether there is a non-target pest region. If so, the non-target pest region is removed to obtain a first target pest image, including the following steps:
[0123] S210: Based on each pest image containing multiple sub-regions, a set of pixel values for each sub-region is obtained, and then a pixel value threshold for each sub-region is obtained. The pixel value threshold for each sub-region is expressed as follows:
[0124]
[0125] Among them, represents the pixel value threshold of the th sub-region, represents the mean value of the pixel values of the th sub-region, , represents the standard deviation of the pixel values of the th sub-region, , represents the total number of pixel points in the th sub-region, represents the pixel value of the rd pixel point in the th sub-region, represents the number of sub-regions, represents the number of pixel points.
[0126] S220: Based on the pixel value threshold of each sub-region, each sub-region is binarized to obtain multiple binarized region images.
[0127] In this step, each pest image containing multiple sub-regions is binarized based on different pixel value thresholds, so that the sub-regions in each image are clearly distinguishable from their background colors, thereby improving the quality of subsequent region fusion, extraction, and merging in the image.
[0128] S230: The multiple binarized region images are merged to obtain a binarized image.
[0129] In this step, the merging method can be through simple pixel overlay (placing according to coordinate correspondence), and finally a complete binarized image after adaptive region binarization is obtained.
[0130] S240: Determine whether there is a non-target pest region. If so, remove the non-target pest region to obtain a first target pest image, including the following steps:
[0131] Extract the contour information of the binary image to form a binary contour set and obtain the area of each binary contour.
[0132] (2) For the contours with binary contour areas smaller than the preset target pest area threshold, fill the corresponding contour areas with the background color of the original pest image to remove the non-target pest areas, and obtain the first target pest image. The preset target pest area threshold can be set to 1 / 5 of the preset contour area threshold.
[0133] Due to the uneven distribution of the light source, when the image acquisition device captures the image of the sticky pest board, the brightness distribution of the original pest image obtained is uneven. Directly using the traditional binary method will lose a lot of information. The present invention performs binary processing on each area independently, which is a new adaptive regional binary method.
[0134] In S300, based on the first target pest image, obtain a plurality of edge contour pixel point sets, and identify the dark area and bright area of the water droplet area based on the brightness distribution of the pixel points within each edge contour pixel point set, to obtain the dark area pixel point set and bright area pixel point set of the water droplet area, including the following steps:
[0135] S310: Perform contrast enhancement, highlight area enhancement, and dark area darkening processing on the first target pest image, so as to enhance the edge information of the dark edge and bright edge in the first target pest image, and obtain the second target pest image.
[0136] S320: Perform median filtering processing on the second target pest image to obtain the third target pest image.
[0137] S340: Use the Canny edge detection operator to perform edge detection on the third target pest image to obtain the background pixel point set and a plurality of edge contour pixel point sets.
[0138] S350: Take the average of the brightness values of all the pixel points in the background pixel point set to obtain the background brightness value; based on the brightness value distribution of the pixel points within each edge contour pixel point set, obtain a plurality of edge contour average brightness values.
[0139] S360: If the edge contour average brightness value is greater than the background brightness value, the corresponding edge contour pixel point set is the bright area pixel point set, and the other edge contour pixel point sets are the dark area pixel point sets.
[0140] In this step, the bright area of the water droplet is white due to specular reflection of the image, showing high brightness. Due to reasons such as the light transmittance of water, the brightness of the dark area is lower than the background brightness, but the color is the original color. Therefore, the bright area and dark area of the water droplet can be distinguished based on the brightness value, so as to obtain the dark area pixel point set. and the set of pixel points in the bright area .
[0141] In S400, based on the set of pixel points in the dark area, obtain the nearest background pixel point of the non-water droplet area, and adjust the pixel points in the set of pixel points in the dark area based on the nearest background pixel point to obtain the first targeted pest image after processing the dark area, including the following steps:
[0142] S410: Based on the set of pixel points in the dark area, obtain the nearest background pixel point of each pixel point, specifically including:
[0143] (1) Take the pixel point in the set of pixel points in the dark area as the central pixel point , and obtain all the pixel points within the neighborhood range of the central pixel point to obtain the first neighborhood pixel point set;
[0144] (2) Remove the pixel points belonging to the set of pixel points in the dark area or the set of pixel points in the bright area from the first neighborhood pixel point set, so as to remove the pixel points in the water droplet area (dark area and bright area) and obtain the second neighborhood pixel point set;
[0145] (3) Initialize the nearest background pixel point of the central pixel point to a null value, and initialize the distance value between the central pixel point and the background pixel point of the central pixel point to a preset distance threshold. The preset distance threshold can be a relatively large number, such as the length of the image diagonal, so as to ensure that it can be updated in the initial state;
[0146] (4) Obtain the Euclidean distance between the central pixel point and each pixel point in the second neighborhood pixel point set, and then obtain the minimum Euclidean distance;
[0147] (5) If the minimum Euclidean distance is less than the preset distance threshold, the pixel point corresponding to the minimum Euclidean distance is the nearest background pixel point of the central pixel point;
[0148] (6) If the nearest background pixel point of the central pixel point is not a null value, remove the central pixel point from the set of pixel points in the dark area, and update the set of pixel points in the dark area, and iterate to obtain the nearest background pixel point of each pixel point in the set of pixel points in the dark area.
[0149] S420: Obtain the RGB value of each pixel point in the first targeted pest image to obtain the first RGB set.
[0150] S430: Based on the RGB values of each pixel in the first RGB set, obtain the brightness value (Value), saturation value (Saturation), and hue value (Hue) of the corresponding pixel, and then obtain the first HSV component set. Converting from the RGB color space to HSV can avoid the mutual interference of the R, G, and B channels when adjusting the image in the RGB space. Among them, the brightness value, saturation value, and hue value of the pixels in the first HSV component set are respectively expressed as follows:
[0151]
[0152]
[0153]
[0154] Among them, represents the coordinate data of the pixel, , and respectively represent the brightness value, saturation value, and hue value of the pixel in the first HSV component set, , and respectively represent the R-channel intensity value, G-channel intensity value, and B-channel intensity value of the pixel in the first RGB set.
[0155] S440: Extract the brightness value and saturation value at the position of the nearest background pixel in the first HSV component set to obtain the brightness value and saturation value of the nearest background pixel of each pixel.
[0156] S450: Based on the brightness value and saturation value of the nearest background pixel of each pixel, adjust the hue value, saturation value, and brightness value of the pixels in the first HSV component set to obtain the second HSV component set. Among them, the hue value, saturation value, and brightness value of the pixels in the second HSV component set are respectively expressed as follows:
[0157]
[0158] Among them, , and respectively represent the hue value, saturation value, and brightness value of the pixel in the second HSV component set, and respectively represent the saturation value and brightness value of the nearest background pixel, and both represent the adjustment coefficients. The value ranges of the R-channel intensity value, G-channel intensity value, and B-channel intensity value are all , The value range is , and the ranges are both .
[0159] S460: Based on the hue value, saturation value, and brightness value of each pixel point in the second HSV component set, obtain the RGB value of the corresponding pixel point, and then obtain the second RGB set, and further obtain the first targeted pest image after processing the dark surface area.
[0160] Through this processing method, the pixels in the dark surface area of the water droplets have their saturation value and brightness value approaching the surrounding normal background while the hue value remains unchanged.
[0161] In step S500, based on the set of pixel points in the bright surface area, determine the edge pixel points of the bright surface area, determine the baseline by pairwise edge pixel points, and perform linear interpolation adjustment on the pixel points on the baseline to obtain the first targeted pest image after processing the bright surface area. Among them, the first targeted pest image after processing the dark surface area and the bright surface area is the final targeted pest image, including the following steps:
[0162] S510: Based on the set of pixel points in the bright surface area, extract the edge of each bright surface area to obtain a set of edge pixel points of multiple bright surface areas.
[0163] S520: Obtain the pixel point with the smallest horizontal coordinate value in the set of edge pixel points of the target bright surface area as the first end pixel point, that is, the pixel point at the leftmost end in the horizontal direction of the target bright surface area.
[0164] S530: Take the horizontal direction as the baseline. Therefore, based on the set of edge pixel points of the target bright surface area, obtain the pixel point with the same horizontal coordinate value as the first end pixel point as the second end pixel point. The connection line between the first end pixel point and the second end pixel point is the baseline of the target bright surface area, and then obtain the first set of baseline pixel points.
[0165] S540: Based on the RGB value of the first end pixel point and the RGB value of the second end pixel point, perform linear interpolation adjustment on the RGB values of the pixel points in the first set of baseline pixel points to obtain the second set of baseline pixel points. The R-channel intensity value, G-channel intensity value, and B-channel intensity value of the pixel points in the second set of baseline pixel points are respectively expressed as follows:
[0166]
[0167] Among them, , and respectively represent the R-channel intensity value, G-channel intensity value, and B-channel intensity value of the pixel points in the second set of baseline pixel points, , and respectively represent the R-channel intensity value, G-channel intensity value, and B-channel intensity value of the first-end pixel point, , and respectively represent the R-channel intensity value, G-channel intensity value, and B-channel intensity value of the second-end pixel point, represents the th pixel point in the direction from the first-end pixel point to the second-end pixel point on the baseline, represents the number of pixel points on the baseline except the first-end pixel point and the second-end pixel point, , represents the horizontal coordinate value of the second-end pixel point, represents the horizontal coordinate value of the first-end pixel point, represents rounding down.
[0168] S550: Traverse the pixel points in each set of edge pixel points of the bright surface area, and adjust the pixel points in each bright surface area based on the baseline to obtain the first targeted pest image after processing the bright surface area.
[0169] As Figure 3 shown, the first targeted pest image after processing the dark surface area and the bright surface area is the final targeted pest image. Through this processing, reasonable color information can be given to the bright surface of the water droplet, making its transition with the surrounding background more natural, eliminating the white high-brightness abrupt area, improving the overall visual effect and color consistency of the image, and facilitating the subsequent accurate identification and analysis of the targets (such as bugs, etc.) in the sticky board image.
[0170] Example 2:
[0171] An intelligent image processing system for attracting pests by sex pheromone, as Figure 4 shown, includes a preprocessing module, a binarization module, a bright and dark surface acquisition module for water droplets, a dark surface adjustment module for water droplets, and a bright surface adjustment module for water droplets;
[0172] The preprocessing module obtains the original pest image, preprocesses the original pest image to obtain multiple pest images containing multiple sub-regions, where the original pest image at least includes a pest region and a water droplet region, and the preprocessing at least includes dimensionality reduction, filling, and cropping;
[0173] The binarization module performs binarization processing on each pest image containing multiple sub-regions to obtain a binarized image, determines whether there is a non-targeted pest region, and if so, removes the non-targeted pest region to obtain the first targeted pest image;
[0174] The water droplet bright and dark surface acquisition module obtains multiple sets of edge contour pixel points based on the first target pest image, and identifies the dark and bright regions of the water droplet area based on the brightness distribution of the pixel points within each set of edge contour pixel points, obtaining the set of pixel points in the dark region and the set of pixel points in the bright region of the water droplet area;
[0175] The water droplet dark surface adjustment module obtains the nearest background pixel points of the non-water droplet area based on the set of pixel points in the dark area, and adjusts the pixel points in the set of pixel points in the dark area based on the nearest background pixel points to obtain the first target pest image after processing the dark area;
[0176] The water droplet bright surface adjustment module determines the edge pixel points of the bright area based on the set of pixel points in the bright area, determines the baseline by pairwise edge pixel points, and performs linear interpolation adjustment on the pixel points on the baseline to obtain the first target pest image after processing the bright area, where the first target pest image after processing the dark area and the bright area is the final target pest image.
[0177] All changes and modifications made without departing from the spirit and scope of the present invention, and all equivalent technical solutions also fall within the scope of the present invention.
[0178] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other.
[0179] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, devices, or computer program products. Therefore, the present invention can be implemented in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0180] The present invention is described with reference to the flowcharts and / or block diagrams of methods, terminal devices (systems), and computer program products according to the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, and the combination of processes and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing terminal devices to generate a machine, so that the instructions executed by the processors of the computer or other programmable data processing terminal devices generate for implementing in the process Figure 1 one process or multiple processes and / or blocks Figure 1a device for the functions specified in one or more boxes.
[0181] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured article including an instruction device that implements the functions specified in one Figure 1 process or multiple processes and / or boxes Figure 1 a box or multiple boxes.
[0182] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, so that a series of operation steps are executed on the computer or other programmable terminal device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one Figure 1 process or multiple processes and / or boxes Figure 1 a box or multiple boxes.
[0183] It should be noted that:
[0184] "An embodiment" or "embodiments" mentioned in the specification means that the specific features, structures or characteristics described in connection with the embodiments are included in at least one embodiment of the present invention. Therefore, the phrases "an embodiment" or "embodiments" that appear throughout the specification do not necessarily all refer to the same embodiment.
[0185] In addition, it should be noted that for the specific embodiments described in this specification, the shapes, names of their components, etc. can be different. Any equivalent or simple changes made according to the structure, features and principles described in the inventive concept of the present invention are included in the protection scope of the present invention. Those skilled in the art to which the present invention pertains can make various modifications or supplements to the described specific embodiments or use similar ways to replace them, as long as they do not deviate from the structure of the present invention or exceed the scope defined by this claim book, they should fall within the protection scope of the present invention.
Claims
1. An intelligent image processing method for attracting pests, characterized in that: The following steps are involved: Acquire an original pest image, perform preprocessing on the original pest image, and obtain a plurality of pest images including a plurality of sub-regions, wherein the original pest image at least includes a pest region and a water drop region, and the preprocessing at least includes dimensionality reduction, padding, and cropping; Binarization is performed on each pest image containing multiple sub-regions to obtain a binary image, and it is determined whether there is a non-targeted pest region. If so, the non-targeted pest region is removed to obtain a first targeted pest image; Based on the first targeted pest image, a plurality of edge contour pixel point sets are obtained, and based on the brightness distribution of the pixels in each edge contour pixel point set, the dark side area and the bright side area of the water drop area are identified to obtain the dark side area pixel point set and the bright side area pixel point set of the water drop area; Based on the dark area pixel set, the nearest background pixel point of the non-water drop area is obtained, and the pixel points in the dark area pixel set are adjusted based on the nearest background pixel point to obtain a first targeted pest image after the dark area is processed; The edge pixel points of the bright surface area are determined based on the set of pixel points in the bright surface area, the baseline is determined by pairwise edge pixel points, and the pixel points on the baseline are linearly interpolated to obtain a first targeted pest image after bright surface area processing, wherein the first targeted pest image after dark surface area processing and bright surface area processing is the final targeted pest image.
2. The image processing method for intelligent pest trapping according to claim 1, characterized in that: The method of preprocessing the original pest image to obtain a plurality of pest images containing a plurality of sub-regions comprises the following steps: Based on the original pest image, a set of pixel grayscale values of the original pest image is obtained; Performing dimension reduction and rounding processing on the grayscale value of each pixel in the pixel grayscale value set to obtain a pixel grayscale value set after dimension reduction; Traverse the pixel points in the grayscale value set of the pixel points after dimensionality reduction, copy the pixel points with equal grayscale values to the newly created image, and obtain multiple separated images with different grayscale values; Extract the contour information of each separated image to form a contour set, and obtain the area of each contour, and remove the corresponding contours in the contour set whose contour area is less than a preset contour area threshold to obtain a new contour set; Perform hole identification on each contour in the new contour set to form a hole set, obtain the area of each hole, and fill the holes in the hole set whose area is smaller than a preset contour area threshold to form a first contour set; Mapping the first contour in the first contour set onto the original pest image, and cutting out the first contour area to obtain a plurality of pest images including a plurality of sub-areas; The dimension reduction and rounding process are expressed as follows: in, Represents the gray value of the pixel in the gray value set of the pixel after dimensionality reduction, Represents the coordinate data of the pixel point. Indicates the preset grayscale value width, Represents the gray value of a pixel in a pixel gray value set. Represents the floor function.
3. The image processing method for intelligent pest trapping according to claim 1, characterized in that: The method of performing binarization processing on each pest image containing multiple sub-regions to obtain a binarized image comprises the following steps: Based on each pest image containing multiple sub-regions, a pixel value set of each sub-region is obtained, and then a pixel value threshold of each sub-region is obtained; Based on the pixel value threshold of each sub-region, each sub-region is binarized to obtain multiple binarized region images; Fusing multiple binary region images to obtain a binary image; The pixel value threshold of each sub-region is expressed as follows: in, Indicates The pixel value threshold of the sub-region is Indicates The mean pixel value of the sub-regions, , Indicates The standard deviation of the pixel values in each sub-region is , Indicates The total number of pixels in each sub-region, Indicates The sub-region The pixel value of a pixel, Indicates the number of sub-regions, Indicates the number of pixels.
4. The image processing method for intelligent pest trapping according to claim 1, characterized in that: The method of determining whether there is a non-targeted pest area, and if so, removing the non-targeted pest area to obtain a first targeted pest image, comprises the following steps: Extract the contour information of the binary image, form a binary contour set, and obtain the area of each binary contour; If the binarized contour area is smaller than the contour of the preset target pest area threshold, the corresponding contour area is filled based on the background color of the original pest image to remove the non-target pest area and obtain the first targeted pest image.
5. The image processing method for intelligent pest trapping according to claim 1, characterized in that: The method of obtaining a plurality of edge contour pixel point sets based on the first targeted pest image, identifying the dark side area and the bright side area of the water drop area based on the brightness distribution of the pixels in each edge contour pixel point set, and obtaining the dark side area pixel point set and the bright side area pixel point set of the water drop area includes the following steps: Performing image enhancement processing on the first targeted pest image to obtain a second targeted pest image, wherein the image enhancement processing includes at least one or more of contrast enhancement, highlight area enhancement, and dark area darkening; Performing median filtering on the second targeted pest image to obtain a third targeted pest image; Performing edge detection on the third targeted pest image to obtain a background pixel point set and a plurality of edge contour pixel point sets; The brightness values of all pixels in the background pixel set are averaged to obtain the background brightness value; Based on the brightness value distribution of the pixel points in each edge contour pixel point set, a plurality of edge contour average brightness values are obtained; If the average brightness value of the edge contour is greater than the background brightness value, the corresponding edge contour pixel point set is the bright area pixel point set, and the other edge contour pixel point sets are the dark area pixel point sets.
6. The image processing method of intelligent pest trapping according to claim 1, characterized in that: The method of obtaining the nearest background pixel point of the non-water droplet area based on the dark area pixel point set, adjusting the pixel points in the dark area pixel point set based on the nearest background pixel point, and obtaining a first targeted pest image after the dark area is processed includes the following steps: Based on the dark area pixel set, the nearest background pixel of each pixel is obtained; Obtaining the RGB value of each pixel in the first targeted pest image, obtaining the brightness value, saturation value and hue value of the corresponding pixel in the HSV space, and then obtaining a first HSV component set; Extract the brightness value and saturation value of the nearest background pixel in the first HSV component set to obtain the brightness value and saturation value of the nearest background pixel of each pixel; Based on the brightness value and saturation value of the nearest background pixel of each pixel, the hue value, saturation value and brightness value of the pixel in the first HSV component set are adjusted to obtain a second HSV component set; Based on the hue value, saturation value and brightness value of each pixel in the second HSV component set, the RGB value of the corresponding pixel is obtained, and then the second RGB set is obtained, and then the first targeted pest image after dark area processing is obtained.
7. The image processing method of intelligent pest trapping according to claim 6, characterized in that: The brightness value, saturation value and hue value of the pixel points of the first HSV component set are respectively expressed as follows: The hue value, saturation value and brightness value of the pixel points of the second HSV component set are respectively expressed as follows: in, Represents the coordinate data of the pixel point. , and Respectively represent the brightness value, saturation value and hue value of the pixel points of the first HSV component set, , and Respectively represent the R channel intensity value, G channel intensity value and B channel intensity value of the pixel point of the first RGB set, , and Respectively represent the hue value, saturation value and brightness value of the pixel point of the second HSV component set, and Respectively represent the saturation value and brightness value of the nearest background pixel, and Both represent adjustment factors.
8. The image processing method of intelligent pest trapping according to claim 6, characterized in that: The method of obtaining the nearest background pixel of each pixel based on the dark area pixel set comprises the following steps: Taking a pixel point in the dark area pixel point set as a central pixel point, obtaining all pixel points within a preset neighborhood range of the central pixel point, and obtaining a first neighborhood pixel point set; Eliminate the pixels belonging to the dark area pixel set or the bright area pixel set in the first neighborhood pixel set to obtain a second neighborhood pixel set; Initialize the distance value between the central pixel and the background pixels of the central pixel to a preset distance threshold; Obtain the Euclidean distance between the central pixel and each pixel in the second neighborhood pixel set, and then obtain the minimum Euclidean distance; If the minimum Euclidean distance is less than the preset distance threshold, the pixel corresponding to the minimum Euclidean distance is the nearest background pixel of the center pixel; The central pixel is removed from the dark area pixel set, and the dark area pixel set is updated, and the nearest background pixel of each pixel in the dark area pixel set is obtained iteratively.
9. The image processing method for intelligent pest trapping according to claim 1, characterized in that: The method of determining edge pixel points of the bright surface area based on the bright surface area pixel point set, determining a baseline through two edge pixel points, and performing linear interpolation adjustment on the pixel points on the baseline to obtain a first targeted pest image after bright surface area processing includes the following steps: Based on the bright surface area pixel point set, the edge of each bright surface area is extracted to obtain multiple bright surface area edge pixel point sets; The pixel point with the smallest horizontal coordinate value in the set of edge pixel points of the target bright surface area is obtained as the first end pixel point; Based on the target bright surface area edge pixel point set, a pixel point having the same horizontal coordinate value as the first end pixel point is obtained as the second end pixel point, and a line connecting the first end pixel point and the second end pixel point is the baseline of the target bright surface area, thereby obtaining a first baseline pixel point set; Based on the RGB value of the first end pixel point and the RGB value of the second end pixel point, linear interpolation adjustment is performed on the RGB values of the pixel points in the first baseline pixel point set to obtain a second baseline pixel point set; The pixel points in the edge pixel point set of each bright surface area are traversed, and the pixel points in each bright surface area are adjusted based on the baseline to obtain a first targeted pest image after the bright surface area is processed.
10. The image processing method of intelligent pest trapping according to claim 9, characterized in that: The R channel intensity value, the G channel intensity value, and the B channel intensity value of the pixel point in the second baseline pixel point set are respectively expressed as follows: in, , and They respectively represent the R channel intensity value, G channel intensity value and B channel intensity value of the pixel points in the second baseline pixel point set, , and Respectively represent the R channel intensity value, G channel intensity value and B channel intensity value of the first end pixel point, , and Respectively represent the R channel intensity value, G channel intensity value and B channel intensity value of the second end pixel point, Indicates the first pixel point on the baseline in the direction from the first end pixel point to the second end pixel point. pixels, Indicates the number of pixels on the baseline except the first end pixel and the second end pixel. , Indicates the horizontal coordinate value of the second end pixel, Indicates the horizontal coordinate value of the first end pixel, Indicates rounding down.
11. An intelligent pest-luring image processing system, characterized in that: It includes a pre-processing module, a binarization module, a water drop bright side and dark side acquisition module, a water drop dark side adjustment module and a water drop bright side adjustment module; The preprocessing module obtains an original pest image, preprocesses the original pest image, and obtains a plurality of pest images containing a plurality of sub-regions, wherein the original pest image at least includes a pest region and a water drop region, and the preprocessing at least includes dimensionality reduction, padding, and cropping; The binarization module performs binarization processing on each pest image containing multiple sub-regions to obtain a binarized image, determines whether there is a non-targeted pest region, and if so, removes the non-targeted pest region to obtain a first targeted pest image; The water drop bright and dark side acquisition module obtains a plurality of edge contour pixel point sets based on the first targeted pest image, identifies the dark side area and the bright side area of the water drop area based on the brightness distribution of the pixels in each edge contour pixel point set, and obtains the dark side area pixel point set and the bright side area pixel point set of the water drop area; The water drop dark side adjustment module obtains the nearest background pixel point of the non-water drop area from the dark side area pixel point set, and adjusts the pixel points in the dark side area pixel point set based on the nearest background pixel point to obtain a first targeted pest image after the dark side area is processed; The water drop bright surface adjustment module determines the edge pixel points of the bright surface area based on the bright surface area pixel point set, determines the baseline through the edge pixel points in pairs, and performs linear interpolation adjustment on the pixel points on the baseline to obtain the first targeted pest image after the bright surface area processing, wherein the first targeted pest image after the dark surface area processing and the bright surface area processing is the final targeted pest image.
12. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
13. An intelligent image processing device for attracting pests, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Method for identifying and counting farmland pests based on colors and models
CN102930249A
Color and feature-based pest identifying and counting method
CN106373136A