A moving target detection method and device

By using the background image obtained by background subtraction for the inter-frame difference method, and using the light insensitive characteristics of the inter-frame difference method, the problems of hollows, 'double shadows', 'ghosts' and illumination sensitivity in motion target detection are solved, and more accurate motion target detection is achieved.

CN112581492BActive Publication Date: 2025-03-18BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN201910926317.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-09-27
Publication Date
2025-03-18
Estimated Expiration
2039-09-27

AI Technical Summary

Technical Problem

The existing motion object detection algorithm has problems such as hollowness, incomplete contours, easy to be lengthened and "double shadows" in the inter-frame differential method; while the background subtraction law cannot effectively solve the "ghost shadows" and lighting problems.

Method used

Combining background subtraction and inter-frame difference method, the background image obtained by background subtraction is used as the background frame of the inter-frame difference method, and the inter-frame difference method is used to use it in background modeling of background subtraction.

Benefits of technology

Through this combination method, the accuracy of five-frame differential detection of moving targets is increased, basically eliminating the problem of "double shadows", and accelerating the elimination of "ghost shadows", improving the accuracy of moving target detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112581492B_ABST
    Figure CN112581492B_ABST
Patent Text Reader

Abstract

The present invention discloses a moving target detection method and device, and relates to the field of computer technology. A specific implementation of the method includes: using a background subtraction method to obtain a background image of a current frame image and detecting a first moving target in the current frame image; detecting a second moving target in the current frame image based on an inter-frame difference method and the background image; performing a logical operation on the first moving target and the second moving target, thereby detecting the moving target in the current frame image. This implementation can solve the technical problems of holes, "double images", "ghost images", and light sensitivity that are easy to appear in moving target detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a moving target detection method and device. Background Art

[0002] There are many types of algorithms for moving target detection, which can be roughly divided into three categories: optical flow method, frame difference method and background subtraction method. The optical flow method is less used now due to its complexity and high hardware requirements; the current mainstream moving target detection algorithms are frame difference method and background subtraction method.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: the inter-frame difference method has problems such as holes, incomplete contours, moving targets are easily elongated, and there are "double images" (foreground pixels in the previous frame image are still detected as foreground pixels in the current frame image); the background subtraction method has the advantages of small computational complexity, low memory usage, and fast processing speed, but it cannot solve the "ghost" (foreground pixels that cannot be eliminated for a long time) phenomenon and lighting problems well, especially when the first frame image has a moving target, "ghost" will exist for a period of time in the following period of time. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a moving target detection method and device to solve the technical problems of holes, "double images", "ghost images" and light sensitivity that are easily seen in moving target detection.

[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a moving target detection method is provided, comprising:

[0006] Using a background subtraction method to obtain a background image of a current frame image and detecting a first moving target in the current frame image;

[0007] Detecting a second moving target in the current frame image based on an inter-frame difference method and the background image;

[0008] A logical operation is performed on the first moving target and the second moving target, thereby detecting the moving target in the current frame graphic.

[0009] Optionally, using a background subtraction method to obtain a background image of a current frame image and detecting a first moving target in the current frame image includes:

[0010] Traverse each pixel point of the current frame image, and for each pixel point: combine the background model to determine whether the pixel point is foreground or background;

[0011] The background image and the background model of the current frame image are updated according to the pixel points determined as the background, and the first moving target in the current frame image is detected according to the pixel points determined as the foreground.

[0012] Optionally, detecting a second moving target in the current frame image based on an inter-frame difference method and the background image includes:

[0013] Based on the inter-frame difference method, the background image, the current frame image and adjacent frames of the current frame image are subjected to difference processing to obtain a plurality of difference images;

[0014] A logical operation is performed on the plurality of differential images to detect a second moving target in the current frame image.

[0015] Optionally, based on an inter-frame difference method, difference processing is performed on the background image, the current frame image, and adjacent frames of the current frame image to obtain a plurality of difference images, including:

[0016] Performing differential processing on the two frame images preceding the current frame image and the current frame image to obtain a first differential image;

[0017] Performing differential processing on the current frame image and two frames of images following the current frame image to obtain a second differential image;

[0018] Performing differential processing on the current frame image and the background image to obtain a third differential image;

[0019] Performing differential processing on a frame image before the current frame image and the current frame image to obtain a fourth differential image;

[0020] Performing differential processing on the current frame image and a frame image subsequent to the current frame image to obtain a fifth differential image.

[0021] Optionally, performing a logical operation on the plurality of differential images to detect a second moving target in the current frame image includes:

[0022] Performing a logical OR operation on the first differential image and the second differential image to obtain a sixth differential image, and performing a logical OR operation on the fourth differential image and the fifth differential image to obtain a seventh differential image;

[0023] Performing a logic AND operation on the third differential image and the sixth differential image to obtain an eighth differential image, and performing a logic AND operation on the third differential image and the seventh differential image to obtain a ninth differential image;

[0024] Performing a logical OR operation on the eighth differential pattern and the ninth differential pattern to obtain a tenth differential image;

[0025] A foreground pixel point in the tenth differential image is detected as a second moving target.

[0026] Optionally, performing a logical operation on the first moving target and the second moving target to detect the moving target in the current frame graphic includes:

[0027] Performing a logical OR operation on the first moving target and the second moving target to obtain a third moving target;

[0028] Morphological processing is performed on the third moving target, and the foreground pixel point is used as the moving target of the current frame image.

[0029] Optionally, after detecting the second moving target in the current frame image, the method further includes:

[0030] Traversing each pixel point of the current frame image, for each pixel point: judging whether the pixel point is a foreground or a background according to a detection result of a second moving target;

[0031] The background image and the background model are updated according to the pixels determined to be the background.

[0032] In addition, according to another aspect of an embodiment of the present invention, there is provided a moving object detection device, comprising:

[0033] A first detection module, used for obtaining a background image of a current frame image by using a background subtraction method and detecting a first moving target in the current frame image;

[0034] A second detection module, used for detecting a second moving target in the current frame image based on an inter-frame difference method and the background image;

[0035] The third detection module is used to perform a logical operation on the first moving target and the second moving target, so as to detect the moving target in the current frame graphic.

[0036] Optionally, the first detection module is further used for:

[0037] Traverse each pixel point of the current frame image, and for each pixel point: combine the background model to determine whether the pixel point is foreground or background;

[0038] The background image and the background model of the current frame image are updated according to the pixel points determined as the background, and the first moving target in the current frame image is detected according to the pixel points determined as the foreground.

[0039] Optionally, the second detection module is further used for:

[0040] Based on the inter-frame difference method, the background image, the current frame image and adjacent frames of the current frame image are subjected to difference processing to obtain a plurality of difference images;

[0041] A logical operation is performed on the plurality of differential images to detect a second moving target in the current frame image.

[0042] Optionally, the second detection module is further used for:

[0043] Performing differential processing on the two frame images preceding the current frame image and the current frame image to obtain a first differential image;

[0044] Performing differential processing on the current frame image and two frames of images following the current frame image to obtain a second differential image;

[0045] Performing differential processing on the current frame image and the background image to obtain a third differential image;

[0046] Performing differential processing on a frame image before the current frame image and the current frame image to obtain a fourth differential image;

[0047] Performing differential processing on the current frame image and a frame image subsequent to the current frame image to obtain a fifth differential image.

[0048] Optionally, the second detection module is further used for:

[0049] Performing a logical OR operation on the first differential image and the second differential image to obtain a sixth differential image, and performing a logical OR operation on the fourth differential image and the fifth differential image to obtain a seventh differential image;

[0050] Performing a logic AND operation on the third differential image and the sixth differential image to obtain an eighth differential image, and performing a logic AND operation on the third differential image and the seventh differential image to obtain a ninth differential image;

[0051] Performing a logical OR operation on the eighth differential pattern and the ninth differential pattern to obtain a tenth differential image;

[0052] A foreground pixel point in the tenth differential image is detected as a second moving target.

[0053] Optionally, the third detection module is further used for:

[0054] Performing a logical OR operation on the first moving target and the second moving target to obtain a third moving target;

[0055] Morphological processing is performed on the third moving target, and the foreground pixel point is used as the moving target of the current frame image.

[0056] Optionally, an update module is also included, for:

[0057] After detecting the second moving target in the current frame image, traverse each pixel point of the current frame image, and for each pixel point: determine whether the pixel point is a foreground or a background according to the detection result of the second moving target;

[0058] The background image and the background model are updated according to the pixels determined to be the background.

[0059] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including:

[0060] one or more processors;

[0061] a storage device for storing one or more programs,

[0062] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above embodiments.

[0063] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above embodiments is implemented.

[0064] One embodiment of the above invention has the following advantages or beneficial effects: because the background image obtained by the background subtraction method is used as the background frame of the inter-frame difference method, and the inter-frame difference method is insensitive to illumination, the background image obtained by the inter-frame difference is used in the background modeling of the background subtraction method, so the technical problems of holes, "double shadows", "ghosts", and illumination sensitivity that are easy to appear in the detection of moving targets in the prior art are overcome. The embodiment of the present invention combines the background subtraction method with the inter-frame difference method, and uses the background image obtained by the background subtraction method as the background frame of the inter-frame difference method, which increases the accuracy of the five-frame difference detection of moving targets and basically eliminates the "double shadow" problem; and the inter-frame difference method is insensitive to illumination, and the background image obtained by the inter-frame difference is used in the background modeling of the background subtraction method to improve the accuracy of the background pixel points of the model, while accelerating the elimination of "ghosts" and increasing the accuracy of the detection of moving targets.

[0065] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0067] Figure 1is a schematic diagram of the main process of the moving target detection method according to an embodiment of the present invention;

[0068] Figure 2 is a schematic diagram of the main process of detecting a moving target using the ViBe algorithm according to an embodiment of the present invention;

[0069] Figure 3 is a schematic diagram of the main process of detecting a moving target using a five-frame difference method according to an embodiment of the present invention;

[0070] Figure 4 is a schematic diagram of the main process of a moving target detection method according to a reference embodiment of the present invention;

[0071] Figure 5 is a schematic diagram of main modules of a moving object detection device according to an embodiment of the present invention;

[0072] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0073] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0074] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0075] In order to solve technical problems such as holes, "double images", "ghost images", and light sensitivity that are prone to occur in motion target detection, an embodiment of the invention provides a motion target detection method, which uses a background image obtained by a background subtraction method as a background frame of an inter-frame difference method, and uses the background image obtained by inter-frame difference in background modeling of a background subtraction method, thereby accurately detecting a moving target.

[0076] Figure 1 FIG. 1 is a schematic diagram of the main process of the moving target detection method according to an embodiment of the present invention. As an embodiment of the present invention, Figure 1 As shown, the moving target detection method may include:

[0077] Step 101: obtain a background image of a current frame image by using a background subtraction method and detect a first moving target in the current frame image.

[0078] In this step, background subtraction is used to detect the first moving target in the current frame image, and the background image of the current frame image can also be obtained. The background image can be used as the background frame of the inter-frame difference method. In the prior art, for the background subtraction method, it is only necessary to create a corresponding background model for each pixel point to determine the foreground pixel point of the current frame image, and it is not necessary to extract the background image. However, in the embodiment of the present invention, when creating the background model, it is also necessary to extract the background image, and the background image can be used as the background frame of the inter-frame difference method. Optionally, step 101 includes: traversing each pixel point of the current frame image, for each pixel point: combining the background model, judging whether the pixel point is the foreground or the background; updating the background image and the background model of the current frame image according to the pixel point judged as the background, and detecting the first moving target in the current frame image according to the pixel point judged as the foreground.

[0079] The ViBe algorithm is a commonly used background subtraction method. The ViBe algorithm only needs one frame of image to initialize the background model. Compared with other algorithms that require multiple frames of image to build the background model, it can greatly improve the detection speed. After the background model is built, each subsequent frame of image is compared with the model sample set to determine whether the pixel belongs to the foreground pixel or the background pixel, and then the background model is updated. This cycle is repeated to detect the moving target. Optionally, the following two strategies can be used to update the background model: 1) Conservative update strategy: This strategy requires that foreground pixels are never used to update the background model; 2) Blind update strategy: Both foreground pixels and background pixels are used to update the background model.

[0080] like Figure 2 As shown, taking the conservative update strategy as an example, the ViBe algorithm is used to obtain the background image of the current frame image and detect the first moving target in the current frame image, including the following steps:

[0081] Step 201: extract the first frame image in the video image.

[0082] Step 202, initialize the background model through the first frame image (for example, use the domain pixels to create the background model), and use the first frame image as the background image. The background model stores a sample set (usually 20, 30, etc.) for each pixel point.

[0083] Step 203: perform image preprocessing on the current frame image, such as filtering processing, noise reduction processing, etc.

[0084] Step 204, traverse each pixel of the current frame image to determine whether the pixel is background or foreground. Specifically, put the pixel value into the ViBe model to determine whether the pixel is foreground or background.

[0085] Step 205: If the pixel is background, the background model and background image are updated.

[0086] Step 206: If the pixel point is a foreground, the pixel point is taken as a moving target (ie, a first moving target).

[0087] It should be noted that, during initialization, the first frame image is used as the background image, and the background image is continuously updated based on the moving target detection result. Therefore, the background image obtained in step 101 is continuously updated based on the moving target detection result of the frame image.

[0088] Step 102: Detect a second moving target in the current frame image based on an inter-frame difference method and the background image.

[0089] In this step, the background image obtained by the background subtraction method is used as the background frame of the inter-frame difference method, which increases the accuracy of the five-frame difference detection of moving targets and basically eliminates the "double image" problem. Optionally, step 102 may specifically include: based on the inter-frame difference method, performing difference processing on the background image, the current frame image, and adjacent frames of the current frame image to obtain multiple difference images; performing logical operations on the multiple difference images to detect the second moving target in the current frame image.

[0090] The inter-frame difference method can be a two-frame difference method, a three-frame difference method or a five-frame difference method, etc. However, compared with the two-frame difference method, the three-frame difference method, etc., the moving target obtained by the five-frame difference method is relatively more accurate and rich. The five-frame difference method uses five consecutive frames of images, takes the middle frame and performs difference operations with the first two frames and the last two frames respectively, sets thresholds respectively, performs binarization operations on the four differential results, and performs AND operations on the obtained binary images again to obtain the moving target image. The five-frame difference method uses five consecutive frames of images f1, f2, f3, f4, and f5 of the video image sequence for difference operations, and then performs further logical operations on the difference results to obtain the moving target. As Figure 3 As shown, detecting the second moving target in the current frame image based on the five-frame difference method and the background image may specifically include the following steps:

[0091] 1) Perform differential processing on the first two frame images f1 of the current frame image and the current frame image f3 to obtain a first differential image; perform differential processing on the current frame image f3 and the last two frame images f5 of the current frame image to obtain a second differential image; perform differential processing on the current frame image f3 and the background image f bPerform differential processing to obtain a third differential image; perform differential processing on the previous frame image f2 of the current frame image and the current frame image f3 to obtain a fourth differential image; perform differential processing on the current frame image f3 and the subsequent frame image f4 of the current frame image to obtain a fifth differential image.

[0092] 2) Performing a logical OR operation on the first differential image and the second differential image to obtain a sixth differential image, and performing a logical OR operation on the fourth differential image and the fifth differential image to obtain a seventh differential image.

[0093] 3) Performing a logical AND operation on the third differential image and the sixth differential image to obtain an eighth differential image, and performing a logical AND operation on the third differential image and the seventh differential image to obtain a ninth differential image.

[0094] 4) Performing a logical OR operation on the eighth differential pattern and the ninth differential pattern to obtain a tenth differential image.

[0095] 5) Performing morphological processing on the tenth difference image.

[0096] 6) Detecting foreground pixels in the tenth differential image after morphological processing as moving targets (ie, second moving targets).

[0097] One of the improvements of the embodiment of the present invention over the five-frame difference method is that a difference result is obtained by differentiating the third frame of five consecutive frames of images from the background image of the background subtraction method, and a logical AND operation is performed on the difference result and the difference result obtained by the standard five-frame difference algorithm, and the final moving target is obtained after morphological processing, thereby increasing the accuracy of the five-frame difference detection of moving targets and basically eliminating the "double image" problem.

[0098] The second improvement of the embodiment of the present invention over the five-frame difference method is that: since the logical OR operation on the differential images is to obtain all the moving targets in the two differential images, compared with the AND operation, the embodiment of the present invention first performs a logical OR operation on the binary differential images, so that the moving target information obtained is richer; since the background difference obtains the moving target more accurately, the embodiment of the present invention performs a logical OR operation on the third difference image and the sixth difference image and the seventh difference image respectively, and then performs a logical AND operation on the obtained results respectively, so that the ghost problem in the two OR operation results can be filtered out, and the "ghost" and light-sensitive pixels existing in the background difference method itself can also be removed.

[0099] Step 103: Perform a logical operation on the first moving target and the second moving target, so as to detect the moving target in the current frame graphic.

[0100] A logical OR operation can be performed on the first moving target detected by the background subtraction method and the second moving target detected by the frame difference method to make the final moving target more complete. Finally, further morphological processing can be used to fill the tiny holes of the moving target and further filter out noise.

[0101] According to the various embodiments described above, it can be seen that the present invention uses the background image obtained by the background subtraction method as the background frame of the inter-frame difference method, and utilizes the characteristic that the inter-frame difference method is insensitive to illumination, and uses the background image obtained by the inter-frame difference for the background modeling of the background subtraction method, thereby solving the technical problems of holes, "double shadows", "ghost images", and illumination sensitivity that are easy to appear in the detection of moving targets in the prior art. The embodiment of the present invention combines the background subtraction method with the inter-frame difference method, and uses the background image obtained by the background subtraction method as the background frame of the inter-frame difference method, thereby increasing the accuracy of the five-frame difference detection of moving targets and substantially eliminating the "double shadow" problem that exists therein; and utilizes the characteristic that the inter-frame difference method is insensitive to illumination, and uses the background image obtained by the inter-frame difference for the background modeling of the background subtraction method, so as to improve the accuracy of the background pixel points of the model, while accelerating the elimination of "ghost images" and increasing the accuracy of the detection of moving targets.

[0102] Figure 4 It is a schematic diagram of the main process of a moving target detection method according to a reference embodiment of the present invention.

[0103] Step 401 : obtain a background image of a current frame image by using a background subtraction method and detect a first moving target in the current frame image.

[0104] In this step, background subtraction is used to detect the first moving target in the current frame image, and the background image of the current frame image can also be obtained. The background image can be used as the background frame of the inter-frame difference method. The ViBe algorithm is a commonly used background subtraction method. The ViBe algorithm only needs one frame image to complete the initialization of the background model. Compared with other algorithms that require multiple frames of images to establish a background model, the detection speed can be greatly improved; after the background model is established, each subsequent frame image is compared with the model sample value to determine whether the pixel belongs to the foreground pixel or the background pixel, and then the background model is updated, and this cycle is repeated to detect the moving target. During initialization, the first frame image is used as the background image, and the background image is continuously updated based on the moving target detection result.

[0105] Step 402: Detect a second moving target in the current frame image based on an inter-frame difference method and the background image.

[0106] Optionally, a five-frame difference method may be used to detect the second moving target. The five-frame difference method uses five consecutive frames of images f1, f2, f3, f4, and f5 of a video image sequence to perform a difference operation, and then performs further logical operations on the difference results to obtain the moving target.

[0107] Step 403, traverse each pixel point of the current frame image, and update the background image and background model based on the pixel points determined to be the background according to the detection result of the second moving target.

[0108] The embodiment of the present invention uses the moving target detected by the inter-frame difference method to update the background model of the background subtraction method. Specifically, the update strategy can be: if the pixel point is a background pixel, the background model and the background image are updated; if the pixel point is a foreground pixel (i.e., a moving target pixel), the background model and the background image are not updated.

[0109] Step 404: perform a logical OR operation on the first moving target and the second moving target to obtain a third moving target.

[0110] A logical OR operation may be performed on the first moving target detected by the background subtraction method and the second moving target detected by the frame difference method, so that the final moving target is more complete.

[0111] Step 405: Perform morphological processing on the third moving target.

[0112] Step 406: After morphological processing, the foreground pixel point is used as the moving target of the current frame image.

[0113] It should be noted that the background image and background model updated in step 403 are used for moving target detection in the next frame image. Specifically, in the background subtraction method of the next frame image (such as f4), the background image and background model obtained in step 403 are updated by using the background subtraction method.

[0114] Since the inter-frame difference method (especially the five-frame difference method) has an advantage that there is no "ghost" problem, and it is not sensitive to illumination, the moving target detected by it is closer to the real moving target. From another perspective, the background detected by it is less affected by illumination, and there will be no "ghost" problem. Therefore, the embodiment of the present invention uses it to update the background model and background image of the background subtraction method, which can speed up the elimination of "ghosts" and reduce the time to eliminate the influence of illumination on the background model and background image. Since the background subtraction method can detect moving targets well except for the "ghost" and illumination problems, the moving targets obtained by the inter-frame difference method and the background subtraction method are logically or operated to make the final moving target more complete. Finally, the tiny holes of the moving target are filled by further morphological processing, and the noise can also be further filtered out.

[0115] In addition, the specific implementation content of the moving target detection method in a reference embodiment of the present invention has been described in detail in the moving target detection method described above, so the repeated content will not be described here.

[0116] Figure 5 is a schematic diagram of the main modules of the moving target detection device according to an embodiment of the present invention, such as Figure 5 As shown, the moving target detection device 500 includes a first detection module 501, a second detection module 502 and a third detection module 503. The first detection module 501 is used to obtain the background image of the current frame image by using the background subtraction method and detect the first moving target in the current frame image; the second detection module 502 is used to detect the second moving target in the current frame image based on the inter-frame difference method and the background image; the third detection module 503 is used to perform a logical operation on the first moving target and the second moving target, so as to detect the moving target in the current frame image.

[0117] Optionally, the first detection module 501 is further used for:

[0118] Traverse each pixel point of the current frame image, and for each pixel point: combine the background model to determine whether the pixel point is foreground or background;

[0119] The background image and the background model of the current frame image are updated according to the pixel points determined as the background, and the first moving target in the current frame image is detected according to the pixel points determined as the foreground.

[0120] Optionally, the second detection module 502 is further configured to:

[0121] Based on the inter-frame difference method, the background image, the current frame image and adjacent frames of the current frame image are subjected to difference processing to obtain a plurality of difference images;

[0122] A logical operation is performed on the plurality of differential images to detect a second moving target in the current frame image.

[0123] Optionally, the second detection module 502 is further configured to:

[0124] Performing differential processing on the two frame images preceding the current frame image and the current frame image to obtain a first differential image;

[0125] Performing differential processing on the current frame image and two frames of images following the current frame image to obtain a second differential image;

[0126] Performing differential processing on the current frame image and the background image to obtain a third differential image;

[0127] Performing differential processing on a frame image before the current frame image and the current frame image to obtain a fourth differential image;

[0128] Performing differential processing on the current frame image and a frame image subsequent to the current frame image to obtain a fifth differential image.

[0129] Optionally, the second detection module 502 is further configured to:

[0130] Performing a logical OR operation on the first differential image and the second differential image to obtain a sixth differential image, and performing a logical OR operation on the fourth differential image and the fifth differential image to obtain a seventh differential image;

[0131] Performing a logic AND operation on the third differential image and the sixth differential image to obtain an eighth differential image, and performing a logic AND operation on the third differential image and the seventh differential image to obtain a ninth differential image;

[0132] Performing a logical OR operation on the eighth differential pattern and the ninth differential pattern to obtain a tenth differential image;

[0133] A foreground pixel point in the tenth differential image is detected as a second moving target.

[0134] Optionally, the third detection module 503 is further used to:

[0135] Performing a logical OR operation on the first moving target and the second moving target to obtain a third moving target;

[0136] Morphological processing is performed on the third moving target, and the foreground pixel point is used as the moving target of the current frame image.

[0137] Optionally, an update module is also included, for:

[0138] After detecting the second moving target in the current frame image, traverse each pixel point of the current frame image, and for each pixel point: determine whether the pixel point is a foreground or a background according to the detection result of the second moving target;

[0139] The background image and the background model are updated according to the pixels determined to be the background.

[0140] According to the various embodiments described above, it can be seen that the present invention uses the background image obtained by the background subtraction method as the background frame of the inter-frame difference method, and utilizes the characteristic that the inter-frame difference method is insensitive to illumination, and uses the background image obtained by the inter-frame difference for the background modeling of the background subtraction method, thereby solving the technical problems of holes, "double shadows", "ghost images", and illumination sensitivity that are easy to appear in the detection of moving targets in the prior art. The embodiment of the present invention combines the background subtraction method with the inter-frame difference method, and uses the background image obtained by the background subtraction method as the background frame of the inter-frame difference method, thereby increasing the accuracy of the five-frame difference detection of moving targets and substantially eliminating the "double shadow" problem that exists therein; and utilizes the characteristic that the inter-frame difference method is insensitive to illumination, and uses the background image obtained by the inter-frame difference for the background modeling of the background subtraction method, so as to improve the accuracy of the background pixel points of the model, while accelerating the elimination of "ghost images" and increasing the accuracy of the detection of moving targets.

[0141] It should be noted that the specific implementation content of the moving target detection device of the present invention has been described in detail in the moving target detection method described above, so the repeated content will not be described again here.

[0142] Figure 6 An exemplary system architecture 600 is shown to which the moving target detection method or moving target detection apparatus according to the embodiment of the present invention can be applied.

[0143] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0144] Users can use terminal devices 601, 602, and 603 to interact with server 605 through network 604 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0145] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0146] The server 605 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 601, 602, and 603. The backend management server may analyze and process the received data such as the item information query request, and feed back the processing results (such as target push information, item information - only an example) to the terminal device.

[0147] It should be noted that the moving target detection method provided in the embodiment of the present invention is generally executed by the server 605, and accordingly, the moving target detection device is generally set in the server 605. The moving target detection method provided in the embodiment of the present invention can also be executed by the terminal devices 601, 602, and 603, and accordingly, the moving target detection device can be set in the terminal devices 601, 602, and 603.

[0148] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0149] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0150] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0151] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0152] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program article, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.

[0153] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0154] The flowchart and block diagram in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the system, method and computer program article according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0155] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a first detection module, a second detection module and a third detection module, wherein the names of these modules do not constitute a limitation on the modules themselves in some cases.

[0156] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: using a background subtraction method to obtain a background image of a current frame image and detecting a first moving target in the current frame image; detecting a second moving target in the current frame image based on an inter-frame difference method and the background image; performing a logical operation on the first moving target and the second moving target, thereby detecting a moving target in the current frame image.

[0157] According to the technical solution of the embodiment of the present invention, because the background image obtained by the background subtraction method is used as the background frame of the inter-frame difference method, and the inter-frame difference method is insensitive to illumination, the background image obtained by the inter-frame difference is used in the background modeling of the background subtraction method, so the technical problems of holes, "double shadows", "ghost images", and illumination sensitivity that are easy to appear in the detection of moving targets in the prior art are overcome. The embodiment of the present invention combines the background subtraction method with the inter-frame difference method, and uses the background image obtained by the background subtraction method as the background frame of the inter-frame difference method, which increases the accuracy of the five-frame difference detection of moving targets and basically eliminates the "double shadow" problem; and the inter-frame difference method is insensitive to illumination, and the background image obtained by the inter-frame difference is used in the background modeling of the background subtraction method, so as to improve the accuracy of the background pixel points of the model, and at the same time accelerate the elimination of "ghost images" and increase the accuracy of the detection of moving targets.

[0158] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A moving target detection method, characterized in that: include: Using a background subtraction method to obtain a background image of a current frame image and detecting a first moving target in the current frame image; Detecting a second moving target in the current frame image based on an inter-frame difference method and the background image; Performing a logical operation on the first moving target and the second moving target, thereby detecting the moving target in the current frame image; After detecting the second moving target in the current frame image, the method further includes: Traversing each pixel point of the current frame image, for each pixel point: judging whether the pixel point is a foreground or a background according to a detection result of a second moving target; The background image and the background model are updated according to the pixels determined to be the background.

2. The method according to claim 1, characterized in that The method of obtaining a background image of a current frame image by using a background subtraction method and detecting a first moving target in the current frame image includes: Traverse each pixel point of the current frame image, and for each pixel point: combine the background model to determine whether the pixel point is foreground or background; The background image and the background model of the current frame image are updated according to the pixel points determined as the background, and the first moving target in the current frame image is detected according to the pixel points determined as the foreground.

3. The method according to claim 1, characterized in that Detecting a second moving target in the current frame image based on an inter-frame difference method and the background image includes: Based on the inter-frame difference method, the background image, the current frame image and adjacent frames of the current frame image are subjected to difference processing to obtain a plurality of difference images; A logical operation is performed on the plurality of differential images to detect a second moving target in the current frame image.

4. The method according to claim 3, characterized in that Based on the inter-frame difference method, the background image, the current frame image and adjacent frames of the current frame image are subjected to difference processing to obtain a plurality of difference images, including: Performing differential processing on the two frame images preceding the current frame image and the current frame image to obtain a first differential image; Performing differential processing on the current frame image and two frames of images following the current frame image to obtain a second differential image; Performing differential processing on the current frame image and the background image to obtain a third differential image; Performing differential processing on a frame image before the current frame image and the current frame image to obtain a fourth differential image; Performing differential processing on the current frame image and a frame image subsequent to the current frame image to obtain a fifth differential image.

5. The method according to claim 4, characterized in that Performing a logical operation on the plurality of differential images to detect a second moving target in the current frame image includes: Performing a logical OR operation on the first differential image and the second differential image to obtain a sixth differential image, and performing a logical OR operation on the fourth differential image and the fifth differential image to obtain a seventh differential image; Performing a logic AND operation on the third differential image and the sixth differential image to obtain an eighth differential image, and performing a logic AND operation on the third differential image and the seventh differential image to obtain a ninth differential image; performing a logical OR operation on the eighth differential image and the ninth differential image to obtain a tenth differential image; A foreground pixel point in the tenth differential image is detected as a second moving target.

6. The method according to claim 1, characterized in that Performing a logical operation on the first moving target and the second moving target to detect the moving target in the current frame image includes: Performing a logical OR operation on the first moving target and the second moving target to obtain a third moving target; Morphological processing is performed on the third moving target, and the foreground pixel point is used as the moving target of the current frame image.

7. A moving target detection device, characterized in that: include: A first detection module, used for obtaining a background image of a current frame image by using a background subtraction method and detecting a first moving target in the current frame image; A second detection module, used for detecting a second moving target in the current frame image based on an inter-frame difference method and the background image; a third detection module, configured to perform a logic operation on the first moving target and the second moving target, thereby detecting the moving target in the current frame image; Also includes update modules for: After detecting the second moving target in the current frame image, traverse each pixel point of the current frame image, and for each pixel point: determine whether the pixel point is a foreground or a background according to the detection result of the second moving target; The background image and the background model are updated according to the pixels determined to be the background.

8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Moving object rapid detection method based on video sequence

    CN106846359A

  • Pedestrian detection method based on GMM background difference and combined features

    CN107103303A

  • Moving target detection method and device, equipment and readable storage medium

    CN111325773A