Relic detection method, related equipment and storage medium

By using multiple image frames to determine the first image and the second image in the legacy detection, and performing differential operations and differentiation processing, the problem of not being able to filter the moving target in the prior art is solved, and the accuracy of legacy detection is improved.

CN113673454BActive Publication Date: 2025-02-28SOUNDAI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110986893.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-26
Publication Date
2025-02-28
Estimated Expiration
2041-08-26

AI Technical Summary

Technical Problem

Existing relic detection methods cannot effectively filter moving targets, resulting in reduced detection accuracy.

Method used

By acquiring the target video and reading the image frames frame by frame, in the process of reading the image frame, the first image is updated based on the N recently read image frames, the second image is determined based on the M first images of the recently updated target video, the current first image and the second image are differentiated to obtain the target image, and the target image is differentiated to determine the legacy area.

Benefits of technology

By determining the first image and the second image using a plurality of image frames, it is possible to filter the moving targets that are temporarily staying in the current image frame, and improve the accuracy of legacy detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113673454B_ABST
    Figure CN113673454B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for detecting a relic, related equipment and storage medium. The method comprises: obtaining a target video, reading image frames from the target video frame by frame; in the process of reading the image frames, updating the first image corresponding to the target video based on the most recently read N image frames; determining the second image based on the most recently updated M first images of the target video; performing a differential operation on the current first image corresponding to the target video and the second image to obtain the target image; performing differential processing on the target image to determine the relic area in the target image. In an embodiment of the present invention, a plurality of image frames are used to determine the first image, and a plurality of first images are used to determine the second image, so as to filter the moving target that briefly stays in the current image frame, thereby improving the accuracy of relic detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a residue detection method, related equipment and storage medium. Background Art

[0002] Object detection is a basic function in intelligent video surveillance. Object detection mainly uses computer vision technology to detect static objects in surveillance videos and convert the area where the objects are located into a bounding box that can identify the objects.

[0003] At present, the method of detecting the remnants is to establish a background image frame, use the current image frame and the background image frame to perform a differential operation, and obtain the area where the remnants are located in the background image frame. However, in the above-mentioned remnant detection process, the moving target that briefly stays in the current image frame may be mistaken for the remnants, generating an erroneous detection result, which reduces the accuracy of the remnant detection. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a method for detecting a relic, a related device and a storage medium, so as to solve the technical problem that the existing method for detecting a relic cannot filter moving targets, thereby reducing the accuracy of detecting a relic. The specific technical solution is as follows:

[0005] In a first aspect of an embodiment of the present invention, a method for detecting a residue is first provided, comprising:

[0006] Acquire a target video, and read image frames from the target video frame by frame;

[0007] In the process of reading the image frames, based on the most recently read N image frames, updating the first image corresponding to the target video; the first image is used to represent the current scene of the target video, and N is a first preset value;

[0008] Determine a second image based on the M first images most recently updated in the target video; the second image is used to represent the background of the target video, and M is a second preset value;

[0009] Performing a difference operation between the current first image corresponding to the target video and the second image to obtain a target image;

[0010] Performing differentiation processing on the target image to determine a residue area in the target image.

[0011] In a second aspect of the embodiments of the present invention, a device for detecting residual objects is further provided, the device comprising:

[0012] An acquisition module, used for acquiring a target video and reading image frames from the target video frame by frame;

[0013] An updating module, used to update a first image corresponding to the target video based on the most recently read N image frames during the process of reading the image frames; the first image is used to represent the current scene of the target video, and N is a first preset value;

[0014] A first determination module is used to determine a second image based on the M first images most recently updated in the target video; the second image is used to represent the background of the target video, and M is a second preset value;

[0015] A calculation module, used for performing a difference operation between the current first image corresponding to the target video and the second image to obtain a target image;

[0016] The second determination module is used to perform differential processing on the target image to determine the residue area in the target image.

[0017] In a third aspect of an embodiment of the present invention, a smart trash can is further provided, the smart trash can comprising a camera and a processing module;

[0018] The camera is used to obtain the target video;

[0019] The processing module is used to read image frames from the target video frame by frame;

[0020] In the process of reading the image frames, based on the most recently read N image frames, updating the first image corresponding to the target video; the first image is used to represent the current scene of the target video, and N is a first preset value;

[0021] Determine a second image based on the M first images most recently updated in the target video; the second image is used to represent the background of the target video, and M is a second preset value;

[0022] Performing a difference operation between the current first image corresponding to the target video and the second image to obtain a target image;

[0023] Performing differentiation processing on the target image to determine a residue area in the target image.

[0024] In a fourth aspect of the embodiments of the present invention, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes the residue detection method described in any of the above embodiments.

[0025] In a fifth aspect of the implementation of the present invention, there is also provided a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the residue detection method described in any of the above embodiments.

[0026] In an embodiment of the present invention, a target video is obtained, and image frames are read frame by frame from the target video; in the process of reading image frames, the first image corresponding to the target video is updated based on the N image frames read most recently; the second image is determined based on the M first images updated most recently by the target video; the current first image corresponding to the target video is differentially calculated with the second image to obtain the target image; the target image is differentiated to determine the relic area in the target image. In an embodiment of the present invention, the first image is determined based on the N image frames read most recently, and the second image is determined based on the M first images updated most recently by the target video. In other words, the first image is determined using multiple image frames, and the second image is determined using multiple first images, so as to filter the moving targets that briefly stay in the current image frame, thereby improving the accuracy of relic detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0028] Figure 1 Schematic diagram of the process of the residue detection method in the embodiment of the present invention;

[0029] Figure 2 Schematic diagram of the structure of the residue detection device in the embodiment of the present invention;

[0030] Figure 3 This is a schematic diagram of the structure of an electronic device in an embodiment of the present invention;

[0031] Figure 4 Schematic diagram of the structure of the intelligent trash can in an embodiment of the present invention. DETAILED DESCRIPTION

[0032] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0033] See also Figure 1 , Figure 1 Flow chart of the method for detecting residues in an embodiment of the present invention. The method for detecting residues provided in an embodiment of the present invention comprises:

[0034] S101, acquiring a target video, and reading image frames from the target video frame by frame.

[0035] The target video may be a surveillance video or other types of videos, which are not specifically limited here. In this step, after acquiring the target video, image frames are read frame by frame from the target video, that is, according to the order of each image frame in the target video, the image frames in the target video are read in sequence.

[0036] S102: In the process of reading the image frames, based on the most recently read N image frames, updating the first image corresponding to the target video.

[0037] The value of N is a first preset value, and the first image is used to represent the current scene of the target video.

[0038] In this step, when N image frames are read for the first time, a first image corresponding to the target video is generated based on the above N image frames; thereafter, in the subsequent process of reading image frames frame by frame, when N consecutive image frames are read again, the above first image is updated.

[0039] For example, the first preset value is 20, that is, the value of N is 20. When the 20th frame of the target video is read, the first image corresponding to the target video is generated based on the read frames 1 to 20. When the 40th frame of the target video is read, the first image corresponding to the target video is updated based on the read frames 21 to 40.

[0040] For a specific solution on how to update the first image based on N image frames, please refer to the subsequent embodiments.

[0041] S103: Determine a second image based on the M first images that are most recently updated in the target video.

[0042] The above-mentioned M is a second preset value, and the above-mentioned second image is used to represent the background of the target video.

[0043] In this step, after the M first images are updated, a second image is generated based on the M images.

[0044] For example, the value of N is 20, and the value of M is 10. Since the first image corresponding to the target video is updated every time 20 image frames are read, when the 200th frame of the target video is read, the number of first images updated in the target video is determined to be 10, and thus the second image can be determined based on the first to tenth first images.

[0045] When the 400th frame of the target video is read, it is determined that the number of first images updated by the target video is 20. Thus, the second image can be determined based on the 10 most recently updated first images of the target video, ie, the 11th to 20th first images.

[0046] For a specific solution on how to determine the second image based on the M first images most recently updated in the target video, please refer to the subsequent embodiments.

[0047] S104: Perform a differential operation on the current first image corresponding to the target video and the second image to obtain a target image.

[0048] In this step, after obtaining the second image, a differential operation is performed between the current first image corresponding to the target video and the second image to obtain the target image. The current first image can be understood as the first image most recently updated by the target video, and the target image is also called a differential image.

[0049] The difference operation between the two images can be understood as subtracting the pixel values ​​of corresponding pixels of the two images to weaken the similar parts of the images.

[0050] For example, the value of N is 20, and the value of M is 10, that is, the first image is updated once every 20 image frames are read, and the second image is generated based on the 10 most recently updated first images every 10 first images are updated. In this case, when the 210th frame is read, the number of first images updated by the target video is determined to be 10, and the second image is determined based on the 1st to 10th first images; the current first image is determined to be the most recently updated first image of the target video, that is, the 10th first image. The 10th first image is differentially calculated with the second image to obtain the target image.

[0051] S105, performing differentiation processing on the target image to determine a residue area in the target image.

[0052] In this step, after obtaining the target image, a differential process is performed on the target image to generate at least one target region in the target image, and further, it is determined whether the target region is a residue region.

[0053] The above-mentioned difference processing is used to highlight an object appearing in the target image, which may be a relic or noise existing in the target image. The above-mentioned relic area is the area where the relic is in the target image.

[0054] For specific methods of performing differential processing on the target image and determining the residue area in the target image, please refer to the subsequent embodiments.

[0055] In an embodiment of the present invention, a target video is obtained, and image frames are read frame by frame from the target video; in the process of reading image frames, the first image corresponding to the target video is updated based on the N image frames read most recently; the second image is determined based on the M first images updated most recently by the target video; the current first image corresponding to the target video is differentially calculated with the second image to obtain the target image; the target image is differentiated to determine the relic area in the target image. In an embodiment of the present invention, the first image is determined based on the N image frames read most recently, and the second image is determined based on the M first images updated most recently by the target video. That is to say, the first image is determined using multiple image frames, and the second image is determined using multiple first images, so as to filter the moving target that stays briefly in the current image frame, thereby improving the accuracy of relic detection. At the same time, in the case where the pixel difference between the image frames is large, the relic in the target video can also be detected more quickly based on the current first image and the second image.

[0056] The following specifically describes a technical solution for updating the first image based on N image frames:

[0057] Optionally, updating the first image corresponding to the target video based on the most recently read N image frames includes:

[0058] Accumulating and calculating the N pixel values ​​corresponding to the N image frames one by one to obtain a first accumulation result;

[0059] Performing a division operation on the first accumulated result and N to obtain a first pixel average value corresponding to the N image frames;

[0060] A first image is constructed, wherein the pixel value of the first image is the first pixel average value.

[0061] In this embodiment, the first pixel average value corresponding to N image frames is calculated, wherein the first pixel average value can be calculated in the following manner.

[0062] The pixel value corresponding to each image frame is read to obtain N pixel values; the pixel value corresponding to the image frame can be understood as the pixel value corresponding to the image represented by the image frame. The above N pixel values ​​are accumulated to obtain a first accumulation result. The first accumulation result is divided by N, and the division result is used as the first pixel average value.

[0063] Furthermore, an image is constructed, and the pixel values ​​of the image are set to the first pixel average value, so as to obtain a first image for representing the current scene of the target video.

[0064] In this embodiment, the most recently read N image frames are used to determine the first image representing the current scene of the target video. Since the first image is obtained based on the first pixel average of the N image frames, moving targets that briefly stay in the image frames can be filtered out, thereby improving the accuracy of remains detection.

[0065] Optionally, determining the second image based on the M first images most recently updated in the target video includes:

[0066] At each preset time interval, the first image corresponding to the target video is stored in a preset image set; the first images in the image set are arranged in the order of storage time;

[0067] When the number of first images stored in the image set is a positive integer multiple of a third preset value, the second image is determined based on the last M first images in the image set.

[0068] In this embodiment, an image set is preset, the image set is used to store the first image, and the first images in the image set are arranged in the order of storage time.

[0069] In this embodiment, the first image corresponding to the target video is stored in the preset image set at every preset time interval. Exemplarily, the preset time interval is 1 minute, then, in the process of reading the image frames of the target video frame by frame, the current first image corresponding to the target video is stored in the image set at every 1 minute interval.

[0070] When the number of first images stored in the image set is a positive integer multiple of the third preset value, the second image is determined based on the last M first images in the image set. For a specific technical solution on how to determine the second image based on the last M first images in the image set, please refer to the subsequent embodiments.

[0071] An optional embodiment is that the third preset value is the same as the value of M. That is, when the number of first images stored in the image set is a positive integer multiple of M, the second image is determined based on the last M first images in the image set.

[0072] For example, if M is 10, and if 10 first images are stored in the image set, the second image is determined based on the 10 first images. If 20 first images are stored in the image set, the second image is determined based on the 11th to 20th first images in the image set.

[0073] Another optional implementation is that the third preset value M is different.

[0074] For example, the above M is 10, the above third preset value is 15, and if 15 first images are stored in the image set, the second image is determined based on the 6th to 15th first images in the image set.

[0075] Optionally, determining the second image based on the last M first images sorted in the image set includes:

[0076] Accumulate and calculate the M pixel values ​​corresponding to the M first images one by one to obtain a second accumulation result;

[0077] Performing a division operation on the second accumulated result and M to obtain a second pixel average value corresponding to the M first images;

[0078] A second image is constructed, wherein the pixel value of the second image is the second pixel average value.

[0079] In this embodiment, the second pixel average value corresponding to the M first images is calculated, wherein the second pixel average value can be calculated in the following manner.

[0080] Read the pixel value corresponding to each first image to obtain M pixel values. Perform cumulative calculation on the M pixel values ​​to obtain a second cumulative result. Perform a division operation on the second cumulative result and M, and use the division result as the second pixel average value.

[0081] Furthermore, an image is constructed, and the pixel values ​​of the image are set to the second pixel average value, so as to obtain a second image for representing the background of the target video. The second image is also called the background image of the target video.

[0082] In this embodiment, the M first images most recently updated of the target video are used to determine the background image of the target video. Since the second image is obtained based on the second pixel average value of the M first images, moving targets that briefly stay in the background of the target image can be filtered out, thereby improving the accuracy of remains detection.

[0083] The following specifically describes a method of performing differential processing on a target image and a method of determining a remnant area in the target image: Optionally, performing differential processing on the target image and determining a remnant area in the target image includes:

[0084] Performing binarization and dilation processing on the target image, so as to generate at least one target area in the target image;

[0085] The target area whose area is larger than a preset threshold is determined as the residue area.

[0086] In this embodiment, the target image is binarized. It should be understood that the binarization of the image is to set the grayscale value corresponding to the pixel point of the image to 0 or 255, so that the entire image presents an obvious black and white effect, and a binarized image that can reflect the overall and local features of the image is obtained. The target image after binarization is expanded. It should be understood that the expansion of the image is to add pixel values ​​at the edge of the image so that the overall pixel value is expanded, thereby achieving the expansion effect of the image. In this way, the entire image is composed of two colors, white and black. An optional implementation method is that the area where the black pixels in the image are located can be determined as the target area.

[0087] In this embodiment, a preset threshold is also set. The area of ​​each target area is detected. If the area of ​​the target area is greater than the preset threshold, it means that there are relics in the target area, and the target area is determined as a relic area; if the area of ​​the target area is less than or equal to the preset threshold, it means that the target area is a noise area in the target image.

[0088] In this embodiment, by binarizing and dilating the target image, the residue area is highlighted in the target image, and then the residue area can be quickly determined based on the area corresponding to each target area, thereby improving the efficiency of residue detection.

[0089] Optionally, after acquiring the target video, the method includes:

[0090] Reducing the resolution of each image frame in the target video;

[0091] The image frame with reduced resolution is subjected to grayscale processing and Gaussian filtering.

[0092] In this embodiment, after the target video is acquired, the resolution corresponding to each image frame in the target video is reduced. An optional implementation is to reduce the resolution of each image frame to one tenth of the original resolution.

[0093] The image frame after the resolution is reduced is subjected to grayscale processing and Gaussian filtering processing, wherein grayscale processing refers to setting the R value, G value and B value corresponding to each pixel in the image frame to be the same. An optional implementation method is that a Gaussian smoothing filter can be used to perform Gaussian filtering processing on the image frame.

[0094] In this embodiment, the resolution of each image frame is reduced, and the image frames are subjected to grayscale processing and Gaussian filtering to suppress noise in the image frames, thereby eliminating the interference of noise in the image frames on the remains detection results and improving the accuracy of remains detection.

[0095] like Figure 2As shown, the embodiment of the present invention further provides a residue detection device 200, comprising:

[0096] An acquisition module 201 is used to acquire a target video and read image frames from the target video frame by frame;

[0097] An updating module 202, configured to update the first image corresponding to the target video based on the most recently read N image frames during the process of reading the image frames;

[0098] A first determination module 203, configured to determine a second image based on the M first images most recently updated in the target video;

[0099] The operation module 204 is used to perform a difference operation between the current first image corresponding to the target video and the second image to obtain a target image;

[0100] The second determination module 205 is used to perform a difference process on the target image to determine a residue area in the target image.

[0101] Optionally, the updating module 202 is specifically configured to:

[0102] Accumulating and calculating the N pixel values ​​corresponding to the N image frames one by one to obtain a first accumulation result;

[0103] Performing a division operation on the first accumulated result and N to obtain a first pixel average value corresponding to the N image frames;

[0104] A first image is constructed, wherein the pixel value of the first image is the first pixel average value.

[0105] Optionally, the first determining module 203 is specifically configured to:

[0106] At intervals of a preset time, the first image corresponding to the target video is stored in a preset image set;

[0107] When the number of first images stored in the image set is a positive integer multiple of a third preset value, the second image is determined based on the last M first images in the image set.

[0108] Optionally, the first determining module 203 is specifically configured to:

[0109] Accumulate and calculate the M pixel values ​​corresponding to the M first images one by one to obtain a second accumulation result;

[0110] Performing a division operation on the second accumulated result and M to obtain a second pixel average value corresponding to the M first images;

[0111] A second image is constructed, wherein the pixel value of the second image is the second pixel average value.

[0112] Optionally, the second determining module 205 is specifically configured to:

[0113] Performing binarization and dilation processing on the target image, so as to generate at least one target area in the target image;

[0114] The target area whose area is larger than a preset threshold is determined as the residue area.

[0115] Optionally, the residue detection device 200 further includes:

[0116] A first processing module, used to reduce the resolution corresponding to each image frame in the target video;

[0117] The second processing module is used to perform grayscale processing and Gaussian filtering on the image frame after the resolution is reduced.

[0118] The embodiment of the present invention further provides an electronic device, such as Figure 3 As shown, it includes a processor 301 , a communication interface 302 , a memory 303 and a communication bus 304 , wherein the processor 301 , the communication interface 302 , and the memory 303 communicate with each other via the communication bus 304 .

[0119] Memory 303, used for storing computer programs;

[0120] The processor 301 is used to execute the program stored in the memory 303. When the computer program is executed by the processor 301, it is used to obtain a target video and read image frames from the target video frame by frame;

[0121] In the process of reading the image frames, updating the first image corresponding to the target video based on the most recently read N image frames;

[0122] Determine a second image based on the M first images most recently updated in the target video;

[0123] Performing a difference operation between the current first image corresponding to the target video and the second image to obtain a target image;

[0124] Performing differentiation processing on the target image to determine a residue area in the target image.

[0125] Optionally, when the computer program is executed by the processor 301, it is further used to perform accumulation calculation on the N pixel values ​​corresponding to the N image frames one by one to obtain a first accumulation result;

[0126] Performing a division operation on the first accumulated result and N to obtain a first pixel average value corresponding to the N image frames;

[0127] A first image is constructed, wherein the pixel value of the first image is the first pixel average value.

[0128] Optionally, when the computer program is executed by the processor 301, it is further configured to store the first image corresponding to the target video into a preset image set at intervals of a preset duration;

[0129] When the number of first images stored in the image set is a positive integer multiple of a third preset value, the second image is determined based on the last M first images in the image set.

[0130] Optionally, when the computer program is executed by the processor 301, it is further used to perform accumulation calculation on the M pixel values ​​corresponding to the M first images one by one to obtain a second accumulation result;

[0131] Performing a division operation on the second accumulated result and M to obtain a second pixel average value corresponding to the M first images;

[0132] A second image is constructed, wherein the pixel value of the second image is the second pixel average value.

[0133] Optionally, when the computer program is executed by the processor 301, it is further used to perform binarization and dilation processing on the target image, so as to generate at least one target area in the target image;

[0134] The target area whose area is larger than a preset threshold is determined as the residue area.

[0135] Optionally, when the computer program is executed by the processor 301, it is further used to reduce the resolution corresponding to each image frame in the target video;

[0136] The image frame with reduced resolution is subjected to grayscale processing and Gaussian filtering.

[0137] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0138] The communication interface is used for communication between the above terminal and other devices.

[0139] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0140] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0141] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the residue detection method described in any of the above embodiments.

[0142] like Figure 4 As shown, an embodiment of the present invention further provides a smart trash can 400, which includes a camera 401 and a processing module 402;

[0143] The camera 401 is used to obtain the target video;

[0144] The processing module 402 is used to read image frames from the target video frame by frame;

[0145] In the process of reading the image frames, updating the first image corresponding to the target video based on the most recently read N image frames;

[0146] Determine a second image based on the M first images most recently updated in the target video;

[0147] Performing a difference operation between the current first image corresponding to the target video and the second image to obtain a target image;

[0148] Performing differentiation processing on the target image to determine a residue area in the target image.

[0149] In this embodiment, a camera 401 can be installed on the smart trash can 400. Optionally, the camera 401 can be installed on the lid of the smart trash can 400. The camera 401 is used to obtain the target video. The processing module 402 of the smart trash can 400 runs the method for detecting the remnants described in any of the above embodiments. In this way, the surveillance video captured by the camera 401 is subjected to the detection of remnants. Furthermore, the garbage appearing in the surveillance video can be regarded as remnants, so as to realize the monitoring of the behavior of littering.

[0150] The smart trash can 400 provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented in the method embodiment will not be described again here.

[0151] In another embodiment provided by the present invention, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute the residue detection method described in any of the above embodiments.

[0152] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0153] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0154] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0155] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A method for detecting residues, characterized in that: include: Acquire a target video, and read image frames from the target video frame by frame; In the process of reading the image frames, updating the first image corresponding to the target video based on the most recently read N image frames; The first image is used to represent the current scene of the target video, and N is a first preset value; Determine a second image based on the M first images most recently updated in the target video; The second image is used to represent the background of the target video, and M is a second preset value; Performing a difference operation between the current first image corresponding to the target video and the second image to obtain a target image; The target image is subjected to a differential processing to determine a relic region in the target image, wherein the differential processing is used to highlight an object appearing in the target image, wherein the object is a relic or noise existing in the target image.

2. The method according to claim 1, characterized in that The updating of the first image corresponding to the target video based on the most recently read N image frames includes: Accumulating and calculating the N pixel values ​​corresponding to the N image frames one by one to obtain a first accumulation result; Performing a division operation on the first accumulated result and N to obtain a first pixel average value corresponding to the N image frames; A first image is constructed, wherein the pixel value of the first image is the first pixel average value.

3. The method according to claim 1, characterized in that The determining the second image based on the M first images most recently updated by the target video comprises: At each preset time interval, the first image corresponding to the target video is stored in a preset image set; the first images in the image set are arranged in the order of storage time; When the number of first images stored in the image set is a positive integer multiple of a third preset value, the second image is determined based on the last M first images in the image set.

4. The method according to claim 3, characterized in that The determining the second image based on the last M first images in the image set comprises: Accumulate and calculate the M pixel values ​​corresponding to the M first images one by one to obtain a second accumulation result; Performing a division operation on the second accumulated result and M to obtain a second pixel average value corresponding to the M first images; A second image is constructed, wherein the pixel value of the second image is the second pixel average value.

5. The method according to claim 1, characterized in that The performing differentiation processing on the target image to determine the residue area in the target image comprises: Performing binarization and dilation processing on the target image, so as to generate at least one target area in the target image; The target area whose area is larger than a preset threshold is determined as the residue area.

6. The method according to claim 1, characterized in that After acquiring the target video, the method includes: Reducing the resolution of each image frame in the target video; The image frame with reduced resolution is subjected to grayscale processing and Gaussian filtering.

7. A residue detection device, characterized in that: include: An acquisition module, used for acquiring a target video and reading image frames from the target video frame by frame; An updating module, used for updating the first image corresponding to the target video based on the most recently read N image frames during the process of reading the image frames; The first image is used to represent the current scene of the target video, and N is a first preset value; A first determination module, configured to determine a second image based on the M first images most recently updated in the target video; The second image is used to represent the background of the target video, and M is a second preset value; A calculation module, used for performing a difference operation between the current first image corresponding to the target video and the second image to obtain a target image; The second determination module is used to perform differential processing on the target image to determine the remnant area in the target image, wherein the differential processing is used to highlight the object appearing in the target image, and the object is a remnant or noise existing in the target image.

8. A smart trash can, characterized in that: The smart trash can includes a camera and a processing module; The camera is used to obtain the target video; The processing module is used to read image frames from the target video frame by frame; In the process of reading the image frames, updating the first image corresponding to the target video based on the most recently read N image frames; The first image is used to represent the current scene of the target video, and N is a first preset value; Determine a second image based on the M first images most recently updated in the target video; The second image is used to represent the background of the target video, and M is a second preset value; Performing a difference operation between the current first image corresponding to the target video and the second image to obtain a target image; The target image is subjected to a differential processing to determine a relic region in the target image, wherein the differential processing is used to highlight an object appearing in the target image, wherein the object is a relic or noise existing in the target image.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the residue detection method described in any one of claims 1 to 6 when executing the program stored in the memory.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the residue detection method as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Abandoned object detection method

    CN106650638A

  • Falling object identification method and device, terminal equipment and storage medium

    CN112037266A