Moving object detection method, device, readable storage medium and electronic device
Identifying moving areas and scaling detection through inter-frame differential information solves the problem of large calculations in traditional pyramid algorithms and improves the efficiency and applicability of moving object detection.
Patent Information
- Application Number
- CN202011160883.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-29
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2040-10-29
AI Technical Summary
The traditional image pyramid algorithm has a large amount of calculation in moving target detection, especially in large image scale scenarios. Multi-layer pyramid processing for each frame of image leads to a waste of bandwidth and computing power, and the processing power of the on-chip system is not enough to achieve high frame rates. Require.
By determining the moving area based on inter-frame difference information, scaling and detecting moving targets in the area, the processing of areas outside the image is avoided and the amount of calculation is reduced.
It significantly reduces the calculation amount of moving object detection, improves calculation efficiency, and is suitable for high frame rate and high bandwidth application scenarios, such as security monitoring.
Smart Images

Figure CN112287805B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing, and in particular to a method, device, readable storage medium, and electronic device for detecting a moving object. Background Art
[0002] Traditional image pyramid algorithms downsample the input image and then perform image recognition based on the downsampled results. Because the scale supported by the moving object detection module (e.g., a system-on-chip (SoC) chip capable of executing neural network operations) is fixed, and the system-on-chip (SoC) chip does not know the target object's scale in advance, the pyramid results of each layer are passed to the SoC's hardware module for moving object detection. The module then determines which frame to use for moving object detection based on the supported scale. In scenarios with large image scales, this approach suffers from high computational complexity. Multiple layers of pyramid processing are required for each input frame, while achieving a processing rate of 30, 60, or even higher frames per second. This places high demands on the computing power and bandwidth of the SoC chip. In practical applications, especially in security surveillance, the background of multiple consecutive frames is essentially the same. To some extent, it can be assumed that only a small portion of the image changes. Repeated processing of each frame results in a significant waste of bandwidth and computing power. Summary of the Invention
[0003] To address the above technical issues, the present disclosure is proposed. Embodiments of the present disclosure provide a moving object detection method, apparatus, readable storage medium, and electronic device, which detect moving objects based on a detected area within a first motion region, thereby avoiding detecting moving objects in areas outside the first motion region in an image. This significantly reduces the computational effort involved in moving object detection and improves computational efficiency.
[0004] According to one aspect of the present disclosure, a method for detecting a moving object is provided, comprising:
[0005] Determining inter-frame difference information between the current frame image and the previous frame image based on the current frame image and the previous frame image;
[0006] Determining a multi-frame image set based on the current frame image and a predetermined number of historical frame images before the current frame image;
[0007] determining a first motion region in the current frame image based on the inter-frame difference information of each frame image in the multi-frame image set;
[0008] determining, based on the first motion area, at least one detected area of a predetermined size;
[0009] Based on the detected area in the current frame image, a moving target in the detected area is determined.
[0010] According to a second aspect of the present disclosure, there is provided a moving object detection device, comprising:
[0011] A differential information acquisition module is configured to determine inter-frame differential information between a current frame image and a previous frame image based on the current frame image and the previous frame image;
[0012] A multi-frame image set determining module is configured to determine a multi-frame image set based on the current frame image and a predetermined number of frame images before the current frame image;
[0013] A motion region acquisition module is configured to determine a first motion region in the current frame image based on the inter-frame difference information of each frame image in the multi-frame image set;
[0014] A scale conversion module: configured to determine at least one detected area of a predetermined scale based on the first motion area;
[0015] The moving target detection module is configured to determine a moving target in the detected area based on the detected area in the current frame image.
[0016] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is used to execute any of the above-mentioned methods for detecting moving objects.
[0017] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising:
[0018] processor;
[0019] a memory for storing instructions executable by the processor;
[0020] The processor is configured to read the executable instructions from the memory and execute the instructions to implement any of the above-mentioned methods for detecting moving objects.
[0021] In the above four technical solutions disclosed in the present invention, the first motion area in the current frame image is determined by the differential information in the multi-frame image set, and then calculations are performed based on the first motion area to obtain a detected area of a predetermined scale, and the moving target is detected based on the detected area. In the present invention, the first motion area is scaled and detected. Since the part outside the first motion area does not participate in the calculation, the calculation amount of the detected area is greatly reduced, thereby improving the calculation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The above and other purposes, features, and advantages of the present disclosure will become more apparent through a more detailed description of the embodiments of the present disclosure in conjunction with the accompanying drawings. The accompanying drawings are intended to provide a further understanding of the embodiments of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and are not intended to limit the present disclosure. In the drawings, the same reference numerals generally represent the same components or steps.
[0023] Figure 1 It is a flowchart of a moving object detection method provided by an exemplary embodiment of the present disclosure.
[0024] Figure 2 It is a flowchart of differential information confirmation of a moving object detection method provided by another exemplary embodiment of the present disclosure.
[0025] Figure 3 It is a schematic diagram of a flow chart of first motion region confirmation of a moving object detection method provided by another exemplary embodiment of the present disclosure.
[0026] Figure 4 It is a schematic diagram of a flow chart of first motion region confirmation of a moving object detection method provided by another exemplary embodiment of the present disclosure.
[0027] Figure 5 It is a flowchart of the second motion region merging of the moving object detection method provided by another exemplary embodiment of the present disclosure.
[0028] Figure 6 It is a flowchart of the second motion region merging of the moving object detection method provided by another exemplary embodiment of the present disclosure.
[0029] Figure 7 It is a schematic diagram of a flow chart of determining a detected reference image in a moving object detection method provided by another exemplary embodiment of the present disclosure.
[0030] Figure 8 It is a schematic diagram of a flow chart of reference image determination in a moving object detection method provided by another exemplary embodiment of the present disclosure.
[0031] Figure 9 FIG. 1 is a schematic diagram of a moving object detection device provided by an exemplary embodiment of the present disclosure.
[0032] Figure 10 2 is a schematic diagram of a differential information acquisition module of a moving object detection device provided by another exemplary embodiment of the present disclosure.
[0033] Figure 11 3 is a schematic diagram of a first motion region acquisition module of a moving object detection device provided by another exemplary embodiment of the present disclosure.
[0034] Figure 12 2 is a schematic diagram of a first motion region submodule of a moving object detection device provided by another exemplary embodiment of the present disclosure.
[0035] Figure 13 FIG. 4 is a schematic diagram of a first merging subunit of a moving object detection device provided by another exemplary embodiment of the present disclosure.
[0036] Figure 14 FIG. 4 is a schematic diagram of a first motion region determining unit of a moving object detection apparatus provided by another exemplary embodiment of the present disclosure.
[0037] Figure 15 2 is a schematic diagram of various modules for determining a reference image target object in a moving object detection device provided by another exemplary embodiment of the present disclosure.
[0038] Figure 16 FIG. 4 is a schematic diagram of a reference image determination module of a moving object detection apparatus provided by another exemplary embodiment of the present disclosure.
[0039] Figure 17 is a structural diagram of an electronic device provided by an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0040] Below, the exemplary embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure, and it should be understood that the present disclosure is not limited to the exemplary embodiments described herein.
[0041] Application Overview
[0042] For the detection of moving objects, especially in the process of using neural networks to detect moving objects in video images, due to the different resolutions of the sensors of the image acquisition module or the different distances of the photographed objects, the imaging sizes of the objects will be different. It is usually necessary to scale each frame of the video captured by the image acquisition module to form an image of a specified scale before detecting the moving objects.
[0043] In the technical solution disclosed herein, inter-frame differential information is first obtained by performing a difference calculation between the current frame image and the previous frame image. A multi-frame image set is then determined based on the multiple historical frame images preceding the current frame image. A first motion region is then determined based on the inter-frame differential information of the multi-frame image set. In the subsequent image recognition process, the first motion region of the current frame image is scaled to obtain a detected region of a predetermined scale, and a moving target is determined based on the detected region. In the present disclosure, the first motion region is scaled, and portions outside the first motion region are not included in the calculation. This greatly reduces the amount of computation required during image scaling, thereby significantly improving computational efficiency.
[0044] Exemplary Methods
[0045] Figure 1 A method for detecting a moving object provided by an exemplary embodiment of the present disclosure includes:
[0046] Step 101, determining inter-frame difference information between a current frame image and a previous frame image based on a current frame image and a previous frame image;
[0047] In some embodiments, the current frame image refers to an image of a frame being processed during the image processing process; the previous frame image refers to a frame image that is before the current frame image and adjacent to the current frame image; the inter-frame differential information refers to the difference image obtained by performing differential calculation between the current frame image and the previous frame image and the brightness or grayscale information of each pixel in the difference image.
[0048] Step 102: determining a multi-frame image set based on the current frame image and a predetermined number of historical frame images before the current frame image;
[0049] In some embodiments, a historical frame image refers to a plurality of frames preceding a current frame image. In some preferred embodiments, a historical frame image refers to a plurality of consecutive frames preceding a current frame image. A multi-frame image set refers to a set including a plurality of frames preceding a current frame image. The number of historical frame images can be selected based on the real-time requirements during video processing. For example, when the real-time requirements are high, a single historical frame image is used. When the real-time requirements are low, two or three historical frame images can be used. In actual implementation, the number of historical frame images can also be set based on the bandwidth of the system-on-chip (SOC) chip. For example, when the system-on-chip (SOC) chip is sensitive to bandwidth, the historical frame image can be set to one frame image. Each frame image will calculate and update the motion area. When the system-on-chip (SOC) chip has sufficient bandwidth, the differential result accumulated from the consecutive multiple frames can be calculated.
[0050] Step 103: determining a first motion region in the current frame image based on the inter-frame difference information of each frame image in the multi-frame image set;
[0051] In some embodiments, inter-frame difference information refers to a difference image obtained by performing a differential calculation between a current frame image and a previous frame image, as well as the brightness or grayscale information of each pixel in the difference image. Multiple consecutive inter-frame difference information in a multi-frame image set is accumulated to obtain an accumulated result of multiple consecutive inter-frame difference information. When the accumulated result of a particular pixel exceeds a specified threshold, the corresponding pixel in the last frame image of the multi-frame image set is considered a moving pixel, and the location of the moving pixel and each set of pixels within a predetermined distance around the moving pixel is defined as a first motion region. Since the moving pixels of the multiple frames are accumulated when the inter-frame difference information of the multi-frame image set is accumulated, the result obtained includes the moving pixels in each frame image. Therefore, the accumulated result may cause ghosting of the moving target along its motion direction. Therefore, the number of frame images in the multi-frame image set in the previous step can be selected to be no more than 3, for example, to avoid the generation of ghosting.
[0052] Step 104: determining at least one detected area of a predetermined size based on the first motion area;
[0053] In some embodiments, the first motion region is scaled to obtain at least one detected region of a predetermined size. In subsequent processing, the at least one detected region of a predetermined size is fed into a module for detecting moving objects. The module for detecting moving objects may be a system-on-chip (SOC) chip, an FPGA chip, or an ASIC chip, such as an SOC chip capable of executing neural network operations. The predetermined size is determined by the size supported by the module for detecting moving objects, and the number of detected regions is determined by the size of the first motion region and the size supported by the module for detecting moving objects.
[0054] Step 105 : Determine a moving target in the detected area based on the detected area in the current frame image.
[0055] In some embodiments, the detected area is a portion of the current frame image containing a moving target. Detecting moving targets based on the detected area can reduce computational complexity while ensuring detection accuracy. A moving target is an object whose position changes between the current frame image and the previous frame image, such as a moving vehicle, a running animal, or a walking person.
[0056] In the technical solution disclosed in the present invention, the first motion area in the current frame image is determined by the differential information in the multi-frame image set, and then calculations are performed based on the first motion area to obtain a detected area of a predetermined scale, and the moving target is detected based on the detected area. Since the detected area is a local image in the current frame image, calculations are performed on the detected area, which can greatly reduce the amount of calculation of the detected area and improve calculation efficiency.
[0057] like Figure 2 As shown in the above Figure 1 Based on the embodiment of FIG. 1 , step 101 may further include the following steps:
[0058] Step 1011: determining a pixel difference value corresponding to a predetermined color channel in a predetermined color space based on pixel values corresponding to the current frame image and the previous frame image;
[0059] In some embodiments, each image frame has pixel values for a predetermined color channel in a predetermined color space. When calculating a pixel difference value, the pixel values for the predetermined color channel in the predetermined color space of the current image frame are differentiated from the pixel values for the previous image frame in order to obtain the pixel difference value. For example, when calculating the current image frame and the previous image frame in YUV space, the pixel values for the Y channel of the current image frame in YUV space are differentiated from the pixel values for the Y channel of the previous image frame in YUV space to obtain the pixel difference value for the Y channel of the current image frame and the previous image frame in order ...
[0060] Taking the calculation of the current frame image and the previous frame image in YUV space as an example, the calculation process is as follows:
[0061] The calculation formula for the pixel difference value corresponding to the Y channel is as follows:
[0062] |Y(x,y,t)–Y(x,y,t-1)|;
[0063] The calculation formula for the pixel difference value corresponding to the U channel is as follows:
[0064] |U(x,y,t)–U(x,y,t-1)|;
[0065] The calculation formula for the pixel difference value corresponding to the V channel is as follows:
[0066] |V(x,y,t)–V(x,y,t-1)|;
[0067] Where x and y are the coordinates of the image; t and t-1 are the frame numbers of the current frame image and the previous frame image; Y, U, and V represent three channels respectively. Specifically, Y(x, y, t) represents the pixel value at the coordinate (x, y) in the Y channel of the current frame image in the YUV space.
[0068] Those skilled in the art should understand that the above only takes the calculation process in the YUV space as an example, and during the calculation process, calculation can also be performed in the RGB, HSV or HSL space.
[0069] Step 1012: Determine the inter-frame difference information based on the pixel difference value and a predetermined weight value.
[0070] In some embodiments, the pixel difference values are the pixel difference values of the predetermined color channels in the predetermined color space calculated in the previous step. The above-mentioned difference values are weighted according to a predetermined weight value to obtain the inter-frame difference information. The above-mentioned weight value is set based on the moving target of the video image that needs to be paid attention to and the background of the video image. For example, the information of the moving target of the video image that needs to be paid attention to is mainly concentrated in the Y channel. In this case, the information recognition requirement for the Y channel is higher. The weight value corresponding to the Y channel is set to a higher weight value. In this case, the pixel difference value of the Y channel will have a greater impact on the inter-frame difference information, which is beneficial to the recognition of the information in the Y channel. For another example, the background information of the video image is mainly concentrated in the V channel. In this case, during the detection process, there is no need to pay attention to the background information. Therefore, the information recognition requirement for the V channel is higher. The weight value corresponding to the V channel is set to a higher weight value. In this case, the pixel difference value of the V channel will have a smaller impact on the inter-frame difference information, which is beneficial to the recognition of the information in the Y and V channels.
[0071] Still taking the calculation of the current frame image and the previous frame image in YUV space as an example, the calculation process is as follows:
[0072] D(x,y,t)=((|Y(x,y,t)–Y(x,y,t-1)|< <W0)+
[0073] (|U(x,y,t)–U(x,y,t-1)|< <W1)+
[0074] (|V(x,y,t)–V(x,y,t-1)|< <W2))
[0075] Among them, W0+W1+W2=100%.
[0076] In the above formula, D(x, y, t) represents the inter-frame differential information of the pixel at the coordinate (x, y) of the current frame image; Y(x, y, t) represents the pixel differential value at the coordinate (x, y) of the Y channel of the current frame image in the YUV space, and the same applies to Y(x, y, t-1), U(x, y, t), U(x, y, t-1), V(x, y, t), and V(x, y, t-1); W0, W1, and W2 represent the weight values of the pixel differential values in the three color channels. In some embodiments, the above weight values are set based on the moving target that needs to be paid attention to in the video picture and the background of the picture in the video. For example, the information of the moving target that needs to be paid attention to in the video picture is mainly concentrated in the Y channel. At this time, the information recognition requirement for the Y channel is higher, and the weight value corresponding to the Y channel is set to a higher weight value. At this time, the pixel differential value of the Y channel will have a greater impact on the inter-frame differential information, which is conducive to the recognition of the information of the Y channel. For another example, the background information of the picture in the video is mainly concentrated in the V channel. At this time, during the detection process, there is no need to pay attention to the background information. Therefore, the information recognition requirements for the V channel are higher, and the weight value corresponding to the V channel is set to a higher weight value. At this time, the pixel difference value of the V channel will have less impact on the inter-frame differential information, which is conducive to the recognition of the information of the Y channel and the V channel.
[0077] By using the method described in the above embodiment to confirm inter-frame difference information, it is possible to focus on the pixel difference values of all color channels, thereby making the calculation result sensitive to the grayscale of moving objects. Of course, in some scenarios, such as traffic lights, it is also possible to focus only on one or more components in the YUV, thereby making the calculation result sensitive to color changes of objects in the image.
[0078] like Figure 3 As shown, in Figure 1 Based on the embodiment shown, the above step 103 may further include the following steps:
[0079] Step 1031, accumulating inter-frame difference information of each frame image in the multi-frame image set to determine accumulated difference information of the multi-frame image set;
[0080] In some embodiments, the inter-frame difference information of each frame image in the multi-frame image set is accumulated, and the accumulated result is used as the accumulated difference information of the multi-frame image set; this difference information is subsequently used to determine the first motion area of the current frame image. The specific calculation formula of the difference information is as follows:
[0081] C(x,y,Δt)=D(x,y,t1)+D(x,y,t1+1)+…+D(x,y,t2);
[0082] Wherein, C(x, y, Δt) represents the accumulated result of the pixel difference value at point (x, y); D(x, y, t1) represents the pixel difference value of the t1 frame image at (x, y).
[0083] Step 1032: determining moving pixels in the current frame image based on a comparison result between the accumulated difference information and a predetermined threshold;
[0084] In some embodiments, the predetermined threshold is set based on the stray noise of the sensor used to capture the image. The greater the sensor's stray noise, the higher the predetermined threshold is typically set. This is intended to filter out recognition errors caused by stray noise. For example, if two frames of imagery are substantially identical, and the threshold is set too low, motion may be detected in both frames due to the influence of sensor stray noise.
[0085] Step 1033: Determine a first motion region of the current frame image based on the motion pixel points in the current frame image.
[0086] In some embodiments, after determining the cumulative difference information of all pixels in the current frame image, pixels whose cumulative difference information is greater than a predetermined threshold are screened out, i.e., moving pixels are screened out. The locations occupied by the moving pixels are defined as the first motion region. Typically, to ensure the integrity of the moving object, pixels within a certain distance around the moving pixel are also considered as pixel values within the first motion region.
[0087] In the above embodiment, the inter-frame differential information in the multi-frame image set is accumulated, and the moving pixel points are identified based on the accumulated results. In the multi-frame image set, the moving area of the current frame is identified, thereby reducing the computational complexity of the moving area identification and the subsequent moving target detection, and greatly improving the efficiency of identifying moving objects.
[0088] like Figure 4 As shown, in Figure 3 Based on the embodiment shown, step 1033 may further include the following steps:
[0089] Step 10331: Based on the moving pixel point and the predetermined distance, determine a set of pixel points whose distance from the moving pixel point is within the predetermined distance range;
[0090] In some embodiments, the predetermined distance is set based on the scene of each frame image. For example, when the target objects in the scene of each frame image are relatively large, the predetermined distance is set to be larger, and when the target objects in the scene of each frame image are relatively small, the predetermined distance is set to be smaller. The pixel point set includes moving pixel points and pixel points that are less than the predetermined distance from the moving pixel points. The purpose of this setting is to ensure that the entire moving target object is included in the first moving area. For example, when a part of a moving target object moves, it is obviously impossible to include the entire moving target object in the first moving area by using the moving pixel points as the moving area. However, by setting a reasonable predetermined distance and determining the first moving area by using the pixel points within the predetermined distance around the moving pixel points as elements of the pixel point set, the moving target object can usually be included in the first moving area.
[0091] Step 10332: Determine the first motion area based on the pixel point set.
[0092] In some embodiments, the position of the moving pixel in the current frame image and the positions of the pixels within a predetermined distance around the moving pixel are combined to obtain a first motion region. For example, when the predetermined distance is set to 16 pixels, the scale of the first motion region determined by a moving pixel is a 32*32 first motion region. In this case, the first motion region includes both the moving pixel and the pixels within the predetermined distance around the moving pixel.
[0093] By adopting the technical solution in the above embodiment, the position of the current frame image occupied by the moving pixel point and the pixel points within a predetermined distance around the moving pixel point is taken as the first moving area, which can ensure that the entire moving target is included in the first moving area, which is conducive to the subsequent identification of the moving target in the first moving area.
[0094] like Figure 5 As shown in the above Figure 4 Based on the embodiment shown, step 10332 may further include the following steps:
[0095] Step 103321: determining a second motion area based on the pixel point set;
[0096] In some embodiments, each moving pixel can define a pixel set, and the positions occupied by the individual pixels in each pixel set are combined to form a second motion region. Because each second motion region includes not only the moving pixel but also pixels within a predetermined distance around the moving pixel, when the distance between two moving pixels is less than the predetermined distance, the second motion regions defined by the pixel sets corresponding to the two moving pixels will inevitably contain overlapping pixels.
[0097] Step 103322: Based on the overlapping pixels of the two or more second motion regions, merge the two or more second motion regions into a first motion region.
[0098] In some embodiments, when two second motion areas have overlapping pixel points, one of the motion pixel points is within the second motion area corresponding to the other motion pixel point. At this time, the two motion pixel points can be regarded as two motion pixel points of the same motion target. Therefore, the two second motion areas are merged into the first motion area, thereby ensuring that the same motion target is not segmented, facilitating the subsequent identification of the motion target.
[0099] like Figure 6 As shown in the above Figure 4 Based on the embodiment shown, step 10332 may further include the following steps:
[0100] Step 103321: determining a second motion area based on the pixel point set;
[0101] In some embodiments, each moving pixel can be used to define a pixel set, and the positions occupied by each pixel set are combined to form a second motion region. When the distance between two adjacent second motion regions is small, the two second motion regions can generally be considered to be motion regions on the same target object.
[0102] Step 103323: Determine a merging result of the two adjacent second motion regions based on a distance between the two adjacent second motion regions;
[0103] In some embodiments, when a portion of a moving target is close to the image of the background area, the two second motion areas identified for the same moving target will be discontinuous. At this time, in order to ensure that the same moving target is divided into the same first motion area, the distance between the two adjacent second motion areas is used to determine whether to merge the two second motion areas. When the distance is less than a specific distance, the two second motion areas are merged. When the distance is not less than a specific distance, the two second motion areas are respectively used as two first motion areas. The above-mentioned specific distance can be set according to the scene of the picture in the video, and can also be set according to the moving target to be identified.
[0104] Step 103324: Based on the merging result, merge two adjacent second motion areas whose distance meets a preset condition into a first motion area.
[0105] In some embodiments, the predetermined condition may be, for example, that the distance between the two second motion areas is less than a specific distance. Based on the above steps, the two second motion areas in the current frame image whose distance is less than the specific distance are merged into the first motion area. When setting the above specific distance, it is necessary to set it according to the scene of the picture in the video, and it can also be set according to the moving target that needs to be identified. For example, when the moving target occupies a large proportion in the video image, the specific distance can be set to a larger distance. For another example, when the scene color of the picture in the video is relatively single, the specific distance can be set to a smaller distance. The purpose of merging the two second motion areas in the current frame image whose distance is less than the specific distance is to ensure that the same moving target is divided into the same first motion area. If the specific distance is set too small, the complete moving object may be segmented, resulting in the inability of subsequent modules to correctly identify it; if the specific distance is set too large, the scale of the first motion area will be larger, and the subsequent scaling of the first motion area and the amount of calculation for identifying the detected area will increase.
[0106] like Figure 7 As shown in the above Figure 1 Based on the embodiment shown, the method further includes the following steps:
[0107] Step 106, determining a reference image based on a comparison result between the current frame image and a predetermined condition;
[0108] In some embodiments, the picture in the video expresses a scene with a slowly changing background. In this case, reference images need to be used at intervals to help the system grasp the slowly changing background. The predetermined condition can be determined based on the background of the picture in the video, or based on the moving target of the picture in the video. For example, the current frame image can be selected as the reference image every fixed number of historical frame images based on the background change speed of the picture in the video. When the background change speed of the picture in the video is fast, the number of historical frame images at intervals is small. When the background change speed of the picture in the video is slow, the number of historical frame images at intervals is large. Whether to use the current frame image as the reference image can also be determined based on the proportion of the first motion area in the current frame image.
[0109] Step 107, downsampling the reference image successively to obtain at least one detected reference image of a predetermined scale;
[0110] In some embodiments, the reference image is also limited by the scale supported by the module for detecting moving targets (such as a SOC chip capable of performing neural network operations). Therefore, the reference image needs to be downsampled at least once to obtain at least one detected reference image of a predetermined scale. Since the minimum image scale that can be obtained by a single downsampling is 1 / 2 of the original image scale, when the scale of the reference image differs greatly from the predetermined scale, the reference image needs to be downsampled multiple times, and each downsampling obtains a frame of a detected reference image of a predetermined scale, until a detected reference image of a scale supported by the module for detecting moving targets is obtained. Therefore, the number of detected reference images needs to be determined by the scale supported by the module for detecting moving targets and the scale of the reference image. The predetermined scale can be determined by the scale supported by the module for detecting moving targets.
[0111] Step 108: Determine the moving target in the reference image based on the at least one detected reference image of a predetermined scale.
[0112] In some embodiments, after obtaining the reference image to be detected, the reference image to be detected is fed into a module for detecting moving objects, such as a SOC chip capable of performing neural network operations, and the module is used to detect moving objects in the reference image.
[0113] In the above embodiment, by selecting reference images at intervals, background changes in the video can be identified, thereby eliminating the impact of background changes on the recognition of moving objects. For example, as time passes, the illumination changes caused by the rising and setting of the sun will affect the brightness of each frame in the video. Using the method of this embodiment, the impact of background brightness changes on the recognition of moving objects can be eliminated.
[0114] In the above Figure 7 Based on the embodiment shown, step 106 includes: determining a reference image based on the number of frame images between the current frame image and the previous reference image.
[0115] In some embodiments, the above-mentioned method of determining the reference image is a static determination method, and its specific method is to take out a frame image as a reference image at every fixed number of frame images. For example, the reference image is called frame A, and the frame image that scales the first motion area is called frame B. By setting a period T, the reference image is periodically scaled to obtain the detected reference image every T period and sent to the moving target recognition module for processing. For example, taking a video with a frame rate of 50Hz as an example, when T is 100 milliseconds, that is, every 100 milliseconds, a frame image is taken as a reference image. At this time, the arrangement order of the reference image and the frame image that scales the first motion area is ABBBBABBBB. Since the frame image rate is fixed in the same video, that is, the time occupied by each frame image is fixed, the fixed period is specified to determine the number of frame images in the interval. Of course, you can also directly set a fixed number of interval frame images, for example, set it to obtain a frame image as a reference image every 3 frames. At this time, the frame images of the full image zoom and the frame images of the first motion area zoom will be arranged as follows: ABBBABBB.
[0116] Setting the reference image in the manner of this embodiment can eliminate the influence caused by the slowly changing background environment, and is conducive to the accurate recognition of moving targets.
[0117] like Figure 8 As shown in the above Figure 7 Based on the embodiment shown, step 106 may further include the following steps:
[0118] Step 1061, determining the proportion of the first motion region in the current frame image to the current frame image;
[0119] In some embodiments, the ratio of the first motion region to the current frame image refers to the ratio of the number of pixels in the first motion region to the total number of pixels in the current frame image. In some embodiments, there may be multiple first motion regions. When there are multiple first motion regions, the ratio refers to the ratio of the sum of the number of pixels in the multiple first motion regions to the total number of pixels in the current frame image.
[0120] Step 1062: Determine a reference image based on the comparison result of the ratio and a predetermined threshold range.
[0121] In some embodiments, when the detected motion area exceeds a certain proportion of the full image, the full image is automatically scaled and sent to the motion target detection module for processing. The proportion of the motion area can be configured according to different application scenarios. For example, in a scene with dense flow of people, vehicles or animals, setting the ratio to be smaller will help to identify the moving details of the picture in the video. At this time, the ratio of the A frame image and the B frame image is dynamically changing. For example, when the proportion of the first motion area of the first frame image, the fourth frame image to the sixth frame image and the twelfth frame image exceeds a certain proportion of the full image, the first frame image, the fourth frame image to the sixth frame image and the twelfth frame image are used as reference frames, and the first motion areas of other frame images do not exceed the full image. Figure 1 The first motion region is scaled at a fixed ratio, so that the reference image and the frame image for scaling the first motion region are arranged in the following order: ABBAAABBBBBABB.
[0122] By adopting the technical solution of this embodiment, the reference image can be determined according to the proportion of the moving target in the current frame image, thereby being able to fully identify the activity details of the moving target in the video.
[0123] Those skilled in the art will appreciate that the two aforementioned methods of setting reference images, static and dynamic, can be switched. For example, the ratio (or absolute number) of moving pixels per unit time can be detected. When the ratio is low, static reference image selection can be used. Another example, depending on the scene, static reference image selection can be used at night, while dynamic reference image selection can be used during the day.
[0124] In the above Figure 7 Based on the embodiment shown, the following steps may be further included after step 107:
[0125] Based on the detected area of the current frame image and the detected reference image of the reference image of a frame image before the current frame image, a detected image of a predetermined scale corresponding to the current frame image is determined.
[0126] In some embodiments, this step can be implemented in two ways, one of which is as follows: based on the coordinates of the first motion region, the position of the motion region relative to the starting point of the image is obtained, and the relative position can be converted into an address offset relative to the starting point of the image. This method stores the scaling result of the first motion region, that is, at least one detected region of a predetermined scale, in a storage unit. When the module for detecting the moving target requires the scaling result of the entire image of the current frame, the scaling result of the detected region and a frame of reference image before the current frame, that is, at least one frame of detected reference image, can be read out at the same time. According to the address offset of the first motion region, the detected reference image and the detected region are summed, and the summed result is the scaling result of the entire image of the current frame. The second method is as follows: If the module for detecting moving targets needs to directly obtain the full image scaling result of the current frame image instead of transferring it through the storage unit, the previously detected reference image stored in the storage unit can be read out at the same time during the calculation process of the detected area. According to whether the current image pixel is a moving area, it is determined whether to sum the detected area and the previously detected reference image and output it to the subsequent processing module or to output the previously detected reference image in the storage unit to the subsequent processing module. If the pixel is in the first moving area, the sum of the detected area and the previously detected reference image is output to the subsequent module. Otherwise, the previously detected reference image is directly output to the subsequent module for processing. This processing transmits the detected area of the predetermined scale obtained from the moving area in the current frame image to the module for detecting moving targets, eliminating the process of storing the detected area of the predetermined scale in the storage unit and reading it out from the storage unit, thereby greatly reducing the image processing delay.
[0127] Exemplary devices
[0128] Figure 9 An exemplary embodiment of the present disclosure provides a moving object detection device, comprising:
[0129] The difference information acquisition module 901 is used for determining the inter-frame difference information between the current frame image and the previous frame image based on the current frame image and the previous frame image.
[0130] In some embodiments, the current frame image refers to an image of a frame being processed during the image processing process; the previous frame image refers to a frame image that is before the current frame image and adjacent to the current frame image; the inter-frame differential information refers to the difference image obtained by performing differential calculation between the current frame image and the previous frame image and the brightness or grayscale information of each pixel in the difference image.
[0131] A multi-frame image set determining module 902 is configured to determine a multi-frame image set based on the current frame image and a predetermined number of historical frame images before the current frame image;
[0132] In some embodiments, a historical frame image refers to a plurality of frames preceding a current frame image. In some preferred embodiments, a historical frame image refers to a plurality of consecutive frames preceding a current frame image. A multi-frame image set refers to a set including a plurality of frames preceding a current frame image. The number of historical frame images can be selected based on the real-time requirements during video processing. For example, when the real-time requirements are high, a single historical frame image is used. When the real-time requirements are low, two or three historical frame images can be used. In actual implementation, the number of historical frame images can also be set based on the bandwidth of the system on chip (SOC). For example, when the system on chip (SOC) is sensitive to bandwidth, the historical frame image can be set to one frame. Each frame image will calculate and update the motion area. When the system on chip (SOC) has sufficient bandwidth, the differential result accumulated from the consecutive multiple frames can be calculated.
[0133] a first motion region acquisition module 903, configured to determine a first motion region in the current frame image based on the inter-frame difference information of each frame image in the multi-frame image set;
[0134] In some embodiments, inter-frame difference information refers to a difference image obtained by performing a differential calculation between a current frame image and a previous frame image, as well as the brightness or grayscale information of each pixel in the difference image. Multiple consecutive inter-frame difference information in a multi-frame image set is accumulated to obtain an accumulated result of multiple consecutive inter-frame difference information. When the accumulated result of a particular pixel exceeds a specified threshold, the corresponding pixel in the last frame image of the multi-frame image set is considered a moving pixel, and the location of the moving pixel and each set of pixels within a predetermined distance around the moving pixel is defined as a first motion region. Since the moving pixels of the multiple frames are accumulated when the inter-frame difference information of the multi-frame image set is accumulated, the result obtained includes the moving pixels in each frame image. Therefore, the accumulated result may cause ghosting of the moving target along its motion direction. Therefore, the number of frame images in the multi-frame image set in the previous step can be selected to be no more than 3, for example, to avoid the generation of ghosting.
[0135] A scale conversion module 904 is configured to determine at least one detected area of a predetermined scale based on the first motion area;
[0136] In some embodiments, the first motion region is scaled to obtain at least one detected region of a predetermined size. In subsequent processing, the at least one detected region of a predetermined size is fed into a module for detecting moving objects. The module for detecting moving objects may be a system-on-chip (SOC) chip, an FPGA chip, or an ASIC chip, such as an SOC chip capable of executing neural network operations. The predetermined size is determined by the size supported by the module for detecting moving objects, and the number of detected regions is determined by the size of the first motion region and the size supported by the module for detecting moving objects.
[0137] The moving object detection module 905 determines a moving object in the detected area based on the detected area in the current frame image.
[0138] In some embodiments, the detected area is a portion of the current frame image containing a moving target. Detecting moving targets based on the detected area can reduce computational complexity while ensuring detection accuracy. A moving target is an object whose position changes between the current frame image and the previous frame image, such as a moving vehicle, a running animal, or a walking person.
[0139] In the technical solution disclosed in the present invention, the first motion area in the current frame image is determined by the differential information in the multi-frame image set, and then calculations are performed based on the first motion area to obtain a detected area of a predetermined scale, and the moving target is detected based on the detected area. Since the detected area is a local image in the current frame image, calculations are performed on the detected area, which can greatly reduce the amount of calculation of the detected area and improve calculation efficiency.
[0140] like Figure 10 As shown in the above Figure 9 Based on the embodiment of FIG. 1 , the differential information acquisition module 901 may further include the following submodules:
[0141] A pixel difference submodule 9011 is configured to determine a pixel difference value corresponding to a predetermined color channel in a predetermined color space based on pixel values corresponding to the current frame image and the previous frame image;
[0142] In some embodiments, each image frame has pixel values for a predetermined color channel in a predetermined color space. When calculating a pixel difference value, the pixel values for the predetermined color channel in the predetermined color space of the current image frame are differentiated from the pixel values for the previous image frame in order to obtain the pixel difference value. For example, when calculating the current image frame and the previous image frame in YUV space, the pixel values for the Y channel of the current image frame in YUV space are differentiated from the pixel values for the Y channel of the previous image frame in YUV space to obtain the pixel difference value for the Y channel of the current image frame and the previous image frame in order ...
[0143] Taking the calculation of the current frame image and the previous frame image in YUV space as an example, the calculation process is as follows:
[0144] The calculation formula for the pixel difference value corresponding to the Y channel is as follows:
[0145] |Y(x,y,t)–Y(x,y,t-1)|;
[0146] The calculation formula for the pixel difference value corresponding to the U channel is as follows:
[0147] |U(x,y,t)–U(x,y,t-1)|;
[0148] The calculation formula for the pixel difference value corresponding to the V channel is as follows:
[0149] |V(x,y,t)–V(x,y,t-1)|;
[0150] Where x and y are the coordinates of the image; t and t-1 are the frame numbers of the current frame image and the previous frame image; Y, U, and V represent three channels respectively. Specifically, Y(x, y, t) represents the pixel value at the coordinate (x, y) in the Y channel of the current frame image in the YUV space.
[0151] Those skilled in the art should understand that the above only takes the calculation process in the YUV space as an example, and during the calculation process, calculation can also be performed in the RGB, HSV or HSL space.
[0152] The inter-frame difference submodule 9012 is configured to determine the inter-frame difference information based on the pixel difference value and a predetermined weight value.
[0153] In some embodiments, the pixel difference values are the pixel difference values of the predetermined color channels in the predetermined color space calculated in the previous step. The above-mentioned difference values are weighted according to a predetermined weight value to obtain the inter-frame difference information. The above-mentioned weight value is set based on the moving target of the video image that needs to be paid attention to and the background of the video image. For example, the information of the moving target of the video image that needs to be paid attention to is mainly concentrated in the Y channel. In this case, the information recognition requirement for the Y channel is higher. The weight value corresponding to the Y channel is set to a higher weight value. In this case, the pixel difference value of the Y channel will have a greater impact on the inter-frame difference information, which is beneficial to the recognition of the information in the Y channel. For another example, the background information of the video image is mainly concentrated in the V channel. In this case, during the detection process, there is no need to pay attention to the background information. Therefore, the information recognition requirement for the V channel is higher. The weight value corresponding to the V channel is set to a higher weight value. In this case, the pixel difference value of the V channel will have a smaller impact on the inter-frame difference information, which is beneficial to the recognition of the information in the Y and V channels.
[0154] Still taking the calculation of the current frame image and the previous frame image in YUV space as an example, the calculation process is as follows:
[0155] D(x,y,t)=((|Y(x,y,t)–Y(x,y,t-1)|< <W0)+
[0156] (|U(x,y,t)–U(x,y,t-1)|< <W1)+
[0157] (|V(x,y,t)–V(x,y,t-1)|< <W2))
[0158] Among them, W0+W1+W2=100%.
[0159] In the above formula, D(x, y, t) represents the inter-frame differential information of the pixel at the coordinate (x, y) of the current frame image; Y(x, y, t) represents the pixel differential value at the coordinate (x, y) of the Y channel of the current frame image in the YUV space, and the same applies to Y(x, y, t-1), U(x, y, t), U(x, y, t-1), V(x, y, t), and V(x, y, t-1); W0, W1, and W2 represent the weight values of the pixel differential values in the three color channels. In some embodiments, the above weight values are set based on the moving target that needs to be paid attention to in the video picture and the background of the picture in the video. For example, the information of the moving target that needs to be paid attention to in the video picture is mainly concentrated in the Y channel. At this time, the information recognition requirement for the Y channel is higher, and the weight value corresponding to the Y channel is set to a higher weight value. At this time, the pixel differential value of the Y channel will have a greater impact on the inter-frame differential information, which is conducive to the recognition of the information of the Y channel. For another example, the background information of the picture in the video is mainly concentrated in the V channel. At this time, during the detection process, there is no need to pay attention to the background information. Therefore, the information recognition requirements for the V channel are higher, and the weight value corresponding to the V channel is set to a higher weight value. At this time, the pixel difference value of the V channel will have less impact on the inter-frame differential information, which is conducive to the recognition of the information of the Y channel and the V channel.
[0160] By using the method described in the above embodiment to confirm inter-frame difference information, it is possible to focus on the pixel difference values of all color channels, thereby making the calculation result sensitive to the grayscale of moving objects. Of course, in some scenarios, such as traffic lights, it is also possible to focus only on one or more components in the YUV, thereby making the calculation result sensitive to color changes of objects in the image.
[0161] like Figure 11 As shown, in Figure 9 Based on the embodiment shown, the first motion region acquisition module 903 may further include the following submodules:
[0162] The difference accumulation submodule 9031 is used to accumulate the inter-frame difference information of each frame image in the multi-frame image set to determine the accumulated difference information of the multi-frame image set;
[0163] In some embodiments, the inter-frame difference information of each frame image in the multi-frame image set is accumulated, and the accumulated result is used as the accumulated difference information of the multi-frame image set; this difference information is subsequently used to determine the first motion area of the current frame image. The specific calculation formula of the difference information is as follows:
[0164] C(x,y,Δt)=D(x,y,t1)+D(x,y,t1+1)+…+D(x,y,t2);
[0165] Wherein, C(x, y, Δt) represents the accumulated result of the pixel difference value at point (x, y); D(x, y, t1) represents the pixel difference value of the t1 frame image at (x, y).
[0166] A moving pixel point determination submodule 9032 is configured to determine the moving pixel points in the current frame image based on a comparison result between the accumulated difference information and a predetermined threshold;
[0167] In some embodiments, the predetermined threshold is set based on the stray noise of the sensor used to capture the image. The greater the sensor's stray noise, the higher the predetermined threshold is typically set. This is intended to filter out recognition errors caused by stray noise. For example, if two frames of imagery are substantially identical, and the threshold is set too low, motion may be detected in both frames due to the influence of sensor stray noise.
[0168] The first motion region submodule 9033 determines a first motion region of the current frame image based on the motion pixels in the current frame image.
[0169] In some embodiments, after determining the cumulative difference information of all pixels in the current frame image, pixels whose cumulative difference information is greater than a predetermined threshold are screened out, i.e., moving pixels are screened out. The locations occupied by the moving pixels are defined as the first motion region. Typically, to ensure the integrity of the moving object, pixels within a certain distance around the moving pixel are also considered as pixel values within the first motion region.
[0170] In the above embodiment, the inter-frame differential information in the multi-frame image set is accumulated, and the moving pixel points are identified based on the accumulated results. In the multi-frame image set, the moving area of the current frame is identified, thereby reducing the computational complexity of the moving area identification and the subsequent moving target detection.
[0171] like Figure 12 As shown, in Figure 11 Based on the embodiment shown, the first motion region submodule 9033 may further include the following units:
[0172] The pixel point set determining unit 90331 is configured to determine, based on the moving pixel point and the predetermined distance, a pixel point set whose distance from the moving pixel point is within the predetermined distance range;
[0173] In some embodiments, the predetermined distance is set based on the scene of each frame image. For example, when the target objects in the scene of each frame image are relatively large, the predetermined distance is set to be larger, and when the target objects in the scene of each frame image are relatively small, the predetermined distance is set to be smaller. The pixel point set includes moving pixel points and pixel points that are less than the predetermined distance from the moving pixel points. The purpose of this setting is to ensure that the entire moving target object is included in the first moving area. For example, when a part of a moving target object moves, it is obviously impossible to include the entire moving target object in the first moving area by using the moving pixel points as the moving area. However, by setting a reasonable predetermined distance and determining the first moving area by using the pixel points within the predetermined distance around the moving pixel points as elements of the pixel point set, the moving target object can usually be included in the first moving area.
[0174] The first motion region determining unit 90332 is configured to determine the first motion region based on the pixel point set.
[0175] In some embodiments, the position of the moving pixel in the current frame image and the positions of the pixels within a predetermined distance around the moving pixel are combined to obtain a first motion region. For example, when the predetermined distance is set to 16, the size of the first motion region determined by a moving pixel is a 32*32 first motion region. In this case, the first motion region includes both the moving pixel and the pixels within the predetermined distance around the moving pixel.
[0176] By adopting the technical solution in the above embodiment, the position of the current frame image occupied by the moving pixel point and the pixel points within a predetermined distance around the moving pixel point is taken as the first moving area, which can ensure that the entire moving target is included in the first moving area, which is conducive to the subsequent identification of the moving target in the first moving area.
[0177] like Figure 13 As shown in the above Figure 12 Based on the embodiment shown, the first motion region determining unit 90332 may further include the following subunits:
[0178] A second motion region determining subunit 903321 is configured to determine a second motion region based on the pixel point set;
[0179] In some embodiments, each moving pixel can define a pixel set, and the positions occupied by the individual pixels in each pixel set are combined to form a second motion region. Because each second motion region includes not only the moving pixel but also pixels within a predetermined distance around the moving pixel, when the distance between two moving pixels is less than the predetermined distance, the second motion regions defined by the pixel sets corresponding to the two moving pixels will inevitably contain overlapping pixels.
[0180] The first merging subunit 903322 is configured to merge the two or more second motion regions into a first motion region based on overlapping pixels in the two or more second motion regions.
[0181] In some embodiments, when two second motion areas have overlapping pixel points, one of the motion pixel points is within the second motion area corresponding to the other motion pixel point. At this time, the two motion pixel points can be regarded as two motion pixel points of the same motion target. Therefore, the two second motion areas are merged into the first motion area, thereby ensuring that the same motion target is not segmented, facilitating the subsequent identification of the motion target.
[0182] like Figure 14 As shown in the above Figure 12 Based on the embodiment shown, the first motion region acquisition module 90332 may further include the following subunits:
[0183] A second motion region determining subunit 903321 is configured to determine a second motion region based on the pixel point set;
[0184] In some embodiments, each moving pixel can be used to define a pixel set, and the positions occupied by each pixel set are combined to form a second motion region. When the distance between two adjacent second motion regions is small, the two second motion regions can generally be considered to be motion regions on the same target object.
[0185] a merging result confirming subunit 903323, configured to determine a merging result of two adjacent second motion areas based on a distance between the two adjacent second motion areas;
[0186] In some embodiments, when a portion of a moving target is close to the image of the background area, the two second motion areas identified for the same moving target will be discontinuous. At this time, in order to ensure that the same moving target is divided into the same first motion area, the distance between the two adjacent second motion areas is used to determine whether to merge the two second motion areas. When the distance is less than a specific distance, the two second motion areas are merged. When the distance is not less than a specific distance, the two second motion areas are respectively used as two first motion areas. The above-mentioned specific distance can be set according to the scene of the picture in the video, and can also be set according to the moving target to be identified.
[0187] The second merging subunit 903324 is configured to merge two adjacent second motion regions whose distances meet a preset condition into a first motion region based on the merging result.
[0188] In some embodiments, the predetermined condition may be, for example, that the distance between the two second motion areas is less than a specific distance. Based on the above steps, the two second motion areas in the current frame image whose distance is less than the specific distance are merged into the first motion area. When setting the above specific distance, it is necessary to set it according to the scene of the picture in the video, and it can also be set according to the moving target that needs to be identified. For example, when the moving target occupies a large proportion in the video image, the specific distance can be set to a larger distance. For another example, when the scene color of the picture in the video is relatively single, the specific distance can be set to a smaller distance. The purpose of merging the two second motion areas in the current frame image whose distance is less than the specific distance is to ensure that the same moving target is divided into the same first motion area. If the specific distance is set too small, the complete moving object may be segmented, resulting in the inability of subsequent modules to correctly identify it; if the specific distance is set too large, the scale of the first motion area will be larger, and the subsequent scaling of the first motion area and the amount of calculation for identifying the detected area will increase.
[0189] like Figure 15 As shown in the above Figure 9 Based on the embodiment shown, the device further includes the following modules:
[0190] A reference image determination module 906 is configured to determine a reference image based on a comparison result between the current frame image and a predetermined condition;
[0191] In some embodiments, in some embodiments, the picture in the video expresses a scene with a slowly changing background. In this case, reference images need to be used at intervals to help the system grasp the slowly changing background. The predetermined condition can be determined based on the background of the picture in the video, or based on the moving target of the picture in the video. For example, based on the background change speed of the picture in the video, the current frame image can be selected as the reference image every fixed number of historical frame images. When the background change speed of the picture in the video is fast, the number of historical frame images at intervals is small. When the background change speed of the picture in the video is slow, the number of historical frame images at intervals is large. Whether to use the current frame image as the reference image can also be determined based on the proportion of the first motion area in the current frame image.
[0192] A detected reference image determining module 907 is configured to successively downsample the reference image to obtain at least one detected reference image of a predetermined scale;
[0193] In some embodiments, the reference image is also limited by the scale supported by the module for detecting moving targets (such as a SOC chip capable of performing neural network operations). Therefore, the reference image needs to be downsampled at least once to obtain at least one detected reference image of a predetermined scale. Since the minimum image scale that can be obtained by a single downsampling is 1 / 2 of the original image scale, when the scale of the reference image differs greatly from the predetermined scale, the reference image needs to be downsampled multiple times, and each downsampling obtains a frame of a detected reference image of a predetermined scale, until a detected reference image of a scale supported by the module for detecting moving targets is obtained. Therefore, the number of detected reference images needs to be determined by the scale supported by the module for detecting moving targets and the scale of the reference image. The predetermined scale can be determined by the scale supported by the module for detecting moving targets.
[0194] The reference image target determination module 908 is configured to determine the moving target in the reference image based on the detected reference image of at least one predetermined scale.
[0195] In some embodiments, after obtaining the reference image to be detected, the reference image to be detected is fed into a module for detecting moving objects, such as a SOC chip capable of performing neural network operations, and the module is used to detect moving objects in the reference image.
[0196] In the above embodiment, by selecting reference images at intervals, background changes in the video can be identified, thereby eliminating the impact of background changes on the recognition of moving objects. For example, as time passes, the illumination changes caused by the rising and setting of the sun will affect the brightness of each frame in the video. Using the method of this embodiment, the impact of background brightness changes on the recognition of moving objects can be eliminated.
[0197] In the above Figure 15 Based on the illustrated embodiment, the reference image determination module 906 is configured to determine a reference image based on the number of frame images between the current frame image and the previous reference image.
[0198] In some embodiments, the above-mentioned method of determining the reference image is a static determination method, and its specific method is to take out a frame image as a reference image at every fixed number of frame images. For example, the reference image is called frame A, and the frame image that scales the first motion area is called frame B. By setting a period T, the reference image is periodically scaled to obtain the detected reference image every T period and sent to the moving target recognition module for processing. For example, taking a video with a frame rate of 50Hz as an example, when T is 100 milliseconds, that is, every 100 milliseconds, a frame image is taken as a reference image. At this time, the arrangement order of the reference image and the frame image that scales the first motion area is ABBBBABBBB. Since the frame image rate is fixed in the same video, that is, the time occupied by each frame image is fixed, the fixed period is specified to determine the number of frame images in the interval. Of course, you can also directly set a fixed number of interval frame images, for example, set it to obtain a frame image as a reference image every 3 frames. At this time, the frame images of the full image zoom and the frame images of the first motion area zoom will be arranged as follows: ABBBABBB.
[0199] Setting the reference image in the manner of this embodiment can eliminate the influence caused by the slowly changing background environment, and is conducive to the accurate recognition of moving targets.
[0200] like Figure 16 As shown in the above Figure 15 Based on the embodiment shown, the reference image determination module 906 may further include the following modules:
[0201] The ratio confirmation submodule 9061 is used to determine the ratio of the first motion region in the current frame image to the current frame image;
[0202] In some embodiments, the ratio of the first motion region to the current frame image refers to the ratio of the number of pixels in the first motion region to the total number of pixels in the current frame image. In some embodiments, there may be multiple first motion regions. When there are multiple first motion regions, the ratio refers to the ratio of the sum of the number of pixels in the multiple first motion regions to the total number of pixels in the current frame image.
[0203] The reference image confirmation submodule 9062 is configured to determine a reference image based on a comparison result of the ratio and a predetermined threshold range.
[0204] In some embodiments, when the detected motion area exceeds a certain proportion of the full image, the full image is automatically scaled and sent to the motion target detection module for processing. The proportion of the motion area can be configured according to different application scenarios. For example, in a scene with dense flow of people, vehicles or animals, setting the ratio to be smaller will help to identify the moving details of the picture in the video. At this time, the ratio of the A frame image and the B frame image is dynamically changing. For example, when the proportion of the first motion area of the first frame image, the fourth frame image to the sixth frame image and the twelfth frame image exceeds a certain proportion of the full image, the first frame image, the fourth frame image to the sixth frame image and the twelfth frame image are used as reference frames, and the first motion areas of other frame images do not exceed the full image. Figure 1 The first motion region is scaled at a fixed ratio, so that the reference image and the frame image for scaling the first motion region are arranged in the following order: ABBAAABBBBBABB.
[0205] By adopting the technical solution of this embodiment, the reference image can be determined according to the proportion of the moving target in the current frame image, thereby being able to fully identify the activity details of the moving target in the video.
[0206] Those skilled in the art will appreciate that the two aforementioned methods of setting reference images, static and dynamic, can be switched. For example, the ratio (or absolute number) of moving pixels per unit time can be detected. When the ratio is low, static reference image selection can be used. Another example, depending on the scene, static reference image selection can be used at night, while dynamic reference image selection can be used during the day.
[0207] In the above Figure 15 Based on the embodiment shown, the device may further include the following modules:
[0208] The current frame image full image scaling module is used to determine a detected image of a predetermined scale corresponding to the current frame image based on the detected area of the current frame image and the detected reference image of the reference image of a frame image before the current frame image.
[0209] In some embodiments, this module can be implemented in two ways, one of which is as follows: based on the coordinates of the first motion region, the position of the motion region relative to the starting point of the image is obtained, and this relative position can be converted into an address offset relative to the starting point of the image. This method stores the scaling result of the first motion region, that is, at least one detected region of a predetermined scale, in a storage unit. When the module for detecting the moving target requires the scaling result of the entire current frame image, the scaling result of the detected region and a frame of reference image before the current frame image, that is, at least one frame of detected reference image, can be read out at the same time. According to the address offset of the first motion region, the detected reference image and the detected region are summed, and the summation result is the scaling result of the entire current frame image. The second method is as follows: If the module for detecting moving targets needs to directly obtain the full image scaling result of the current frame image instead of transferring it through the storage unit, the previously detected reference image stored in the storage unit can be read out at the same time during the calculation process of the detected area. According to whether the current image pixel is a moving area, it is determined whether to sum the detected area and the previously detected reference image and output it to the subsequent processing module or to output the previously detected reference image in the storage unit to the subsequent processing module. If the pixel is in the first moving area, the sum of the detected area and the previously detected reference image is output to the subsequent module. Otherwise, the previously detected reference image is directly output to the subsequent module for processing. This processing transmits the detected area of the predetermined scale obtained from the moving area in the current frame image to the module for detecting moving targets, eliminating the process of storing the detected area of the predetermined scale in the storage unit and reading it out from the storage unit, thereby greatly reducing the image processing delay.
[0210] Exemplary electronic devices
[0211] Below, reference Figure 17 An electronic device according to an embodiment of the present disclosure is described. Figure 17 A block diagram of an electronic device according to an embodiment of the present disclosure is illustrated.
[0212] like Figure 17 As shown, the electronic device 11 includes one or more processors 111 and a memory 112 .
[0213] The processor 111 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 11 to perform desired functions.
[0214] The memory 112 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 111 may execute the program instructions to implement the moving object detection method of each embodiment of the present disclosure described above and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.
[0215] In one example, the electronic device 11 may further include an input device 113 and an output device 114 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0216] For example, the input device 113 may be a communication network connector for receiving input signals.
[0217] In addition, the input device 113 may also include, for example, a keyboard, a mouse, and the like.
[0218] The output device 114 can output various information to the outside. The output device 114 can include, for example, a display, a speaker, a printer, a communication network and its connected remote output device, etc.
[0219] Of course, to simplify, Figure 17 Only some of the components related to the present disclosure in the electronic device 11 are shown, and components such as buses, input / output interfaces, etc. are omitted. In addition, the electronic device 17 may further include any other appropriate components according to specific application scenarios.
[0220] Exemplary computer program products and computer-readable storage media
[0221] In addition to the above-mentioned methods and devices, an embodiment of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the motion object detection method according to various embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section of this specification.
[0222] The computer program product may be written in any combination of one or more programming languages to implement the operations of the disclosed embodiments, including object-oriented programming languages such as Java, C++, and conventional procedural programming languages such as C or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0223] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, enable the processor to execute the steps of the motion object detection method according to various embodiments of the present disclosure described in the above "Exemplary Method" section of this specification.
[0224] The computer-readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can, for example, include but is not limited to a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable 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 thereof.
[0225] The basic principles of the present disclosure have been described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, and effects mentioned in this disclosure are merely illustrative and not restrictive, and should not be construed as necessarily possessed by each embodiment of the present disclosure. Furthermore, the specific details disclosed above are provided for illustrative purposes and to facilitate understanding, rather than as limitations. These details do not limit the present disclosure to necessarily being implemented using these specific details.
[0226] The block diagrams of the devices, devices, equipment, and systems involved in this disclosure are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, devices, equipment, and systems can be connected, arranged, or configured in any manner. Words such as "include," "comprise," "have," and the like are open-ended words, meaning "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or" and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.
[0227] It should also be noted that in the apparatus, device, and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0228] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0229] The above description has been provided for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although a number of example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.
Claims
1. A method for detecting a moving object, include: Based on a current frame image and a frame image before the current frame image, determining inter-frame difference information between the current frame image and the frame image before the current frame image; Determine a set of multiple frame images based on the current frame image and a predetermined number of historical frame images before the current frame image; Determining a first motion region in the current frame image based on the inter-frame difference information of each frame image in the multi-frame image set; Based on the first motion area, determining at least one detected area of a predetermined size; Determining a reference image based on a comparison result between the current frame image and a predetermined condition; Downsampling the reference image successively to obtain at least one detected reference image of a predetermined scale; According to the address offset of the first motion region, the detected reference image and the detected region are summed to determine the detected image of the predetermined scale corresponding to the current frame image; or, according to whether the pixel of the current frame image is in the motion region, it is determined whether to sum the detected region and the detected reference image; if the current pixel is in the first motion region, the detected region and the detected reference image are summed; if the current pixel is not in the first motion region, the detected reference image is retained to determine the detected image of the predetermined scale corresponding to the current frame image; Based on the detected image of the current frame image, a moving target in the detected area is determined.
2. The method according to claim 1, in, Based on the current frame image and the previous frame image, determining the inter-frame difference information between the current frame image and the previous frame image includes: Determine a corresponding pixel difference value of a predetermined color channel in a predetermined color space based on the pixel values corresponding to the current frame image and the previous frame image; The inter-frame difference information is determined based on the pixel difference value and a predetermined weight value.
3. The method according to claim 1, in, Based on the inter-frame difference information of each frame image in the multi-frame image set, determining the first motion area in the current frame image includes: Accumulating inter-frame difference information of each frame image in the multi-frame image set to determine accumulated difference information of the multi-frame image set; Determine the moving pixel points in the current frame image based on the comparison result between the accumulated difference information and a predetermined threshold; Based on the moving pixel points in the current frame image, a first moving area of the current frame image is determined.
4. The method according to claim 3, in, Determining a first motion region of the current frame image based on the motion pixel points in the current frame image includes: Based on the moving pixel point and the predetermined distance, determining a set of pixel points whose distances from the moving pixel point are within the predetermined distance range; Based on the pixel point set, the first motion area is determined.
5. The method according to claim 4, in, The determining the first motion area based on the pixel point set includes: Determining a second motion area based on the pixel point set; Based on the overlapping pixel points of the two or more second motion regions, the two or more second motion regions are merged into a first motion region.
6. The method according to claim 4, in, Determining the first motion region frame image based on the pixel point set includes: Determining a second motion area based on the pixel point set; determining a merging result of two adjacent second motion regions based on a distance between the two adjacent second motion regions; Based on the merging result, two adjacent second motion regions whose distances meet a preset condition are merged into a first motion region.
7. The method according to claim 1, in, The method further comprises: Based on the detected reference image of the at least one predetermined scale, the moving target in the reference image is determined.
8. A moving object detection device, include: The differential information acquisition module is used to determine the inter-frame differential information between the current frame image and the previous frame image based on the current frame image and the previous frame image; A multi-frame image set determination module: used to determine a multi-frame image set based on the current frame image and a predetermined number of frame images before the current frame image; A motion region acquisition module: used to determine a first motion region in the current frame image based on the inter-frame difference information of each frame image in the multi-frame image set; A scale conversion module: used to determine at least one detected area of a predetermined scale based on the first motion area; A reference image determination module: used to determine a reference image based on a comparison result between the current frame image and a predetermined condition; A detected reference image determination module is used to successively downsample the reference image to obtain at least one detected reference image of a predetermined scale; The current frame image full image scaling module is used to sum the detected reference image and the detected area according to the address offset of the first motion area to determine the detected image of the predetermined scale corresponding to the current frame image; or, according to whether the pixel of the current frame image is in the motion area, determine whether to sum the detected area and the detected reference image. If the current pixel is in the first motion area, the detected area and the detected reference image are summed. If the current pixel is not in the first motion area, the detected reference image is retained to determine the detected image of the predetermined scale corresponding to the current frame image; The moving target detection module is used to determine the moving target in the detected area based on the detected image of the current frame image.
9. A computer-readable storage medium storing a computer program, wherein the computer program is used to execute the moving object detection method according to any one of claims 1 to 7.
10. An electronic device, wherein the electronic device include: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the moving object detection method described in any one of claims 1-7.
Citation Information
Patent Citations
Aerial photo video motion object detection method
CN108109163A
Moving target detection method and device and electronic equipment
CN110751678A
