CN110727755B - Terrain shape regularization method, electronic device and storage medium - Google Patents

Terrain shape regularization method, electronic device and storage medium Download PDF

Info

Publication number
CN110727755B
CN110727755B CN201910974807.8A CN201910974807A CN110727755B CN 110727755 B CN110727755 B CN 110727755B CN 201910974807 A CN201910974807 A CN 201910974807A CN 110727755 B CN110727755 B CN 110727755B
Authority
CN
China
Prior art keywords
edge
polygon
preset
adjacent
inclination angle
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910974807.8A
Other languages
Chinese (zh)
Other versions
CN110727755A (en
Inventor
王有年
李小凯
邓凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Handarui Technology Co ltd
Original Assignee
Wuhan Handarui Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Handarui Technology Co ltd filed Critical Wuhan Handarui Technology Co ltd
Priority to CN201910974807.8A priority Critical patent/CN110727755B/en
Publication of CN110727755A publication Critical patent/CN110727755A/en
Application granted granted Critical
Publication of CN110727755B publication Critical patent/CN110727755B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/29Geographical information databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Remote Sensing (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a terrain shape regularization method, an electronic device and a storage medium, wherein the method comprises the following steps: calculating the inclination angle of each side of a preset polygon, and determining the main direction of the preset polygon according to the inclination angle and the length of each side of the preset polygon; after the preset polygon is rotated to the main direction, recalculating the inclination angle of each side of the preset polygon, and respectively defining the inclination intervals in the horizontal direction and the vertical direction; sequentially traversing each edge of the preset polygon, and obtaining an edge set in the same direction according to the inclined interval of two adjacent edges of the preset polygon and the included angle formed by the two adjacent edges; and calculating the center point of the edge set in the same direction, and squaring the polygon according to the center point of the edge set. The method solves the problems of large calculated amount and complex process of the existing polygon squaring method, simplifies the calculation process and effectively reduces the calculated amount.

Description

Terrain shape regularization method, electronic device and storage medium
Technical Field
The present invention relates to the field of geographic data processing, and in particular, to a method for regularizing a terrain shape, an electronic device, and a storage medium.
Background
In the process of drawing the shape of the ground feature according to the remote sensing image, because the object or the object after picture processing is possibly deformed during shooting or the specific ground feature needs to be subjected to contour processing, the right-angled shape can be involved, and the regular expression of the shape of the specific ground feature can be conveniently drawn and is beneficial to the contradiction between the map and the actual shape.
At present, the existing polygon squaring method comprises a polygon squaring method based on a limit coordinate value and a squaring method based on a least square method, the two methods can better square a polygon, but because matrix operation is frequently involved and minimum displacement of an inflection point is required to be obtained, the calculated amount is large, the process is complex, and the actual application effect is general.
Disclosure of Invention
In view of this, embodiments of the present invention provide a terrain regularization method, an electronic device, and a storage medium, so as to solve the problem of a large calculation amount in the conventional squaring method.
In a first aspect of embodiments of the present invention, there is provided a terrain regularization method, including:
calculating the inclination angle of each side of a preset polygon, and determining the main direction of the preset polygon according to the inclination angle and the length of each side of the preset polygon;
after the preset polygon is rotated to the main direction, recalculating the inclination angle of each side of the preset polygon, and respectively defining the inclination intervals in the horizontal direction and the vertical direction;
sequentially traversing each edge of the preset polygon, and obtaining an edge set in the same direction according to the inclined interval of two adjacent edges of the preset polygon and the included angle formed by the two adjacent edges;
and calculating the center point of the edge set in the same direction, and squaring the polygon according to the center point of the edge set.
In a second aspect of embodiments of the present invention, there is provided an electronic device, including:
the direction determining module is used for calculating the inclination angle of each side of a preset polygon and determining the main direction of the preset polygon according to the inclination angle and the length of each side of the preset polygon;
the defining module is used for recalculating the inclination angle of each edge of the preset polygon after the preset polygon is rotated to the main direction, and respectively defining the inclination intervals in the horizontal direction and the vertical direction;
the traversing module is used for sequentially traversing each edge of the preset polygon and obtaining an edge set in the same direction according to the inclined interval of two adjacent edges of the preset polygon and the included angle formed by the two adjacent edges;
and the squaring module is used for calculating the center point of the same-direction edge set and squaring the polygon according to the edge set center point.
In a third aspect of the embodiments of the present invention, there is provided an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, where the processor executes the computer program to implement the steps of the method according to the first aspect of the embodiments of the present invention.
In a fourth aspect of the embodiments of the present invention, a computer-readable storage medium is provided, which stores a computer program, which when executed by a processor implements the steps of the method provided by the first aspect of the embodiments of the present invention.
In the embodiment of the invention, the inclination angle of each side of a preset polygon is calculated, the main direction of the polygon is determined according to the inclination angle and the length of the side, after the polygon is rotated to the main direction, the inclination intervals in the horizontal direction and the vertical direction are defined, each side is traversed, the homodromous side set is obtained according to the inclination interval and the included angle of the adjacent side, the central point of the homodromous side set is obtained, and the squaring of the polygon is carried out based on the central point. Therefore, the problems of large calculation amount and complex process of the existing polygon squaring are effectively solved, the squaring process is simplified, the calculation amount is reduced, the squaring efficiency can be effectively improved, and the regular expression of the shape of the ground object is realized.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings described below are only some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for regularizing a feature shape according to an embodiment of the present invention;
fig. 2 is another schematic flow chart of a method for regularizing a feature shape according to an embodiment of the present invention;
fig. 3 is another schematic flow chart of a method for regularizing a feature shape according to an embodiment of the present invention;
fig. 4 is another schematic flow chart of a method for regularizing a feature shape according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a ground object shape regularization electronic device according to an embodiment of the present invention;
fig. 6 is another schematic structural diagram of an electronic device according to an embodiment of the invention.
Detailed Description
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the embodiments described below are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "comprises" and "comprising," when used in this specification and claims, and in the accompanying drawings and figures, are intended to cover non-exclusive inclusions, such that a process, method or system, or apparatus that comprises a list of steps or elements is not limited to the listed steps or elements. In addition, "first" and "second" are used to distinguish different objects, and are not used to describe a specific order.
The first embodiment is as follows:
referring to fig. 1, a flow chart of a method for regularizing a terrain according to an embodiment of the present invention includes:
s101, calculating an inclination angle of each side of a preset polygon, and determining a main direction of the preset polygon according to the inclination angle and the length of each side of the preset polygon;
the predetermined polygon is an external contour corresponding to a ground feature, and is generally a shape of a ground building obtained based on a remote sensing technology, and may also be a shape of a ground feature extracted from a map vector file. The polygon is a building with a regular shape, and collected building shape deviation can be corrected by squaring a preset polygon.
And establishing a two-dimensional coordinate system in a plane where the preset polygon is located, calculating the inclination angle of each side of the polygon, and acquiring the side length of each side. The main direction of the polygon can be calculated based on the inclination angle and the side length of the side, and the main direction refers to the shape trend of the polygon and is often determined according to the characteristics of the side.
Specifically, defining an inclination angle division interval of the edges, dividing the interval according to the inclination angle and the inclination angle of each edge, and adding each edge to the corresponding inclination angle division interval; establishing a direction histogram among the partitions with different inclination angles, wherein the abscissa of the direction histogram is the inclination angle, and the ordinate is the sum of the lengths of the inner edges among the partitions with the inclination angle; and after the direction histogram is subjected to Gaussian smoothing processing, taking the inclination angle corresponding to the point with the maximum sum of the side lengths as the main direction.
Illustratively, the inclination angles of the sides of the polygon are distributed in the interval of (0 ° -180 °), and the inclination angles are divided into 90 intervals, each interval being 2 °. Putting each side of the polygon into the respective interval, establishing a direction histogram of the side, wherein the abscissa of the histogram is an inclination angle (or called inclination angle), such as [0 °, 2 ° ], [2 °, 4 ° ], [4 °, 6 ° ], the ordinate is the sum of the lengths of the inner sides of the interval, such as two sides in the interval [100 °, 102 ° ], and the sum of the lengths of the two sides is 12. And performing Gaussian smoothing processing on the histogram to obtain a smooth curve in a plane coordinate system, acquiring an inclination angle corresponding to the maximum position of the ordinate value in the smooth curve, and taking the inclination angle as a main direction.
The calculation based on the main direction of the polygon can ensure that the calculation of the center points of the edge set and the edge set is accurate, and further ensure the accuracy and reliability of the squaring.
S102, after the preset polygon is rotated to the main direction, recalculating the inclination angle of each side of the preset polygon, and respectively defining the inclination intervals in the horizontal direction and the vertical direction;
the polygon is rotated to the main direction, so that calculation is convenient, and the sides in the vertical direction in the horizontal direction can be distinguished conveniently. Under the current main direction, the inclination angle of each edge needs to be recalculated, and the inclination intervals in the horizontal direction and the vertical direction are defined.
Specifically, the horizontal tilt interval is (0, 45 °) U (135 °, 180 °), and the vertical tilt interval is (45 °, 135 °).
When the polygon edge belongs to the interval of (135 degrees and 180 degrees), the polygon edge belongs to the horizontal direction, the horizontal direction edge belongs to the same direction, or the same direction edge,
s103, traversing each side of the preset polygon in sequence, and obtaining a set of sides in the same direction according to the inclined interval of two adjacent sides of the preset polygon and the included angle formed by the two adjacent sides;
and selecting any one edge of the preset polygon to start traversing, taking the edge as an initial edge, sequentially traversing adjacent edges in a clockwise or anticlockwise direction according to a determined direction, adding the adjacent edges into an edge set when the detection and judgment of the adjacent edges are finished, and continuously traversing by taking the adjacent edges as the initial edges.
Illustratively, will l1As an initial edge, get l1Adjacent edge l of2The included angle between the two and the belonged inclined interval is determined1And l2Whether the inclined intervals are the same or not and whether the included angle is larger than a preset value or not. Correspondingly, will l2Put in l1Set the same direction edge, or2Put a new set of edges and put l2As an initial edge, a judgment sum l is detected3The relationship between them. Correspondingly, will l3Put in l2Set the same direction edge, or3A new set of edges is put in.
When any two adjacent edges belong to the same inclined interval and have an included angle larger than 90 degrees, the two edges can be regarded as the edges in the same direction, and if the two adjacent edges belong to different inclined intervals or have an included angle smaller than 90 degrees, the two adjacent edges are regarded as the edges in different directions.
And S104, calculating the center point of the same-direction edge set, and squaring the polygon according to the center point of the edge set.
The center point of the set of edges in the same direction may be determined according to the length of the edges in the set of edges, and the center of two adjacent sets of edges is generally obtained.
Specifically, the edges in the same direction are weighted according to the length of each edge in the set of edges in the same direction, and the position corresponding to the center point of the set of edges in the same direction is obtained through a weighted arithmetic mean method. And setting a weight according to the length of each edge in the edge set, and solving a central point by a weighted arithmetic mean method based on the sequence of the edges in the edge set.
Optionally, the intersection point of the straight lines is added to a predefined point set by passing through the straight lines made by the center points of the edge set, so as to generate a right-angled polygon according to the point set.
Optionally, a straight line is drawn through the center point of the edge set and the intersection point of adjacent edges, and the intersection point of the straight line is added to a predefined point set to generate a right-angled polygon according to the point set, where the adjacent edges are two edges belonging to different tilt intervals or a tilt angle included angle is less than 90 °.
And after a new polygon is generated according to the point set, rotating the polygon to the original direction.
The method provided by the embodiment can obtain a new multi-edge point set based on the homodromous edge set and the center point of the edge set, further obtain a right-angled polygon, is simple and quick in implementation process, and is more accurate in center point determination compared with the traditional direct edge center point, applicable to right-angled treatment of complex polygon shapes, and meanwhile effectively reduces the calculation amount.
Example two:
fig. 2 is another flow chart of the method for regularizing a terrain according to the third embodiment of the present invention, and details the obtaining of the sets of edges in the same direction on the basis of step S103 in fig. 1, including:
s103, detecting and judging the inclined interval of the initial edge and the adjacent edge and the included angle between the two inclined intervals;
for two adjacent edges, it is necessary to determine the tilt intervals to which the two edges belong, and calculate the included angle between the two edges, and the included angle between the two edges can be calculated based on the tilt angle.
Further, in S1031, if the adjacent edge and the initial edge belong to the same inclined interval and the included angle therebetween is greater than the predetermined value, the adjacent edge is added to the first homodromous edge set where the initial edge is located.
When the inclination angles of the adjacent edge and the initial edge are in the horizontal direction interval or the vertical direction interval, the inclination intervals of the adjacent edge and the initial edge are the same. Meanwhile, the included angle between the adjacent edge and the initial edge is smaller than a preset value, and the adjacent edge and the initial edge can be regarded as the same type of direction.
For two edges in the same direction, the same homodromous edge set, i.e. the first homodromous edge set
In S1032, if the adjacent edge and the initial edge belong to the same inclined interval and the included angle therebetween is smaller than the predetermined value, the adjacent edge is added to the second homodromous edge set.
When the inclination angles of the adjacent edge and the initial edge are in the horizontal direction interval or the vertical direction interval, the inclination intervals of the adjacent edge and the initial edge are the same. And if the included angle between the adjacent edge and the initial edge is smaller than the preset value, the different directions are considered, and the adjacent edge needs to be added to a new edge set, namely a second homodromous edge set.
In S1033, if the adjacent edge and the initial edge belong to different tilt intervals, the adjacent edge is added to the second set of equidirectional edges.
When the tilt angles of the adjacent edge and the initial edge are not in the same tilt interval, for example, the adjacent edge is in the horizontal direction interval, and the initial edge is in the vertical direction interval, the two edges are in different directions, and the adjacent edge needs to be added to a new edge set, that is, a second homodromous edge set.
Typically, the preset value is 90 °.
It should be noted that the initial edge is any edge, and when the detection and judgment of the edge adjacent to the initial edge is completed and added to the corresponding set, the adjacent edge can be used as the initial edge to detect the next adjacent edge in a predetermined order.
It is further noted that the first set of homodromous edges and the second set of homodromous edges are only used to distinguish between different sets of edges and do not represent a set order or priority. For the adjacent edge added to the second homodromous edge set, when detecting the next adjacent edge, if the edge does not satisfy the condition of adding the second homodromous edge set, a third homodromous edge set can be newly defined, and so on until all edges of the polygon are traversed.
EXAMPLE III
On the basis of fig. 2, another flow diagram of the method for regularizing the feature shape is provided in the embodiment of the present invention, and on the premise of step S1032, the method includes:
if the condition in S301 is satisfied, that is, two adjacent edges belong to the same inclination interval, but the included angle between the two edges is smaller than the preset value, indicating that the two edges do not belong to the same type of direction, the adjacent edges are placed into a new edge set, that is, a second homodromous edge set, and at the same time, the initial edge is already placed into the first homodromous edge set.
Wherein the preset value is generally 90 °, and the homogeneous direction refers to a horizontal direction or a vertical direction divided according to the definition of the tilt interval. And when the direction of the initial edge is the same as the direction of the initial edge, adding the adjacent edge into a first homodromous edge set where the initial edge is located, if the direction of the initial edge is different from the direction of the initial edge, adding a newly created second homodromous edge set, and setting the adjacent edge as the initial edge to continue judging.
In S302, the center points of the first homodromous edge set and the second homodromous edge set are calculated respectively, and are calculated by a weighted arithmetic mean method according to the lengths of the edges in the edge sets. Meanwhile, the intersection point of the initial edge and the adjacent edge needs to be obtained, and the intersection point of the initial edge and the adjacent edge can be regarded as the inflection point of the right angle of the polygon. Illustratively, the center points of the first and second sets of homodromous edges are named as a1 and a2, respectively, and the intersection point of the initial edge and the adjacent edge is named as c 1.
In S303, a straight line parallel to the preset direction is made through the first homodromous edge set center point and the second homodromous edge set center point, a straight line perpendicular to the preset direction is made through the intersection point of the initial edge and the adjacent edge, two intersection points can be obtained, and the two intersection points are placed into a predefined point set.
Wherein, the preset direction may be the same as the main direction, or may be perpendicular to the main direction, and is generally 0 ° or 90 °. Illustratively, the center point a1 of the first homodromous edge set and the center point a2 of the second homodromous edge set are parallel to each other by two straight lines l1 and l2 in the 0 ° direction, i.e., the main direction, and the straight lines l3, l1, l2 and l3 in the 90 ° direction perpendicular to the main direction are formed through the intersection point c1 of the initial edge and the adjacent edge
Intersecting the two points p1 and p2, put p1 and p2 into a predefined set of points.
When all edges of the predetermined polygon have been traversed, a new polygon may be generated based on the predefined set of points. Specifically, the predefined point set comprises a plurality of points (such as p1 and p2 … pn), and each point is used as a vertex of a polygon, and a right-angled polygon can be obtained after the points are sequentially connected.
Example four
On the basis of fig. 2, another schematic flow chart of the method for regularizing the feature shape according to the embodiment of the present invention is provided, and on the premise of step S1033, the method includes:
if the condition in S401 is satisfied, that is, two adjacent edges belong to different tilt intervals, that is, two edges do not belong to the same type of direction, the adjacent edges are placed in a new edge set, that is, a second homodromous edge set, and at the same time, the initial edge is already placed in the first homodromous edge set.
Wherein, the homogeneous direction refers to a horizontal direction or a vertical direction divided according to the definition of the tilt interval. And when the direction of the initial edge is the same as the direction of the initial edge, adding the adjacent edge into a first homodromous edge set where the initial edge is located, if the direction of the initial edge is different from the direction of the initial edge, adding a newly created second homodromous edge set, and setting the adjacent edge as the initial edge to continue judging.
In S402, there are several edges in the first homodromous edge set and the first homodromous edge set, generally, the edges in the same kind of direction, and the number of the edges in the edge set is at least 1. And respectively calculating the central points of the first homodromous edge set and the second homodromous edge set, and specifically calculating by a weighted arithmetic mean method according to the lengths of the edges in the edge sets. Illustratively, the center points of the first set of homodromous edges and the second set of homodromous edges are named as a1 and a2, respectively.
In S403, the first homodromous edge set center point is used to make a straight line parallel to the preset direction, and the second homodromous edge set center point is used to make a straight line perpendicular to the preset direction, so as to obtain an intersection point of the two straight lines, and the intersection point is placed into a predefined point set.
Wherein, the preset direction may be the same as the main direction, or may be perpendicular to the main direction, and is generally 0 ° or 90 °. Illustratively, the center point a1 of the first homodromous edge set is a straight line l1 parallel to the 0 ° direction, i.e. the main direction, and the center point a2 of the second homodromous edge set is a straight line l2 perpendicular to the main direction, i.e. the 90 ° direction, and l1 and l2 intersect at a point p, and the point p is placed in a predefined point set.
When all edges of the predetermined polygon have been traversed, a new polygon may be generated based on the predefined set of points. Specifically, a plurality of points are collected in a predefined point set, each point is used as a vertex of a polygon, and a right-angled polygon can be obtained after the points are connected in sequence.
It should be noted that the intersection points obtained from S303 and S403 can be put into the same predefined set of points. And obtaining the intersection point of straight lines passing through the center point of the edge set and/or the intersection point of lines on two sides according to the direction type and the included angle of the initial edge and the adjacent edge of the polygon, and sequentially adding the intersection points to a predefined point set.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Example five:
fig. 5 is a schematic structural diagram of an electronic device for ground shape regularization according to an embodiment of the present invention, where the electronic device includes:
a calculating module 510, configured to calculate an inclination angle of each edge of a predetermined polygon, and determine a main direction of the predetermined polygon according to the inclination angle and the length of each edge of the predetermined polygon;
optionally, the calculating module 510 includes:
the dividing unit divides the space by the inclination angle of the defined edge, divides the space according to the inclination angle and the inclination angle of each edge, and adds each edge to the corresponding inclination angle divided space;
the establishing unit is used for establishing a direction histogram between different inclination angle division areas, the abscissa of the direction histogram is an inclination angle, and the ordinate is the sum of the lengths of the inner edges between the inclination angle division areas;
and the acquisition unit is used for performing Gaussian smoothing processing on the direction histogram and then taking the inclination angle corresponding to the point with the maximum sum of the side lengths as the main direction.
A defining module 520, configured to recalculate the tilt angle of each edge of the predetermined polygon after the predetermined polygon is rotated to the main direction, and define tilt intervals in the horizontal direction and the vertical direction respectively;
optionally, the horizontal tilt interval is (0, 45 °) U (135 °, 180 °), and the vertical tilt interval is (45 °, 135 °).
A traversing module 530, configured to sequentially traverse each edge of the predetermined polygon, and obtain an edge set in the same direction according to an inclined interval to which two adjacent edges of the predetermined polygon belong and an included angle formed by the two adjacent edges;
optionally, the traversal module 530 includes:
the detection judgment unit is used for selecting any one edge of the preset polygon as an initial edge, adding the edge adjacent to the initial edge into a corresponding edge set after the detection judgment of the edge adjacent to the initial edge, and continuing the detection judgment of the edge adjacent to the initial edge as the initial edge;
if the initial edge and the edge adjacent to the initial edge both belong to the same inclined interval, and an included angle formed between the initial edge and the edge adjacent to the initial edge is larger than a preset value, adding the edge adjacent to the initial edge into a first homodromous edge set;
if the initial edge and the edge adjacent to the initial edge both belong to the same inclined interval, but the included angle formed between the initial edge and the edge is smaller than a preset value, adding the edge adjacent to the initial edge into a second homodromous edge set;
and if the initial edge and the edge adjacent to the initial edge do not belong to the same inclined interval, adding the edge adjacent to the initial edge into a second homodromous edge set.
Optionally, if the initial edge and the edge adjacent to the initial edge both belong to the same inclined interval, but an included angle formed between the initial edge and the edge adjacent to the initial edge is smaller than a predetermined value, adding the edge adjacent to the initial edge to a second homodromous edge set includes:
respectively calculating the central points of the first homodromous edge set and the second homodromous edge set, and acquiring the intersection point of the initial edge and the adjacent edge;
making two straight lines parallel to the preset direction through the central point of the first homodromous edge set and the central point of the second homodromous edge set, making a straight line perpendicular to the preset direction through the intersection point of the initial edge and the adjacent edge, and making the two straight lines parallel to the preset direction and the straight line perpendicular to the preset direction intersect at two points;
wherein the preset direction is 0 ° or 90 °.
Optionally, if the initial edge and the edge adjacent to the initial edge do not belong to the same inclined interval, adding the edge adjacent to the initial edge into a second homodromous edge set includes:
respectively calculating the center points of the first homodromous edge set and the second homodromous edge set, making a straight line parallel to the preset direction at the center point of the first homodromous edge set, making a straight line perpendicular to the preset direction at the center point of the second homodromous edge set, and intersecting the two straight lines at one point;
wherein the preset direction is 0 ° or 90 °.
And the squaring module 540 is configured to calculate a center point of the same-direction edge set, and squaring the polygon according to the edge set center point.
Optionally, the squaring module 540 includes:
and the calculation unit is used for weighting the edges in the same direction according to the length of each edge in the set of the edges in the same direction and obtaining the position corresponding to the center point of the set of the edges in the same direction by a weighted arithmetic mean method.
Optionally, the calculating the center point of the equidirectional edge set, and according to the edge set center point, squaring the polygon includes:
and adding the intersection point of the straight lines into a predefined point set by passing through the straight lines made by the center points of the edge set so as to generate a right-angled polygon according to the point set.
Through virtual module among the electronic equipment of this embodiment, can carry out the squarization to the polygon and handle, reduce the calculated amount of squarization process to can effectively promote squarization efficiency.
Example six:
fig. 6 is a schematic structural diagram of an electronic device for ground object shape regularization according to an embodiment of the present invention, where the electronic device is a device for providing computing services, including but not limited to a smartphone, a tablet computer, a notebook, and the like, and as shown in fig. 6, the electronic device 6 according to the embodiment includes: memory 610, processor 620, said memory 610 comprising executable program 6101 stored thereon, it being understood by those skilled in the art that the electronic device structure shown in fig. 6 does not constitute a limitation of an electronic terminal device or apparatus, may comprise more or less components than those shown, or may combine certain components, or a different arrangement of components.
The following describes each component of the electronic device in detail with reference to fig. 6:
the memory 610 may be used to store software programs and modules, and the processor 620 executes various functional applications and data processing of the electronic terminal device by operating the software programs and modules stored in the memory 610. The memory 610 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the electronic terminal device, and the like. Further, the memory 610 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
An executable program 6101 containing a method for project engineering initialization is stored in the memory 610, the executable program 6101 may be divided into one or more modules/units, the one or more modules/units are stored in the memory 610 and executed by the processor 620 to implement squaring of polygons, and the one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used for describing the execution process of the computer program 6101 in the electronic terminal device 6. For example, the computer program 6101 may be partitioned into a computation module, a definition module, a traversal module, and a squaring module.
The processor 620 is a control center of the electronic terminal device, connects various parts of the whole electronic terminal device by using various interfaces and lines, and performs various functions of the electronic terminal device and processes data by operating or executing software programs and/or modules stored in the memory 610 and calling data stored in the memory 610, thereby performing overall monitoring of the electronic terminal device. Optionally, processor 620 may include one or more processing units; preferably, the processor 620 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 620.
The electronic device may also include at least one sensor, such as light sensors, motion sensors, and other sensors, an input device, such as a touch screen, keyboard, and others, an output device, such as a speaker, display, and others. Other constituent elements are not described in detail herein.
In this embodiment of the present invention, the executable program executed by the processor 320 included in the electronic device is specifically:
calculating the inclination angle of each side of a preset polygon, and determining the main direction of the preset polygon according to the inclination angle and the length of each side of the preset polygon;
after the preset polygon is rotated to the main direction, recalculating the inclination angle of each side of the preset polygon, and respectively defining the inclination intervals in the horizontal direction and the vertical direction;
sequentially traversing each edge of the preset polygon, and obtaining an edge set in the same direction according to the inclined interval of two adjacent edges of the preset polygon and the included angle formed by the two adjacent edges;
and calculating the center point of the edge set in the same direction, and squaring the polygon according to the center point of the edge set.
Further, the determining the main direction of the predetermined polygon according to the inclination angle and the length of each side of the predetermined polygon includes:
defining an inclination angle division space of the edges, dividing the division space according to the inclination angle and the inclination angle of each edge, and adding each edge to the corresponding inclination angle division space;
establishing a direction histogram among the partitions with different inclination angles, wherein the abscissa of the direction histogram is the inclination angle, and the ordinate is the sum of the lengths of the inner edges among the partitions with the inclination angle;
and after the direction histogram is subjected to Gaussian smoothing processing, taking the inclination angle corresponding to the point with the maximum sum of the side lengths as the main direction.
Further, the horizontal direction inclination interval is (0, 45 °) U (135 °, 180 °), and the vertical direction inclination interval is (45 °, 135 °).
Further, the sequentially traversing each edge of the predetermined polygon, and obtaining an edge set in the same direction according to an inclined interval to which two adjacent edges of the predetermined polygon belong and an included angle formed by the two adjacent edges includes:
selecting any one edge of the preset polygon as an initial edge, adding the edge adjacent to the initial edge into a corresponding edge set after detecting and judging the edge adjacent to the initial edge, and continuously detecting and judging the edge adjacent to the initial edge as the initial edge;
if the initial edge and the edge adjacent to the initial edge both belong to the same inclined interval, and an included angle formed between the initial edge and the edge adjacent to the initial edge is larger than a preset value, adding the edge adjacent to the initial edge into a first homodromous edge set;
if the initial edge and the edge adjacent to the initial edge both belong to the same inclined interval, but the included angle formed between the initial edge and the edge is smaller than a preset value, adding the edge adjacent to the initial edge into a second homodromous edge set;
and if the initial edge and the edge adjacent to the initial edge do not belong to the same inclined interval, adding the edge adjacent to the initial edge into a second homodromous edge set.
Further, if the initial edge and the edge adjacent to the initial edge both belong to the same inclined interval, but an included angle formed between the initial edge and the edge adjacent to the initial edge is smaller than a predetermined value, adding the edge adjacent to the initial edge into a second homodromous edge set includes:
respectively calculating the central points of the first homodromous edge set and the second homodromous edge set, and acquiring the intersection point of the initial edge and the adjacent edge;
making two straight lines parallel to the preset direction through the central point of the first homodromous edge set and the central point of the second homodromous edge set, making a straight line perpendicular to the preset direction through the intersection point of the initial edge and the adjacent edge, and making the two straight lines parallel to the preset direction and the straight line perpendicular to the preset direction intersect at two points;
wherein the preset direction is 0 ° or 90 °.
Further, if the initial edge and the edge adjacent to the initial edge do not belong to the same inclined interval, adding the edge adjacent to the initial edge into a second homodromous edge set includes:
respectively calculating the center points of the first homodromous edge set and the second homodromous edge set, making a straight line parallel to the preset direction at the center point of the first homodromous edge set, making a straight line perpendicular to the preset direction at the center point of the second homodromous edge set, and intersecting the two straight lines at one point;
wherein the preset direction is 0 ° or 90 °.
Further, the calculating the center point of the set of equidirectional edges includes:
and weighting the edges in the same direction according to the length of each edge in the set of the edges in the same direction, and obtaining the corresponding position of the center point of the set of the edges in the same direction by a weighted arithmetic mean method.
Further, the calculating the center point of the equidirectional edge set, and according to the edge set center point, squaring the polygon includes:
and adding the intersection point of the straight lines into a predefined point set by passing through the straight lines made by the center points of the edge set so as to generate a right-angled polygon according to the point set.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (9)

1. A method for regularizing a topography of a surface, comprising:
extracting a ground object external contour based on a remote sensing technology or a map vector file, wherein the ground object external contour is a polygon, calculating an inclination angle of each side of a preset polygon, and determining a main direction of the preset polygon according to the inclination angle and the length of each side of the preset polygon;
the determining the main direction of the predetermined polygon according to the inclination angle and the length of each side of the predetermined polygon comprises:
defining an inclination angle division space of the edges, dividing the division space according to the inclination angle and the inclination angle of each edge, and adding each edge to the corresponding inclination angle division space;
establishing a direction histogram among the partitions with different inclination angles, wherein the abscissa of the direction histogram is the inclination angle, and the ordinate is the sum of the lengths of the inner edges among the partitions with the inclination angle;
after the direction histogram is subjected to Gaussian smoothing processing, taking the inclination angle corresponding to the point with the maximum sum of the side lengths as a main direction;
after the preset polygon is rotated to the main direction, recalculating the inclination angle of each side of the preset polygon, and respectively defining the inclination intervals in the horizontal direction and the vertical direction;
sequentially traversing each edge of the preset polygon, and obtaining an edge set in the same direction according to the inclined interval of two adjacent edges of the preset polygon and the included angle formed by the two adjacent edges;
and calculating the center point of the edge set in the same direction, and squaring the polygon according to the center point of the edge set.
2. The method according to claim 1, wherein the horizontal tilt interval is (0, 45 °) U (135 °, 180 °), and the vertical tilt interval is (45 °, 135 °).
3. The method according to claim 1, wherein the sequentially traversing each edge of the predetermined polygon, and obtaining a set of edges in the same direction according to the included angle formed by the adjacent two edges and the included angle to which the adjacent two edges belong, comprises:
selecting any one edge of the preset polygon as an initial edge, adding the edge adjacent to the initial edge into a corresponding edge set after detecting and judging the edge adjacent to the initial edge, and continuously detecting and judging the edge adjacent to the initial edge as the initial edge;
if the initial edge and the edge adjacent to the initial edge both belong to the same inclined interval, and an included angle formed between the initial edge and the edge adjacent to the initial edge is larger than a preset value, adding the edge adjacent to the initial edge into a first homodromous edge set;
if the initial edge and the edge adjacent to the initial edge both belong to the same inclined interval, but the included angle formed between the initial edge and the edge is smaller than a preset value, adding the edge adjacent to the initial edge into a second homodromous edge set;
and if the initial edge and the edge adjacent to the initial edge do not belong to the same inclined interval, adding the edge adjacent to the initial edge into a second homodromous edge set.
4. The method of claim 3, wherein adding the edge adjacent to the initial edge to a second set of co-directional edges if the initial edge and the edge adjacent to the initial edge both belong to the same slope region but form an included angle smaller than a predetermined value comprises:
respectively calculating the central points of the first homodromous edge set and the second homodromous edge set, and acquiring the intersection point of the initial edge and the adjacent edge;
making two straight lines parallel to the preset direction through the central point of the first homodromous edge set and the central point of the second homodromous edge set, making a straight line perpendicular to the preset direction through the intersection point of the initial edge and the adjacent edge, and making the two straight lines parallel to the preset direction and the straight line perpendicular to the preset direction intersect at two points;
wherein the preset direction is 0 ° or 90 °.
5. The method of claim 3, wherein adding the edge adjacent to the initial edge to a second set of co-directional edges if the initial edge and the edge adjacent to the initial edge do not belong to the same slope region comprises:
respectively calculating the center points of the first homodromous edge set and the second homodromous edge set, making a straight line parallel to the preset direction at the center point of the first homodromous edge set, making a straight line perpendicular to the preset direction at the center point of the second homodromous edge set, and intersecting the two straight lines at one point;
wherein the preset direction is 0 ° or 90 °.
6. The method of claim 1, wherein calculating the center point of the set of co-directional edges comprises:
and weighting the edges in the same direction according to the length of each edge in the set of the edges in the same direction, and obtaining the corresponding position of the center point of the set of the edges in the same direction by a weighted arithmetic mean method.
7. The method of claim 1, wherein calculating the center point of the set of equidirectional edges, and wherein squaring the polygon from the edge set center point comprises:
and adding the intersection point of the straight lines into a predefined point set by passing through the straight lines made by the center points of the edge set so as to generate a right-angled polygon according to the point set.
8. An electronic device for terrain regularization, comprising:
the calculation module is used for extracting a ground feature external contour based on a remote sensing technology or a map vector file, wherein the ground feature external contour is a polygon, calculating the inclination angle of each side of a preset polygon, and determining the main direction of the preset polygon according to the inclination angle and the length of each side of the preset polygon;
wherein the preset polygon is an external contour corresponding to the ground object;
the determining the main direction of the predetermined polygon according to the inclination angle and the length of each side of the predetermined polygon comprises:
defining an inclination angle division space of the edges, dividing the division space according to the inclination angle and the inclination angle of each edge, and adding each edge to the corresponding inclination angle division space;
establishing a direction histogram among the partitions with different inclination angles, wherein the abscissa of the direction histogram is the inclination angle, and the ordinate is the sum of the lengths of the inner edges among the partitions with the inclination angle;
after the direction histogram is subjected to Gaussian smoothing processing, taking the inclination angle corresponding to the point with the maximum sum of the side lengths as a main direction;
the defining module is used for recalculating the inclination angle of each edge of the preset polygon after the preset polygon is rotated to the main direction, and respectively defining the inclination intervals in the horizontal direction and the vertical direction;
the traversing module is used for sequentially traversing each edge of the preset polygon and obtaining an edge set in the same direction according to the inclined interval of two adjacent edges of the preset polygon and the included angle formed by the two adjacent edges;
and the squaring module is used for calculating the center point of the same-direction edge set and squaring the polygon according to the edge set center point.
9. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the terrain shape regularization method according to any one of claims 1 to 7 when the computer program is executed.
CN201910974807.8A 2019-10-14 2019-10-14 Terrain shape regularization method, electronic device and storage medium Active CN110727755B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910974807.8A CN110727755B (en) 2019-10-14 2019-10-14 Terrain shape regularization method, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910974807.8A CN110727755B (en) 2019-10-14 2019-10-14 Terrain shape regularization method, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN110727755A CN110727755A (en) 2020-01-24
CN110727755B true CN110727755B (en) 2022-02-08

Family

ID=69221083

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910974807.8A Active CN110727755B (en) 2019-10-14 2019-10-14 Terrain shape regularization method, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN110727755B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104143214A (en) * 2013-05-07 2014-11-12 北京四维图新科技股份有限公司 Electronic map polygon triangulation method and device
CN105631849A (en) * 2014-11-06 2016-06-01 航天恒星科技有限公司 Polygon object change detection method and device
CN105678844A (en) * 2016-01-06 2016-06-15 东南大学 Contour construction algorithm on the basis of point by point increasing of ground object scattered points
CN106530228A (en) * 2016-11-04 2017-03-22 中科宇图科技股份有限公司 Vector polygon right-angle correction method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002092646A (en) * 2000-09-14 2002-03-29 Minolta Co Ltd Device and method for extracting plane from three- dimensional shape data and storage medium
JP6060646B2 (en) * 2012-11-27 2017-01-18 株式会社デンソー Map display device and map display system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104143214A (en) * 2013-05-07 2014-11-12 北京四维图新科技股份有限公司 Electronic map polygon triangulation method and device
CN105631849A (en) * 2014-11-06 2016-06-01 航天恒星科技有限公司 Polygon object change detection method and device
CN105678844A (en) * 2016-01-06 2016-06-15 东南大学 Contour construction algorithm on the basis of point by point increasing of ground object scattered points
CN106530228A (en) * 2016-11-04 2017-03-22 中科宇图科技股份有限公司 Vector polygon right-angle correction method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于最小二乘的建筑物多边形的化简与直角化;刘鹏程等;《中国矿业大学学报》;20080915(第05期);全文 *

Also Published As

Publication number Publication date
CN110727755A (en) 2020-01-24

Similar Documents

Publication Publication Date Title
US8959005B2 (en) Building envelope determination
WO2020107326A1 (en) Lane line detection method, device and computer readale storage medium
CN113658339B (en) Contour line-based three-dimensional entity generation method and device
CN107742313A (en) A kind of data compression method and equipment applied to vector space
CN112583620B (en) Network topology map generation method, device, electronic equipment and storage medium
CN111862204A (en) Method for extracting visual feature points of image and related device
CN115937167A (en) Method and device for detecting defects of battery pole piece ceramic and electronic equipment
CN112825199B (en) Collision detection method, device, equipment and storage medium
CN114241032A (en) Area analysis-based region division method, device, equipment and storage medium
CN113538623B (en) Method, device, electronic equipment and storage medium for determining target image
CN109658453B (en) Circle center determining method, device, equipment and storage medium
CN110727755B (en) Terrain shape regularization method, electronic device and storage medium
CN111141208A (en) Parallel line detection method and device
CN107578470B (en) Three-dimensional model processing method and device, server and storage medium
CN113379826A (en) Method and device for measuring volume of logistics piece
CN113989310B (en) Method, device and equipment for estimating building volume data and storage medium
CN115511701A (en) Method and device for converting geographic information
CN107895381B (en) Distance determination method and device
CN115564923A (en) Three-dimensional model processing method and device, electronic equipment and storage medium
CN109325500A (en) A kind of method for extracting characteristics of three-dimensional model and device based on Area-weighted
CN114419333A (en) Method for generating detection frame overlapping degree, target detection method and device
CN110750847B (en) Method, device, equipment and medium for determining grid segmentation relation
CN117687543A (en) Three-dimensional model regular curved surface extraction method and device, electronic equipment and storage medium
CN114943112B (en) Automatic generation method, device, equipment and medium for arrangement scheme along building line
CN111179405B (en) 3D scene roaming collision detection method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant