A video surveillance-based early warning method, device, and storage medium
By dividing the target area and calculating the distance between personnel in video surveillance and determining the hazard coefficient, the problem of low monitoring and early warning efficiency in the existing technology is solved, and timely water hazard warning and rescue are achieved.
Patent Information
- Application Number
- CN202310793347.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2043-06-30
AI Technical Summary
The existing video surveillance early warning methods are inefficient and cannot detect dangerous situations in the waters in a timely manner, especially when managers in multiple water areas need to observe multiple surveillance images.
By obtaining monitoring images and dividing target areas and non-target areas, determining the edge lines of the target areas, counting the number and distance of personnel, calculating the risk coefficient, and performing early warning processing.
The efficiency of monitoring and early warning is improved, allowing managers to detect and deal with dangerous situations in a timely manner, and improving the early warning capability of water monitoring.
Smart Images

Figure CN116721516B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of monitoring and early warning technology, and in particular to an early warning method, device and storage medium based on video monitoring. Background Art
[0002] As the incidence of drowning incidents continues to rise, strengthening water monitoring to reduce drowning incidents is becoming increasingly important. In existing technologies, managers often monitor multiple monitoring areas in real time and alert relevant personnel (on the shore and in the water) when an anomaly is detected. However, because multiple water areas often exist within the same area, such as an administrative district or a town containing many ponds and lakes, the same manager needs to observe a large number of monitoring images, which can easily lead to the inability to provide timely warnings and rescue in some dangerous situations. Therefore, existing warning methods are inefficient. Summary of the Invention
[0003] The embodiments of the present application provide an early warning method and device based on video surveillance to solve the problem of low efficiency of existing early warning methods.
[0004] In order to solve the above technical problems, this application is implemented as follows:
[0005] In a first aspect, embodiments of the present application provide an early warning method based on video surveillance. The method comprises:
[0006] Acquire multiple surveillance images within the same time period within the monitoring area;
[0007] Dividing each of the plurality of monitoring images into a target area and a non-target area, wherein the target area is an area where the water area is located in the monitoring image, and the non-target area is an area in the monitoring image other than the target area;
[0008] Determine N first edge lines in the outline of the target area, where the first edge lines are edge lines in the outline of the target area that are connected to the non-target area, where N is an integer greater than or equal to 1;
[0009] Counting a first number of first persons in the target area and a second number of second persons in the non-target area;
[0010] Calculating N first distances corresponding to each first person and N second distances corresponding to each second person, respectively, where the first distance is the distance between the first person and the first edge line, and the second distance is the distance between the second person and the first edge line;
[0011] Early warning processing is performed based on the first number, the second number, the first target distance and the second target distance corresponding to each monitoring image, where the first target distance is the shortest distance among multiple first distances, and the second target distance is the shortest distance among multiple second distances.
[0012] Optionally, dividing each of the plurality of surveillance images into a target area and a non-target area includes:
[0013] Extracting target pixel points in the monitoring image that are within a preset pixel value range;
[0014] An area formed by a plurality of target pixel points is determined as the target area, and an area other than the target area in the monitoring image is determined as the non-target area.
[0015] Optionally, determining N first edge lines in the outline of the target area includes:
[0016] Obtaining each edge line in the outline of the target area, and counting adjacent pixel points of a pixel point on each edge line to form a set of adjacent pixel points corresponding to each edge line;
[0017] An edge line corresponding to a set of adjacent pixel points, in which the number of pixel points belonging to the non-target area among the adjacent pixel points is greater than a preset number, is determined as a first edge line.
[0018] Optionally, after determining the N first edge lines in the outline of the target area, the method further includes:
[0019] Display N first edge lines in the outline of the target area;
[0020] generating a corresponding modified transparent layer based on the size of the surveillance image, and superimposing the modified transparent layer on the corresponding surveillance image;
[0021] Obtaining a user-side input trajectory of a first target edge line;
[0022] In response to the input trajectory, the first target edge line is adjusted on the modified transparent layer, where the first target edge line is any one of the N first edge lines.
[0023] Optionally, respectively calculating the N first distances corresponding to each of the first persons and the N second distances corresponding to each of the second persons includes:
[0024] Calculating distances between a target person and a plurality of pixel points of a first target edge line to obtain a plurality of third distances, wherein the target person is any one of the first persons or the second persons, and the first target edge line is any one of the N first edge lines;
[0025] The shortest distance among the multiple third distances is selected as a target distance, and the target distance is any one of the N first distances or the N second distances.
[0026] Optionally, respectively calculating the distances between the target person and a plurality of pixel points on the first target edge line to obtain a plurality of third distances includes:
[0027] Calculate the distances between the first coordinates of multiple first pixel points of the first target edge line and the first center point of the person identification frame of the target person respectively to obtain multiple third distances, where the first coordinates of the first pixel point are the coordinates of the first pixel point in the first coordinate system, and the first coordinate system is a coordinate system established based on the first center point.
[0028] Optionally, respectively calculating the distances between the target person and a plurality of pixel points on the first target edge line to obtain a plurality of third distances includes:
[0029] generating a first circular area based on a first center point and a preset radius of the person identification frame of the target person, wherein the first circular area does not intersect with the first target edge line;
[0030] Enlarging the first circular area in equal proportion to obtain a second circular area, where the second circular area is the smallest circular area that can intersect with the first target edge line;
[0031] determining a first target line segment according to two intersection points where the first target edge line intersects the second circular area;
[0032] Calculate the distances between the second coordinates of multiple second pixel points of the first target line segment and the first center point of the person identification box of the target person respectively to obtain multiple third distances, where the second coordinates of the second pixel point are the coordinates of the second pixel point in the first coordinate system, and the first coordinate system is a coordinate system established based on the first center point.
[0033] Optionally, respectively calculating the N first distances corresponding to each of the first persons and the N second distances corresponding to each of the second persons includes:
[0034] The first target edge line is translated and copied along a first direction at a preset distance to obtain a plurality of first target edge lines, where the first target edge line is any edge line among the N first edge lines, and the first direction is the direction of the target area;
[0035] The target distance is calculated based on the preset distance, where the target distance is the distance between the target spacing area and the initial first target edge line before translation and copying. The target spacing area is the spacing area where the target person is located. The spacing area is the area formed by two adjacent first target edge lines and the outline of the target area. The target person is any one of the first persons, and the target distance is any one of the N first distances. Alternatively, the target person is any one of the second persons, and the target distance is any one of the N second distances.
[0036] Optionally, performing early warning processing according to the first number, the second number, the first target distance, and the second target distance corresponding to each surveillance image includes:
[0037] The risk factor of each surveillance image is calculated based on the following calculation formula according to the first number, the second number, the first target distance, and the second target distance:
[0038]
[0039] Among them, p i is the risk factor of the i-th monitoring image, is the first number in the i-th monitoring image, f i is the first number in the i-th monitoring image, h e is the first distance of the e-th first person in the i-th monitoring image, k1 is the weight value of the target area in the i-th monitoring image, is the second number in the i-th monitoring image, s i is the second number in the i-th monitoring image, c g is the second distance of the g-th second person in the i-th monitoring image, and k2 is the weight value of the non-target area in the i-th monitoring image;
[0040] The plurality of monitoring images are sorted according to their risk factors to obtain a monitoring image risk sequence, and an early warning is issued based on the monitoring image risk sequence.
[0041] Optionally, performing early warning processing according to the first number, the second number, the first target distance, and the second target distance corresponding to each surveillance image includes at least one of the following:
[0042] When the first number in the first monitoring image is greater than the first preset number, outputting first prompt information, wherein the first prompt information is used to prompt that the number of people located in the target area of the first monitoring image is greater than the first preset number;
[0043] When the second number in the first surveillance image is greater than a second preset number, outputting a second prompt message, wherein the second prompt message is used to prompt that the number of people located in the non-target area of the first surveillance image is greater than the second preset number;
[0044] When the first target distance in the first monitoring image is greater than the first preset distance, outputting third prompt information, wherein the third prompt information is used to prompt that the distance between the person located in the target area of the first monitoring image and the first edge line is greater than the first preset distance;
[0045] When the second target distance in the first monitoring image is less than the second preset distance, a fourth prompt information is output, and the fourth prompt information is used to prompt that the distance between the person in the non-target area of the first monitoring image and the first edge line is less than the first preset distance.
[0046] In a second aspect, an embodiment of the present application further provides an early warning device based on video surveillance. The early warning device based on video surveillance includes:
[0047] The first acquisition module is used to acquire multiple monitoring images within the same time period in the monitoring area;
[0048] a first division module, configured to divide each of the plurality of monitoring images into a target area and a non-target area, wherein the target area is an area where the water area is located in the monitoring image, and the non-target area is an area in the monitoring image other than the target area;
[0049] a first determining module, configured to determine N first edge lines in the outline of the target area, where the first edge lines are edge lines in the outline of the target area that are connected to the non-target area, wherein N is an integer greater than or equal to 1;
[0050] a first statistical module, configured to count a first number of first persons in the target area and a second number of second persons in the non-target area;
[0051] a first calculation module, configured to calculate N first distances corresponding to each of the first persons and N second distances corresponding to each of the second persons, wherein the first distance is the distance between the first person and the first edge line, and the second distance is the distance between the second person and the first edge line;
[0052] The first early warning module is used to perform early warning processing based on the first number, the second number, the first target distance and the second target distance corresponding to each monitoring image, where the first target distance is the shortest distance among multiple first distances, and the second target distance is the shortest distance among multiple second distances.
[0053] Optionally, the first division module includes:
[0054] A first extraction unit is used to extract target pixel points in the monitoring image that are located in a preset pixel value range;
[0055] The first determining unit is configured to determine an area formed by a plurality of target pixel points as the target area, and to determine an area in the monitoring image other than the target area as the non-target area.
[0056] Optionally, the first determining module includes:
[0057] A first acquisition unit is configured to acquire each edge line in the outline of the target area, and to count adjacent pixel points of a pixel point on each edge line to form a set of adjacent pixel points corresponding to each edge line;
[0058] The first determining unit is configured to determine, as a first edge line, an edge line corresponding to a set of adjacent pixel points in which the number of pixel points belonging to the non-target area among the adjacent pixel points is greater than a preset number.
[0059] Optionally, the device further comprises:
[0060] A first display module, configured to display N first edge lines in the outline of the target area;
[0061] A first superposition module is configured to generate a corresponding modified transparent layer based on the size of the surveillance image, and superimpose the modified transparent layer on the corresponding surveillance image;
[0062] A second acquisition module is used to obtain a trajectory input by a user terminal to the first target edge line;
[0063] The first adjustment module is configured to adjust the first target edge line on the modified transparent layer in response to the input trajectory, where the first target edge line is any one of the N first edge lines.
[0064] Optionally, the first calculation module includes:
[0065] a first calculating unit, configured to respectively calculate distances between a target person and a plurality of pixel points of a first target edge line to obtain a plurality of third distances, wherein the target person is any one of the first persons or the second persons, and the first target edge line is any one of the N first edge lines;
[0066] The first selection unit is configured to select the shortest distance among the plurality of third distances as a target distance, where the target distance is any one of the N first distances or the N second distances.
[0067] Optionally, the first computing unit includes:
[0068] The first calculation subunit is used to respectively calculate the distance between the first coordinates of multiple first pixel points of the first target edge line and the first center point of the person identification box of the target person to obtain multiple third distances, where the first coordinate of the first pixel point is the coordinate of the first pixel point in the first coordinate system, and the first coordinate system is a coordinate system established based on the first center point.
[0069] Optionally, the first computing unit includes:
[0070] A first generating subunit is configured to generate a first circular area based on a first center point and a preset radius of the person identification frame of the target person, wherein the first circular area does not intersect with the first target edge line;
[0071] a first determining subunit, configured to proportionally enlarge the first circular area to obtain a second circular area, where the second circular area is a minimum circular area that can intersect with the first target edge line;
[0072] a second determining subunit, configured to determine a first target line segment according to two intersection points where the first target edge line intersects the second circular area;
[0073] The third determination subunit is used to respectively calculate the distance between the second coordinates of multiple second pixel points of the first target line segment and the first center point of the person identification box of the target person to obtain multiple third distances, where the second coordinates of the second pixel point are the coordinates of the second pixel point in the first coordinate system, and the first coordinate system is a coordinate system established based on the first center point.
[0074] Optionally, the first calculation module includes:
[0075] a first copying unit, configured to perform translational copying of the first target edge line along a first direction at intervals of a preset distance to obtain a plurality of first target edge lines, wherein the first target edge line is any one of the N first edge lines, and the first direction is a direction in which the target area is located;
[0076] A second calculation unit is used to calculate the target distance based on the preset distance, where the target distance is the distance between the target spacing area and the initial first target edge line before translation and copying, the target spacing area is the spacing area where the target person is located, and the spacing area is the area formed by two adjacent first target edge lines and the outline of the target area, the target person is any one of the first persons, and the target distance is any one of the N first distances, or the target person is any one of the second persons, and the target distance is any one of the N second distances.
[0077] Optionally, the first early warning module includes:
[0078] The third calculation unit is configured to calculate the risk factor of each surveillance image according to the first number, the second number, the first target distance, and the second target distance based on the following calculation formula:
[0079]
[0080] Among them, p i is the risk factor of the i-th monitoring image, is the first number in the i-th monitoring image, f i is the first number in the i-th monitoring image, h e is the first distance of the e-th first person in the i-th monitoring image, k1 is the weight value of the target area in the i-th monitoring image, is the second number in the i-th monitoring image, s i is the second number in the i-th monitoring image, c g is the second distance of the g-th second person in the i-th monitoring image, and k2 is the weight value of the non-target area in the i-th monitoring image;
[0081] The first sorting unit is configured to sort the plurality of monitoring images according to their risk factors to obtain a monitoring image risk sequence, and issue an early warning based on the monitoring image risk sequence.
[0082] Optionally, the first early warning module includes at least one of the following units:
[0083] a first output unit, configured to output first prompt information when a first number in the first surveillance image is greater than a first preset number, the first prompt information being used to prompt that the number of persons located in a target area of the first surveillance image is greater than the first preset number;
[0084] a second output unit, configured to output second prompt information when the second number in the first surveillance image is greater than a second preset number, the second prompt information being used to prompt that the number of persons located in the non-target area of the first surveillance image is greater than the second preset number;
[0085] a third output unit, configured to output third prompt information when the distance between the first target in the first surveillance image is greater than a first preset distance, the third prompt information being configured to prompt that the distance between a person located in the target area of the first surveillance image and the first edge line is greater than the first preset distance;
[0086] The fourth output unit is used to output a fourth prompt message when the second target distance in the first monitoring image is less than the second preset distance. The fourth prompt message is used to prompt that the distance between the person in the non-target area of the first monitoring image and the first edge line is less than the first preset distance.
[0087] In a third aspect, an embodiment of the present application also provides an early warning device based on video surveillance, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the above-mentioned early warning method based on video surveillance when executed by the processor.
[0088] In a fourth aspect, an embodiment of the present application further 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 above-mentioned video surveillance-based early warning method are implemented.
[0089] The early warning method based on video surveillance of the embodiment of the present application includes acquiring multiple surveillance images of the same time period within a monitoring area; dividing each of the multiple surveillance images into a target area and a non-target area; determining N first edge lines in the outline of the target area; counting the first number of first persons in the target area and the second number of second persons in the non-target area; calculating the N first distances corresponding to each of the first persons and the N second distances corresponding to each of the second persons; and performing early warning processing based on the first number, the second number, the first target distance, and the second target distance corresponding to each surveillance image. By calculating the first number, the second number, the first target distance, and the second target distance corresponding to each surveillance image, this method enables management personnel to more intuitively observe the actual situation of each surveillance image, and can provide timely early warnings and rescue for some dangerous situations, thereby improving the efficiency of the early warning method. BRIEF DESCRIPTION OF THE DRAWINGS
[0090] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0091] Figure 1 This is a flow chart of an early warning method based on video surveillance provided in an embodiment of the present application;
[0092] Figure 2 This is one of the schematic diagrams for calculating the target distance in the early warning method based on video surveillance provided in an embodiment of the present application;
[0093] Figure 3 This is the second schematic diagram of calculating the target distance in the early warning method based on video surveillance provided in an embodiment of the present application;
[0094] Figure 4 This is a structural diagram of an early warning device based on video surveillance provided by another embodiment of the present application;
[0095] Figure 5 This is a structural diagram of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION
[0096] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0097] The present application embodiment provides an early warning method based on video surveillance. Figure 1 , Figure 1 This is a flow chart of the early warning method based on video monitoring provided by the embodiment of the present application, such as Figure 1 As shown, the following steps are included:
[0098] Step 101: Acquire multiple surveillance images of the same time period within a monitoring area;
[0099] In this step, multiple monitoring images within the monitoring area are acquired simultaneously.
[0100] Step 102: Divide each of the plurality of surveillance images into a target area and a non-target area, wherein the target area is the area where the water area is located in the surveillance image, and the non-target area is the area in the surveillance image other than the target area;
[0101] During actual monitoring, the camera monitoring range may include water areas, land and vegetation on the shore, etc. The areas in the monitoring image are divided, the water areas are divided into target areas, and other areas in the monitoring image except the water areas are non-target areas. For example, non-target areas may include the shore, platform, ship, etc.
[0102] Step 103: Determine N first edge lines in the outline of the target area, where the first edge lines are edge lines in the outline of the target area that are connected to the non-target area, where N is an integer greater than or equal to 1;
[0103] It is understandable that due to the limited acquisition range of the camera, and the large area of some water bodies such as ponds and lakes, there may be water areas that cannot be fully captured in a surveillance image. Therefore, in the surveillance image, the edge lines similar to the shore and the water area are the target area, and the edge line in the outline of the target area that connects with the non-target area is determined as the first edge line.
[0104] Step 104: Count a first number of first persons in the target area and a second number of second persons in the non-target area;
[0105] In this step, people can be detected using existing techniques, such as foreground detection, silhouette templates, HOG features, edgelet features, and other methods. The images are checked for the presence of people and a corresponding person identification box is generated. If the person identification box is within the target area, the person is identified as the first person. If the person identification box is within the non-target area, the person is identified as the second person. The number of people in the first group is counted to determine the first number; the number of people in the second group is counted to determine the second number.
[0106] Step 105: Calculate N first distances corresponding to each first person and N second distances corresponding to each second person, where the first distance is the distance between the first person and the first edge line, and the second distance is the distance between the second person and the first edge line.
[0107] In this step, the distance between the first person and the first edge line is calculated and determined as the first distance. If the first distance is smaller, it means it is safer; the distance between the second person and the first edge line is calculated and determined as the second distance. If the second distance is smaller, it means it is more dangerous.
[0108] Step 106: Perform early warning processing based on the first number, the second number, the first target distance, and the second target distance corresponding to each monitoring image, where the first target distance is the shortest distance among multiple first distances, and the second target distance is the shortest distance among multiple second distances.
[0109] In this step, the shortest distance among the multiple first distances is determined as the first target distance, and the shortest distance among the multiple second distances is determined as the second target distance. The first quantity, second quantity, first target distance and second target distance corresponding to each monitoring image are comprehensively combined to issue an early warning for the multiple monitoring images. For example, the first quantity, second quantity, first target distance and second target distance corresponding to each monitoring image can be intuitively displayed on the management screen, so that the management personnel can timely discover dangerous situations through the display on the management screen; the first quantity, second quantity, first target distance and second target distance corresponding to each monitoring image can also be input into the corresponding alarm device, and the alarm device sends an alarm signal according to preset parameters.
[0110] In the early warning method based on video surveillance in the embodiment of the present application, by calculating the first number, the second number, the first target distance and the second target distance corresponding to each monitoring image, the management personnel can more intuitively observe the actual situation of each monitoring image, and can provide timely warnings and rescue for some dangerous situations, thereby improving the efficiency of the early warning method.
[0111] Optionally, dividing each of the plurality of surveillance images into a target area and a non-target area includes:
[0112] Extracting target pixel points in the monitoring image that are within a preset pixel value range;
[0113] An area formed by a plurality of target pixel points is determined as the target area, and an area other than the target area in the monitoring image is determined as the non-target area.
[0114] In the video surveillance-based alarm method of the embodiment of the present application, target pixels within a preset pixel value interval are extracted from the surveillance image. For example, if the color of lake water is generally light blue, the pixel value interval corresponding to light blue is used as the preset pixel value interval. The collection of target pixels within the preset pixel value interval constitutes the target area, i.e., the water area. This method extracts target pixels within the preset pixel value interval, thereby enabling rapid identification of the target area.
[0115] Optionally, determining N first edge lines in the outline of the target area includes:
[0116] Obtaining each edge line in the outline of the target area, and counting adjacent pixel points of a pixel point on each edge line to form a set of adjacent pixel points corresponding to each edge line;
[0117] An edge line corresponding to a set of adjacent pixel points, in which the number of pixel points belonging to the non-target area among the adjacent pixel points is greater than a preset number, is determined as a first edge line.
[0118] In the alarm method based on video surveillance of the embodiment of the present application, each edge line in the outline of the target area is obtained. It should be noted that the outline of the target area can be recognized by OpenCV. The adjacent pixel points of the pixel points on each edge line are counted respectively to form a set of adjacent pixel points corresponding to each edge line. For example, if it is an edge line corresponding to the shore, one side of the pixel points on the edge line is the pixel point of the water area, and the other side is the pixel point of the shore. The edge line corresponding to the set of adjacent pixel points in which the number of pixel points belonging to the non-target area among the adjacent pixel points is greater than the preset number is determined as the first edge line, that is, the edge line where the water area meets the shore.
[0119] The early warning method based on video surveillance in the embodiment of the present application can quickly determine the first edge line from the edge lines in the outline of the target area by counting the number of non-target pixels in adjacent pixels.
[0120] Optionally, after determining the N first edge lines in the outline of the target area, the method further includes:
[0121] Display N first edge lines in the outline of the target area;
[0122] generating a corresponding modified transparent layer based on the size of the surveillance image, and superimposing the modified transparent layer on the corresponding surveillance image;
[0123] Obtaining a user-side input trajectory of a first target edge line;
[0124] In response to the input trajectory, the first target edge line is adjusted on the modified transparent layer, where the first target edge line is any one of the N first edge lines.
[0125] In the early warning method based on video surveillance in the embodiment of the present application, it should be noted that due to the presence of influencing factors such as vegetation and trees in the monitoring image, the previously identified edge lines may be inaccurate, so further calibration and modification are required based on the needs of the user. After the N first edge lines are displayed, a corresponding modified transparent layer is generated based on the size of the monitoring image, and the modified transparent layer is superimposed on the corresponding monitoring image. The user can edit on the modified transparent layer and adjust the N first edge lines according to the user's input trajectory. This method adjusts the first edge line according to the actual situation, which can make the division of the first edge line more accurate.
[0126] Optionally, respectively calculating the N first distances corresponding to each of the first persons and the N second distances corresponding to each of the second persons includes:
[0127] Calculating distances between a target person and a plurality of pixel points of a first target edge line to obtain a plurality of third distances, wherein the target person is any one of the first persons or the second persons, and the first target edge line is any one of the N first edge lines;
[0128] The shortest distance among the multiple third distances is selected as a target distance, and the target distance is any one of the N first distances or the N second distances.
[0129] In the video surveillance-based early warning method of the embodiment of the present application, the distances between the target person and multiple pixel points on the first target edge line are calculated respectively, and multiple third distances are obtained accordingly. The shortest distance among the multiple third distances is selected as the target distance. It should be noted that the aforementioned target person is any one of the first persons or the second persons, the first target edge line is any one of the N first edge lines, and the target distance is any one of the N first distances or the N second distances. This method is conducive to determining the dangerous situation of each person based on the target distance.
[0130] Optionally, respectively calculating the distances between the target person and a plurality of pixel points on the first target edge line to obtain a plurality of third distances includes:
[0131] Calculate the distances between the first coordinates of multiple first pixel points of the first target edge line and the first center point of the person identification frame of the target person respectively to obtain multiple third distances, where the first coordinates of the first pixel point are the coordinates of the first pixel point in the first coordinate system, and the first coordinate system is a coordinate system established based on the first center point.
[0132] In the video surveillance-based early warning method of an embodiment of the present application, a coordinate system is established using the first center point of the target person's identification frame. The coordinates of multiple first pixel points on the first target edge line in the first coordinate system are determined as first coordinates. The distances between each of the multiple first coordinates and the first center point are calculated, resulting in corresponding multiple third distances. By establishing the coordinate system, this method can quickly calculate the distances between the target person and multiple pixel points on the first target edge line.
[0133] Optionally, respectively calculating the distances between the target person and a plurality of pixel points on the first target edge line to obtain a plurality of third distances includes:
[0134] Based on a first center point and a preset radius, a first circular area is generated, where the first circular area does not intersect with the first target edge line, and the first center point is the center point of the person identification frame of the target person;
[0135] Enlarging the first circular area in equal proportion until a second circular area is obtained, where the second circular area is the smallest circular area that can intersect with the first target edge line;
[0136] determining a first target line segment according to two intersection points where the first target edge line intersects the second circular area;
[0137] Calculate the distances between the second coordinates of multiple second pixel points of the first target line segment and the first center point of the person identification box of the target person respectively to obtain multiple third distances, where the second coordinates of the second pixel point are the coordinates of the second pixel point in the first coordinate system, and the first coordinate system is a coordinate system established based on the first center point.
[0138] In the early warning method based on video surveillance in the embodiment of the present application, see Figure 2 , with the first center point as the center of the circle and the preset radius as the radius of the circle, a first circular area is generated. It should be noted that the first circular area does not intersect with the first target edge line. The first circular area is proportionally enlarged until a second circular area is obtained. It should be noted that the second circular area is the minimum circular area that intersects with the first target edge line. According to the two focal points where the first target edge line intersects with the second circular area, the first target line segment is determined, and then the distance between the target person and the multiple pixel points on the first target line segment is calculated respectively. The early warning method based on video surveillance in the embodiment of the present application reduces the calculated distance between the target person and the multiple pixel points on the first target edge line to the distance between the target person and the multiple pixel points on the first target line segment, thereby reducing the amount of data processing, which is conducive to obtaining the target distance more quickly later.
[0139] Optionally, respectively calculating the N first distances corresponding to each of the first persons and the N second distances corresponding to each of the second persons includes:
[0140] The first target edge line is translated and copied along a first direction at a preset distance to obtain a plurality of first target edge lines, where the first target edge line is any edge line among the N first edge lines, and the first direction is the direction of the target area;
[0141] The target distance is calculated based on the preset distance, where the target distance is the distance between the target spacing area and the initial first target edge line before translation and copying. The target spacing area is the spacing area where the target person is located. The spacing area is the area formed by two adjacent first target edge lines and the outline of the target area. The target person is any one of the first persons, and the target distance is any one of the N first distances. Alternatively, the target person is any one of the second persons, and the target distance is any one of the N second distances.
[0142] In the early warning method based on video surveillance in the embodiment of the present application, see Figure 3 The first target edge line is translated and copied along the first direction at predetermined intervals to obtain multiple first target edge lines, where the first direction is the direction of the target area. The multiple copied first edge lines and the outline of the target area form multiple areas. The distance between the target person and the first target edge line is converted into the distance between the area where the target person is located and the first target edge line. People in the same area are at the same distance from the first target edge line. This method significantly reduces the computational effort, allowing for rapid calculation of the target distance.
[0143] Optionally, performing early warning processing according to the first number corresponding to each surveillance image, the second number corresponding to each surveillance image, the first target distance corresponding to each surveillance image, and the second target distance corresponding to each surveillance image includes:
[0144] The risk factor of each surveillance image is calculated based on the following calculation formula according to the first number, the second number, the first target distance, and the second target distance:
[0145]
[0146] Among them, p i is the risk factor of the i-th monitoring image, is the first number in the i-th monitoring image, f i is the first number in the i-th monitoring image, h e is the first distance of the e-th first person in the i-th monitoring image, k1 is the weight value of the target area in the i-th monitoring image, is the second number in the i-th monitoring image, s i is the second number in the i-th monitoring image, c g is the second distance of the g-th second person in the i-th monitoring image, and k2 is the weight value of the non-target area in the i-th monitoring image;
[0147] The plurality of monitoring images are sorted according to their risk factors to obtain a monitoring image risk sequence, and an early warning is issued based on the monitoring image risk sequence.
[0148] In the early warning method based on video surveillance in an embodiment of the present application, the danger coefficient of each monitoring image is calculated according to the first number, the second number, the first target distance and the second target distance, and according to the above-mentioned calculation formula, and multiple monitoring images are sorted according to their danger coefficients to obtain a monitoring image danger sequence, which enables management personnel to directly discover dangerous situations in the monitoring area based on the monitoring image danger sequence, thereby greatly improving the efficiency of the early warning method.
[0149] Optionally, performing early warning processing according to the first number corresponding to each surveillance image, the second number corresponding to each surveillance image, the first target distance corresponding to each surveillance image, and the second target distance corresponding to each surveillance image includes at least one of the following:
[0150] When the first number in the first monitoring image is greater than the first preset number, outputting first prompt information, wherein the first prompt information is used to prompt that the number of people located in the target area of the first monitoring image is greater than the first preset number;
[0151] When the second number in the first surveillance image is greater than a second preset number, outputting a second prompt message, wherein the second prompt message is used to prompt that the number of people located in the non-target area of the first surveillance image is greater than the second preset number;
[0152] When the first target distance in the first monitoring image is greater than the first preset distance, outputting third prompt information, wherein the third prompt information is used to prompt that the distance between the person located in the target area of the first monitoring image and the first edge line is greater than the first preset distance;
[0153] When the second target distance in the first monitoring image is less than the second preset distance, a fourth prompt information is output, and the fourth prompt information is used to prompt that the distance between the person in the non-target area of the first monitoring image and the first edge line is less than the first preset distance.
[0154] In the video surveillance-based early warning method of the embodiment of the present application, prompt information can be output according to the first quantity, second quantity, first target distance and second target distance corresponding to each monitoring image, so as to provide early warning more flexibly according to different parameters.
[0155] It should be noted that in the early warning method based on video surveillance of the embodiment of the present application, the method for determining the target distance can also establish a first coordinate system based on the first center point of the personnel identification frame of the target person, obtain the first starting point coordinates and the first ending point coordinates of the first target edge line, and establish the first equation of the first target edge line based on the first starting point coordinates and the first ending point coordinates. The vertical slope is determined based on the slope of the first equation, and then the vertical equation is determined based on the vertical slope and the first center point. The first vertical intersection is obtained based on the vertical equation and the first equation, and the target distance is determined based on the first vertical intersection and the first center point.
[0156] See also Figure 4 , Figure 4 This is a structural diagram of an early warning device based on video surveillance provided in another embodiment of the present application.
[0157] like Figure 4 As shown, the early warning device 400 based on video surveillance includes:
[0158] The first acquisition module 401 is used to acquire multiple surveillance images within the same time period in the monitoring area;
[0159] A first division module 402 is configured to divide each of the plurality of surveillance images into a target area and a non-target area, wherein the target area is an area where the water area is located in the surveillance image, and the non-target area is an area in the surveillance image other than the target area;
[0160] A first determining module 403 is configured to determine N first edge lines in the outline of the target area, where the first edge lines are edge lines in the outline of the target area that are connected to the non-target area, where N is an integer greater than or equal to 1;
[0161] A first counting module 404 is configured to count a first number of first persons in the target area and a second number of second persons in the non-target area;
[0162] A first calculation module 405 is configured to calculate N first distances corresponding to each first person and N second distances corresponding to each second person, wherein the first distance is the distance between the first person and the first edge line, and the second distance is the distance between the second person and the first edge line;
[0163] The first warning module 406 is used to perform warning processing based on the first number, the second number, the first target distance and the second target distance corresponding to each monitoring image, where the first target distance is the shortest distance among multiple first distances, and the second target distance is the shortest distance among multiple second distances.
[0164] Optionally, the first division module includes:
[0165] A first extraction unit is used to extract target pixel points in the monitoring image that are located in a preset pixel value range;
[0166] The first determining unit is configured to determine an area formed by a plurality of target pixel points as the target area, and to determine an area in the monitoring image other than the target area as the non-target area.
[0167] Optionally, the first determining module includes:
[0168] A first acquisition unit is configured to acquire each edge line in the outline of the target area, and to count adjacent pixel points of a pixel point on each edge line to form a set of adjacent pixel points corresponding to each edge line;
[0169] The first determining unit is configured to determine, as a first edge line, an edge line corresponding to a set of adjacent pixel points in which the number of pixel points belonging to the non-target area among the adjacent pixel points is greater than a preset number.
[0170] Optionally, the device further comprises:
[0171] A first display module, configured to display N first edge lines in the outline of the target area;
[0172] A first superposition module is configured to generate a corresponding modified transparent layer based on the size of the surveillance image, and superimpose the modified transparent layer on the corresponding surveillance image;
[0173] A second acquisition module is used to obtain a trajectory input by a user terminal to the first target edge line;
[0174] The first adjustment module is configured to adjust the first target edge line on the modified transparent layer in response to the input trajectory, where the first target edge line is any one of the N first edge lines.
[0175] Optionally, the first calculation module includes:
[0176] a first calculating unit, configured to respectively calculate distances between a target person and a plurality of pixel points of a first target edge line to obtain a plurality of third distances, wherein the target person is any one of the first persons or the second persons, and the first target edge line is any one of the N first edge lines;
[0177] The first selection unit is configured to select the shortest distance among the plurality of third distances as a target distance, where the target distance is any one of the N first distances or the N second distances.
[0178] Optionally, the first computing unit includes:
[0179] The first calculation subunit is used to respectively calculate the distance between the first coordinates of multiple first pixel points of the first target edge line and the first center point of the person identification box of the target person to obtain multiple third distances, where the first coordinate of the first pixel point is the coordinate of the first pixel point in the first coordinate system, and the first coordinate system is a coordinate system established based on the first center point.
[0180] Optionally, the first computing unit includes:
[0181] A first generating subunit is configured to generate a first circular area based on a first center point and a preset radius of the person identification frame of the target person, wherein the first circular area does not intersect with the first target edge line;
[0182] a first determining subunit, configured to proportionally enlarge the first circular area to obtain a second circular area, where the second circular area is a minimum circular area that can intersect with the first target edge line;
[0183] a second determining subunit, configured to determine a first target line segment according to two intersection points where the first target edge line intersects the second circular area;
[0184] The third determination subunit is used to respectively calculate the distance between the second coordinates of multiple second pixel points of the first target line segment and the first center point of the person identification box of the target person to obtain multiple third distances, where the second coordinates of the second pixel point are the coordinates of the second pixel point in the first coordinate system, and the first coordinate system is a coordinate system established based on the first center point.
[0185] Optionally, the first calculation module includes:
[0186] a first copying unit, configured to perform translational copying of the first target edge line along a first direction at intervals of a preset distance to obtain a plurality of first target edge lines, wherein the first target edge line is any one of the N first edge lines, and the first direction is a direction in which the target area is located;
[0187] A second calculation unit is used to calculate the target distance based on the preset distance, where the target distance is the distance between the target spacing area and the initial first target edge line before translation and copying, the target spacing area is the spacing area where the target person is located, and the spacing area is the area formed by two adjacent first target edge lines and the outline of the target area, the target person is any one of the first persons, and the target distance is any one of the N first distances, or the target person is any one of the second persons, and the target distance is any one of the N second distances.
[0188] Optionally, the first early warning module includes:
[0189] The third calculation unit is configured to calculate the risk factor of each surveillance image according to the first number, the second number, the first target distance, and the second target distance based on the following calculation formula:
[0190]
[0191] Among them, p i is the risk factor of the i-th monitoring image, is the first number in the i-th monitoring image, f i is the first number in the i-th monitoring image, h e is the first distance of the e-th first person in the i-th monitoring image, k1 is the weight value of the target area in the i-th monitoring image, is the second number in the i-th monitoring image, s i is the second number in the i-th monitoring image, c g is the second distance of the g-th second person in the i-th monitoring image, and k2 is the weight value of the non-target area in the i-th monitoring image;
[0192] The first sorting unit is configured to sort the plurality of monitoring images according to their risk factors to obtain a monitoring image risk sequence, and issue an early warning based on the monitoring image risk sequence.
[0193] Optionally, the first early warning module includes at least one of the following units:
[0194] a first output unit, configured to output first prompt information when a first number in the first surveillance image is greater than a first preset number, the first prompt information being used to prompt that the number of persons located in a target area of the first surveillance image is greater than the first preset number;
[0195] a second output unit, configured to output second prompt information when the second number in the first surveillance image is greater than a second preset number, the second prompt information being used to prompt that the number of persons located in the non-target area of the first surveillance image is greater than the second preset number;
[0196] a third output unit, configured to output third prompt information when the distance between the first target in the first surveillance image is greater than a first preset distance, the third prompt information being configured to prompt that the distance between a person located in the target area of the first surveillance image and the first edge line is greater than the first preset distance;
[0197] The fourth output unit is used to output a fourth prompt message when the second target distance in the first monitoring image is less than the second preset distance. The fourth prompt message is used to prompt that the distance between the person in the non-target area of the first monitoring image and the first edge line is less than the first preset distance.
[0198] See also Figure 5 , Figure 5 This is a structural diagram of an electronic device provided by another embodiment of the present application, such as Figure 5 As shown, the electronic device includes: a processor 501 , a communication interface 502 , a communication bus 504 and a memory 503 , wherein the processor 501 , the communication interface 502 and the memory 503 interact with each other via the communication bus 504 .
[0199] The memory 503 is configured to store a computer program; the processor 501 is configured to acquire multiple surveillance images within the same time period within a surveillance area; divide each of the multiple surveillance images into a target area and a non-target area, where the target area is an area within the surveillance image where water is located, and the non-target area is an area within the surveillance image other than the target area; determine N first edge lines within the outline of the target area, where the first edge line is an edge line within the outline of the target area that connects to the non-target area, where N is an integer greater than or equal to 1; count a first number of first persons within the target area and a second number of second persons within the non-target area; calculate N first distances corresponding to each first person and N second distances corresponding to each second person, where the first distance is the distance between the first person and the first edge line, and the second distance is the distance between the second person and the first edge line; and perform early warning processing based on the first number, the second number, the first target distance, and the second target distance corresponding to each surveillance image, where the first target distance is the shortest distance among the multiple first distances, and the second target distance is the shortest distance among the multiple second distances.
[0200] Optionally, the processor 501 is specifically configured to:
[0201] Extracting target pixel points in the monitoring image that are within a preset pixel value range;
[0202] An area formed by a plurality of target pixel points is determined as the target area, and an area other than the target area in the monitoring image is determined as the non-target area.
[0203] Optionally, the processor 501 is specifically configured to:
[0204] Obtaining each edge line in the outline of the target area, and counting adjacent pixel points of a pixel point on each edge line to form a set of adjacent pixel points corresponding to each edge line;
[0205] An edge line corresponding to a set of adjacent pixel points, in which the number of pixel points belonging to the non-target area among the adjacent pixel points is greater than a preset number, is determined as a first edge line.
[0206] Optionally, the processor 501 is further configured to:
[0207] Display N first edge lines in the outline of the target area;
[0208] generating a corresponding modified transparent layer based on the size of the surveillance image, and superimposing the modified transparent layer on the corresponding surveillance image;
[0209] Obtaining a user-side input trajectory of a first target edge line;
[0210] In response to the input trajectory, the first target edge line is adjusted on the modified transparent layer, where the first target edge line is any one of the N first edge lines.
[0211] Optionally, the processor 501 is specifically configured to:
[0212] Calculating distances between a target person and a plurality of pixel points of a first target edge line to obtain a plurality of third distances, wherein the target person is any one of the first persons or the second persons, and the first target edge line is any one of the N first edge lines;
[0213] The shortest distance among the multiple third distances is selected as a target distance, and the target distance is any one of the N first distances or the N second distances.
[0214] Optionally, the processor 501 is specifically configured to:
[0215] Calculate the distances between the first coordinates of multiple first pixel points of the first target edge line and the first center point of the person identification frame of the target person respectively to obtain multiple third distances, where the first coordinates of the first pixel point are the coordinates of the first pixel point in the first coordinate system, and the first coordinate system is a coordinate system established based on the first center point.
[0216] Optionally, the processor 501 is specifically configured to:
[0217] generating a first circular area based on a first center point and a preset radius of the person identification frame of the target person, wherein the first circular area does not intersect with the first target edge line;
[0218] Enlarging the first circular area in equal proportion to obtain a second circular area, where the second circular area is the smallest circular area that can intersect with the first target edge line;
[0219] determining a first target line segment according to two intersection points where the first target edge line intersects the second circular area;
[0220] Calculate the distances between the second coordinates of multiple second pixel points of the first target line segment and the first center point of the person identification box of the target person respectively to obtain multiple third distances, where the second coordinates of the second pixel point are the coordinates of the second pixel point in the first coordinate system, and the first coordinate system is a coordinate system established based on the first center point.
[0221] Optionally, the processor 501 is specifically configured to:
[0222] The first target edge line is translated and copied along a first direction at a preset distance to obtain a plurality of first target edge lines, where the first target edge line is any edge line among the N first edge lines, and the first direction is the direction of the target area;
[0223] The target distance is calculated based on the preset distance, where the target distance is the distance between the target spacing area and the initial first target edge line before translation and copying. The target spacing area is the spacing area where the target person is located. The spacing area is the area formed by two adjacent first target edge lines and the outline of the target area. The target person is any one of the first persons, and the target distance is any one of the N first distances. Alternatively, the target person is any one of the second persons, and the target distance is any one of the N second distances.
[0224] Optionally, the processor 501 is specifically configured to:
[0225] The risk factor of each surveillance image is calculated based on the following calculation formula according to the first number, the second number, the first target distance, and the second target distance:
[0226]
[0227] Among them, p i is the risk factor of the i-th monitoring image, is the first number in the i-th monitoring image, f i is the first number in the i-th monitoring image, h e is the first distance of the e-th first person in the i-th monitoring image, k1 is the weight value of the target area in the i-th monitoring image, is the second number in the i-th monitoring image, s i is the second number in the i-th monitoring image, c g is the second distance of the g-th second person in the i-th monitoring image, and k2 is the weight value of the non-target area in the i-th monitoring image;
[0228] The plurality of monitoring images are sorted according to their risk factors to obtain a monitoring image risk sequence, and an early warning is issued based on the monitoring image risk sequence.
[0229] Optionally, the processor 501 is specifically configured to:
[0230] When the first number in the first monitoring image is greater than the first preset number, outputting first prompt information, wherein the first prompt information is used to prompt that the number of people located in the target area of the first monitoring image is greater than the first preset number;
[0231] When the second number in the first surveillance image is greater than a second preset number, outputting a second prompt message, wherein the second prompt message is used to prompt that the number of people located in the non-target area of the first surveillance image is greater than the second preset number;
[0232] When the first target distance in the first monitoring image is greater than the first preset distance, outputting third prompt information, wherein the third prompt information is used to prompt that the distance between the person located in the target area of the first monitoring image and the first edge line is greater than the first preset distance;
[0233] When the second target distance in the first monitoring image is less than the second preset distance, a fourth prompt information is output, and the fourth prompt information is used to prompt that the distance between the person in the non-target area of the first monitoring image and the first edge line is less than the first preset distance.
[0234] The communication bus 504 mentioned in the electronic device can be a Peripheral Component Interconnect (PCT) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 504 can be divided into an address bus, a data bus, a control bus, etc. For ease of identification, the figure shows only one thick line, but this does not mean that there is only one bus or only one type of data.
[0235] The communication interface 502 is used for communication between the terminal and other devices.
[0236] The memory 503 may include a random access memory (RAM) or a non-volatile memory (non-volatile memory), such as at least one disk storage. Optionally, the memory 503 may also be at least one storage device located away from the aforementioned processor 501. The aforementioned processor 501 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0237] The present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements the various processes of the above-mentioned video surveillance-based early warning method embodiment and can achieve the same technical effect. To avoid repetition, the details are not described here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0238] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0239] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0240] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. A video surveillance-based early warning method, characterized in that: The method comprises: Acquire multiple surveillance images within the same time period within the monitoring area; Dividing each of the plurality of monitoring images into a target area and a non-target area, wherein the target area is an area where the water area is located in the monitoring image, and the non-target area is an area in the monitoring image other than the target area; Determine N first edge lines in the outline of the target area, where the first edge lines are edge lines in the outline of the target area that are connected to the non-target area, where N is an integer greater than or equal to 1; Counting a first number of first persons in the target area and a second number of second persons in the non-target area; Calculating N first distances corresponding to each first person and N second distances corresponding to each second person, respectively, where the first distance is the distance between the first person and the first edge line, and the second distance is the distance between the second person and the first edge line; Early warning processing is performed based on the first number, the second number, the first target distance and the second target distance corresponding to each monitoring image, where the first target distance is the shortest distance among multiple first distances, and the second target distance is the shortest distance among multiple second distances.
2. The early warning method based on video surveillance according to claim 1, characterized in that: The step of dividing each of the plurality of surveillance images into a target area and a non-target area comprises: Extracting target pixel points in the monitoring image that are within a preset pixel value range; An area formed by a plurality of target pixel points is determined as the target area, and an area other than the target area in the monitoring image is determined as the non-target area.
3. The early warning method based on video surveillance according to claim 1, characterized in that: The determining of N first edge lines in the outline of the target area includes: Obtaining each edge line in the outline of the target area, and counting adjacent pixel points of a pixel point on each edge line to form a set of adjacent pixel points corresponding to each edge line; An edge line corresponding to a set of adjacent pixel points, in which the number of pixel points belonging to the non-target area among the adjacent pixel points is greater than a preset number, is determined as a first edge line.
4. The early warning method based on video surveillance according to claim 1, characterized in that: After determining the N first edge lines in the outline of the target area, the method further includes: Display N first edge lines in the outline of the target area; generating a corresponding modified transparent layer based on the size of the surveillance image, and superimposing the modified transparent layer on the corresponding surveillance image; Obtaining a user-side input trajectory of a first target edge line; In response to the input trajectory, the first target edge line is adjusted on the modified transparent layer, where the first target edge line is any one of the N first edge lines.
5. The early warning method based on video surveillance according to claim 1, characterized in that: The respectively calculating the N first distances corresponding to each of the first persons and the N second distances corresponding to each of the second persons includes: Calculating distances between a target person and a plurality of pixel points of a first target edge line to obtain a plurality of third distances, wherein the target person is any one of the first persons or the second persons, and the first target edge line is any one of the N first edge lines; The shortest distance among the multiple third distances is selected as a target distance, and the target distance is any one of the N first distances or the N second distances.
6. The early warning method based on video surveillance according to claim 5, characterized in that: The step of respectively calculating the distances between the target person and the plurality of pixel points of the first target edge line to obtain a plurality of third distances includes: Calculate the distances between the first coordinates of multiple first pixel points of the first target edge line and the first center point of the person identification frame of the target person respectively to obtain multiple third distances, where the first coordinates of the first pixel point are the coordinates of the first pixel point in the first coordinate system, and the first coordinate system is a coordinate system established based on the first center point.
7. The early warning method based on video surveillance according to claim 5, characterized in that: The step of respectively calculating the distances between the target person and the plurality of pixel points of the first target edge line to obtain a plurality of third distances includes: generating a first circular area based on a first center point and a preset radius of the person identification frame of the target person, wherein the first circular area does not intersect with the first target edge line; Enlarging the first circular area in equal proportion to obtain a second circular area, where the second circular area is the smallest circular area that can intersect with the first target edge line; determining a first target line segment according to two intersection points where the first target edge line intersects the second circular area; Calculate the distances between the second coordinates of multiple second pixel points of the first target line segment and the first center point of the person identification box of the target person respectively to obtain multiple third distances, where the second coordinates of the second pixel point are the coordinates of the second pixel point in the first coordinate system, and the first coordinate system is a coordinate system established based on the first center point.
8. The early warning method based on video surveillance according to claim 1, characterized in that: The respectively calculating the N first distances corresponding to each of the first persons and the N second distances corresponding to each of the second persons includes: The first target edge line is translated and copied along a first direction at a preset distance to obtain a plurality of first target edge lines, where the first target edge line is any edge line among the N first edge lines, and the first direction is the direction of the target area; The target distance is calculated based on the preset distance, where the target distance is the distance between the target spacing area and the initial first target edge line before translation and copying. The target spacing area is the spacing area where the target person is located. The spacing area is the area formed by two adjacent first target edge lines and the outline of the target area. The target person is any one of the first persons, and the target distance is any one of the N first distances. Alternatively, the target person is any one of the second persons, and the target distance is any one of the N second distances.
9. The early warning method based on video surveillance according to claim 1, characterized in that: The performing early warning processing according to the first number, the second number, the first target distance and the second target distance corresponding to each monitoring image includes: The risk factor of each surveillance image is calculated based on the following calculation formula according to the first number, the second number, the first target distance, and the second target distance: Among them, p i is the risk factor of the i-th monitoring image, is the first number in the i-th monitoring image, f i is the first number in the i-th monitoring image, h e is the first distance of the e-th first person in the i-th monitoring image, k1 is the weight value of the target area in the i-th monitoring image, is the second number in the i-th monitoring image, s i is the second number in the i-th monitoring image, c g is the second distance of the g-th second person in the i-th monitoring image, and k2 is the weight value of the non-target area in the i-th monitoring image; The plurality of monitoring images are sorted according to their risk factors to obtain a monitoring image risk sequence, and an early warning is issued based on the monitoring image risk sequence.
10. The early warning method based on video surveillance according to claim 1, characterized in that: The performing early warning processing according to the first number, the second number, the first target distance, and the second target distance corresponding to each surveillance image includes at least one of the following: When the first number in the first monitoring image is greater than the first preset number, outputting first prompt information, wherein the first prompt information is used to prompt that the number of people located in the target area of the first monitoring image is greater than the first preset number; When the second number in the first surveillance image is greater than a second preset number, outputting a second prompt message, wherein the second prompt message is used to prompt that the number of people located in the non-target area of the first surveillance image is greater than the second preset number; When the first target distance in the first monitoring image is greater than the first preset distance, outputting third prompt information, wherein the third prompt information is used to prompt that the distance between the person located in the target area of the first monitoring image and the first edge line is greater than the first preset distance; When the second target distance in the first monitoring image is less than the second preset distance, a fourth prompt information is output, and the fourth prompt information is used to prompt that the distance between the person in the non-target area of the first monitoring image and the first edge line is less than the first preset distance.
11. An early warning device based on video surveillance, characterized in that: The device comprises: The first acquisition module is used to acquire multiple monitoring images within the same time period in the monitoring area; a first division module, configured to divide each of the plurality of monitoring images into a target area and a non-target area, wherein the target area is an area where the water area is located in the monitoring image, and the non-target area is an area in the monitoring image other than the target area; a first determining module, configured to determine N first edge lines in the outline of the target area, where the first edge lines are edge lines in the outline of the target area that are connected to the non-target area, wherein N is an integer greater than or equal to 1; a first statistical module, configured to count a first number of first persons in the target area and a second number of second persons in the non-target area; a first calculation module, configured to calculate N first distances corresponding to each of the first persons and N second distances corresponding to each of the second persons, wherein the first distance is the distance between the first person and the first edge line, and the second distance is the distance between the second person and the first edge line; The first early warning module is used to perform early warning processing according to the first number, the second number, the first target distance and the second target distance corresponding to each monitoring image, where the first target distance is the shortest distance among multiple first distances, and the second target distance is the shortest distance among multiple second distances.
12. An electronic device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the video surveillance-based early warning method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the early warning method based on video surveillance as described in any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Area monitoring method and device, electronic equipment and readable storage medium
CN113673399A
Shoreside personnel dangerous behavior detection method, electronic equipment and storage medium
CN115019402A