Method, device, electronic equipment and storage medium for monitoring objects thrown from high altitude
By calculating the difference between surveillance video frame images and constructing a motion mask map, the problem of untimely and inefficient high-altitude parabola monitoring in the existing technology is solved, and real-time and accurate identification and monitoring of high-altitude parabola behavior are achieved.
Patent Information
- Application Number
- CN202011627329.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-30
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2040-12-30
AI Technical Summary
The existing monitoring effect of high-altitude parabolic events is not good. It requires manual viewing of surveillance videos frame by frame. The workload is large and the situation cannot be discovered in time. Small objects are difficult to be detected by the naked eye in the video.
By obtaining the frame image sequence of the monitoring scene, calculating the difference between the frame images, constructing the motion mask image and the background image, monitoring high-altitude parabolas based on these images, and using the difference between the motion mask image and the background image to identify the parabolic behavior .
It improves the monitoring effect of high-altitude parabolic behavior, realizes real-time monitoring, reduces workload and labor costs, and enhances the ability to identify small objects.
Smart Images

Figure CN112800846B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and in particular to a method, device, electronic equipment and storage medium for monitoring objects thrown from high altitudes. Background Art
[0002] With the development of real estate, the floors of newly built residential communities are getting higher and higher, and the problem of high-altitude throwing is becoming more and more prominent. Most of the current residential communities are equipped with surveillance cameras to monitor the situation in the community. When an incident of high-altitude throwing occurs, relevant personnel can call and view the surveillance video collected of the high-altitude throwing behavior, but the specific high-altitude throwing situation needs to be manually viewed frame by frame or through slow-motion footage, which is not only labor-intensive, but also prone to omissions, and it is impossible to detect high-altitude throwing in time. Moreover, due to the installation of the camera and the camera resolution, sometimes the objects thrown from high altitudes are small and are not easy to be found by the naked eye in the surveillance video. Therefore, the existing monitoring effect of high-altitude throwing events is not good. Summary of the invention
[0003] The embodiment of the present invention provides a method for monitoring objects dropped from high places, which can improve the monitoring effect of the behavior of dropping objects from high places.
[0004] In a first aspect, an embodiment of the present invention provides a method for monitoring objects thrown from a high altitude, the method comprising:
[0005] Obtain the frame image sequence of the current monitoring scene;
[0006] By calculating the difference between the frame images, a first motion mask image between adjacent frame images is obtained;
[0007] constructing a current background image according to the first motion mask image and the frame image corresponding to the first motion mask image;
[0008] Calculating a second motion mask image between the current background image and the current frame image by using a difference between the current background image and the current frame image;
[0009] Based on the second motion mask image, the high-altitude objects are monitored.
[0010] Optionally, the first motion mask image includes a motion mask value and a stationary mask value, and the first motion mask image between adjacent frame images is calculated by using the difference between the frame images, including:
[0011] Calculating the difference between corresponding pixel pairs between adjacent frame images, and determining whether the difference between corresponding pixel pairs between adjacent frame images is greater than or equal to a preset first difference threshold;
[0012] If the difference between the corresponding pixel pairs between the adjacent frame images is greater than or equal to a preset first difference threshold, assigning the corresponding first mask pixel point as a motion mask value;
[0013] If the difference between the corresponding pixel pairs between the adjacent frame images is less than a preset first difference threshold, assigning the corresponding first mask pixel point to a static mask value;
[0014] Based on the assigned first mask pixel points, a first motion mask image is obtained.
[0015] Optionally, constructing the current background image according to the first motion mask image and the frame image corresponding to the first motion mask image includes:
[0016] Dividing the first motion mask image into blocks to obtain a plurality of mask regions;
[0017] constructing a plurality of background regions having the same shape as the mask region according to the mask region and the frame image corresponding to the first motion mask image;
[0018] Based on the background area, a current background image is constructed.
[0019] Optionally, the mask area includes a motion mask value and a static mask value, and constructing a plurality of background areas having the same shape as the mask area according to the mask area and the frame image corresponding to the first motion mask image includes:
[0020] Calculating the motion state of the mask area according to the motion mask value and the static mask value of the mask area;
[0021] According to the motion state of the mask area, an image area corresponding to the frame image corresponding to the first motion mask image is selected as the background area.
[0022] Optionally, the number of the first motion mask images is n frames, and the number of frame images corresponding to the first motion mask images is also n frames, where n is a positive integer greater than 0, and the calculating the motion state of the mask area according to the motion mask value and the static mask value of the mask area includes:
[0023] Extracting a mask value sequence of each mask area in the first motion mask image according to the n-frame first motion mask image, where the dimension of the mask value sequence is n;
[0024] According to the mask value sequence corresponding to the mask area, extract the corresponding target image area index;
[0025] A current background image is constructed based on the frame image corresponding to the first motion mask image and the target image region index.
[0026] Optionally, calculating a second motion mask image between the current background image and the current frame image by using a difference between the current background image and the current frame image includes:
[0027] Calculating the difference between the corresponding pixel pairs of the current background image and the current frame image, and determining whether the difference between the pixel pairs is greater than or equal to a preset second difference threshold;
[0028] If the difference between the corresponding pixel pairs of the current background image and the current frame image is greater than or equal to a preset first difference threshold, assigning the corresponding second mask pixel point as a motion mask value;
[0029] If the difference between the corresponding pixel pairs of the current background image and the current frame image is less than a preset second difference threshold, the corresponding second mask pixel is assigned a static mask value;
[0030] Based on the assigned second mask pixel points, a second motion mask image is obtained.
[0031] Optionally, the monitoring of the high-altitude thrown objects based on the second motion mask image includes:
[0032] Monitoring whether a first motion region having an area greater than a preset area threshold appears in a second motion mask image corresponding to the current frame image, wherein the first motion region is composed of a motion mask value;
[0033] If so, monitoring whether a second motion region with an area greater than a preset area threshold appears in a second motion mask image corresponding to the next frame image, and calculating the similarity between the frame image region corresponding to the first motion region and the frame image region corresponding to the second motion region when the second motion region appears, wherein the second motion region is composed of motion mask values;
[0034] If the similarity between the frame image region corresponding to the first motion region and the frame image region corresponding to the second motion region is greater than a preset similarity threshold, then calculating the motion trajectories of the first motion region and the second motion region;
[0035] Determine whether the motion trajectory meets the conditions of high-altitude throwing.
[0036] Optionally, the monitoring of the high-altitude thrown objects based on the second motion mask image includes:
[0037] Removing interference information in the second motion mask image through a morphological opening operation to obtain a third motion mask image, wherein the third motion mask image includes a motion mask value and a stationary mask value;
[0038] Based on the third motion mask image, the high-altitude objects are monitored.
[0039] Optionally, the method further includes:
[0040] When high-altitude throwing is detected, a preset number of previous and next frame images are obtained as a forensic frame image sequence.
[0041] In a second aspect, an embodiment of the present invention further provides a device for monitoring objects thrown from a high altitude, the device comprising:
[0042] The first acquisition module is used to acquire a frame image sequence of the current monitoring scene;
[0043] A first calculation module, used for calculating a first motion mask image between adjacent frame images through a difference between frame images;
[0044] A background construction module, configured to construct a current background image according to the first motion mask image and a frame image corresponding to the first motion mask image;
[0045] A second calculation module, used for calculating a second motion mask image between the current background image and the current frame image by using a difference between the current background image and the current frame image;
[0046] A monitoring module is used to monitor the high-altitude thrown objects based on the second motion mask image.
[0047] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps in the method for monitoring objects dropped from high places provided in an embodiment of the present invention are implemented.
[0048] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for monitoring objects dropped from high places provided in the embodiment of the invention are implemented.
[0049] In an embodiment of the present invention, a sequence of frame images of the current monitoring scene is obtained; a first motion mask image between adjacent frame images is calculated by the difference between the frame images; a current background image is constructed based on the first motion mask image and the frame image corresponding to the first motion mask image; a second motion mask image between the current background image and the current frame image is calculated by the difference between the current background image and the current frame image; and high-altitude objects are monitored based on the second motion mask image. The current background image constructed by the first motion mask image between adjacent frame images is a real-time background image, which can improve the effect of real-time monitoring. At the same time, the second mask image obtained by the current background image and the current frame image to monitor high-altitude objects reduces the complexity of the numerical value and improves the calculation speed, so that it can be judged in real time whether there is a situation of high-altitude objects being thrown, thereby further improving the monitoring effect of high-altitude objects being thrown. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 It is a flow chart of a method for monitoring objects thrown from high altitudes provided by an embodiment of the present invention;
[0052] Figure 2 is a flow chart of a background image construction method provided by an embodiment of the present invention;
[0053] Figure 3 is a schematic diagram of a first motion mask image block provided by an embodiment of the present invention;
[0054] Figure 4 is a flow chart of another method for monitoring objects thrown from a high altitude provided by an embodiment of the present invention;
[0055] Figure 5 1 is a schematic diagram of the structure of a device for monitoring objects thrown from a high altitude provided by an embodiment of the present invention;
[0056] Figure 6 is a structural schematic diagram of a first computing module provided by an embodiment of the present invention;
[0057] Figure 7 is a structural diagram of a background building module provided by an embodiment of the present invention;
[0058] Figure 8 is a structural diagram of a first building submodule provided by an embodiment of the present invention;
[0059] Fig. 9 is a schematic diagram of the structure of a computing unit provided by an embodiment of the present invention;
[0060] Fig.10 is a structural schematic diagram of a second computing module provided by an embodiment of the present invention;
[0061] Fig.11 is a structural diagram of a monitoring module provided by an embodiment of the present invention;
[0062] Fig.12 is a schematic diagram of the structure of another monitoring module provided by an embodiment of the present invention;
[0063] Fig.13 1 is a schematic diagram of the structure of another device for monitoring objects thrown from high altitudes provided in an embodiment of the present invention;
[0064] Fig.14 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0065] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0066] See also Figure 1 , Figure 1 : is a flow chart of a method for monitoring high-altitude objects provided by an embodiment of the present invention, such as Figure 1 As shown, the method is used to monitor high-altitude objects at a fixed time or in real time, and includes the following steps:
[0067] 101. Obtain a frame image sequence of the current monitoring scene.
[0068] In an embodiment of the present invention, the current monitoring scene may be a residential building, commercial building, office building, or other building scene that the camera is monitoring. The camera monitoring range may be all floors of the building or floors above a certain number of floors, such as floors above the 4th floor. When installing the camera, it may be determined as needed, and the camera shooting angle may be adjusted so that the camera can monitor the floors in the corresponding range.
[0069] The preset frame image sequence may be an image frame sequence of a preset number of frames in the video stream captured by the current camera. The sequence is arranged in time sequence. The video stream may be a real-time video stream or a video stream of a certain period of time.
[0070] 102. Calculate a first motion mask image between adjacent frame images through the difference between the frame images.
[0071] In the embodiment of the present invention, the difference between the frame images can be understood as the difference in pixel values of the corresponding pixel points between the two frame images. Since the video stream is captured by the same camera, the resolution and size of each frame image in the video are the same, so the frame image of the Nth frame can be subtracted from the frame image of the N+1th frame to obtain a difference map, in which the value of each difference pixel point is the difference of the corresponding pixel point pair.
[0072] For example, suppose two adjacent frames of images are K1 and K2, and K1 is a 3*3 image and K2 is also a 3*3 image, as shown in the following matrix formula:
[0073]
[0074]
[0075] The difference map K=K2-K1 between adjacent frame images is:
[0076]
[0077] In the difference map K, the larger the absolute value of the difference, the greater the change in the pixel value of the pixel point, while for background pixels, the change is generally small. Therefore, it is possible to determine whether the corresponding pixel point is in motion or static state based on the change in the pixel value of the corresponding pixel point between adjacent frame images.
[0078] Specifically, the difference between corresponding pixel pairs between adjacent frame images can be calculated, and it can be determined whether the difference between corresponding pixel pairs between adjacent frame images is greater than or equal to a preset first difference threshold; if the difference between corresponding pixel pairs between adjacent frame images is greater than or equal to the preset first difference threshold, the corresponding first mask pixel points are assigned as motion mask values; if the difference between corresponding pixel pairs between adjacent frame images is less than the preset first difference threshold, the corresponding first mask pixel points are assigned as stationary mask values; based on the assigned first mask pixel points, a first motion mask image is obtained.
[0079] Furthermore, the first motion mask image between adjacent frame images can be calculated by the absolute value of the difference between the frame images. The above-mentioned first motion mask image can be a binary mask image. In the binary mask image, the motion mask image is represented by two preset mask values, and one mask value can be used to represent the motion state, that is, the motion mask value, and the other mask value can be used to represent the static state, that is, the static mask value. Specifically, it can be shown as follows:
[0080]
[0081] Among them, in the above formula, motion_mask(i,j) represents the mask value of the first mask pixel (i,j), frame_diff(i,j) represents the absolute value of the difference between the pixel (i,j) in adjacent frame images, motion_thr1 represents the preset first difference threshold, b represents the motion mask value, and c represents the static mask value. The first motion mask image motion_mask1 records the motion changes of the corresponding pixels between adjacent frame images. For example, assuming that the first difference threshold motion_thr1 is set to 30, the first motion mask image motion_mask1 = motion_mask(K), then the first motion mask image motion_mask1 is as follows:
[0082]
[0083] In a possible embodiment, in order to increase the visibility of the first motion mask image, the motion mask value may be 255, and the visual result of outputting the motion mask value 255 in the form of pixel 255 is white. The static mask value may be 0, and the visual result of outputting the static mask value 0 in the form of pixel 0 is black.
[0084] In a possible embodiment, in order to improve the calculation speed between frame images, the frame image sequence can be preprocessed, and the frame images in the frame image sequence can be scaled to a preset size, such as a pixel size of 720*480, 480*320, etc.
[0085] 103. Construct a current background image according to the first motion mask image and the frame image corresponding to the first motion mask image.
[0086] In an embodiment of the present invention, the mask value in the above-mentioned first motion mask image can represent the motion state of the corresponding pixel point. For example, the above-mentioned mask value can be a binary mask, that is, through two different mask values, the motion mask value and the still mask value to represent the different motion states of each pixel point. The above-mentioned motion state can be moving or still, corresponding to the motion mask value and the still mask value respectively.
[0087] For the pixel point whose motion state is static, it can be used as the background pixel point. For the pixel point whose motion state is moving, the corresponding frame image when it is static in the frame image sequence can be found, and the pixel point can be determined as the background pixel point in the frame image.
[0088] Furthermore, the number of the first motion mask images is n frames, and the number of frame images corresponding to the first motion mask images is also n frames. The motion state of the corresponding pixel points in the frame images is judged by the pixel points in the first motion mask image, so as to determine which pixel point in which frame image can be used as the background pixel point.
[0089] When obtaining the corresponding motion mask map according to the preset frame image sequence, a first data set can be maintained to accommodate the latest frame images sampled from the preset image sequence in sequence. For example, when the t+5th frame is sampled, the t+5th frame is added to the first data set. A second data set is maintained to accommodate the corresponding motion mask map. For example, after the frame image of the t+5th frame is added to the first data set, the motion mask map corresponding to the frame image of the t+5th frame is added to the second data set. Among them, the capacity of the first data set and the second data set is set to n frames. After exceeding n frames, the first added frame image or motion mask map will be removed. For example, if n is set to 11, when the frame image or motion mask map in the data set exceeds 11, the frame image or motion mask map first added to the data set will be removed to keep the frame image or motion mask map in the data set from not exceeding 11. The removed frame image or motion mask map can be stored separately for data reuse, or it can be deleted directly. The frame image of the first data set and the motion mask map in the second data set are in a one-to-one correspondence.
[0090] According to the motion state of each pixel in the first motion mask image of n frames, the pixel with a static motion state in the frame image corresponding to n frames can be selected as the background pixel. When a background image with the same size as the frame image or the motion mask image is obtained, the construction of the current background image is completed.
[0091] 104. Calculate a second motion mask image between the current background image and the current frame image through the difference between the current background image and the current frame image.
[0092] In the embodiment of the present invention, the difference between the current background image and the current frame image can be understood as the difference in pixel values of corresponding pixels between the current background image and the current frame image. Since the current background image is constructed in real time, and the constructed current background image and the corresponding frame image have the same resolution and size, the current frame image can be subtracted from the current background image to obtain a corresponding difference image, in which the value of each difference pixel point is the difference between the corresponding pixel pair in the current background image and the current frame image.
[0093] In the difference image, the larger the absolute value of the difference, the greater the change in the pixel value of the pixel point, while for the background pixels, the change is generally small. Therefore, it is possible to determine whether each pixel point in the current frame image is in motion or static state based on the change in the pixel value of the corresponding pixel point between the current background image and the current frame image.
[0094] Specifically, the difference between the corresponding pixel pairs of the current background image and the current frame image can be calculated, and it can be determined whether the difference between the pixel pairs is greater than or equal to a preset second difference threshold; if the difference between the corresponding pixel pairs of the current background image and the current frame image is greater than or equal to the preset first difference threshold, the corresponding second mask pixel points are assigned as motion mask values; if the difference between the corresponding pixel pairs of the current background image and the current frame image is less than the preset second difference threshold, the corresponding second mask pixel points are assigned as static mask values; based on the assigned second mask pixel points, a second motion mask image is obtained.
[0095] Similar to step 102, the second motion mask image between the current background image and the current frame image can be calculated by the absolute value of the difference between the current background image and the current frame image. The second motion mask image can be a binary mask image. In the binary mask image, the motion mask image is represented by two preset mask values, and one mask value can be used to represent the motion state, that is, the motion mask value, and the other mask value can be used to represent the static state, that is, the static mask value. Specifically, it can be shown as the following formula:
[0096]
[0097] Among them, in the above formula, motion_mask(i,j) represents the mask value of the second mask pixel (i,j), frame_diff(i,j) represents the absolute value of the difference between the pixel (i,j) in the current background image and the current frame image, motion_thr2 represents the preset second difference threshold, b represents the motion mask value, and c represents the static mask value. The second motion mask image motion_mask2 records the motion changes of the corresponding pixels between the current background image and the current frame image. For example, assuming that the second difference threshold motion_thr2 is set to 30, the first motion mask image motion_mask2 = motion_mask(K2), K2 is the difference image between the current background image and the current frame image, and assuming that K2 is as shown in the following formula:
[0098]
[0099] Then the second motion mask image motion_mask is as follows:
[0100]
[0101] In a possible embodiment, in order to increase the visibility of the second motion mask image, the motion mask value may be 255, and the visual result of outputting the motion mask value 255 in the form of pixel 255 is white. The static mask value may be 0, and the visual result of outputting the static mask value 0 in the form of pixel 0 is black.
[0102] 105. Based on the second motion mask image, monitor objects thrown from high altitudes.
[0103] In an embodiment of the present invention, the second motion mask map includes motion mask values and stationary mask values. It can be understood that in the absence of objects thrown from high altitudes, only stationary mask values exist in the second motion mask map. When a certain area of motion mask values appears in the second motion mask map, it means that there is a moving object in the current frame image and there is suspicion of throwing objects from high altitudes.
[0104] At the same time, the second motion mask map includes motion mask values and static mask values. By visualizing the second motion mask map, it is easier for staff to see moving objects, which is convenient for staff to monitor the monitoring area. For example, a white object is thrown out of a white building, and it is difficult to observe it by observing the surveillance video with the naked eye. However, through the second motion mask map, the white object can be separated from the white building background by the mask value, which increases the recognition. Taking the motion mask value of 255 and the static mask value of 0 as an example, the visual result of the motion mask value 255 output in the form of pixel 255 is white, and the visual result of the static mask value 0 output in the form of pixel 0 is black; at this time, the white building is a static background, which is black after visualization in the second mask map, and the white object is a moving object, which is white after visualization in the second mask map.
[0105] In the second motion mask map corresponding to the current frame image, if a large area of motion mask values are detected, it means that there is a moving object. The moving object can be analyzed for motion to determine the moving direction of the moving object. If the moving direction of the moving object is downward, it can be considered that the behavior of throwing objects from a high altitude is detected. By automatically detecting the appearance of the motion mask value in the second motion mask map, the monitoring area is automatically monitored and detected, which can reduce the monitoring workload and reduce labor costs. In addition, since the second motion mask map is updated with the current frame image, the second motion mask map is real-time and meets the real-time nature of video monitoring.
[0106] In an embodiment of the present invention, a sequence of frame images of the current monitoring scene is obtained; a first motion mask image between adjacent frame images is calculated by the difference between the frame images; a current background image is constructed based on the first motion mask image and the frame image corresponding to the first motion mask image; a second motion mask image between the current background image and the current frame image is calculated by the difference between the current background image and the current frame image; and high-altitude objects are monitored based on the second motion mask image. The current background image constructed by the first motion mask image between adjacent frame images is a real-time background image, which can improve the effect of real-time monitoring. At the same time, the second mask image obtained by the current background image and the current frame image to monitor high-altitude objects reduces the complexity of the numerical value and improves the calculation speed, so that it can be judged in real time whether there is a situation of high-altitude objects being thrown, thereby further improving the monitoring effect of high-altitude objects being thrown.
[0107] Optional, see Figure 2 , Figure 2 is a flow chart of a background image construction method provided by an embodiment of the present invention. Figure 2 As shown, the following steps are included:
[0108] 201. Divide a first motion mask image into blocks to obtain multiple mask regions.
[0109] In the embodiment of the present invention, the first motion mask image may be divided into blocks according to a preset rule, or may be divided into blocks according to image recognition.
[0110] Specifically, the above-mentioned pre-set rule can be an average division, which can be to divide the first motion mask image into M*N blocks of the same size, each block corresponds to a mask area, thereby obtaining M*N mask areas, and the size of each mask area is: (img_width / M, img_height / N), wherein the above-mentioned img_width is the total width of the first motion mask image, and img_height is the total height of the first motion mask image.
[0111] 202. Construct a plurality of background regions having the same shape as the mask region according to the mask region and the frame image corresponding to the first motion mask image.
[0112] In the embodiment of the present invention, the motion state of the mask area can be calculated according to the mask value of the mask area; and then according to the motion state of the mask area, the corresponding image area in the frame image corresponding to the first motion mask image is selected as the background area.
[0113] Specifically, the mask area includes a motion mask value and a static mask value, and the motion state of a mask area can be judged according to the motion mask value and the static mask value. When the motion state of a mask area is judged to be static, the image area corresponding to the mask area can be taken out from the frame image corresponding to the first motion mask image as the background area. When the motion state of the mask area is judged to be motion, the motion state of the mask area corresponding to the first motion mask image of the next frame is judged again. The motion state of the mask area can be judged according to the average value of the motion mask value and the static mask value of the mask area, or the motion state of the mask area can be judged according to the number or proportion of the motion mask values of the mask area.
[0114] Furthermore, in an embodiment of the present invention, the number of first motion mask images is n frames, and the number of frame images corresponding to the first motion mask image is also n frames, wherein n is a positive integer greater than 0. Based on the n frames of first motion mask images, a mask value sequence of each mask area in the first motion mask image can be extracted, and the dimension of the mask value sequence is n; based on the mask value sequence corresponding to the mask area, the corresponding target image area index is extracted; and based on the frame image corresponding to the first motion mask image and the target image area index, the corresponding background area is constructed.
[0115] Furthermore, the frame image sequence includes n+1 frame images, corresponding to which n first motion mask images can be calculated, the nth first motion mask image corresponds to the n+1th frame image, and each first motion mask image includes M*N mask areas. The latest n first motion mask images can be put into an array motion_value_array(n, N, M), and the latest n frame images can be put into another array frame_patch_array(n, height, width). The number of entries in each array is n. If it exceeds n, the first motion mask image or frame image that was first added to the array will be deleted. In a possible embodiment, the frame image also corresponds to M*N image areas, each image area corresponds to a mask area, and the latest n frame images can be put into another array frame_patch_array(n, N, M).
[0116] The motion state of the mask area can be calculated by the following formula:
[0117]
[0118] Among them, motion_value(pi,pj) in the formula represents the motion state of the mask area (pi,pj), M*N represents the number of mask areas, img_width is the total width of the first motion mask image, img_height is the total height of the first motion mask image, img_height*img_width represents the pixel area of the first motion mask image, (i,j) represents the first mask pixel point in the mask area (pi,pj), and patch(pi,pj)(i,j) represents the mask value of the first mask pixel point (i,j) in the mask area (pi,pj).
[0119] For each motion state motion_value of the mask area, there is an n-dimensional array representing the motion state of this block in the latest n frames. The index min_index with the smallest value in the array is taken as the target image area index, and the entire image area corresponding to the index min_index position block in the array frame_patch_array (n, height, width) of the latest n frame images is taken as the background area. For example, when M = 2 and N = 2, the first motion mask image includes 4 mask areas, namely mask area 1, mask area 2, mask area 3, and mask area 4. Figure 3 As shown, when the value of mask area 1 of the first motion mask image of the second frame in the first motion mask image array motion_value_array(n, N, M) is the smallest, the mask area 1 of the first motion mask image of the second frame is judged to be in a stationary state, and the corresponding index min_index is (the second frame, mask area 1), then according to the index (the second frame, mask area 1) to the array of frame images frame_patch_array(n, height, width) to search for the frame image of the second frame, and the area corresponding to the mask area 1 in the frame image of the second frame is used as the background area 1; when the first motion mask image In the image array motion_value_array(n, N, M), the value of mask area 2 of the first motion mask image of the 4th frame is the smallest, then the mask area 2 of the first motion mask image of the 4th frame is judged to be in a stationary state, and the corresponding index min_index is (4th frame, mask area 2). Then, according to the index (4th frame, mask area 2), the frame image of the 4th frame is searched in the array of frame images frame_patch_array(n,height,width), and the area corresponding to the mask area 2 in the frame image of the 4th frame is used as background area 2; background area 3 and background area 4 can be obtained in the same way.
[0120] 203. Construct a current background image based on the background area.
[0121] In the embodiment of the present invention, the background area obtained by calculating the correspondence between the mask areas has a corresponding positional relationship with each mask area, and the background area is spliced according to the position of the mask area in the first motion mask image, so as to obtain the current background image.
[0122] In a possible embodiment, the frame image sequence participates in the real-time construction of the current background image. In order to speed up the construction of the current background image, the number n of frame images in the frame image sequence can be limited, for example, set to a smaller number, such as 20, 30, etc. For ordinary cameras, the acquisition of video stream image frames is about 30 frames per second, so n can be set to a positive integer less than 30, thereby improving the speed of constructing the current background image, thereby improving the real-time performance of monitoring.
[0123] In the embodiment of the present invention, the first motion mask image is divided into blocks, and the current background image is constructed in the form of blocks, without performing reconstruction calculation pixel by pixel, thereby further improving the construction speed of the real-time background image.
[0124] Optional, see Figure 4 , Figure 4 is a flow chart of another method for monitoring high-altitude objects provided by an embodiment of the present invention. Figure 1 Based on the embodiment, the second motion mask image is detected to achieve the monitoring of high-altitude throwing objects, such as Figure 4 As shown, the following steps are included:
[0125] 401. Monitor whether a first motion region with an area greater than a preset area threshold appears in a second motion mask image corresponding to a current frame image.
[0126] In the embodiment of the present invention, the first motion region is composed of motion mask values. The area of the first motion region is larger than a preset area, and is a detectable object, and the probability of being interfered by noise is low.
[0127] 402. If so, monitor whether a second motion region with an area greater than a preset area threshold appears in the second motion mask image corresponding to the next frame image, and when the second motion region appears, calculate the similarity between the frame image region corresponding to the first motion region and the frame image region corresponding to the second motion region.
[0128] In the embodiment of the present invention, the second motion region is composed of motion mask values. The area of the second motion region is larger than the preset area, and is a detectable object, and the probability of being interfered by noise is low.
[0129] Since the first motion region and the second motion region are in a relationship of previous and next frames, it can be determined by similarity calculation whether the first motion region and the second motion region are motion regions corresponding to the same object.
[0130] In a possible embodiment, the first motion region and the second motion region may be frame-shaped regions obtained by fitting the contour of the motion mask value. If there are multiple first motion regions and multiple second motion regions, the similarities of the frame image regions corresponding to the multiple first motion regions and the frame image regions corresponding to the multiple second motion regions are calculated one by one, and the structural similarity ssim is used as the similarity calculation method. When the structural similarity ssim of the image region corresponding to the first motion region and the image region corresponding to the second motion region is greater than a preset similarity threshold, such as the structural similarity ssim is greater than 0.8, it can be determined that the first motion region and the second motion region are motion regions of the same object. It should be noted that the frame image region corresponding to the first motion region is the image region in the current frame image, and the frame image region corresponding to the second motion region is the image region in the next frame image.
[0131] 403 . If the similarity between the frame image region corresponding to the first motion region and the frame image region corresponding to the second motion region is greater than a preset similarity threshold, calculate motion trajectories of the first motion region and the second motion region.
[0132] In an embodiment of the present invention, if the similarity between the frame image area corresponding to the first motion area and the frame image area corresponding to the second motion area is greater than a preset similarity threshold, it means that the object in the first motion area and the object in the second motion area are the same object, and the object is in motion. Based on the motion trajectory of the object, it can be determined whether the object is a high-altitude parabola.
[0133] Specifically, the vector distance between the center position of the first motion region and the center position of the second motion region may be calculated as the motion trajectory.
[0134] 404. Determine whether the trajectory of motion meets the conditions for dropping objects from high altitude.
[0135] In an embodiment of the present invention, if the direction of the motion trajectory (which may be the vector distance) is downward and the value of the motion trajectory (which may be the vector distance) is greater than a preset value, it can be determined as an object thrown from a high altitude; in other cases, it can be determined that no object thrown from a high altitude has occurred.
[0136] In some possible embodiments, the difference between the vertical coordinate cur_roi_y of the center position of the first motion area and the vertical coordinate next_roi_y of the center position of the second motion area can also be calculated. If the difference is positive and the value is greater than a preset value, it can be determined that it is an object thrown from a high altitude. In other cases, it can be determined that no object thrown from a high altitude has occurred. It can also be determined whether next_roi_y is greater than acur_roi_y, where a is greater than 1, for example, whether next_roi_y is greater than 1.2acur_roi_y. If it is greater, it can be determined that it is an object thrown from a high altitude. In other cases, it can be determined that no object thrown from a high altitude has occurred.
[0137] Optionally, before step 401 and step 402, the second motion mask image may be preprocessed to eliminate noise interference in the second motion mask image, thereby obtaining a more accurate and clear second motion mask image as the third motion mask image. In this way, high-altitude objects can be monitored based on the third motion mask image, making the detection of high-altitude objects more accurate. Monitoring high-altitude objects based on the third motion mask image can refer to steps 401 and 402.
[0138] Optionally, when a high-altitude object is detected, a preset number of previous and next frame images can be obtained as a forensic frame image sequence. For example, the first 100 frames and the last 100 frames at the time of occurrence are retained as an evidence image sequence, and then manually confirmed to find which household caused the high-altitude object to be dropped, and then subsequent processing is carried out, such as warnings, penalties, and accountability.
[0139] Optionally, when objects being dropped from high places are detected, an alarm for such objects being dropped from high places can be automatically sent to the current monitoring scene and / or management department.
[0140] The above-mentioned current monitoring scene refers to the scene where the corresponding camera is deployed, such as Unit C, Building B, Residential Area A. When the camera of Unit C, Building B, Residential Area A detects objects thrown from a high altitude, a danger alarm will be issued at Unit C, Building B, Residential Area A to alert people near Unit C, Building B, Residential Area A.
[0141] The above-mentioned management department may be a property management department or a city management department or other organizations with management authority, such as an owner's committee, a garden club, etc. In a possible implementation, the prompt alarm sent to the management department also includes video information of the current monitoring scene, which includes continuous frame images of high-altitude throwing. The alarm information can be sent to the contact terminal of the management department or relevant personnel through various contact methods, such as email, mobile phone APP or WeChat public account push, etc.
[0142] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a device for monitoring objects thrown from a high altitude provided by an embodiment of the present invention. Figure 5 As shown, the device comprises:
[0143] The first acquisition module 501 is used to acquire a frame image sequence of the current monitoring scene;
[0144] A first calculation module 502, configured to calculate a first motion mask image between adjacent frame images by using the difference between the frame images;
[0145] A background construction module 503, configured to construct a current background image according to the first motion mask image and a frame image corresponding to the first motion mask image;
[0146] A second calculation module 504 is used to calculate a second motion mask image between the current background image and the current frame image by using a difference between the current background image and the current frame image;
[0147] The monitoring module 505 is used to monitor the high-altitude thrown objects based on the second motion mask image.
[0148] Optional, such as Figure 6 As shown, the first motion mask image includes motion mask values and stationary mask values, and the first calculation module 502 includes:
[0149] The first calculation submodule 5021 is used to calculate the difference between the corresponding pixel pairs between adjacent frame images, and determine whether the difference between the corresponding pixel pairs between the adjacent frame images is greater than or equal to a preset first difference threshold;
[0150] A first mask submodule 5022 is configured to assign a corresponding first mask pixel point as a motion mask value if the difference between corresponding pixel pairs between adjacent frame images is greater than or equal to a preset first difference threshold;
[0151] A second mask submodule, configured to assign a corresponding first mask pixel point to a static mask value if the difference between corresponding pixel pairs between adjacent frame images is less than a preset first difference threshold 5023;
[0152] The first processing submodule 5024 is used to obtain a first motion mask image based on the assigned first mask pixel points.
[0153] Optional, such as Figure 7 As shown, the background construction module 503 includes:
[0154] A block division submodule 5031 is used to divide the first motion mask image into blocks to obtain multiple mask areas;
[0155] A first construction submodule 5032 is used to construct a plurality of background regions having the same shape as the mask region according to the mask region and the frame image corresponding to the first motion mask image;
[0156] The second construction submodule 5033 constructs the current background image based on the background area.
[0157] Optional, such as Figure 8 As shown, the mask area includes a motion mask value and a static mask value, and the first construction submodule 5032 includes:
[0158] A calculation unit 50321, configured to calculate a motion state of the mask area according to a motion mask value and a static mask value of the mask area;
[0159] The selection unit 50322 is used to select an image area corresponding to the frame image corresponding to the first motion mask image as a background area according to the motion state of the mask area.
[0160] Optional, such as Fig. 9 As shown, the number of the first motion mask images is n frames, and the number of frame images corresponding to the first motion mask images is also n frames, where n is a positive integer greater than 0, and the calculation unit 50321 includes:
[0161] The first extraction subunit 503211 is used to extract a mask value sequence of each mask area in the first motion mask image according to the n-frame first motion mask image, where the dimension of the mask value sequence is n;
[0162] The second extraction subunit 503212 is used to extract the corresponding target image area index according to the mask value sequence corresponding to the mask area;
[0163] The construction subunit 503213 is used to construct a current background image based on the frame image corresponding to the first motion mask image and the target image area index.
[0164] Optional, such as Fig.10 As shown, the second calculation module 504 includes:
[0165] The second calculation submodule 5041 is used to calculate the difference between the corresponding pixel pairs of the current background image and the current frame image, and determine whether the difference between the pixel pairs is greater than or equal to a preset second difference threshold;
[0166] The third mask submodule 5042 is configured to assign a motion mask value to a corresponding second mask pixel if the difference between the corresponding pixel pairs of the current background image and the current frame image is greater than or equal to a preset first difference threshold;
[0167] The fourth mask submodule 5043 is used to assign the corresponding second mask pixel point to a static mask value if the difference between the corresponding pixel point pairs of the current background image and the current frame image is less than a preset second difference threshold;
[0168] The second processing submodule 5044 is used to obtain a second motion mask image based on the assigned second mask pixel points.
[0169] Optional, such as Fig.11 As shown, the monitoring module 505 includes:
[0170] The first monitoring submodule 5051 is used to monitor whether a first motion region with an area greater than a preset area threshold appears in the second motion mask image corresponding to the current frame image, wherein the first motion region is composed of a motion mask value;
[0171] The third calculation submodule 5052 is used to monitor whether a second motion region with an area greater than a preset area threshold appears in the second motion mask image corresponding to the next frame image, and calculate the similarity between the frame image area corresponding to the first motion region and the frame image area corresponding to the second motion region when the second motion region appears, wherein the second motion region is composed of motion mask values;
[0172] a fourth calculation submodule 5053, configured to calculate the motion trajectories of the first motion region and the second motion region if the similarity between the frame image region corresponding to the first motion region and the frame image region corresponding to the second motion region is greater than a preset similarity threshold;
[0173] The judgment submodule 5054 is used to judge whether the motion trajectory meets the conditions of high-altitude throwing.
[0174] Optional, such as Fig.12 As shown, the monitoring module 505 further includes:
[0175] A preprocessing submodule 5055 is used to remove interference information in the second motion mask image through a morphological opening operation to obtain a third motion mask image, wherein the third motion mask image includes a motion mask value and a stationary mask value;
[0176] The second monitoring submodule 5056 is used to monitor the high-altitude thrown objects based on the third motion mask image.
[0177] Optional, such as Fig.13 As shown, the device also includes:
[0178] The second acquisition module 506 is used to acquire a preset number of preceding and following frame images as a forensic frame image sequence when a high-altitude dropping is detected.
[0179] It should be noted that the device for monitoring objects dropped from high places provided in the embodiment of the present invention can be applied to mobile phones, monitors, computers, servers and other equipment that can monitor objects dropped from high places.
[0180] The high-altitude object dropping monitoring device provided in the embodiment of the present invention can realize each process realized by the high-altitude object dropping monitoring method in the above method embodiment, and can achieve the same beneficial effects. To avoid repetition, it will not be described here.
[0181] See also Fig.14 , Fig.14 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Fig.14 As shown, it includes: a memory 1402, a processor 1401, and a computer program stored in the memory 1402 and executable on the processor 1401, wherein:
[0182] The processor 1401 is used to call the computer program stored in the memory 1402 and execute the following steps:
[0183] Obtain the frame image sequence of the current monitoring scene;
[0184] By calculating the difference between the frame images, a first motion mask image between adjacent frame images is obtained;
[0185] constructing a current background image according to the first motion mask image and the frame image corresponding to the first motion mask image;
[0186] Calculating a second motion mask image between the current background image and the current frame image by using a difference between the current background image and the current frame image;
[0187] Based on the second motion mask image, the high-altitude objects are monitored.
[0188] Optionally, the first motion mask image includes a motion mask value and a stationary mask value, and the processor 1401 performs the calculation of the difference between the frame images to obtain the first motion mask image between adjacent frame images, including:
[0189] Calculating the difference between corresponding pixel pairs between adjacent frame images, and determining whether the difference between corresponding pixel pairs between adjacent frame images is greater than or equal to a preset first difference threshold;
[0190] If the difference between the corresponding pixel pairs between the adjacent frame images is greater than or equal to a preset first difference threshold, assigning the corresponding first mask pixel point as a motion mask value;
[0191] If the difference between the corresponding pixel pairs between the adjacent frame images is less than a preset first difference threshold, assigning the corresponding first mask pixel point to a static mask value;
[0192] Based on the assigned first mask pixel points, a first motion mask image is obtained.
[0193] Optionally, the processor 1401 constructs the current background image according to the first motion mask image and the frame image corresponding to the first motion mask image, including:
[0194] Dividing the first motion mask image into blocks to obtain a plurality of mask regions;
[0195] constructing a plurality of background regions having the same shape as the mask region according to the mask region and the frame image corresponding to the first motion mask image;
[0196] Based on the background area, a current background image is constructed.
[0197] Optionally, the processor 1401 constructs a plurality of background regions having the same shape as the mask region according to the mask region and the frame image corresponding to the first motion mask image, including:
[0198] Calculating the motion state of the mask area according to the mask value of the mask area;
[0199] According to the motion state of the mask area, an image area corresponding to the frame image corresponding to the first motion mask image is selected as the background area.
[0200] Optionally, the number of the first motion mask images is n frames, and the number of frame images corresponding to the first motion mask image is also n frames, where n is a positive integer greater than 0, and the processor 1401 calculates the motion state of the mask area according to the motion mask value and the static mask value of the mask area, including:
[0201] Extracting a mask value sequence of each mask area in the first motion mask image according to the n-frame first motion mask image, where the dimension of the mask value sequence is n;
[0202] According to the mask value sequence corresponding to the mask area, extract the corresponding target image area index;
[0203] A current background image is constructed based on the frame image corresponding to the first motion mask image and the target image region index.
[0204] Optionally, the processor 1401 calculates the second motion mask image between the current background image and the current frame image by using the difference between the current background image and the current frame image, including:
[0205] Calculating the difference between the corresponding pixel pairs of the current background image and the current frame image, and determining whether the difference between the pixel pairs is greater than or equal to a preset second difference threshold;
[0206] If the difference between the corresponding pixel pairs of the current background image and the current frame image is greater than or equal to a preset first difference threshold, assigning the corresponding second mask pixel point as a motion mask value;
[0207] If the difference between the corresponding pixel pairs of the current background image and the current frame image is less than a preset second difference threshold, the corresponding second mask pixel is assigned a static mask value;
[0208] Based on the assigned second mask pixel points, a second motion mask image is obtained.
[0209] Optionally, the monitoring of the high-altitude thrown objects based on the second motion mask image performed by the processor 1401 includes:
[0210] Monitoring whether a first motion region having an area greater than a preset area threshold appears in a second motion mask image corresponding to the current frame image, wherein the first motion region is composed of a motion mask value;
[0211] If so, monitoring whether a second motion region with an area greater than a preset area threshold appears in a second motion mask image corresponding to the next frame image, and calculating the similarity between the frame image region corresponding to the first motion region and the frame image region corresponding to the second motion region when the second motion region appears, wherein the second motion region is composed of motion mask values;
[0212] If the similarity between the frame image region corresponding to the first motion region and the frame image region corresponding to the second motion region is greater than a preset similarity threshold, then calculating the motion trajectories of the first motion region and the second motion region;
[0213] Determine whether the motion trajectory meets the conditions of high-altitude throwing.
[0214] Optionally, the monitoring of the high-altitude thrown objects based on the second motion mask image performed by the processor 1401 includes:
[0215] Removing interference information in the second motion mask image through a morphological opening operation to obtain a third motion mask image, wherein the third motion mask image includes a motion mask value and a stationary mask value;
[0216] Based on the third motion mask image, the high-altitude objects are monitored.
[0217] Optionally, the processor 1401 further executes:
[0218] When high-altitude throwing is detected, a preset number of previous and next frame images are obtained as a forensic frame image sequence.
[0219] It should be noted that the above-mentioned electronic equipment may be mobile phones, monitors, computers, servers and other equipment that can be used to monitor objects dropped from high places.
[0220] The electronic device provided in the embodiment of the present invention can implement each process of the high-altitude object dropping monitoring method in the above method embodiment, and can achieve the same beneficial effects. To avoid repetition, it will not be described here.
[0221] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the high-altitude object dropping monitoring method provided by the embodiment of the present invention are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0222] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0223] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A method for monitoring objects dropped from high altitudes, It is characterized in that The following steps are involved: Obtain the frame image sequence of the current monitoring scene; By calculating the difference between the frame images, a first motion mask image between adjacent frame images is obtained; The first motion mask image is divided into M*N blocks of the same size, each block corresponds to a mask area, and M*N mask areas are obtained, wherein the mask area includes a motion mask value and a static mask value; the frame image corresponding to the first motion mask image also includes M*N image areas, each image area corresponds to a mask area, the motion mask value is 255, and the static mask value is 0; Put the latest n first motion mask images into the first motion mask image array, and put the latest n frame images into the frame image array; The motion state of the mask area is calculated according to the motion mask value and the static mask value of the mask area; the motion state of the mask area is calculated by the following formula: Wherein, motion_value(pi,pj) represents the motion state of the mask area (pi,pj), M*N represents the number of mask areas, img_width represents the total width of the first motion mask image, img_height represents the total height of the first motion mask image, img_height*img_width represents the pixel area of the first motion mask image, (i,j) represents the first mask pixel point in the mask area (pi,pj), and patch(pi,pj)(i,j) represents the mask value of the first mask pixel point (i,j) in the mask area (pi,pj); According to the motion state of the mask area, selecting an image area corresponding to the frame image corresponding to the first motion mask image as a background area, wherein the background area has a corresponding positional relationship with the mask area; splicing the background area according to the position of the corresponding mask area in the first motion mask image to obtain a current background image; Calculating a second motion mask image between the current background image and the current frame image by using a difference between the current background image and the current frame image; Based on the second motion mask image, monitoring the high-altitude thrown objects; The selecting an image area corresponding to the frame image corresponding to the first motion mask image as the background area includes: For each mask area, the first motion mask map array has an n-dimensional array representing the motion state motion_value of this mask area in the most recent n frames. The index min_index of the mask area with the smallest motion state motion_value in the n-dimensional array is taken as the target image area index. The image area corresponding to the index min_index in the array of the frame image is taken as the background area. The index min_index includes the frame number n and the mask area identifier (N, M).
2. The method according to claim 1, It is characterized in that The first motion mask image includes a motion mask value and a static mask value. The first motion mask image between adjacent frame images is calculated by using the difference between the frame images, including: Calculating the difference between corresponding pixel pairs between adjacent frame images, and determining whether the difference between corresponding pixel pairs between adjacent frame images is greater than or equal to a preset first difference threshold; If the difference between the corresponding pixel pairs between the adjacent frame images is greater than or equal to a preset first difference threshold, assigning the corresponding first mask pixel point as a motion mask value; If the difference between the corresponding pixel pairs between the adjacent frame images is less than a preset first difference threshold, assigning the corresponding first mask pixel point to a static mask value; Based on the assigned first mask pixel points, a first motion mask image is obtained.
3. The method according to claim 1, It is characterized in that The calculating a second motion mask image between the current background image and the current frame image by using the difference between the current background image and the current frame image comprises: Calculating the difference between the corresponding pixel pairs of the current background image and the current frame image, and determining whether the difference between the pixel pairs is greater than or equal to a preset second difference threshold; If the difference between the corresponding pixel pairs of the current background image and the current frame image is greater than or equal to a preset first difference threshold, assigning the corresponding second mask pixel point as a motion mask value; If the difference between the corresponding pixel pairs of the current background image and the current frame image is less than a preset second difference threshold, the corresponding second mask pixel is assigned a static mask value; Based on the assigned second mask pixel points, a second motion mask image is obtained.
4. The method according to claim 1, It is characterized in that The monitoring of the high-altitude thrown objects based on the second motion mask image includes: Monitoring whether a first motion region having an area greater than a preset area threshold appears in a second motion mask image corresponding to the current frame image, wherein the first motion region is composed of a motion mask value; If so, monitoring whether a second motion region with an area greater than a preset area threshold appears in a second motion mask image corresponding to the next frame image, and calculating the similarity between the frame image region corresponding to the first motion region and the frame image region corresponding to the second motion region when the second motion region appears, wherein the second motion region is composed of motion mask values; If the similarity between the frame image region corresponding to the first motion region and the frame image region corresponding to the second motion region is greater than a preset similarity threshold, then calculating the motion trajectories of the first motion region and the second motion region; Determine whether the motion trajectory meets the conditions of high-altitude throwing.
5. The method according to claim 1, It is characterized in that The monitoring of the high-altitude thrown objects based on the second motion mask image includes: Removing interference information in the second motion mask image through a morphological opening operation to obtain a third motion mask image, wherein the third motion mask image includes a motion mask value and a stationary mask value; Based on the third motion mask image, the high-altitude objects are monitored.
6. The method according to any one of claims 1 to 5, It is characterized in that The method further comprises: When high-altitude throwing is detected, a preset number of previous and next frame images are obtained as a forensic frame image sequence.
7. A monitoring device for objects thrown from high altitudes, It is characterized in that The device comprises: The first acquisition module is used to acquire a frame image sequence of the current monitoring scene; A first calculation module, used for calculating a first motion mask image between adjacent frame images through a difference between frame images; A block division submodule is used to divide the first motion mask image into M*N blocks of the same size, each block corresponds to a mask area, and obtain M*N mask areas, wherein the mask area includes a motion mask value and a static mask value; the frame image corresponding to the first motion mask image also includes M*N image areas, each image area corresponds to a mask area, the motion mask value is 255, and the static mask value is 0; the latest n first motion mask images are placed into a first motion mask image array, and the latest n frame images are placed into a frame image array; The calculation unit is used to calculate the motion state of the mask area according to the motion mask value and the static mask value of the mask area; the motion state of the mask area is calculated by the following formula: Wherein, motion_value(pi,pj) represents the motion state of the mask area (pi,pj), M*N represents the number of mask areas, img_width represents the total width of the first motion mask image, img_height represents the total height of the first motion mask image, img_height*img_width represents the pixel area of the first motion mask image, (i,j) represents the first mask pixel point in the mask area (pi,pj), and patch(pi,pj)(i,j) represents the mask value of the first mask pixel point (i,j) in the mask area (pi,pj); A selection unit is used to select an image area corresponding to the frame image corresponding to the first motion mask map as a background area according to the motion state of the mask area, and the background area has a corresponding positional relationship with the mask area; the image area corresponding to the frame image corresponding to the first motion mask map is selected as the background area, including: for each mask area, the first motion mask map array has an n-dimensional array representing the motion state motion_value of this mask area in the latest n frames, the index min_index of the mask area with the smallest motion state motion_value in the n-dimensional array is taken as the target image area index, and the image area corresponding to the index min_index in the array of the frame image is taken as the background area, and the index min_index includes the frame number n and the mask area identifier (N, M); A second construction submodule is used to splice the background area according to the position of the mask area in the first motion mask image to obtain a current background image; A second calculation module, used for calculating a second motion mask image between the current background image and the current frame image by using a difference between the current background image and the current frame image; A monitoring module is used to monitor the high-altitude thrown objects based on the second motion mask image.
8. An electronic device, It is characterized in that include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps in the method for monitoring objects dropped from high places as described in any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps in the method for monitoring objects dropped from high places as described in any one of claims 1 to 6.
