Insecticide efficiency detection method of sticky insect board based on image processing
Through pre -processing and regional division of sticky insect panel images, the self -adaptation threshold division is dynamically adjusted to adjust the large -scale threshold, which solves the problem of inaccurate division of the pest area under the condition of complex light, and improves the accuracy and reliability of insecticidal efficiency assessment.
Patent Information
- Application Number
- CN202411539597.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-10-31
AI Technical Summary
The prior art cannot accurately segment and identify the pest areas in the sticky insect plate under complex lighting conditions, affecting the accuracy of the evaluation results of insecticidal efficiency.
By pre -processing the adhesive insect image, including Gaussian filtering and gray level, divided into multiple areas, calculate the degree of light effect and threshold adjustment coefficient of each region, dynamically adjust the large -scale threshold for adaptive threshold division, identify the pest area area Essence
The accuracy of the division of pest regions under complex light conditions has been improved, and the situation of error division and leakage division is reduced, and the reliability of the pesticide efficiency assessment results is ensured.
Smart Images

Figure CN119048542B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method for detecting insecticidal efficiency of an insect sticky board based on image processing. Background Art
[0002] In modern agricultural production, sticky insect boards, as an important tool for pest monitoring and control, play a key role in crop disease and pest management. They capture flying pests through the sticky material on their surface, providing farmers with first-hand information on the types and numbers of pests. The insecticidal efficiency of sticky insect boards is an important indicator for measuring the effectiveness of pest control measures. If the insecticidal efficiency is found to be low, it means that the existing prevention and control measures may not be effective enough, and it is necessary to adjust or replace the prevention and control measures in time to improve the overall level of disease and pest management and increase crop yields.
[0003] In order to detect the insecticidal efficiency of sticky insect boards, the prior art usually uses image processing technology to identify the pest area and then evaluate the insecticidal efficiency. For example, the existing Chinese patent application document with publication number CN109102004A provides a cotton pest identification and classification method and device, the method obtains an original image containing cotton pests to be classified, obtains the original image Invariant moment parameters and overall contour feature parameters of cotton pests to be classified; based on Otsu threshold segmentation algorithm and The edge detection algorithm separates the image of the cotton pest to be classified from the background of the original image, extracts the wing image from the original image, and obtains the wing contour feature parameters of the cotton pest to be classified based on the wing image; the mathematical morphology algorithm is used to optimize the wing image, and the mathematical morphological feature parameters corresponding to the wings of the cotton pest to be classified are extracted, and the radial basis function neural network is used to identify and classify the cotton pest to be classified.
[0004] However, in practical applications, due to the complex and changeable lighting conditions in the natural environment and the existence of shadows, the threshold segmentation results of the sticky insect board image by the Otsu threshold segmentation algorithm are not accurate enough, and the pest area cannot be accurately identified, which in turn affects the accuracy of the evaluation results of the insecticide efficiency. Summary of the invention
[0005] In order to solve the problem that the Otsu threshold segmentation algorithm cannot accurately segment and identify the pest area in the sticky insect board under complex lighting conditions, thereby affecting the accuracy of the evaluation results of the insecticidal efficiency, the present invention proposes a sticky insect board insecticidal efficiency detection method based on image processing, which specifically adopts the following scheme:
[0006] Preprocessing the image of the insect sticky board to obtain a grayscale image, dividing the grayscale image into a plurality of regions of equal size, obtaining the Otsu threshold and the intermediate grayscale value of each region, and taking the pixel points in each region whose grayscale value is greater than the intermediate grayscale value as background pixel points;
[0007] Calculate the lighting impact of each area: , where For the The degree of light impact in an area For the The number of background pixels contained in the region, is the mean grayscale value of all background pixels in all regions, For the In the region Gray value of background pixels;
[0008] Get all adjacent regions of each region and calculate the threshold adjustment coefficient for each region:
[0009] , where It is Threshold adjustment factor for each region, It is The number of neighboring regions of a region, It is Region The degree of light influence on adjacent areas, It is Region and its The Euclidean distance between adjacent regions;
[0010] The Otsu threshold of each area is adjusted by the threshold adjustment coefficient of the area, and the grayscale image is adaptively threshold segmented based on the adjusted Otsu threshold to segment the pest area. The insecticidal efficiency of the sticky insect board is determined according to the area ratio of the pest area in the grayscale image to complete the insecticidal efficiency detection.
[0011] The above technical solution can remove noise and simplify the image by collecting and preprocessing the image of the sticky insect board, making it more suitable for subsequent processing. Dividing the grayscale image into multiple regions is helpful for fine-grained analysis of the local part of the image. In short, preprocessing and region division can reduce the impact of global illumination changes on the segmentation results, making the processing of each region more refined and accurate. By calculating the intermediate grayscale value of each region, the background part and the pest part of the region can be preliminarily distinguished according to the intermediate grayscale value, providing an initial segmentation result, and further filtering the background pixels through the intermediate grayscale value, improving the distinction between the background part and the pest part. By calculating the degree of illumination influence of each region, it reflects the possibility of each region being illuminated. The greater the degree of illumination influence of a region, the more likely it is that the region is a shadow part caused by illumination. By considering the degree of illumination influence of each region's adjacent regions and the distance between each region and its adjacent regions, the Otsu threshold of each region is dynamically adjusted. , ensuring that the Otsu threshold of each area is no longer fixed, but is dynamically adjusted according to its lighting conditions and neighborhood information. Since the threshold adjustment coefficient takes neighborhood information into account, the threshold adjustment is smoother and more natural. The grayscale image is adaptively threshold segmented based on the adjusted Otsu threshold, which helps to better segment the pest area under complex lighting conditions, reduce mis-segmentation and missed segmentation, and improve the accuracy and robustness of the Otsu threshold algorithm segmentation. In particular, in the case of uneven lighting, the pest area can be identified more accurately. Based on the accurate pest area segmentation results, reliable insecticide efficiency evaluation results can be obtained.
[0012] Further, the method for determining the insecticidal efficiency according to the area ratio of the pest area in the grayscale image includes: The grayscale image of the sticky insect board is collected every minute, and the area ratio of the pest area in the grayscale image is taken as the sticky insect rate of the sticky insect board at the collection time corresponding to the grayscale image. is the preset value; the absolute value of the difference between the sticking rates of each two adjacent grayscale images is calculated as the sticking rate difference of the two adjacent grayscale images, and the sticking rate difference of the two adjacent grayscale images is compared with The ratio of is taken as the insecticidal efficiency of the sticky insect board in these two adjacent grayscale images; the average of the insecticidal efficiencies of the sticky insect board in all adjacent grayscale images within one day is taken as the insecticidal efficiency of the sticky insect board.
[0013] The above technical solution can dynamically reflect the rate of change of the number of pests by calculating the difference in the sticky insect rate of every two adjacent grayscale images and taking the ratio of it to the time interval as the insecticidal efficiency of the sticky insect board in the adjacent grayscale images, thereby more accurately evaluating the insecticidal effect.
[0014] Furthermore, the method of adjusting the Otsu threshold of each region by the threshold adjustment coefficient of the region is as follows: ,in, For the The Otsu threshold after regional adjustment, For the The Otsu threshold of the region, For the Threshold adjustment factor for each region, is the minimum value function.
[0015] The above technical solution dynamically adjusts the Otsu threshold of each area through the threshold adjustment coefficient, so that the Otsu threshold of each area is no longer fixed, but is adaptively adjusted according to the lighting conditions and neighborhood information. The adjustment range is limited by taking the minimum function to ensure that the adjusted Otsu threshold does not exceed the original Otsu threshold, avoiding distortion of the segmentation result caused by excessive adjustment.
[0016] Further, the pre-processing includes: The channels are Gaussian filtered separately, and the images after Gaussian filtering are grayed out.
[0017] The above technical solution can effectively remove image noise and simplify image information through Gaussian filtering and grayscale preprocessing, providing a clearer and more stable grayscale image basis for subsequent area division and pest detection.
[0018] Furthermore, the area ratio of the pest region in the grayscale image is equal to the ratio of the number of pixels included in the pest region to the number of pixels included in the grayscale image.
[0019] Furthermore, the method for obtaining the intermediate gray value is:
[0020] Get the maximum grayscale value and minimum grayscale value of all pixels in each area, select a pixel with the maximum grayscale value and a pixel with the minimum grayscale value, and use these two pixels as the two initial cluster center points respectively. Perform K-MEANS clustering on all pixels in the area based on the size of the grayscale value. After clustering, get the two final cluster center points, and use the grayscale mean of these two final cluster center points as the intermediate grayscale value of all pixels in the area.
[0021] The above technical solution obtains the maximum grayscale value and the minimum grayscale value of each area, and uses the pixels of these two extreme values as the initial clustering centers for K-MEANS clustering. This method can adaptively find the actual grayscale distribution characteristics in the image, reduce the error caused by uneven lighting, and improve the distinction between the background and the pest area based on the accurate intermediate grayscale value.
[0022] Furthermore, all adjacent regions of each region are adjacent regions in eight directions around the region.
[0023] The present invention has the following effects:
[0024] The present invention reduces the influence of global illumination change on the segmentation result of Otsu threshold algorithm through preprocessing and area division, improves the processing precision and accuracy of each area, dynamically adjusts the Otsu threshold of each area according to the illumination condition and neighborhood information of the area, performs adaptive threshold segmentation on the grayscale image based on the adjusted Otsu threshold of all areas, overcomes the adverse influence of complex illumination conditions on the segmentation result of Otsu threshold, reduces the situation of mis-segmentation and missed segmentation, can more accurately identify the pest area, evaluates the insecticidal efficiency of the sticky insect board based on the accurate pest area segmentation result, and improves the reliability of the insecticidal efficiency evaluation result of the sticky insect board. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0026] Figure 1 It is a schematic flow chart of the method of the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0028] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0029] Reference Figure 1 The method for detecting insecticidal efficiency of sticky insect boards based on image processing includes steps S1 to S6, which are specifically as follows:
[0030] S1: Collect images of sticky insect boards, divide them into multiple areas, and determine the Otsu threshold for each area.
[0031] Sticky insect boards are usually hung at a certain height of crops to trap different types of pests. The height changes with the growth conditions of the crops. The growth conditions of the same crop are generally the same. Therefore, the height of the same crop hung on the sticky insect board is basically the same. The collected sticky insect board image is an RGB image. Since it is easy to capture irrelevant factors such as crops or other environments in the image when collecting the sticky insect board image, the collected image is first preprocessed, including: Gaussian filtering the R, G, and B channels of the sticky insect board image respectively, and graying the Gaussian filtered image to obtain a corresponding grayscale image, and cropping the grayscale image to remove irrelevant factors such as crops or other environments to obtain a grayscale image of the sticky insect board area. In subsequent steps, the grayscale image of the sticky insect board area is referred to as a grayscale image, and only the grayscale image is analyzed to evaluate the insecticidal efficiency, eliminating the influence of other irrelevant factors.
[0032] The grayscale image is divided into multiple regions of the same size. The size of each region is determined by the length and width of the grayscale image, that is, the length of each region is divisible by the length of the grayscale image, and the width of each region is divisible by the width of the grayscale image, so as to ensure that the grayscale image can be evenly and completely divided. The significance of regional division of the grayscale image here is that by dividing the image into multiple regions, each region can be analyzed more carefully, which helps to capture local features and changes and improve the precision and accuracy of processing. For example, in the case of uneven lighting, different regions have different lighting conditions. This regional division improves the accuracy of the analysis.
[0033] The Otsu threshold algorithm is a commonly used automatic image segmentation method. It determines an optimal threshold by maximizing the inter-class variance. In simple terms, the Otsu algorithm will find a threshold so that when the image is divided into foreground and background, the difference between the two parts is the largest. This threshold can usually distinguish the target from the background in the image well. Corresponding to this scheme, when the traditional Otsu threshold algorithm is used to perform threshold segmentation on the entire grayscale image, a threshold will be found in the entire grayscale image, which distinguishes the pest area from the background area in the grayscale image.
[0034] Since the accuracy of the insecticide efficiency evaluation results needs to be further improved by improving the segmentation effect of the Otsu threshold algorithm, after the entire grayscale image has been finely divided into regions, the Otsu threshold algorithm is applied separately to each region of the grayscale image to automatically obtain the Otsu threshold of each region, rather than the Otsu threshold of the entire grayscale image. The significance of calculating the Otsu threshold for each region separately here is that due to changes in ambient light, the lighting conditions in different regions may be different, that is, there are differences in the grayscale distribution of different regions. Using the same Otsu threshold for all regions is likely to lead to inaccurate segmentation. Therefore, obtaining the Otsu threshold for each region can better adapt to these changes and improve the accuracy of segmentation.
[0035] S2: Determine the middle gray value of all pixels in each area, and determine the background pixels in the area according to the middle gray value.
[0036] For the entire grayscale image, the color and surface characteristics of the pests are usually different from the background of the sticky insect board. The insects are darker in color and reflect less light, so they appear as lower grayscale values in the grayscale image. The background of the sticky insect board is usually designed to be brighter (such as yellow or white) to better highlight the presence of the insects. The background reflects more light, so it appears as a higher grayscale value in the grayscale image. When the lighting is uneven, the sticky insect board will produce shadow areas. The grayscale values of these shadow areas are between the grayscale values of the pests and the grayscale values of the background. The shadow area contains both background pixels (pixels corresponding to the background of the sticky insect board) and pest pixels (pixels corresponding to the pests on the sticky insect board). The shadow area will reduce the grayscale value of the background pixels, but it is still higher than the grayscale value of the pest pixels.
[0037] For each specific area, the background pixels in each area are more sensitive to changes in lighting. When the lighting conditions change, the grayscale values of the background pixels will change significantly. For example, if the light becomes darker, the grayscale values of the background pixels will decrease, and if the light becomes brighter, the grayscale values of the background pixels will increase. In each area, the grayscale values of the pest pixels are relatively stable. The grayscale values of the pest pixels are mainly determined by their own color and surface characteristics, and are less affected by changes in lighting. Even if the lighting conditions change, the grayscale values of the pest pixels do not change significantly.
[0038] Therefore, in order to accurately analyze the degree of illumination influence in each area, it is only necessary to analyze the background pixels in the area, because the background pixels can accurately reflect the influence of different illumination conditions. The grayscale value change of the background pixels can directly reflect the change of illumination conditions. If the illumination becomes darker, the background pixels will become darker. If the illumination becomes brighter, the background pixels will become brighter. By analyzing the background pixels separately, it is possible to see more clearly how the illumination conditions change. However, the sensitivity of the pest pixels to the changes in illumination conditions is low. Even if the illumination changes, the brightness of the pest pixels does not change much. If the pest pixels are also included in the analysis of the illumination influence, the brightness of the pest pixels will interfere with the judgment. For example, due to the uneven illumination, there is a shadow area in a certain area. The shadow area contains both background pixels and pest pixels. At this time, the pest pixels will lower the overall grayscale value of the shadow area and cannot accurately reflect the changes in illumination conditions. Therefore, in order to accurately analyze the influence of illumination on the sticky insect board, it is necessary to only focus on the grayscale changes of the background pixels, so that the changes in illumination conditions can be reflected more clearly and accurately.
[0039] Specifically, in each area, find the maximum grayscale value and the minimum grayscale value of all pixels, select any pixel with the maximum grayscale value and any pixel with the minimum grayscale value, take these two pixels as the initial cluster center points, perform K-MEANS clustering based on the grayscale value on all pixels in the area, and divide all pixels in the area into two clusters. The pixels in each cluster are similar to each other. Clustering is an iterative process. During this process, the initial cluster center point will be continuously updated and changed. After clustering is completed, two clusters will be obtained, and each cluster cluster corresponds to a final cluster center point.
[0040] The grayscale mean of the two final cluster center points is calculated and used as the middle grayscale value of the area. This middle grayscale value can preliminarily distinguish the background pixels and pest pixels in the area. The specific distinction method is: the pixels in the area with grayscale values greater than the middle grayscale value are regarded as background pixels, and the pixels other than the background pixels are regarded as pest pixels.
[0041] S3: Calculate the lighting impact of each area.
[0042] First, obtain the mean grayscale value of all background pixels in all regions, and then calculate the degree of illumination influence of the region according to the following formula:
[0043]
[0044] In the formula, For the The degree of light impact in an area For the The number of background pixels contained in the region, is the mean grayscale value of all background pixels in all regions, For the In the region The gray value of the background pixel.
[0045] In this formula, The larger the value, the In the region The grayscale value of a background pixel is lower than the average level of all background pixels. The darker the pixel is, the more likely it is to be affected by the shadow caused by the light, that is, the more likely the pixel is to be in the shadow area. The smaller the value, the brighter the pixel is and the more likely it is not affected by the shadows created by the light. All background pixels in the region correspond to The values are accumulated and averaged, and the grayscale relationship between the background pixels in this area and all the background pixels in all areas is averaged to obtain the value used as the degree of illumination influence in this area.
[0046] S4: Determine the threshold adjustment coefficient of each area according to the difference in illumination impact between each area and its adjacent areas and the distance.
[0047] This step is to determine all adjacent areas of any area, and calculate the threshold adjustment coefficient of the area by considering the degree of illumination influence of the area and its adjacent areas and the Euclidean distance between them. This threshold adjustment coefficient is used to adjust the Otsu threshold of the area.
[0048] First, the adjacent areas in eight directions around each area are regarded as all the adjacent areas of the area, and the threshold adjustment coefficient of each area is calculated according to the following relationship:
[0049]
[0050] In the formula, It is Threshold adjustment factor for each region, It is The number of neighboring regions of a region, It is Region The degree of light influence on adjacent areas, It is Region and its The Euclidean distance between adjacent regions.
[0051] In this formula, Reflects the The relative magnitude of the illumination impact of an area and its adjacent areas. When the value of is large, it means that There is a large difference between the degree of illumination influence of an area and that of its adjacent area, which means that the area is greatly affected by illumination, while its adjacent area is less affected by illumination, or the area is less affected by illumination, while its adjacent area is greatly affected by illumination. Both situations mean that the area requires a larger threshold adjustment coefficient to adjust the Otsu threshold of the area to adapt to different illumination conditions.
[0052] The Euclidean distance indicates the distance between each region and its adjacent regions in space, that is, the distance between the center of each region and the center of its adjacent regions. The farther away the neighboring area is, the more The smaller the influence of the threshold adjustment coefficient of each area, the smaller the influence of the threshold adjustment coefficient of each area, because the illumination conditions of the adjacent areas farther away are more different from those of the current area (compared with the adjacent areas closer to each other), and should not occupy too much weight in the calculation of the threshold adjustment coefficient, while the illumination conditions of the adjacent areas closer to each other are less different from those of the current area, and the adjacent areas closer to each other make the calculation of the adjustment coefficient more accurate. Therefore, the reciprocal of the Euclidean distance is taken in the formula. Participate in calculations.
[0053] Finally, the difference in illumination impact between each area and all adjacent areas and the spatial distance relationship were comprehensively considered to calculate the threshold adjustment coefficient for each area.
[0054] S5: The Otsu threshold of each region is adjusted using the threshold adjustment coefficient of the region, and adaptive threshold segmentation is performed based on the adjusted Otsu thresholds of all regions to obtain pest regions.
[0055] Due to uneven lighting, shadow areas are prone to appear in the image of the sticky insect board. The grayscale values of these shadow areas are between the grayscale values of the background pixels and the grayscale values of the pest pixels. If no adjustment is made, the pixels in the shadow areas are easily mistaken for the pest pixels, resulting in mis-segmentation. Therefore, by appropriately lowering the Otsu threshold of each area through the threshold adjustment coefficient of each area, the shadow area can be better identified as background pixels, reducing the misjudgment of the pixels in the shadow area as pest pixels, thereby improving the accuracy of pest detection.
[0056] Specifically, the method of adjusting the Otsu threshold of each region by the threshold adjustment coefficient of the region is:
[0057]
[0058] In the formula, For the The Otsu threshold after regional adjustment, For the The Otsu threshold of the region, For the Threshold adjustment factor for each region, is the minimum value function.
[0059] By introducing the threshold adjustment coefficient, the Otsu threshold of each area can be dynamically adjusted according to the degree of illumination influence in each area, which enables the Otsu threshold to adapt to the illumination conditions of different areas, thereby improving the accuracy and robustness of segmentation. The threshold adjustment coefficient reflects the degree of illumination influence in each area. Uneven illumination will cause the grayscale value of the shadow area to be between the background and the pest. The threshold adjustment coefficient can better handle these shadow areas and avoid mis-segmentation. The minimum value function ensures that the threshold adjustment coefficient does not exceed 1. This prevents the Otsu threshold from being raised, thereby avoiding mistaking the shadow area for the pest area.
[0060] S6: The insecticidal efficiency is evaluated according to the area ratio of the pest area in the entire image to achieve the detection of insecticidal efficiency.
[0061] Through the previous steps, the adjusted Otsu thresholds have been calculated for each area. These thresholds are dynamically adjusted according to the degree of light influence in each area, and can better adapt to the light conditions in different areas. Next, these adjusted thresholds are used to perform adaptive threshold segmentation on the grayscale image to more accurately identify and segment the pest area.
[0062] The specific steps are as follows: for each area, the adjusted Otsu threshold of the area is used for threshold segmentation. The specific segmentation method is to compare the grayscale value of each pixel in the area with the adjusted Otsu threshold. If the grayscale value of the pixel is less than the adjusted Otsu threshold, it is marked as a pest pixel. If the grayscale value of the pixel is greater than or equal to the adjusted Otsu threshold, it is marked as a background pixel. Finally, the threshold segmentation result of the grayscale image is obtained. The segmentation result includes: a plurality of background areas composed of background pixels and a plurality of pest areas composed of pest pixels.
[0063] In addition, in order to ensure that the boundaries between adjacent areas are smoother, after the threshold segmentation result of the grayscale image is finally obtained, smoothing processing technology (such as morphological operations) can be further used to eliminate possible boundary artifacts, and then the segmented grayscale image is converted into a binary image, in which the pest area is represented by black and the background area is represented by white, and then the connected area analysis is performed.
[0064] Then, every The image of the sticky insect board is collected once every minute for one day, and the above operations from step S1 to this step are performed to accurately segment the pest area in the grayscale image corresponding to each sticky insect board image.
[0065] Calculate the area ratio of the pest area in each grayscale image as the insect sticking rate of the sticky board at the collection time corresponding to the grayscale image, where the area ratio can be expressed by the ratio of the number of pixels. Calculate the absolute value of the difference between the sticking rates of each two adjacent grayscale images as the difference in the sticking rates of the two adjacent grayscale images. The ratio of is taken as the insecticidal efficiency of the sticky insect board in these two adjacent grayscale images, and the average of the insecticidal efficiency of the sticky insect board in all adjacent grayscale images within one day is taken as the insecticidal efficiency of the sticky insect board. In this embodiment, The default value is set to 10 (experience value).
[0066] In conclusion, by performing adaptive threshold segmentation based on the adjusted Otsu threshold for all regions, pest areas can be identified and segmented more accurately. This method not only takes into account the impact of light changes, but also improves the accuracy of segmentation by dynamically adjusting the threshold. Finally, the insecticidal efficiency of sticky insect boards can be effectively evaluated by further processing and analysis of the segmentation results.
[0067] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0068] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A method for detecting insecticidal efficiency of sticky insect boards based on image processing, characterized in that: include: Preprocessing the image of the insect sticky board to obtain a grayscale image, dividing the grayscale image into a plurality of regions of equal size, obtaining the Otsu threshold and the intermediate grayscale value of each region, and taking the pixel points in each region whose grayscale value is greater than the intermediate grayscale value as background pixel points; Calculate the lighting impact of each area: , where For the The degree of light impact in an area For the The number of background pixels contained in the region, is the mean grayscale value of all background pixels in all regions, For the In the region Gray value of background pixels; Get all adjacent regions of each region and calculate the threshold adjustment coefficient for each region: , where It is Threshold adjustment factor for each region, It is The number of neighboring regions of a region, It is Region The degree of light influence on adjacent areas, It is Region and its The Euclidean distance between adjacent regions; The Otsu threshold of each area is adjusted by the threshold adjustment coefficient of the area, and the grayscale image is adaptively threshold segmented based on the adjusted Otsu threshold to segment the pest area. The insecticidal efficiency of the sticky insect board is determined according to the area ratio of the pest area in the grayscale image to complete the insecticidal efficiency detection.
2. The method for detecting insecticidal efficiency of sticky insect boards based on image processing according to claim 1, wherein: Methods for determining the insecticide efficiency based on the area ratio of the pest area in the grayscale image include: Every The grayscale image of the sticky insect board is collected every minute, and the area ratio of the pest area in the grayscale image is taken as the sticky insect rate of the sticky insect board at the collection time corresponding to the grayscale image. is the default value; Calculate the absolute value of the difference between the sticking rates of each two adjacent grayscale images as the sticking rate difference of the two adjacent grayscale images, and add the sticking rate difference of the two adjacent grayscale images to the The ratio of is taken as the insecticidal efficiency of the sticky insect board in these two adjacent grayscale images; The mean of the insecticidal efficiencies of all adjacent grayscale images of the sticky insect board within one day is taken as the insecticidal efficiency of the sticky insect board.
3. The method for detecting insecticidal efficiency of sticky insect boards based on image processing according to claim 1, characterized in that: The method of adjusting the Otsu threshold of each region by the threshold adjustment coefficient of the region is: ,in, For the The Otsu threshold after regional adjustment, For the The Otsu threshold of the region, For the Threshold adjustment factor for each region, is the minimum value function.
4. The method for detecting insecticidal efficiency of sticky insect boards based on image processing according to claim 1, wherein: The preprocessing comprises: performing Gaussian filtering on the R, G and B channels of the image of the insect sticky board respectively, and graying the image after the Gaussian filtering.
5. The method for detecting insecticidal efficiency of sticky insect boards based on image processing according to claim 2, wherein: The area ratio of the pest region in the grayscale image is equal to the ratio of the number of pixels included in the pest region to the number of pixels included in the grayscale image.
6. The method for detecting insecticidal efficiency of sticky insect boards based on image processing according to claim 3, characterized in that: The Otsu threshold for each region was obtained using the Otsu method.
7. The method for detecting insecticidal efficiency of sticky insect boards based on image processing according to claim 6, characterized in that: The method for obtaining the intermediate gray value is: Get the maximum grayscale value and minimum grayscale value of all pixels in each area, select a pixel with the maximum grayscale value and a pixel with the minimum grayscale value, and use these two pixels as the two initial cluster center points respectively. Perform K-MEANS clustering on all pixels in the area based on the size of the grayscale value. After clustering, get the two final cluster center points, and use the grayscale mean of these two final cluster center points as the intermediate grayscale value of all pixels in the area.
8. The method for detecting insecticidal efficiency of sticky insect boards based on image processing according to claim 6, characterized in that: All adjacent regions of each region are adjacent regions in eight directions around the region.
Citation Information
Patent Citations
Cotton pest identification and classification method and device
CN109102004A
Fluorescent glue defect segmentation method robust to illumination change
CN110610496A
Cable insulation skin damage identification method
CN118037735A