Termite monitoring method and system based on visual identification and medium
By using visual recognition-based methods in dam termite monitoring, and using Gaussian modeling and cumulative difference algorithms to automatically judge termite activities, the problems of low efficiency and labor consumption in the existing technology are solved, and efficient and automatic termite monitoring is achieved.
Patent Information
- Application Number
- CN202510032722.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-09
- Publication Date
- 2025-02-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is inefficient and labor-intensive in dam termite monitoring, making it difficult to accurately locate termite nests and cannot grasp termite hazard dynamics in time.
The termite monitoring method based on visual recognition is adopted, and the video images in the monitoring video are obtained, and the binary mask map is generated using Gaussian modeling and cumulative difference algorithms are used to extract the connected domain and compare the pixel area, and termite activity is automatically judged.
Automatic monitoring of termite activities is realized, the time and energy of manual search is reduced, the monitoring efficiency is improved, and the monitoring results of termite activities can be obtained in a timely and intuitive manner.
Smart Images

Figure CN119445452A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image recognition, and in particular to a termite monitoring method, system and medium based on visual recognition. Background Art
[0002] Termites are a major hidden danger to the safe operation of water conservancy projects. Their harm may lead to major dangerous situations such as pipe bursts, subsidence, and landslides in reservoir dams, and even cause disasters such as dam collapse, causing immeasurable losses to the country and people’s lives and property. Therefore, termite monitoring is crucial to ensure the safety of water conservancy projects.
[0003] At present, termite monitoring in dams mainly relies on manual search through surface signs to determine the extent and location of termite damage, or regular inspections by installing termite attractant monitoring devices. However, these methods have many limitations. For example, manual search is time-consuming and laborious, and it is difficult to accurately locate termite nests; although the attractant monitoring device can monitor termite activities, it cannot grasp the dynamics of termite damage in a timely manner and is easily affected by environmental factors. Therefore, traditional monitoring technology can no longer meet the needs of dam termite monitoring. Summary of the invention
[0004] Purpose of the invention: The purpose of the present invention is to solve the defects of low efficiency and labor-intensive termite detection in the prior art, and to provide a termite monitoring method, system and medium based on visual recognition, so as to realize automatic monitoring of termites in surveillance videos, without the need for manual inspection at all times, thereby improving the efficiency of monitoring.
[0005] One or more embodiments of the present specification simultaneously relate to a termite monitoring method based on visual recognition, a system, and a computer-readable storage medium to solve the technical defects existing in the prior art.
[0006] Technical solution:
[0007] In the first aspect, the present application proposes a termite monitoring method based on visual recognition, comprising the steps of:
[0008] Acquire video images shot of termites, including acquiring a first-collected video in the video image as a monitoring template and acquiring monitoring images acquired at regular intervals after acquiring the first-collected video;
[0009] The monitoring template and the monitoring image are respectively obtained by Gaussian modeling and cumulative difference algorithm to obtain a first binary mask image and a second binary mask image;
[0010] Connected domain extraction is performed on the first binary mask image and the second binary mask image respectively to obtain the first connected domain pixel area and the second connected domain pixel area respectively. If the number of image frames in which the pixel area of the first connected domain reaches the set threshold reaches a set ratio, and the number of image frames in which the pixel area of the second connected domain reaches the set threshold also reaches a set ratio, it is determined that termite activity is currently present.
[0011] Preferably, obtaining the first collected video in the video image as a monitoring template and obtaining the monitoring image periodically after obtaining the first collected video includes:
[0012] The monitoring template is the first surveillance video collected, with a duration of 1 minute. One frame of image is taken every 1 second, and 60 frames of image are obtained as the monitoring template;
[0013] The monitoring image is a frame of image taken every 1 second during each recognition within N minutes.
[0014] Preferably, obtaining a first binary mask image by Gaussian modeling of the monitoring template and the monitoring image includes:
[0015] Initialize multiple Gaussian distributions for each pixel point of each frame image of the monitoring template to obtain a background model;
[0016] The foreground image is obtained according to the matching degree between the frame image pixels of the monitoring image and the background model;
[0017] The obtained foreground image is subjected to morphological denoising to generate a first binary mask image.
[0018] Preferably, obtaining the foreground image according to the matching degree between the frame image pixels of the monitoring image and the background model includes:
[0019] If the value of a pixel point in the frame image of the monitoring image does not match any of the K Gaussian distributions, it means that the pixel belongs to the foreground.
[0020] Preferably, obtaining a second binary mask image by using a cumulative difference algorithm on the monitoring template and the monitoring image includes:
[0021] Take a frame of image of the monitoring template every second, and average the images of all monitoring templates to obtain the template image;
[0022] Take a frame of the monitoring image at intervals of one second, and average the 60 frames of images taken every minute to get the average pixel value;
[0023] The gray value difference between the average pixel value and the template image is used to obtain the difference result;
[0024] The difference result is binarized and morphologically denoised to obtain the second binary mask image.
[0025] Preferably, performing binarization and morphological denoising on the difference result to obtain a second binary mask image comprises:
[0026] Binarization uses hard thresholding method, the threshold is set to 30 by default, and morphological operations include morphological opening and morphological closing operations.
[0027] Preferably, connected domain extraction is performed on the first binary mask image and the second binary mask image to obtain the first connected domain pixel area and the second connected domain pixel area respectively. If the number of image frames whose pixel area of the first connected domain reaches a set threshold reaches a set ratio, and the number of image frames whose pixel area of the second connected domain reaches the set threshold also reaches a set ratio, it is determined that termite activity currently exists, including:
[0028] Extracting all connected foreground areas from the first binary mask image and the second binary mask image, namely, the pixel area of the first connected domain and the pixel area of the second connected domain;
[0029] Eliminate irrelevant noise and small areas through area filtering;
[0030] An area threshold is set. If the pixel area of the first connected domain is greater than the set threshold, it is determined that termite activity exists in the current frame. If the number of image frames determined to have termite activity in the first binary mask reaches 80%, the video processing using the Gaussian modeling method can determine that termite activity exists.
[0031] If the pixel area of the second connected domain is greater than the set threshold, it is determined that termite activity exists in the current frame. If the image frames determined to have termite activity in the second binary mask image reach 80%, the cumulative difference algorithm can be used to determine that termite activity exists.
[0032] If the video processing of the Gaussian modeling method and the cumulative difference algorithm can both determine the existence of termite activity, the result that the termite activity is true is output.
[0033] Preferably, the method further includes: when it is determined that termite activity currently exists, reporting the identification date, identification result and identification image to the platform.
[0034] In a second aspect, the present invention provides a termite monitoring system based on visual recognition, including a sensing device, an edge device and a platform end, wherein the sensing device is connected to the platform end through the edge device, the edge device includes a memory and a processor, and the memory stores a computer program that can be run on the processor. When the computer program is executed by the processor, the processor implements a method as described in any one of the above embodiments.
[0035] In a third aspect, the present invention provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method as described in any one of the above embodiments is implemented.
[0036] Beneficial effects: The present invention adopts template-based improved mixed Gaussian modeling and template-based cumulative difference algorithm, which are combined to determine whether there is termite activity, and can obtain the monitoring results of termite activity in a timely and intuitive manner, reducing the time and effort of manual search and improving the efficiency of monitoring;
[0037] The monitoring template is used for Gaussian distribution calculation without updating the Gaussian distribution. The monitoring image after the first collected video is used as the difference without updating the template value. This is more suitable for termite detection needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 Provide a schematic diagram of the method framework for the present invention;
[0039] Figure 2 Provide a flow chart of the present invention;
[0040] Figure 3 Provides a schematic diagram of the process of timing the opening of the fill light for the present invention;
[0041] Figure 4 It is a structural diagram of a system provided by an embodiment of the present application;
[0042] Figure 5 It is a structural schematic diagram of a bait box provided by an embodiment of the present application;
[0043] Figure 6 This is a schematic diagram of a data transmission structure provided by an embodiment of the present application;
[0044] Figure 7 This is a schematic diagram of the edge device structure provided in one embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the technical solution of the present invention clearer, the present invention is further described in detail below with reference to the specific embodiments of the accompanying drawings.
[0046] Example 1
[0047] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Unless otherwise defined, the technical terms or scientific terms used herein should be understood by people with general skills in the field to which the present invention belongs. "Including" and similar words used in this article mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects.
[0048] In view of the problems existing in the existing technology, such as Figure 1 and Figure 2 As shown, a termite monitoring method based on visual recognition includes the following steps:
[0049] Acquire video images shot of termites, including acquiring a first-collected video in the video image as a monitoring template and acquiring monitoring images acquired at regular intervals after acquiring the first-collected video;
[0050] The monitoring template and the monitoring image are respectively obtained by Gaussian modeling and cumulative difference algorithm to obtain a first binary mask image and a second binary mask image;
[0051] Connected domain extraction is performed on the first binary mask image and the second binary mask image respectively to obtain the first connected domain pixel area and the second connected domain pixel area respectively. If the number of image frames in which the pixel area of the first connected domain reaches the set threshold reaches a set ratio, and the number of image frames in which the pixel area of the second connected domain reaches the set threshold also reaches a set ratio, it is determined that termite activity is currently present.
[0052] Specifically, by using the first acquired video as a detection template, this template can be processed in two ways. One is to use Gaussian modeling to process the first acquired video as a monitoring template and a monitoring image acquired regularly after the first acquired video is acquired. The other scheme is to use the cumulative difference algorithm to process the first acquired video as a monitoring template and a monitoring image acquired regularly after the first acquired video is acquired. Both of the above schemes can obtain a binary mask map, and then perform connected domain processing on the binary mask map. When the area is greater than the set threshold, it represents termite activity. Only after the two schemes obtain the structure with termite activity, will the final determination of termite activity be made to improve the accuracy of monitoring.
[0053] In some preferred embodiments, obtaining a first-collected video in a video image as a monitoring template and obtaining a monitoring image periodically obtained after obtaining the first-collected video includes:
[0054] The monitoring template is the first surveillance video collected, with a duration of 1 minute. One frame of image is taken every 1 second, and 60 frames of image are obtained as the monitoring template;
[0055] The monitoring image is a frame of image taken every 1 second during each recognition within N minutes.
[0056] Specifically, the acquired images are distributed as one-minute images collected for the first time. The purpose of this one-minute image is to determine a fixed template when there are no termites. Then, when the subsequent monitoring video is compared with this fixed template, it is determined whether there is termite activity.
[0057] Each time the identification is performed, N is a variable parameter, which indicates the length of the observation period required for each termite activity identification. The value of N can be adjusted according to the actual situation, such as the frequency of termite activities, the stability of the monitoring environment, etc.
[0058] A frame of image is taken every 1 second. Similar to the way of obtaining monitoring templates, we also capture a frame of image every 1 second during each identification for N minutes. This is done to capture possible termite activities during this period.
[0059] In some preferred embodiments, obtaining a first binary mask image by Gaussian modeling of the monitoring template and the monitoring image includes:
[0060] Initialize multiple Gaussian distributions for each pixel point of each frame image of the monitoring template to obtain a background model;
[0061] The foreground image is obtained according to the matching degree between the frame image pixels of the monitoring image and the background model;
[0062] The obtained foreground image is subjected to morphological denoising to generate a first binary mask image.
[0063] Specific:
[0064] (1) Initialization of background model
[0065] Initialize multiple Gaussian distributions for each pixel of each frame of the monitoring template:
[0066] The monitoring template is composed of a frame of image captured every 1 second in the first collected surveillance video, with a total of 60 frames. Each frame of the monitoring template is analyzed at the pixel level. For each pixel, multiple Gaussian distributions are initialized (usually K Gaussian distributions are used to represent the background of each pixel). These Gaussian distributions are used to model the color or brightness changes of each pixel at different times, reflecting the common characteristics of the background. During initialization, the parameters such as the mean, variance and weight of these Gaussian distributions need to be set according to the actual situation. Usually, the mean can be set to the initial value of the pixel, the variance can be set to a smaller value, and the weight can be set to be equal or allocated according to some prior knowledge.
[0067] (2) Acquisition of foreground image
[0068] The foreground image is obtained according to the matching degree between the frame image pixels of the monitoring image and the background model:
[0069] Determine whether each pixel in the monitoring image frame belongs to the foreground based on the matching degree between the pixel and the background model;
[0070] Set a threshold. If the matching degree of a certain pixel with all Gaussian distributions is lower than this threshold (i.e., none of them match well), the pixel is considered to belong to the foreground; otherwise, the pixel is considered to belong to the background.
[0071] (3) Perform morphological denoising on the obtained foreground image:
[0072] The foreground image may contain some noise or small isolated points, which will affect the subsequent connected domain extraction and pixel area comparison steps;
[0073] Therefore, we need to perform morphological denoising on the foreground image, which usually includes steps such as corrosion, dilation, opening and closing operations; these steps can help remove small noise points, fill small holes and connect adjacent foreground areas;
[0074] Generate the first binary mask image. After morphological denoising, we get a clearer and more accurate foreground image. Convert this foreground image into a binary mask image (i.e., the first binary mask image), where the value of the foreground pixel is 1 (or white) and the value of the background pixel is 0 (or black).
[0075] This binary mask image will be used in the subsequent connected domain extraction and pixel area comparison steps to determine whether there is termite activity in the current frame.
[0076] In some preferred embodiments, obtaining a foreground image according to the degree of matching between the frame image pixels of the monitoring image and the background model includes:
[0077] If the value of a pixel point in the frame image of the monitoring image does not match any of the K Gaussian distributions, it means that the pixel belongs to the foreground.
[0078] Specifically, once it is determined that a certain pixel does not match any Gaussian distribution in the background model, we can mark the pixel as a foreground pixel. By traversing all pixels in the monitoring image and marking the foreground pixels according to the above matching judgment results, we can generate a complete foreground image, which will contain all pixels judged to be foreground objects.
[0079] In some preferred embodiments, obtaining a second binary mask image by using a cumulative difference algorithm on the monitoring template and the monitoring image includes:
[0080] Take a frame of image of the monitoring template every second, and average the images of all monitoring templates to obtain the template image;
[0081] Take a frame of the monitoring image at intervals of one second, and average the 60 frames of images taken every minute to get the average pixel value;
[0082] The gray value difference between the average pixel value and the template image is used to obtain the difference result;
[0083] The difference result is binarized and morphologically denoised to obtain the second binary mask image.
[0084] Specifically, first, take a frame of image from the monitoring template every second, so that 60 frames of image can be obtained within one minute, and average these 60 frames of image, that is, take the average value of each pixel in all 60 frames to obtain a template image, which represents the average state of the background environment and is used for subsequent differential processing. During the monitoring process, take a frame of image at intervals of one second. Whenever the accumulation reaches one minute (i.e. 60 frames of image), average these images to obtain a new average pixel value image. This image represents the average state of the background environment during the current monitoring period, and the formula is as follows:
[0085] ;
[0086] Where P i (x, y) is the i-th frame image, T(x, y) is the generated template image;
[0087] Perform grayscale value difference processing on the average pixel value image obtained in the previous step and the template image. That is, for each pixel point, calculate the difference between its grayscale value in the average pixel value image and its grayscale value in the template image. The value of each pixel point in the difference result image reflects the degree of change from the template image to the current average pixel value image. The formula is as follows:
[0088] ;
[0089] Among them, for each image captured for recognition, the average pixel value M of 60 frames of images per second is calculated every one minute. i (x, y), and make gray value difference with the template image, the difference result is R(x, y);
[0090] Binarization is performed on the difference result image, and the pixel values are converted to 0 or 1 (or black and white) to distinguish the foreground and background. This is achieved by setting a threshold. Pixels greater than the threshold are judged as foreground, and pixels less than the threshold are judged as background.
[0091] Since the binarized image may contain some noise or small isolated points, morphological denoising is required, which includes steps such as erosion, dilation, opening and closing operations to remove noise points and optimize the shape and contour of the foreground object;
[0092] After the above steps, we get a denoised binary image, that is, the second binary mask image. The final binary mask image formula is as follows:
[0093] ;
[0094] Among them, T p is the threshold value.
[0095] In some preferred embodiments, binarizing and morphologically denoising the difference result to obtain a second binary mask image comprises:
[0096] Binarization uses hard thresholding method, the threshold is set to 30 by default, and morphological operations include morphological opening and morphological closing operations.
[0097] Specifically, the grayscale image is converted into a binary image according to a fixed threshold value, and the threshold value is set to 30. For each pixel in the difference result image, if its grayscale value is greater than or equal to 30, the pixel is set to white (or 1) in the binary image; if its grayscale value is less than 30, it is set to black (or 0);
[0098] Morphological opening operation: A morphological operation of first erosion and then dilation. It is mainly used to remove small objects (noise) in the image or disconnect small connections between objects. The binary image is eroded to remove objects smaller than the structural element; then the eroded image is dilated to restore the eroded part but retain the effect of removing noise. The size and shape of the structural element will affect the effect of the morphological opening operation. In practical applications, it is necessary to select a suitable structural element according to the size and shape of the termite.
[0099] Morphological closing operation: a morphological operation of dilation followed by erosion. It is mainly used to fill small holes or tiny gaps in an image and connect adjacent objects. A dilation operation is performed on a binary image to fill small holes or gaps; then an erosion operation is performed on the dilated image to remove the extra parts caused by the dilation but retain the filling effect. Similarly, the size and shape of the structural element will affect the effect of the morphological closing operation, and a suitable structural element needs to be selected according to the actual situation.
[0100] In some preferred embodiments, connected domain extraction is performed on the first binary mask image and the second binary mask image to obtain the first connected domain pixel area and the second connected domain pixel area respectively. If the number of image frames whose pixel area of the first connected domain reaches a set threshold reaches a set ratio, and the number of image frames whose pixel area of the second connected domain reaches the set threshold also reaches a set ratio, it is determined that termite activity currently exists, including:
[0101] Extracting all connected foreground areas from the first binary mask image and the second binary mask image, namely, the pixel area of the first connected domain and the pixel area of the second connected domain;
[0102] Eliminate irrelevant noise and small areas through area filtering;
[0103] An area threshold is set. If the pixel area of the first connected domain is greater than the set threshold, it is determined that termite activity exists in the current frame. If the number of image frames determined to have termite activity in the first binary mask reaches 80%, the video processing using the Gaussian modeling method can determine that termite activity exists.
[0104] If the pixel area of the second connected domain is greater than the set threshold, it is determined that termite activity exists in the current frame. If the image frames determined to have termite activity in the second binary mask image reach 80%, the cumulative difference algorithm can be used to determine that termite activity exists.
[0105] Specifically, according to the size of termites and image resolution, a reasonable area threshold is set. This threshold is used to exclude those connected domains that are too small, may be noise or irrelevant objects, and the threshold can be 10% of the width and height of the image by default.
[0106] Determination of pixel area of the first connected domain:
[0107] For each connected domain in the first binary mask image, its pixel area is calculated. If the area of a connected domain is greater than a set threshold, it is considered that termite activity exists in the frame image.
[0108] If 80% of all the recognized image frames have connected domains with an area exceeding the threshold, it can be determined that termite activity exists in the video processed by the Gaussian modeling method at the current moment;
[0109] Determination of pixel area of the second connected domain:
[0110] Similarly, for each connected domain in the second binary mask image, the same area calculation and threshold judgment are performed. If the area of a connected domain is greater than the set threshold, it is considered that termite activity exists in the frame image.
[0111] If 80% of all the recognized image frames have connected domains with an area exceeding the threshold, it can be determined that termite activity exists in the video processed by the cumulative difference algorithm at the current moment;
[0112] Comprehensive judgment:
[0113] If the video processing of both the Gaussian modeling method and the cumulative difference algorithm can determine the existence of termite activity, then it is finally confirmed that termite activity exists at the current point.
[0114] In some preferred embodiments, the method further includes: when it is determined that termite activity currently exists, reporting the identification date, identification result and identification image to the platform end 9.
[0115] In a second aspect, the present invention provides a termite monitoring system based on visual recognition, combined with Figure 4 and Figure 5 , including a sensing device 8, an edge device 3 and a platform end 9, wherein the sensing device 8 is connected to the platform end 9 through the edge device 3.
[0116] In some preferred embodiments, the sensing device 8 includes a camera and a built-in fill light to ensure that a clear image can be captured even in a low-light environment;
[0117] Key features:
[0118] Video image acquisition: The camera is responsible for capturing video images of the monitored area in a timely manner;
[0119] You can watch N minutes of video collected during the detection;
[0120] The edge device 3 includes:
[0121] Termite detection model: used to identify termite activities in video images;
[0122] Algorithm service: provides the operating environment and necessary computing resources for the termite detection model;
[0123] Data collection, processing, storage, and upload program: responsible for acquiring video images from the sensing device 8, performing preprocessing (such as format conversion, compression, etc.), storing important data, and uploading the processed data (such as recognition results, warning pictures, etc.) to the platform end 9;
[0124] Device basic information configuration page: used to configure and manage basic information of edge devices 3, such as device code, online status, operation and maintenance personnel, etc.
[0125] Key features:
[0126] Connecting to the sensing device 8: Establishing a connection with the sensing device 8 through a universal protocol (such as UVC protocol) to obtain video image information in a timely manner;
[0127] Termite identification: Call the termite detection model to analyze the video images in real time and identify termite activities;
[0128] Warning synchronization: When termite activity is detected, the edge device 3 will generate warning images and information and synchronize them to the platform end 9;
[0129] Equipment management: Provides configuration and management functions for basic equipment information to ensure normal operation and effective maintenance of equipment;
[0130] Platform 9 includes:
[0131] Video aggregation platform: used to receive and display video images and warning data from various edge devices 3;
[0132] Device display page: displays the status, location, operation and maintenance personnel of all online devices;
[0133] Model update service: responsible for online updating and optimization of termite detection models;
[0134] Early warning service: Generate early warning information based on early warning data and send it to designated staff;
[0135] Key features:
[0136] Warning data display: Provides an intuitive interface to display warning data, including warning pictures, locations, time and other information;
[0137] Warning plan configuration: allows users to configure multiple warning plans according to actual needs, such as warning level, notification method, etc.;
[0138] Device configuration and management: Provides device information query, configuration and management functions, and supports operations such as adding, deleting and modifying online devices;
[0139] Algorithm management: responsible for uploading, downloading, updating and optimizing termite detection models to ensure the accuracy and effectiveness of the models;
[0140] User rights allocation: Assign different rights according to user roles and needs to ensure the security and controllability of the system;
[0141] Also included is a bait box 6: a built-in pine wood strip to attract termites, and a camera is placed inside the bait box 6.
[0142] In some specific embodiments, Figure 6 The data flow is as follows: the edge device 3 collects the camera image data and stores it in the edge device 3. The termite monitoring algorithm in the edge device 3 processes the calculation and identification, and transmits the image data to the platform end 9 through the MQTT protocol data. The platform end 9 can send the algorithm upgrade package data to the edge device 3 for updating and upgrading. The platform sends the warning image data to the operation and maintenance personnel for SMS reception.
[0143] In some specific embodiments, Figure 3 , the camera will turn on the fill light at a fixed time. The specific steps are as follows:
[0144] The camera of the termite monitoring device has a built-in fill light, which communicates with the edge device 3 through the USB interface, and the edge device 3 sets the timer through the software;
[0145] The software of edge device 3 queries whether the scheduled time has been reached;
[0146] If the timing is reached, the USB interface power supply is turned on through the serial port command, so that the camera and the built-in fill light are started;
[0147] Edge device 3 collects video streams through the UVC protocol;
[0148] When the preset collection time is over, the edge device 3 turns off the USB interface power supply through the serial port command, and the camera and the built-in fill light are turned off.
[0149] In some specific embodiments, Figure 5 The box 2 is set on the pole 1, the pole 1 is set on the ground 5, the edge device 3 and the wireless 4G router 4 are set in the box 2, the camera 7 is set in the bait box 6, and the camera 7 is electrically connected to the edge device 3.
[0150] In other embodiments of the present invention, Figure 7 , the edge device 3 includes one or more processors 401; a memory 402; one or more applications (not shown); and one or more computer programs 404, and the above-mentioned components can be connected through one or more communication buses 405. The one or more computer programs 404 are stored in the above-mentioned memory 402 and are configured to be executed by the one or more processors 401. The one or more computer programs 404 include instructions, which can be used to execute such as Figure 1 to Figure 2 And each step in the corresponding embodiment.
[0151] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk and other media that can store program codes.
[0152] The above is only a specific implementation of the embodiment of the present invention, but the protection scope of the embodiment of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiment of the present invention should be included in the protection scope of the embodiment of the present invention. Therefore, the protection scope of the embodiment of the present invention should be based on the protection scope of the claims.
Claims
1. A termite monitoring method based on visual recognition, characterized in that: Includes steps: Acquire video images shot of termites, including acquiring a first-collected video in the video image as a monitoring template and acquiring monitoring images acquired at regular intervals after acquiring the first-collected video; The monitoring template and the monitoring image are respectively obtained by Gaussian modeling and cumulative difference algorithm to obtain a first binary mask image and a second binary mask image; Connected domain extraction is performed on the first binary mask image and the second binary mask image respectively to obtain the first connected domain pixel area and the second connected domain pixel area respectively. If the number of image frames in which the pixel area of the first connected domain reaches the set threshold reaches a set ratio, and the number of image frames in which the pixel area of the second connected domain reaches the set threshold also reaches a set ratio, it is determined that termite activity is currently present.
2. A termite monitoring method based on visual recognition according to claim 1, characterized in that: The first collected video is obtained in the video image as a monitoring template and the monitoring image obtained periodically after the first collected video is obtained includes: The monitoring template is the first surveillance video collected, with a duration of 1 minute. One frame of image is taken every 1 second, and 60 frames of image are obtained as the monitoring template; The monitoring image is a frame of image taken every 1 second during each recognition within N minutes.
3. The method for monitoring termites based on visual recognition according to claim 1, characterized in that: The monitoring template and the monitoring image are modeled by Gaussian to obtain the first binary mask image, including: Initialize multiple Gaussian distributions for each pixel point of each frame image of the monitoring template to obtain a background model; The foreground image is obtained according to the matching degree between the frame image pixels of the monitoring image and the background model; The obtained foreground image is subjected to morphological denoising to generate a first binary mask image.
4. A method for monitoring termites based on visual recognition according to claim 3, characterized in that: The foreground image obtained according to the matching degree between the frame image pixels of the monitoring image and the background model includes: If the value of a pixel point in the frame image of the monitoring image does not match any of the K Gaussian distributions, it means that the pixel belongs to the foreground.
5. The method for monitoring termites based on visual recognition according to claim 1, characterized in that: The second binary mask image is obtained by using the monitoring template and the monitoring image through the cumulative difference algorithm, including: Take a frame of image of the monitoring template every second, and average the images of all monitoring templates to obtain the template image; Take a frame of the monitoring image at intervals of one second, and average the 60 frames of images taken every minute to get the average pixel value; The gray value difference between the average pixel value and the template image is used to obtain the difference result; The difference result is binarized and morphologically denoised to obtain the second binary mask image.
6. A method for monitoring termites based on visual recognition according to claim 5, characterized in that: The second binary mask image obtained by binarizing and morphologically denoising the difference result includes: Binarization uses hard thresholding method, the threshold is set to 30 by default, and morphological operations include morphological opening and morphological closing operations.
7. The method for monitoring termites based on visual recognition according to claim 1, characterized in that: Connected domain extraction is performed on the first binary mask image and the second binary mask image to obtain the first connected domain pixel area and the second connected domain pixel area respectively. If the number of image frames whose pixel area of the first connected domain reaches a set threshold reaches a set ratio, and the number of image frames whose pixel area of the second connected domain reaches a set threshold also reaches a set ratio, it is determined that termite activity currently exists, including: Extracting all connected foreground areas from the first binary mask image and the second binary mask image, namely, the pixel area of the first connected domain and the pixel area of the second connected domain; Eliminate irrelevant noise and small areas through area filtering; An area threshold is set. If the pixel area of the first connected domain is greater than the set threshold, it is determined that termite activity exists in the current frame. If the number of image frames determined to have termite activity in the first binary mask reaches 80%, the video processing using the Gaussian modeling method can determine that termite activity exists. If the pixel area of the second connected domain is greater than the set threshold, it is determined that termite activity exists in the current frame. If the image frames determined to have termite activity in the second binary mask image reach 80%, the cumulative difference algorithm can be used to determine that termite activity exists. If the video processing of the Gaussian modeling method and the cumulative difference algorithm can both determine the existence of termite activity, the result that the termite activity is true is output.
8. The method for monitoring termites based on visual recognition according to claim 1, characterized in that: Also includes: When it is determined that termite activity is currently present, the identification date, identification result and identification image are reported to the platform.
9. A termite monitoring system based on visual recognition, characterized in that: It includes a sensing device, an edge device and a platform end, the sensing device is connected to the platform end through the edge device, the edge device includes a memory and a processor, the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the processor implements the method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Real-time weld defect detection method based on improved background difference method
CN106770318A
Termite monitoring method and device and storage device
CN110992389A
Hazardous article identification early warning method based on Gaussian mixture model and convolutional neural network
CN112651355A
Dam termite video identification method based on optical flow network and Gaussian background modeling
CN114626445A
Cited By
Intelligent analysis method and system for monitoring data of visual termite monitoring device
CN119863759A