Methods, devices, storage media, and electronic components for determining the location of monitoring equipment
By selecting some vertices in the target coordinate system as references and using slope comparison to determine whether the monitoring device is within the target geographical area, the problem of low efficiency in determining the location of the monitoring device is solved, and more efficient location detection is achieved.
Patent Information
- Application Number
- CN202310034807.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-10
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2043-01-10
AI Technical Summary
Existing technologies have low efficiency in determining the location of monitoring equipment, especially in complex scenarios where detection efficiency is insufficient.
By determining the geographical location of the target monitoring device and the boundary polygon of the target geographical area in the target coordinate system, selecting some vertices located on one side of the reference line as reference vertices, and using slope comparison based on the positional relationship between the target point and the reference vertices and adjacent vertices, it is determined whether the monitoring device is within the target geographical area.
This improves the efficiency of determining the location of monitoring equipment, avoids the inefficiency caused by traversing all vertices and edges of a polygon, and achieves more efficient location detection.
Smart Images

Figure CN116261101B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of intelligent security technology, and more specifically, to a method, apparatus, storage medium, and electronic device for determining the location of a monitoring device. Background Technology
[0002] With the continuous development of IoT technology, artificial intelligence technology, big data technology, and computing chips and data storage hardware, intelligent monitoring equipment has received increasing attention and wider application in various fields.
[0003] In related technologies, determining whether a device or location belongs to a certain area mainly employs a simple and crude detection method that involves traversing the entire area. For more complex scenarios, this method has low detection efficiency. In other words, using the detection methods in related technologies to determine the location of monitoring equipment is inefficient.
[0004] There is currently no effective solution to the problem of low efficiency in determining the location of monitoring equipment in related technologies. Summary of the Invention
[0005] This invention provides a method, apparatus, storage medium, and electronic device for determining the location of monitoring equipment, in order to at least solve the problem of low efficiency in determining the location of monitoring equipment in related technologies.
[0006] According to an embodiment of the present invention, a method for determining the location of a monitoring device is provided, comprising: acquiring location information of a target monitoring device and boundary location information of a target geographical area, and determining a target point and a target polygon in a target coordinate system, wherein the target point represents the geographical location indicated by the location information of the target monitoring device, and the target polygon represents the boundary of the target geographical area indicated by the boundary location information; determining a set of reference vertices among the vertices of the target polygon, wherein the set of reference vertices are some vertices in the target polygon, and the set of reference vertices are all located on one side of a reference line passing through the target point in the target coordinate system, and at least one adjacent vertex of each vertex in the set of vertices is located on the other side of the reference line; determining whether the target monitoring device is located within the target geographical area based on the positional relationship between the target point and the set of reference vertices and the set of adjacent vertices, wherein the set of adjacent vertices are the vertices located on the other side among the adjacent vertices of each vertex in the set of reference vertices.
[0007] In an exemplary embodiment, determining whether the target monitoring device is located within the target geographical area based on the positional relationship between the target point and the set of reference vertices and the set of adjacent vertices includes: determining a first set of slopes based on the target point and the set of reference vertices, wherein the first set of slopes is the slope of the straight line formed by the target point and each vertex in the set of reference vertices; determining a second set of slopes based on the set of reference vertices and the set of adjacent vertices, wherein the second set of slopes is the slope of the straight line formed by each vertex in the set of reference vertices and each adjacent vertex in the set of adjacent vertices; and determining whether the target monitoring device is located within the target geographical area based on the first set of slopes and the second set of slopes.
[0008] In an exemplary embodiment, determining whether the target monitoring device is located within the target geographical area based on the first set of slopes and the second set of slopes includes: determining, based on the first set of slopes and the second set of slopes, slopes in the second set of slopes that satisfy a preset condition, wherein satisfying the preset condition means that one slope in the second set of slopes is less than the corresponding slope in the first set of slopes, and the corresponding slope and the slope are the slopes of the straight lines formed by the same vertex in the set of reference vertices and the target point and one vertex in the set of adjacent vertices, respectively; and determining whether the target monitoring device is located within the target geographical area based on the number of slopes that satisfy the preset condition.
[0009] In one exemplary embodiment, determining whether the target monitoring device is located within the target geographical area based on the number of slopes satisfying the preset conditions includes: determining that the target monitoring device is located within the target geographical area when the number of slopes satisfying the preset conditions is odd; and determining that the target monitoring device is located outside the target geographical area when the number of slopes satisfying the preset conditions is even.
[0010] In one exemplary embodiment, after determining whether the target monitoring device is located within the target geographical area, the method further includes: if it is determined that the target monitoring device is located outside the target geographical area, determining whether the target monitoring device is located within a target preset range of the boundary of the target geographical area; if it is determined that the target monitoring device is located within the target preset range of the boundary of the target geographical area, determining that the target monitoring device is located within the target geographical area.
[0011] In an exemplary embodiment, determining whether the target monitoring device is located within a target preset range of the boundary of the target geographical area includes: determining the target distance between the target point and each side of the target polygon to obtain a set of target distances; and determining whether the target monitoring device is located within the target preset range based on the set of target distances.
[0012] In an exemplary embodiment, determining the target distance between the target point and each edge of the target polygon includes: determining a reference point on each edge of the target polygon that is closest to the target point; and determining the distance between the target point and the reference point on each edge as the target distance between the target point and each edge.
[0013] In an exemplary embodiment, determining whether the target monitoring device is located within the target preset range based on the set of target distances includes: determining that the target monitoring device is located within the target preset range if at least one of the target distances in the set of target distances is less than or equal to a predetermined distance threshold; and determining that the target monitoring device is located outside the target preset range if all of the target distances in the set of target distances are greater than the predetermined distance threshold.
[0014] According to another embodiment of the present invention, a device for determining the location of a monitoring device is also provided, comprising: an acquisition module, configured to acquire location information of a target monitoring device and boundary location information of a target geographical area, and determine a target point and a target polygon in a target coordinate system, wherein the target point represents the geographical location indicated by the location information of the target monitoring device, and the target polygon represents the boundary of the target geographical area indicated by the boundary location information; a first determination module, configured to determine a set of reference vertices among the vertices of the target polygon, wherein the set of reference vertices are some vertices in the target polygon, and the set of reference vertices are all located on one side of a reference line passing through the target point in the target coordinate system, and at least one adjacent vertex of each vertex in the set of vertices is located on the other side of the reference line; and a second determination module, configured to determine whether the target monitoring device is located within the target geographical area based on the positional relationship between the target point and the set of reference vertices and the set of adjacent vertices, wherein the set of adjacent vertices are the vertices located on the other side among the adjacent vertices of each vertex in the set of reference vertices.
[0015] According to yet another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
[0016] According to yet another embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0017] This invention determines the geographical location of a target monitoring device within a target coordinate system, and identifies a target polygon representing the boundary of the target geographical area. Then, a set of reference vertices located on one side of a reference line is determined from the vertices of the target polygon. Each vertex in this set of reference vertices has at least one adjacent vertex located on the other side of the reference line. Based on the positional relationship between the target point, the set of reference vertices, and the set of adjacent vertices, it can be determined whether the target monitoring device is located within the target geographical area. The set of adjacent vertices consists of the vertices of each vertex in the set of reference vertices that are adjacent to each other and located on the other side of the reference line. This invention avoids the problem of low detection efficiency caused by traversing all vertices and edges of a polygon, as is often the case in related technologies. Therefore, it solves the problem of low efficiency in determining the location of monitoring devices in related technologies, achieving an improvement in the efficiency of monitoring device location determination. Attached Figure Description
[0018] Figure 1 This is a block diagram of the mobile terminal hardware structure of the location determination method for monitoring equipment according to an embodiment of the present invention;
[0019] Figure 2 This is a flowchart of a method for determining the location of a monitoring device according to an embodiment of the present invention;
[0020] Figure 3 This is a scenario example according to an embodiment of the present invention. Figure 1 ;
[0021] Figure 4 This is a scenario example according to an embodiment of the present invention. Figure 2 ;
[0022] Figure 5 This is an example diagram of the shortest distance according to a specific embodiment of the present invention;
[0023] Figure 6 This is an overall flowchart of the in-region and out-of-region detection method according to a specific embodiment of the present invention;
[0024] Figure 7 This is a flowchart of an in-region and out-of-region detection method according to a specific embodiment of the present invention;
[0025] Figure 8 This is a structural block diagram of a location determination device for a monitoring device according to an embodiment of the present invention. Detailed Implementation
[0026] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples.
[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0028] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a mobile terminal hardware structure block diagram of the location determination method for monitoring equipment according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0029] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the location determination method of the monitoring device in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0030] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0031] This embodiment provides a method for determining the location of a monitoring device. Figure 2 This is a flowchart of a method for determining the location of a monitoring device according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:
[0032] Step S202: Obtain the location information of the target monitoring device and the boundary location information of the target geographical area, and determine the target point and the target polygon in the target coordinate system, wherein the target point represents the geographical location indicated by the location information of the target monitoring device, and the target polygon represents the boundary of the target geographical area indicated by the boundary location information;
[0033] Step S204: Determine a set of reference vertices among the vertices of the target polygon, wherein the set of reference vertices are some of the vertices in the target polygon, and the set of reference vertices are all located on one side of a reference line passing through the target point in the target coordinate system, and at least one adjacent vertex of each vertex in the set of vertices is located on the other side of the reference line.
[0034] Step S206: Based on the positional relationship between the target point and the set of reference vertices and the set of adjacent vertices, determine whether the target monitoring device is located within the target geographical area, wherein the set of adjacent vertices is the vertex located on the other side among the adjacent vertices of each vertex in the set of reference vertices.
[0035] Through the above steps, a target point representing the geographical location of the target monitoring device and a target polygon representing the boundary of the target geographical area are determined in the target coordinate system. Then, a set of reference vertices located on one side of a reference line are determined from the vertices of the target polygon. Each vertex in the set of reference vertices has at least one adjacent vertex located on the other side of the reference line. Based on the positional relationship between the target point, the set of reference vertices, and the set of adjacent vertices, it can be determined whether the target monitoring device is located within the target geographical area. The set of adjacent vertices consists of the vertices of each vertex in the set of reference vertices that are adjacent to each other and located on the other side of the reference line. This avoids the problem of low detection efficiency caused by traversing all vertices and edges of the polygon, which is a common method in related technologies. Therefore, it solves the problem of low efficiency in determining the location of monitoring devices in related technologies, achieving the effect of improving the efficiency of monitoring device location determination.
[0036] The entity performing the above steps can be a terminal, such as a computer terminal or a mobile terminal, or a processor with human-computer interaction capabilities configured on a storage device, or a processing device or processing unit with similar processing capabilities, but is not limited to these.
[0037] In the above embodiments, the location information of the target monitoring device and the boundary location information of the target geographical area are obtained, and the target point and target polygon are determined in the target coordinate system. The target point represents the geographical location indicated by the location information of the target monitoring device, and the target polygon represents the boundary of the target geographical area represented by the boundary location information. For example, the target monitoring device can be a camera, video camera, or other video recording equipment, or a device monitoring a point. The location information of the target monitoring device can be the coordinate information or latitude and longitude information of the geographical location of the target monitoring device. The boundary location information of the target geographical area can be information composed of the coordinates (or latitude and longitude) of the boundary endpoints (or vertices) of the target geographical area. Thus, the target point representing the geographical location of the target monitoring device and the target polygon representing the boundary of the target geographical area can be determined in the target coordinate system. Figure 3 As shown, V1, V2...V n-1 V n The endpoints represent the target geographic region, which form the target polygon described above. The diagram uses a heptagon as an example only; in practical applications, the boundaries of the target geographic region may form polygons with other numbers of sides. Figure 3Point A in the diagram represents the target point (i.e., the location of the target monitoring equipment). A set of reference vertices is determined from the vertices of the target polygon. This set of reference vertices consists of a subset of the vertices in the target polygon. In the target coordinate system, each of these reference vertices lies on one side of a reference line passing through the target point. At least one adjacent vertex of each vertex in the set lies on the other side of the reference line. For example, the reference line is a straight line perpendicular to the X-axis passing through point A (e.g., ...). Figure 3 (the line containing SA or TA), and vertex V n-1 V1 and V2 constitute the aforementioned set of reference vertices. Based on the positional relationship between the target point, the set of reference vertices, and the set of adjacent vertices, it is determined whether the target monitoring device is located within the target geographical area. Here, the set of adjacent vertices consists of the vertices on the opposite side of the adjacent vertices of each vertex in the set of reference vertices, for example... Figure 3 Chinese V n-2 V n V1 and V2 constitute the aforementioned set of adjacent vertices. Then, based on the positional relationship between the target vertex and a set of reference vertices and a set of adjacent vertices, it is determined whether the target monitoring device is located within the target geographical area. For example, based on the positional relationship between the target vertex, a set of reference vertices, and a set of adjacent vertices, it is determined whether the target vertex is located between one of the vertices (e.g., V1) and an adjacent vertex (e.g., V2). n Within the area formed by V1V2V n Within the area, or V1V n Within the sector formed by V1 and V2, for example, it can also be based on point A and any vertex in the above set of reference vertices (such as V). n-1 The lines connecting (e.g., V) n-1 The slope of the line containing A and V n-1 The line connecting adjacent vertices (e.g., V) n-1 V n-2 V n-1 V n The relationship between the slope of the line containing V1A and the slope of the line containing V1A is used to determine whether the target monitoring device is located within the target geographical area. For example, if the slope of the line containing V1A is greater than that of V1A, the target monitoring device is located within the target geographical area. n-1 V n The slope of the line is less than V. n-1 V n-2 The slope of the line containing point A can be used to determine the location of point A on line V. n-2 V n-1 With V n-1 V nWithin the fan-shaped area formed, it can be determined that point A is located within the aforementioned target polygon. This embodiment avoids the problem of low detection efficiency caused by the method of traversing all vertices and edges of the polygon, which is mainly used in related technologies. Therefore, it solves the problem of low efficiency in determining the location of monitoring equipment in related technologies, achieving the effect of improving the efficiency of determining the location of monitoring equipment.
[0038] In an optional embodiment, determining whether the target monitoring device is located within the target geographical area based on the positional relationship between the target point and the set of reference vertices and the set of adjacent vertices includes: determining a first set of slopes based on the target point and the set of reference vertices, wherein the first set of slopes is the slope of the straight line formed by the target point and each vertex in the set of reference vertices; determining a second set of slopes based on the set of reference vertices and the set of adjacent vertices, wherein the second set of slopes is the slope of the straight line formed by each vertex in the set of reference vertices and each adjacent vertex in the set of adjacent vertices; and determining whether the target monitoring device is located within the target geographical area based on the first set of slopes and the second set of slopes. In this embodiment, combined with... Figure 3 To illustrate, assume point A is the target point (i.e., the location of the target monitoring device), and a set of reference vertices includes... Figure 3 V in n-1 V1, that is, the slope of the line containing the first set of slopes V1A and V n-1 The slope of the line containing A; from Figure 3 As can be seen from V n-1 V are adjacent vertices n-2 V n And V n-2 V n All are located on the other side of the reference line (such as the line where SA is located), and the adjacent vertices of V1 are V n V2, and V n Both V1 and V2 are located on the other side of the reference line (such as the line where SA is located). The above set of adjacent vertices includes V1 and V2. n-2 V n V2, thus, the second set of slopes can be determined to include V. n-1 V n-2 V n-1 V n The slope of the line containing V1V n First, determine the slope of the straight line containing V1 and V2; then, based on the first and second sets of slopes, determine whether the target monitoring device is located within the target geographical area. For example, consider V... n-1 The slope of the line containing A (let's assume it's k0) is related to V. n-1 V n-2The slope of the line (let's assume it's k1), V n-1 V n Compare the slopes of the lines containing points A and V (let's say k2). If k0 is greater than both k1 and k2, or if k0 is smaller than both k1 and k2, then point A can be determined to be on line V. n-2 V n-1 With V n-1 V n Outside the sector formed, if k0 is between k1 and k2, then point A can be determined to be in V. n-2 V n-1 With V n-1 V n Within the sector formed by these points, and so on, using the same method, we can determine whether point A is within V1V. n Within the sector formed by V1 and V2; in this embodiment, if the above set of reference vertices includes multiple vertices, the slope of each vertex can be compared using the same method as above. In practical applications, a counting method can also be used when comparing the slope of the lines. For example, with f as the count value (initial value is 0), if k0 is greater than k1, f can be incremented by 1. If k0 is also greater than k2, f can be incremented by 1 again. If k0 is less than k1 or k2, f remains unchanged. The same method is used to traverse the above set of reference vertices and then determine the count value of f. If f is odd, it can be determined that point A is inside the above target polygon, that is, the target monitoring device is in the target geographical area. If f is even, it can be determined that point A is outside the above target polygon, that is, the target monitoring device is outside the target geographical area. In this embodiment, by comparing the slope of the straight line formed by the target point and each vertex of a set of reference vertices with the slope formed by that vertex and its adjacent vertices, it can be determined whether point A is located within the target polygon. In practical applications, if only one of the two adjacent vertices of a vertex in a set of reference vertices is located on the other side of the reference straight line, then only the slope of the straight line containing that vertex and its adjacent vertex on the other side is determined, i.e., only the slope of one straight line is calculated (such as k1 or k2 mentioned above). Then, the slope comparison results are statistically analyzed in the same way to determine whether the target point is located within the target polygon. Through this embodiment, it is only necessary to compare with a portion of the vertices to the left of the reference straight line and some adjacent vertices to determine whether the monitoring device is located within the target geographical area, avoiding the problem of low efficiency in determining the location of the monitoring device due to the need to traverse all vertices and edges of the polygon in related technologies.
[0039] In an optional embodiment, determining whether the target monitoring device is located within the target geographical area based on the first set of slopes and the second set of slopes includes: determining slopes in the second set of slopes that satisfy a preset condition, wherein satisfying the preset condition means that one slope in the second set of slopes is less than the corresponding slope in the first set of slopes, and the corresponding slope and the slope are the slopes of the straight lines formed by the same vertex in the set of reference vertices and the target point and one vertex in the set of adjacent vertices, respectively; determining whether the target monitoring device is located within the target geographical area based on the number of slopes that satisfy the preset condition. In this embodiment, using Figure 3 Taking point A in the equation as an example, the first set of slopes includes the slope of the line containing V1A and V... n-1 The slope of the line containing A, the second set of slopes includes V. n-1 V n-2 V n-1 V n The slope of the line containing V1V n The slope of the line containing V1V2, because the slope of the line containing V1A is greater than that of V1V. n The slope of the line containing V1V2, therefore, V1V n The slope of the line containing V1V2 is the slope that satisfies the above preset conditions. Similarly, because V n-1 The slope of the line containing A is greater than V. n-1 V n The slope of the line containing V, therefore, V n-1 V n The slope of the line containing this line also satisfies the aforementioned preset conditions. Therefore, Figure 3 The number of slopes that satisfy the preset conditions corresponding to point A is three. Based on the number of slopes satisfying the preset conditions, it is determined whether the target monitoring device is located within the target geographical area. For example, when the number of slopes satisfying the preset conditions is odd, it can be determined that the target monitoring device is located within the target geographical area; when the number of slopes satisfying the preset conditions is even, it can be determined that the target monitoring device is located outside the target geographical area. Through this embodiment, the purpose of determining whether a target point is located within the target polygon is achieved by determining the number of slopes satisfying the preset conditions in the second set of slopes.
[0040] In an optional embodiment, determining whether the target monitoring device is located within the target geographical area based on the number of slopes satisfying the preset conditions includes: determining that the target monitoring device is located within the target geographical area when the number of slopes satisfying the preset conditions is odd; and determining that the target monitoring device is located outside the target geographical area when the number of slopes satisfying the preset conditions is even. In this embodiment, when the number of slopes satisfying the preset conditions is odd, it can be determined that the target point is located inside the target polygon, thus determining that the target monitoring device is located within the target geographical area. Figure 3 Point A in the target polygon has an odd number of slopes satisfying the preset conditions; when the number of slopes satisfying the preset conditions is even, it can be determined that the target point is located outside the target polygon, thus confirming that the target monitoring device is located outside the target geographical area. Figure 4 Point B in V n-1 The ratio of the slope of the line containing point B to V n-1 V n-2 The slope of the line, V n-1 V n The slopes of the lines containing points V1 and B are all small, while the slope of the line containing point B is greater than that of line V1V. n The slopes of the lines containing points B and V1V2 are both large. Therefore, for point B, the number of slopes satisfying the preset conditions is 2 (an even number), which determines that point B is located outside the target polygon. This embodiment allows us to determine whether a target monitoring device is located within a target geographical area based on the number of slopes satisfying the preset conditions.
[0041] In practice, since the latitude and longitude information of video surveillance points is mostly maintained manually, some offset is inevitable. A small offset should not be considered as outside the designated area. However, most current methods for detecting inside and outside the designated area rely on simple, absolute judgment. Therefore, in real-world scenarios, how to perform area detection with a certain relaxation mechanism based on imprecise location information (latitude and longitude) is a problem that urgently needs to be solved. This invention provides a method for determining the location of surveillance equipment with a certain relaxation mechanism. The optional embodiments of this invention are described below.
[0042] In an optional embodiment, after determining whether the target monitoring device is located within the target geographical area, the method further includes: if the target monitoring device is determined to be outside the target geographical area, determining whether the target monitoring device is located within a target preset range of the boundary of the target geographical area; if the target monitoring device is determined to be located within the target preset range of the boundary of the target geographical area, determining that the target monitoring device is located within the target geographical area. This embodiment provides a method for determining the location of a monitoring device with a certain relaxed discrimination mechanism. When it is determined that the target monitoring device is outside the target geographical area according to the method of the aforementioned embodiment, it is further determined whether the target monitoring device is located within a target preset range of the boundary of the target geographical area. For example, the target preset range is 100m (or 200m, or other distances). When it is determined that the target monitoring device is located within the target preset range of the boundary of the target geographical area, the target monitoring device can be re-determined to be located within the target geographical area. This avoids the problem of low error tolerance caused by the simple and crude absolute determination method used in related technologies. Through this embodiment, the accuracy of determining the location of the target monitoring device can be improved.
[0043] In an optional embodiment, determining whether the target monitoring device is located within a predetermined target range of the boundary of the target geographical area includes: determining the target distance between the target point and each side of the target polygon to obtain a set of target distances; and determining whether the target monitoring device is located within the predetermined target range based on the set of target distances. In this embodiment, a set of target distances can be obtained by determining the target distance between the target point and each side of the target polygon, and then the determination of whether the target monitoring device is located within the predetermined target range can be made based on this set of target distances. For example, when one or more target distances in the set are determined to be less than a predetermined distance threshold (such as 100m or 200m or other distances), the target monitoring device can be determined to be within the predetermined target range; conversely, when each target distance in the set is determined to be greater than the predetermined distance threshold (such as 100m or 200m or other distances), the target monitoring device can be determined to be outside the predetermined target range. Compared to methods used in related technologies, this embodiment achieves a certain degree of fault tolerance, is suitable for more complex coverage scenarios and scenarios requiring less traversal, improves the efficiency of determining the location of monitoring devices, and also improves the accuracy of location determination.
[0044] In an optional embodiment, determining the target distance between the target point and each edge of the target polygon includes: determining a reference point on each edge of the target polygon that is closest to the target point; and determining the distance between the target point and the reference point on each edge as the target distance between the target point and each edge. In this embodiment, the distance between the target point and the reference point can be determined as the target distance by determining the reference point on each edge of the target polygon that is closest to the target point. Figure 5 As shown, assume point C is the target point (corresponding to the location of the aforementioned target monitoring device). Figure 5 (a), (b), and (c) correspond to three different scenarios, such as the target point being on the left, middle, and right side of the line segment. Figure 5 In (a), the reference point is A. Figure 5 The reference point in (b) is D, and Figure 5 The reference point in (c) is B. This embodiment achieves the goal of determining the shortest distance from the target point to each side of the target polygon for different situations.
[0045] In an optional embodiment, determining whether the target monitoring device is within the target preset range based on the set of target distances includes: determining that the target monitoring device is within the target preset range if at least one target distance in the set of target distances is less than or equal to a predetermined distance threshold; and determining that the target monitoring device is outside the target preset range if all target distances in the set are greater than the predetermined distance threshold. In this embodiment, when it is determined that one or more target distances in a set of target distances are less than the predetermined distance threshold (e.g., 100m, 200m, or other distances), the target monitoring device can be determined to be within the target preset range. Conversely, when it is determined that each target distance in a set of target distances is greater than the predetermined distance threshold (e.g., 100m, 200m, or other distances), the target monitoring device can be determined to be outside the target preset range. Compared to methods used in related technologies, this embodiment achieves a certain degree of fault tolerance, is suitable for more complex coverage scenarios and scenarios requiring less traversal, improves the efficiency of determining the location of monitoring devices, and also improves the accuracy of location determination.
[0046] Obviously, the embodiments described above are only some embodiments of the present invention, and not all embodiments. The present invention will be specifically described below with reference to the embodiments.
[0047] Figure 6 This is an overall flowchart of the in-region and out-of-region detection method according to a specific embodiment of the present invention. The process includes steps 1 to 4, as follows:
[0048] Step 1: Obtain administrative division location information:
[0049] Get an array consisting of the boundary data (latitude and longitude) of the target area.
[0050] Step 2: Obtain the latitude and longitude of the smart video surveillance points:
[0051] Typically, the latitude and longitude location information for each video surveillance point is maintained by the operator, the local unit, and the equipment maintenance personnel, enabling rapid location of the geographical coordinates of each video surveillance device. This information is then uniformly uploaded to the resource library of the data warehouse of the higher-level management department. The corresponding latitude and longitude data (corresponding to the location information of the aforementioned target monitoring device) can be obtained by using the device's national standard code or device name, and this data serves as one of the inputs in step 3.
[0052] It should be noted that there is no specific order between steps 1 and 2 above. Step 2 can be executed first, followed by step 1, or steps 1 and 2 can be executed simultaneously.
[0053] Step 3: In-region and out-of-region detection:
[0054] The boundary of a polygonal region (corresponding to the aforementioned target geographic region) is represented by a series of ordered latitude and longitude coordinates. By sequentially connecting the latitude and longitude points of the region's boundary, the boundary of the region (such as a city) can be reconstructed. Two latitude and longitude points form a line segment, and the boundary is composed of multiple such line segments. Figure 3 As shown, the endpoints of the polygon are V1, V2...V n-2 V n-1 V n A polygon is composed of line segments formed by two adjacent endpoints, which together form the edges of a polygon, such as V1V2...Vn-1Vn, VnV1. A polygon possesses the following characteristics: (1) all vertices are distinct; (2) each vertex belongs only to the edge it occupies; (3) it is composed only of non-intersecting line segments. For example... Figure 3 As shown, the polygons are sorted counterclockwise, and their coordinates are indicated as: V1(X1, Y1), V2(X2, Y2), ..., V n (X n Y n Let A(X, Y) be the point to be determined as inside or outside the x-axis. Draw a line through A perpendicular to the x-axis, intersecting the x-axis at X. a The polygon is defined by S and T; the next step is to determine whether a point is inside or outside the polygon area, which includes:
[0055] 1) Traverse each vertex V of the polygon i Determine whether point A coincides with any endpoint. If it does, then directly determine that the point is within the polygonal region.
[0056] 2) First, define a flag value f (corresponding to the slope that satisfies the preset condition), with an initial value of 0. Traverse each vertex V of the polygon i , and determine whether V i is on the left side of the dashed line ST, and its adjacent endpoint V i-1 or V i+1 is on the right side of ST. Specifically, when i = 1, V i-1 = V n , and when i = n, V i+1 = V1. Determine whether the line segment (V i , V i+1 ) or (V i-1 , V i ) satisfies the following two conditions:
[0057] ① Condition 1: When X i < X and at the same time X i+1 > X, determine whether the relationship (V i , V i+1 ) satisfies (Y - V i(Y) )(V i+1(X) - V i(X) ) - (V i+1(Y) - V i(Y) )(X - V i(X) ) > 0. If it is satisfied, then f = f + 1;
[0058] ② Condition 2: When X i < X and at the same time X i-1 > X, determine whether the relationship Vi, Vi - 1) satisfies (Y - V i(Y) )(V i-1(X) - V i(X) ) - (V i-1(Y) - V i(Y) )(X - V i(X) ) > 0. If it is satisfied, then f = f + 1.
[0059] 3) After traversing all the endpoints (corresponding to the aforementioned set of reference vertices), determine the parity of f. If it is odd, then point A is inside the polygon region; otherwise, it is outside the polygon region.
[0060] Combined with Figure 7 to explain the process of the above inside / outside region detection method, Figure 7 is the flowchart of the inside / outside region detection method according to a specific embodiment of the present invention. This process includes:
[0061] S702, determine whether there are still vertices (corresponding to the aforementioned set of reference vertices) that have not been discriminated, that is, determine whether all the vertices included in a set of reference vertices have been discriminated;
[0062] S704, if the judgment result of S702 is yes, further determine whether condition 1 is satisfied (corresponding to the above condition one or condition two);
[0063] S706, if the judgment result of S704 is yes, f = f + 1, that is, f is incremented by 1; then proceed to step S708, or if the judgment result of S704 is no, directly proceed to step S708;
[0064] S708, further determine whether condition 2 is satisfied (corresponding to condition 2 or condition 1 above);
[0065] S710, if the judgment result of S708 is yes, f = f + 1, that is, f is incremented by 1; then proceed to step S712, or if the judgment result of S708 is no, directly proceed to step S712;
[0066] S712, test the next vertex;
[0067] A set of reference vertices may include multiple vertices, i.e. Figure 3 There may be multiple vertices to the left of the reference line. After the current vertex is identified, the next vertex is tested until all vertices in a set of reference vertices have been identified.
[0068] If the judgment result of step S702 is negative, that is, after all vertices have been judged, proceed to step S714.
[0069] S714, determine whether f is an odd number;
[0070] S716, if the judgment result of S714 is yes, determine that the target point (or the point to be detected, or the location of the monitoring device to be determined) is within the polygonal area;
[0071] S718, if the judgment result of S714 is yes, determine that the target point is outside the polygon area;
[0072] S720, end.
[0073] Step 4: Surrounding Area Detection:
[0074] For points not within the area identified in step 3, further determination is made as to whether they fall within the specified boundary range (corresponding to the aforementioned target preset range). The range is a configurable threshold (corresponding to the aforementioned predetermined distance threshold). For example, let C(X,Y) represent a video surveillance point (similar to point A in step 3), A'(X1,Y1) represent the starting point of the line segment, and B'(X2,Y2) represent the ending point of the line segment. The distance from a point to a line segment can be categorized into the following three main types:
[0075] ① When (X2-X1)×(X-X1)+(Y2-Y1)×(Y-Y1)<0, ∠A' is an obtuse angle, C is to the left of line segment A'B', and the shortest distance is A'C, as shown below. Figure 5 (a);
[0076] ② When (X2-X1)×(X-X1)+(Y2-Y1)×(Y-Y1)>(X2-X1)×(X2-X1)+(Y2-Y1×(Y2-Y1), ∠B' is an obtuse angle, and the shortest distance is B'C, as shown below. Figure 5 (c);
[0077] ③ When neither ∠A' nor ∠B' is an obtuse angle, the shortest distance is the perpendicular distance from C to line segment A'B', such as... Figure 5 (b) Figure 5 (b) Point D is the intersection of the perpendicular line and the line segment. The x-coordinate of the intersection of the perpendicular line and the line segment is represented as (X*, Y*), where X*=X1+(X2-X1)×r, Y*=Y1+(Y2-Y1)×r, r=(X2-X1)×(X-X1)+(Y2-Y1)×(Y-Y1) / (X2-X1)×(X2-X1)+(Y2-Y1)×(Y2-Y1);
[0078] ④ Determine the radians of the angle between the point (X,Y) and the perpendicular point (X*,Y*) and the Earth's center, using the following formula:
[0079]
[0080] or
[0081]
[0082] Finally, the arc distance between two points on the Earth's surface is calculated using the following formula:
[0083] Distance = 6371000 × acos(radians 1) or 2 × 6371000 asin(radians 2), unit: meters
[0084] For cases ① and ② above, A'C and B'C can be calculated using the same method as in ④ above;
[0085] The distance is calculated and the corresponding point is labeled according to the condition threshold (corresponding to the aforementioned predetermined distance threshold). Points that are neither in the area nor in the surrounding area are determined to be points outside the area.
[0086] In the above embodiment, firstly, the positional relationship between the points and the polygon is strictly determined using the line-position method, which is applicable to arbitrarily complex polygons. Then, points outside the region are further judged by the shortest distance; if the shortest distance is less than a threshold, they are determined to be within the region; otherwise, they are outside the region. Compared to general methods, this approach has a certain degree of fault tolerance, can handle more complex coverage scenarios, and requires fewer traversals, resulting in higher efficiency.
[0087] This invention integrates the linear positioning method and the shortest distance method from a point to a line segment to determine whether a point belongs to a specified area. It considers the inaccuracies in manually maintained latitude and longitude coordinates in real-world scenarios, and the method exhibits some relaxation in its discrimination for certain latitude and longitude offsets. It performs well on polygonal regions in complex scenes, and the surrounding threshold is configurable, making it suitable for determining the inside and outside of target areas of various sizes.
[0088] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they 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 invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0089] This embodiment also provides a device for determining the location of a monitoring device. Figure 8 This is a structural block diagram of a location determination device for a monitoring device according to an embodiment of the present invention, such as... Figure 8 As shown, the device includes:
[0090] The acquisition module 802 is used to acquire the location information of the target monitoring device and the boundary location information of the target geographical area, and to determine the target point and the target polygon in the target coordinate system, wherein the target point represents the geographical location indicated by the location information of the target monitoring device, and the target polygon represents the boundary of the target geographical area indicated by the boundary location information;
[0091] The first determining module 804 is used to determine a set of reference vertices among the vertices of the target polygon, wherein the set of reference vertices are some of the vertices in the target polygon, and the set of reference vertices are all located on one side of a reference line passing through the target point in the target coordinate system, and at least one adjacent vertex of each vertex in the set of vertices is located on the other side of the reference line.
[0092] The second determining module 806 is used to determine whether the target monitoring device is located within the target geographical area based on the positional relationship between the target point and the set of reference vertices and the set of adjacent vertices, wherein the set of adjacent vertices is the vertex located on the other side among the adjacent vertices of each vertex in the set of reference vertices.
[0093] In an optional embodiment, the second determining module 806 includes: a first determining submodule, configured to determine a first set of slopes based on the target point and the set of reference vertices, wherein the first set of slopes is the slope of the straight line formed by the target point and each vertex in the set of reference vertices; a second determining submodule, configured to determine a second set of slopes based on the set of reference vertices and the set of adjacent vertices, wherein the second set of slopes is the slope of the straight line formed by each vertex in the set of reference vertices and each adjacent vertex in the set of adjacent vertices; and a third determining submodule, configured to determine whether the target monitoring device is located within the target geographical area based on the first set of slopes and the second set of slopes.
[0094] In an optional embodiment, the third determining submodule includes: a first determining unit, configured to determine, based on the first set of slopes and the second set of slopes, a slope that satisfies a preset condition in the second set of slopes, wherein satisfying the preset condition means that one slope in the second set of slopes is less than the corresponding slope in the first set of slopes, and the corresponding slope and the slope are the slopes of the straight lines formed by the same vertex in the set of reference vertices and one vertex in the target point and the set of adjacent vertices, respectively; and a second determining unit, configured to determine whether the target monitoring device is located within the target geographical area based on the number of slopes that satisfy the preset condition.
[0095] In an optional embodiment, the second determining unit includes: a first determining subunit, configured to determine that the target monitoring device is located within the target geographical area when the number of slopes satisfying the preset conditions is odd; and a second determining subunit, configured to determine that the target monitoring device is located outside the target geographical area when the number of slopes satisfying the preset conditions is even.
[0096] In an optional embodiment, the above apparatus further includes: a third determining module, configured to, after determining whether the target monitoring device is located within the target geographical area, determine whether the target monitoring device is located within a target preset range of the boundary of the target geographical area if the target monitoring device is located outside the target geographical area; and a fourth determining module, configured to, if the target monitoring device is determined to be located within the target geographical area if the target monitoring device is located within the target preset range of the boundary of the target geographical area.
[0097] In an optional embodiment, the third determining module includes: a fourth determining submodule, used to determine the target distance between the target point and each side of the target polygon, to obtain a set of target distances; and a fifth determining submodule, used to determine whether the target monitoring device is located within the target preset range based on the set of target distances.
[0098] In an optional embodiment, the fourth determining submodule includes: a third determining unit, configured to determine a reference point on each edge of the target polygon that is closest to the target point; and a fourth determining unit, configured to determine the distance between the target point and the reference point on each edge as the target distance between the target point and each edge.
[0099] In an optional embodiment, the fifth determining submodule includes: a fifth determining unit, configured to determine that the target monitoring device is located within the target preset range when at least one target distance in the set of target distances is less than or equal to a predetermined distance threshold; and a sixth determining unit, configured to determine that the target monitoring device is located outside the target preset range when all of the set of target distances are greater than the predetermined distance threshold.
[0100] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0101] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
[0102] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0103] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0104] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0105] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0106] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0107] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for determining the location of a monitoring device, characterized in that, include: The location information of the target monitoring device and the boundary location information of the target geographical area are obtained, and the target point and the target polygon are determined in the target coordinate system. The target point represents the geographical location indicated by the location information of the target monitoring device, and the target polygon represents the boundary of the target geographical area indicated by the boundary location information. A set of reference vertices is determined from the vertices of the target polygon, wherein the set of reference vertices is a portion of the vertices in the target polygon, and the set of reference vertices are all located on one side of a reference line passing through the target point in the target coordinate system, and at least one adjacent vertex of each vertex in the set of reference vertices is located on the other side of the reference line. Based on the positional relationship between the target point and the set of reference vertices and the set of adjacent vertices, it is determined whether the target monitoring device is located within the target geographical area, wherein the set of adjacent vertices is the vertex located on the other side among the adjacent vertices of each vertex in the set of reference vertices; Determining whether the target monitoring device is located within the target geographical area based on the positional relationship between the target point and the set of reference vertices and the set of adjacent vertices includes: Based on the first set of slopes and the second set of slopes, a slope satisfying a preset condition is determined from the second set of slopes. The first set of slopes are the slopes of the straight lines formed by the target point and each vertex in the set of reference vertices. The second set of slopes are the slopes of the straight lines formed by each vertex in the set of reference vertices and each adjacent vertex in the set of adjacent vertices. Satisfying the preset condition means that one slope in the second set of slopes is less than the corresponding slope in the first set of slopes. The corresponding slope and the slope are the slopes of the straight lines formed by the same vertex in the set of reference vertices and the target point and one vertex in the set of adjacent vertices, respectively. Based on the number of slopes that meet the preset conditions, it is determined whether the target monitoring device is located within the target geographical area.
2. The method according to claim 1, characterized in that, The step of determining whether the target monitoring device is located within the target geographical area based on the positional relationship between the target point and the set of reference vertices and the set of adjacent vertices further includes: The first set of slopes is determined based on the target point and the set of reference vertices; The second set of slopes is determined based on the set of reference vertices and the set of adjacent vertices.
3. The method according to claim 1, characterized in that, Determining whether the target monitoring device is located within the target geographical area based on the number of slopes that meet the preset conditions includes: If the slope of the vertex that satisfies the preset condition is odd, it is determined that the target monitoring device is located within the target geographical area; If the slope of the vertex that satisfies the preset condition is even, it is determined that the target monitoring device is located outside the target geographical area.
4. The method according to any one of claims 1 to 3, characterized in that, After determining whether the target monitoring device is located within the target geographical area, the method further includes: If it is determined that the target monitoring device is located outside the target geographical area, determine whether the target monitoring device is located within a target preset range of the boundary of the target geographical area; If it is determined that the target monitoring device is located within the target preset range of the boundary of the target geographical area, the target monitoring device is determined to be located within the target geographical area.
5. The method according to claim 4, characterized in that, Determining whether the target monitoring device is located within a preset target range of the boundary of the target geographical area includes: Determine the target distance between the target point and each edge of the target polygon to obtain a set of target distances; Based on the set of target distances, determine whether the target monitoring device is located within the target preset range.
6. The method according to claim 5, characterized in that, Determining the target distance between the target point and each edge of the target polygon includes: Determine the reference point on each edge of the target polygon that is closest to the target point; The distance between the target point and the reference point on each edge is determined as the target distance between the target point and each edge.
7. The method according to claim 5, characterized in that, The step of determining whether the target monitoring device is within the preset range of the target based on the set of target distances includes: If at least one of the target distances in the set of target distances is less than or equal to a predetermined distance threshold, it is determined that the target monitoring device is located within the preset range of the target. If the distances to all of the targets are greater than the predetermined distance threshold, it is determined that the target monitoring device is located outside the target preset range.
8. A location determination device for monitoring equipment, characterized in that, include: The acquisition module is used to acquire the location information of the target monitoring device and the boundary location information of the target geographical area, and to determine the target point and the target polygon in the target coordinate system, wherein the target point represents the geographical location indicated by the location information of the target monitoring device, and the target polygon represents the boundary of the target geographical area indicated by the boundary location information; The first determining module is used to determine a set of reference vertices among the vertices of the target polygon, wherein the set of reference vertices are some of the vertices in the target polygon, and the set of reference vertices are all located on one side of a reference line passing through the target point in the target coordinate system, and at least one adjacent vertex of each vertex in the set of reference vertices is located on the other side of the reference line. The second determining module is used to determine whether the target monitoring device is located within the target geographical area based on the positional relationship between the target point and the set of reference vertices and the set of adjacent vertices, wherein the set of adjacent vertices is the vertex located on the other side among the adjacent vertices of each vertex in the set of reference vertices; The device is further configured to determine, based on a first set of slopes and a second set of slopes, a slope that satisfies a preset condition within the second set of slopes. The first set of slopes represents the slopes of the straight lines formed by the target point and each vertex in the set of reference vertices. The second set of slopes represents the slopes of the straight lines formed by each vertex in the set of reference vertices and each adjacent vertex in the set of adjacent vertices. Satisfying the preset condition indicates that one slope in the second set of slopes is less than the corresponding slope in the first set of slopes. The corresponding slope and the slope represent the slopes of the straight lines formed by the same vertex in the set of reference vertices and the target point and one vertex in the set of adjacent vertices, respectively. Based on the number of slopes that satisfy the preset condition, the device determines whether the target monitoring device is located within the target geographical area.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 7.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for positioning irregular safe area of wearable device
CN114858157A