Vectorization processing method and device for blocky geographic elements
By constructing and repairing the boundary line diagram structure of block geographic elements in the semantic segmentation result image, the problems of boundary line interruption and non-closing of edges and corners are solved, and efficient vectorization processing and improved Polygon yield are achieved.
Patent Information
- Application Number
- CN202411274271.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2025-02-11
AI Technical Summary
In the prior art, in the boundary line processing of block geographic elements in semantic segmentation results images, there are problems such as breaking boundary lines, non-connection, and non-closing of edges and corners, resulting in waste of low-quality data and low Polygon yield.
By obtaining the image to be processed, building the graph structure of boundary pixel points, fixing the problem boundary line, generating position information of closed polygons, and realizing vectorization processing.
Reduces waste of low-quality data, improves Polygon's yield, and ensures the closure and clear segmentation of boundary lines of blocky geographical elements.
Smart Images

Figure CN119418187A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a vectorization processing method and device for block geographic elements in the fields of computer vision, knowledge graphs, deep learning, image processing, and electronic maps. Background Art
[0002] In practical applications, for original images such as satellite images and aerial images, semantic segmentation models can be used to perform semantic segmentation on them, thereby obtaining semantic segmentation result images. The semantic segmentation result image may include segmented foreground information, background information, and boundary information, etc. The boundary information usually refers to the boundary line information of block geographic elements. Block geographic elements may include areas of interest (AOI, Area of Interest), buildings, water systems, and green spaces. Furthermore, vectorization processing can be performed based on the boundary line information of block geographic elements to generate the location information of closed polygons corresponding to each block geographic element (Polygon). Polygon refers to the location information of each pixel point that constitutes the closed polygon, which can be used for subsequent map drawing, etc. Summary of the invention
[0003] The present disclosure provides a method and device for vectorizing block-shaped geographic elements.
[0004] A vector processing method for block-shaped geographic elements, comprising:
[0005] Acquire an image to be processed, wherein the image to be processed includes boundary line information of block-shaped geographic elements;
[0006] Taking the position information of the boundary pixel points as nodes, and constructing a first graph structure corresponding to the image to be processed according to the connectivity relationship between the boundary pixel points, wherein the boundary pixel points are the pixel points constituting the boundary line;
[0007] Repairing the problematic boundary line in the first graph structure to obtain a repaired second graph structure;
[0008] The position information of the closed polygon is extracted from the second graph structure as the required vectorization processing result.
[0009] A vector processing device for block-shaped geographic elements, comprising: an acquisition module, a construction module, a repair module and an extraction module;
[0010] The acquisition module is used to acquire the image to be processed, wherein the image to be processed includes the boundary line information of the block-shaped geographic elements;
[0011] The construction module is used to construct a first graph structure corresponding to the image to be processed by taking the position information of the boundary pixel points as nodes and according to the connectivity relationship between the boundary pixel points, wherein the boundary pixel points are the pixel points constituting the boundary line;
[0012] The repair module is used to repair the problematic boundary line in the first graph structure to obtain a repaired second graph structure;
[0013] The extraction module is used to extract the position information of the closed polygon from the second graph structure as the required vectorization processing result.
[0014] An electronic device, comprising:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described above.
[0018] A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the method as described above.
[0019] A computer program product comprises a computer program / instruction, wherein the computer program / instruction implements the method described above when executed by a processor.
[0020] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0022] Figure 1 It is a flow chart of an embodiment of the vectorization processing method of block-shaped geographic elements disclosed in the present invention;
[0023] Figure 2 A schematic diagram of a line-labeled channel heat map according to the present disclosure;
[0024] Figure 3 Schematic diagram of binary images obtained by using the fixed threshold algorithm and the local threshold algorithm respectively described in the present disclosure;
[0025] Figure 4A schematic diagram of the problem nodes and inflection points described in the present disclosure;
[0026] Figure 5 is a schematic diagram of the regression line and the parallel lines described in the present disclosure;
[0027] Figure 6 This is a schematic diagram of the effect after performing the first geometric modification operation described in the present disclosure;
[0028] Figure 7 is a first schematic diagram of the extension lines and intersection points described in the present disclosure;
[0029] Figure 8 is a second schematic diagram of the extension lines and intersection points described in the present disclosure;
[0030] Fig. 9 A schematic diagram of the boundary line of the problem that cannot be repaired as described in the present disclosure;
[0031] Fig.10 A schematic diagram of any two closed polygons with overlapping boundary lines and corresponding combinations described in the present disclosure;
[0032] Fig.11 It is a schematic diagram of the overall implementation process of the vectorization processing method of block-shaped geographic elements disclosed in the present invention;
[0033] Fig.12 It is a schematic diagram of the composition structure of an embodiment 1200 of the vector processing device for block-shaped geographic elements disclosed in the present invention;
[0034] Fig.13 A schematic block diagram of an electronic device 1300 that can be used to implement an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0035] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0036] In addition, it should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0037] Figure 1Flow chart of an embodiment of the vectorization processing method of block-shaped geographic elements disclosed in the present invention. Figure 1 As shown, the following specific implementation methods are included.
[0038] In step 101, an image to be processed is obtained, wherein the image to be processed includes boundary line information of block-shaped geographic elements.
[0039] In step 102, the position information of the boundary pixel points is used as nodes, and a first graph structure corresponding to the image to be processed is constructed according to the connectivity relationship between the boundary pixel points, where the boundary pixel points are the pixel points constituting the boundary line.
[0040] In step 103, the problematic boundary line in the first graph structure is repaired to obtain a repaired second graph structure.
[0041] In step 104, the position information of the closed polygon is extracted from the second graph structure as the required vectorization processing result.
[0042] Ideally, the semantic segmentation result image should meet the following standards: the boundary lines of the block geographic elements are closed, the adjacent block geographic elements can be clearly segmented, and the foreground pixels fill the closed boundary lines. However, in actual results, only some cases meet the standards, and more commonly, low-quality data that does not meet the standards is obtained, such as: the boundary lines are interrupted, not connected, the corners are not closed, and only the general outline of the block geographic elements is outlined by discrete line segments.
[0043] According to traditional processing methods, low-quality data is usually filtered out, that is, it will not be used to generate Polygon (because no closed polygon is formed), resulting in a large amount of low-quality data being wasted.
[0044] However, by adopting the scheme described in the above method embodiment, considering that in many cases the boundary line information obtained has outlined the approximate outline of the block geographic elements, it can be repaired, that is, for the image to be processed including the boundary line information of the block geographic elements, a corresponding first graph structure can be constructed, and the problematic boundary lines in the first graph structure can be repaired to obtain a repaired second graph structure, and then the position information of the closed polygon can be extracted from the second graph structure, that is, the required Polygon can be obtained, thereby reducing the waste of low-quality data and improving the yield of Polygon.
[0045] For the image to be processed, before generating the first graph structure, the image to be processed may be preprocessed, that is, the image to be processed in the form of a raster graph may be binarized.
[0046] Accordingly, in some embodiments of the present disclosure, a method for constructing a first graph structure corresponding to an image to be processed may include: binarizing the image to be processed to obtain a binary image, wherein the values of boundary pixels in the binary image are greater than the values of non-boundary pixels, and constructing the first graph structure based on the binary image; or, binarizing the image to be processed to obtain a binary image, and refining the binary image, and constructing the first graph structure based on the refined binary image.
[0047] By binarizing the image to be processed, a binary image can be obtained, in which the values of the boundary pixels are greater than the values of the non-boundary pixels, such as the values of the boundary pixels are 255 and the values of the non-boundary pixels are 0. The obtained binary image can be further subjected to thinning processing, which can also be called skeletonization processing, that is, the process of reducing the line width of the image from multiple pixels to a single pixel width. Specifically, in the scheme described in the present disclosure, the boundary line composed of boundary pixels with a value of 255 can be thinned, thereby obtaining a single-pixel connected grid map (i.e., a thinned binary image), so as to facilitate the subsequent search when generating the first graph structure. Among them, the commonly used thinning algorithm can be used to implement the thinning processing, such as the Zhang-Suen algorithm.
[0048] The image to be processed may be a semantic segmentation result image obtained by semantically segmenting the original image through a semantic segmentation model, and a fixed threshold algorithm may be used to perform binarization processing on the semantic segmentation result image to obtain a binary image.
[0049] In some embodiments of the present disclosure, the image to be processed may also be a line-annotated channel heat map, which is one of M heat maps generated by a semantic segmentation model, where M is a positive integer greater than 1, and the M heat maps are used by the semantic segmentation model to generate a semantic segmentation result image corresponding to the original object. Accordingly, a fixed threshold algorithm may be used to binarize the line-annotated channel heat map to obtain a binary image, or a local threshold algorithm may be used to binarize the line-annotated channel heat map to obtain a binary image. The line-annotated channel heat map may also be called a boundary channel heat map.
[0050] In practical applications, the semantic segmentation model generates multiple heat maps before generating the semantic segmentation result image, such as the line annotation channel heat map, the background channel heat map, and the surface channel heat map. These heat maps can then be combined to generate the semantic segmentation result image through the variable value (argmax) fusion operation that makes the function take the maximum value. These heat maps also have the value of increasing production.
[0051] The fixed threshold algorithm or the local threshold algorithm can be used to perform binary processing on the line annotation channel heat map. Among them, the fixed threshold algorithm refers to setting a fixed threshold and comparing the value of each pixel in the image with the threshold. If it is greater than the threshold, it is set to 255, otherwise, it is set to 0. The specific value of the threshold can be determined according to actual needs. The local threshold algorithm refers to achieving binary segmentation through multiple local thresholds.
[0052] Figure 2 Schematic diagram of the line annotation channel heat map described in the present disclosure. It can be seen that the boundary pixels are lighter, and a fixed threshold algorithm or a local threshold algorithm can be used to binarize the line annotation channel heat map. There is no restriction on which local threshold algorithm is used, for example, it can be the mean method, the median method, the Bernsen algorithm, or the local dynamic threshold (NiBlack) algorithm.
[0053] By adopting the local threshold algorithm, each pixel can be compared with the pixels around it to determine the value of each pixel, thereby improving the binarization effect. Figure 3 Schematic diagram of a binary image obtained by using a fixed threshold algorithm and a local threshold algorithm respectively as described in the present disclosure. Figure 2 The lines shown are channel heatmaps. Figure 3 The left image in is a binary image obtained by using a fixed threshold algorithm. Figure 3 The right image in the figure is a binary image obtained by using the local threshold algorithm. It can be seen that compared with the binary image on the left, the binary image on the right retains a lot of boundary line information, which lays a good foundation for subsequent processing. However, compared with the local threshold algorithm, the fixed threshold algorithm is simpler to implement, which can improve processing efficiency. Therefore, the specific algorithm to be selected can be determined according to actual needs.
[0054] Furthermore, the obtained binary image or the refined binary image may be vectorized to construct a corresponding first graph structure.
[0055] In some embodiments of the present disclosure, the method of constructing the first graph structure may include: constructing a third graph structure using an 8-connected search method, and using the third graph structure as the first graph structure, or constructing a third graph structure using an 8-connected search method, and performing thinning processing on the third graph structure to obtain the first graph structure.
[0056] That is to say, the constructed third graph structure can be directly used as the required first graph structure, or after the third graph structure is obtained, it can be further thinned out, and the third graph structure after thinning out can be used as the first graph structure. Which method to use can be determined according to actual needs. Preferably, the latter method can be used, because the third graph structure usually contains a large number of redundant nodes, such as a line segment of length N will be expressed by N+1 connected nodes, and these redundant nodes are unnecessary for subsequent processing, so the third graph structure can be thinned out, such as using the Ramer-Douglas-Peucker algorithm to thin out the third graph structure, thereby reducing the workload of subsequent processing and improving processing efficiency.
[0057] There is no restriction on how to construct the third graph structure. For example, the existing 4-connected search method or 8-connected search method can be used, the position information of the boundary pixels in the binary image (or the refined binary image) is used as the node, and the third graph structure is constructed according to the connectivity relationship between the boundary pixels. The solution described in the present disclosure can adopt the more effective 8-connected search method.
[0058] In addition, in some embodiments of the present disclosure, during the search process, for any boundary pixel point, the search direction corresponding to the boundary pixel point can be determined according to the principle that the priority of the pixel point that is directly adjacent to the boundary pixel point is higher than the priority of the pixel point that is diagonally adjacent to the boundary pixel point, wherein the pixel point that is directly adjacent to the boundary pixel point includes: the pixel points located in the four directions of the upper, lower, left and right of the boundary pixel point within the 3*3 area with the boundary pixel point as the center point, and the pixel points that are diagonally adjacent to the boundary pixel point include: the pixel points located in the four directions of the upper left, lower left, upper right and lower right of the boundary pixel point within the 3*3 area. Through the above processing, the search efficiency can be improved, etc.
[0059] Based on the above principles, for given boundary pixel points, a batch search method can be adopted. First, search (preliminary search) the pixel points with direct adjacent relationships. After they are selected, continue to search for the pixel points with diagonal adjacent relationships. In addition, assuming that the pixel points with direct adjacent relationships that meet the requirements are determined during the preliminary search, such as pixel point P1, then when continuing the search, the search direction that is directly adjacent to pixel point P1 and diagonally adjacent to the given boundary pixel point can be disabled.
[0060] After the first graph structure is obtained, the problematic boundary lines in the first graph structure may be repaired to obtain a second graph structure.
[0061] In some embodiments of the present disclosure, the problem boundary line in the first graph structure may be repaired by sequentially executing a predetermined first geometric reshaping operation and a second geometric reshaping operation.
[0062] The ideal first graph structure should only include boundary lines, and the boundary lines of block-shaped geographic elements should be closed, that is, there should be no nodes with a degree of 1 in the first graph structure, so the main processing object of the geometric reshaping operation is the node with a degree of 1 in the first graph structure. Combined with the characteristics of the geometric shape of the boundary line (not connected, corners not closed), the scheme described in the present disclosure respectively designs a first geometric reshaping operation method and a second geometric reshaping operation method, wherein the first geometric reshaping operation method can also be called the regression line method, and the second geometric reshaping operation method can also be called the extension line method. The two methods are used to implement edge filling and angle filling processing, respectively, and are introduced below.
[0063] 1) The first geometric modification operation
[0064] In some embodiments of the present disclosure, nodes with a degree of 1 can be determined from the first graph structure as problem nodes, and problem line segments where each problem node is located can be determined respectively, and the problem line segment is a continuous boundary line. Then, the following processing can be performed for each problem line segment: other problem line segments that can be connected to the problem line segment are added as candidate line segments to the line segment set corresponding to the problem line segment; in response to determining that the line segment sets corresponding to each problem line segment are empty, the first geometric reshaping operation is terminated; in response to determining that at least one line segment set is not empty, connection processing is performed between the problem line segments according to the non-empty line segment sets, and the first geometric reshaping operation is repeated for the first graph structure after the connection processing.
[0065] In addition, in some embodiments of the present disclosure, the method of separately determining the problem line segments where each problem node is located may include: determining the inflection points (also referred to as inflection points) in the broken line-shaped boundary line containing the problem node from the first graph structure; performing the following processing for each problem node: in response to determining that the problem node meets the following predetermined requirements: both ends of the boundary line where the problem node is located are problem nodes, and there is no inflection point in the boundary line, determining the boundary line as the problem line segment; in response to determining that the problem node does not meet the predetermined requirements, determining the boundary line between the problem node and the predetermined inflection point as the problem line segment, and the predetermined inflection point is the inflection point in the boundary line where the problem node is located that is closest to the problem node.
[0066] Figure 4 Schematic diagram of the problem nodes and inflection points described in this disclosure. Figure 4As shown, boundary line 1 is a boundary point in the shape of a broken line, which includes two problem nodes, namely problem node 1 and problem node 4. In addition, the inflection points, namely inflection point 1, inflection point 2 and inflection point 3, can be determined by using a principle similar to the thinning algorithm. In addition, Figure 4 Also shown are problem nodes 2 and 3. For problem nodes 2 and 3, both ends of the boundary line 2 where they are located are problem nodes, and there is no inflection point in the boundary line 2. Therefore, the boundary line 2 can be determined as the problem line segment. For problem node 1, the inflection point closest to the problem node 1 in the boundary line 1 where the problem node 1 is located can be determined, that is, inflection point 1, and the boundary line between the problem node 1 and the inflection point 1 can be determined as the problem line segment. For problem node 4, the inflection point closest to the problem node 4 in the boundary line 1 where the problem node 4 is located can be determined, that is, inflection point 3, and the boundary line between the problem node 4 and the inflection point 3 can be determined as the problem line segment.
[0067] Through the above processing, the required problem line segments can be determined efficiently and accurately, thus laying a good foundation for subsequent processing.
[0068] Furthermore, for each problematic line segment, the following processing may be performed respectively: other problematic line segments that are determined to be connectable to the problematic line segment are added as candidate line segments to the line segment set corresponding to the problematic line segment.
[0069] In some embodiments of the present disclosure, the following processing can be performed for each problem line segment: the problem line segment is used as a line segment to be processed; linear regression fitting is performed on the line segment to be processed to obtain a regression line; a parallel line parallel to the regression line is set on both sides of the regression line, and the two parallel lines are both of a predetermined length, the predetermined length is greater than the length of the regression line, and the distances between the two parallel lines and the regression line are equal; the problem line segment outside the line segment to be processed that is located between the two parallel lines is determined as other problem line segments that can be connected to the line segment to be processed, and is added to the line segment set corresponding to the line segment to be processed.
[0070] Figure 5 Schematic diagram of the regression line and parallel lines described in the present disclosure. Figure 5 As described above, although the line segment to be processed, i.e., the problem line segment a, is generally a straight line, it is usually curved to a certain extent. Therefore, a linear regression fitting can be performed on it according to the coordinates of each position therein to obtain a regression line. Then, a parallel line parallel to the regression line can be made on both sides of the regression line, and the distance from the regression line is d. The specific lengths of the two parallel lines can be determined according to actual needs, but are usually greater than the length of the regression line. Then, the problem line segment outside the problem line segment a located between the two parallel lines can be determined, such as Figure 5The problem line segment b and the problem line segment c shown in the figure can be added to the line segment set corresponding to the problem line segment a as other problem line segments that can be connected to the problem line segment a.
[0071] The above description takes the problem line segment a as an example. Other problem line segments can be processed in the same way as the problem line segment a.
[0072] In this way, after the above processing, each problem line segment can correspond to its own line segment set respectively, and for any problem line segment, the content included in its corresponding line segment set may be empty or not empty. For example, the line segment set corresponding to the problem line segment a mentioned above includes problem line segment b and problem line segment c.
[0073] If it is determined that the line segment sets corresponding to each problem line segment are empty, the first geometric reshaping operation can be terminated. If it is determined that at least one line segment set is not empty, connection processing between the problem line segments can be performed based on the non-empty line segment set.
[0074] In some embodiments of the present disclosure, for each non-empty line segment set, the following processing can be performed respectively: determine the problem line segment in the line segment set that is closest to the problem node in the problem line segment corresponding to the line segment set, and connect the problem line segment with the problem line segment corresponding to the line segment set.
[0075] Still taking the problem line segment a as an example, its corresponding line segment set includes problem line segment b and problem line segment c, where problem line segment b is closer to the problem node in problem line segment a, so problem line segment b can be connected to problem line segment a, that is, problem line segment a will only be connected to the problem line segment closest to it in the corresponding line segment set, and other problem line segments will be discarded. For another example, for problem line segment b, assuming that its corresponding line segment set includes problem line segment c, then problem line segment b can be directly connected to problem line segment a.
[0076] After completing the connection processing between the above-mentioned problem line segments, the first geometric reshaping operation can be repeatedly performed on the latest first graph structure until all the obtained line segment sets are empty. It should be noted that before each repetition of the first geometric reshaping operation, each line segment set needs to be cleared.
[0077] Figure 6 Schematic diagram of the effect after performing the first geometric modification operation described in the present disclosure. Figure 6 As shown, corresponding to Figure 5 In the case shown, the disconnected boundary lines can be connected together by connecting the problematic line segments.
[0078] In summary, by performing the first geometric shaping operation, the disconnected boundary lines can be connected, thereby filling the defects of the problematic boundary lines in the first graph structure.
[0079] 2) Second geometry modification operation
[0080] By performing the first geometric reshaping operation, only the existing nodes in the first graph structure can be connected, and the problem of disconnection at corners, that is, unclosed corners, cannot be solved. Therefore, the second geometric reshaping operation needs to be further performed.
[0081] In some embodiments of the present disclosure, a node with a degree of 1 can be determined from the fourth graph structure as a problem node. The fourth graph structure is the first graph structure after performing the first geometric reshaping operation, and the problem line segments where each problem node is located can be determined respectively. The problem line segments are continuous boundary lines. Then, starting from each problem node, extension lines of the problem line segments where each problem node is located can be generated. The extension lines are all of predetermined lengths, and the intersection points of each extension line with the boundary line in the fourth graph structure and other extension lines can be obtained respectively. Then, the newly added nodes in the fourth graph structure can be determined based on the intersection points, and the newly added nodes can be connected to the problem nodes on the extension lines to obtain the second graph structure.
[0082] How to determine the problematic line segments where each problematic node is located may be the same as in the first geometric modification operation.
[0083] Figure 7 FIG. 1 is a first schematic diagram of the extension lines and intersection points described in the present disclosure. Figure 7 As shown, the solid line portion represents the boundary line in the fourth figure structure, and the dotted line portion represents the extension line. The specific length of the extension line can be determined according to actual needs, wherein extension line 1 corresponds to two intersection points, intersection 1 and intersection 2, extension line 2 corresponds to two intersection points, intersection 1 and intersection 3, and extension line 3 corresponds to one intersection point, intersection 4.
[0084] A newly added node in the fourth graph structure may be determined according to the intersection point, and the newly added node may be connected to the problem node on the extension line.
[0085] In some embodiments of the present disclosure, the following processing may be performed for each extension line: in response to determining that the number of intersection points corresponding to the extension line is 1, and determining that the node corresponding to the intersection point is not included in the fourth graph structure, the intersection point is added to the fourth graph structure as a newly added node, and the newly added node is connected to the problem node on the extension line; in response to determining that the number of intersection points corresponding to the extension line is greater than 1, the intersection point closest to the problem node on the extension line is selected, and in response to determining that the node corresponding to the selected intersection point is not included in the fourth graph structure, the selected intersection point is added to the fourth graph structure as a newly added node, and the newly added node is connected to the problem node on the extension line.
[0086] like Figure 7 As shown, extension line 1 corresponds to two intersection points, intersection 1 and intersection 2. Therefore, the intersection point closest to the problem node x on extension line 1 can be selected from intersection 1 and intersection 2, that is, intersection 1. Moreover, the fourth graph structure does not include the node corresponding to intersection 1. Therefore, a node corresponding to intersection 1 can be added to the fourth graph structure, and the newly added node can be connected to the problem node x and the problem node y in the extension lines (extension line 1 and extension line 2). Figure 7 In the figure, the two intersections of extension line 1 and intersection 2 are taken as an example. If it is assumed that extension line 1 only corresponds to intersection 1, and the node corresponding to intersection 1 is not included in the fourth graph structure, then a node corresponding to intersection 1 can also be added to the fourth graph structure, and the newly added node can be connected to the problem node in the extension line.
[0087] In addition, in some embodiments of the present disclosure, the following processing can be performed for each extension line: in response to determining that the number of intersection points corresponding to the extension line is 1, and determining that the fourth graph structure includes the node corresponding to the intersection point, the node corresponding to the intersection point is connected to the problem node on the extension line; in response to determining that the number of intersection points corresponding to the extension line is greater than 1, the intersection point closest to the problem node on the extension line is selected, and in response to determining that the fourth graph structure includes the node corresponding to the selected intersection point, the node corresponding to the selected intersection point is connected to the problem node on the extension line.
[0088] like Figure 7 As shown, the extension line 3 corresponds to the intersection point 4, and it is determined that the fourth graph structure includes the node corresponding to the intersection point 4, then the node corresponding to the intersection point 4 can be directly connected to the problem node z on the extension line 3.
[0089] Figure 8 FIG. 2 is a second schematic diagram of the extension lines and intersection points described in the present disclosure. Figure 8 As shown, for the extension line 4, it corresponds to two intersection points, namely, intersection point 5 and intersection point 6. Then, the intersection point closest to the problem node w on the extension line 4 can be selected from these two intersection points, namely, intersection point 5. Since the fourth graph structure includes the node corresponding to intersection point 5, the node corresponding to intersection point 5 can be connected to the problem node w on the extension line 4.
[0090] It can be seen that by adopting the second geometric reshaping operation, new nodes can be added to the fourth graph structure, so that the new nodes can be used to fill the defects of unclosed corners, that is, to make up for the unclosed corners, thereby further improving the quality of the obtained second graph structure.
[0091] Accordingly, by using the first geometric reshaping operation and the second geometric reshaping operation consecutively, the boundary lines of a large number of open block-shaped geographic elements can be turned into a closed state, thereby improving the subsequent Polygon yield, etc.
[0092] After the second graph structure is obtained by performing the first geometric reshaping operation and the second geometric reshaping operation, the Polygon can be extracted from the second graph structure. In some embodiments of the present disclosure, in response to determining that there are still unrepaired problematic boundary lines in the second graph structure, the unrepaired problematic boundary lines can be first deleted from the second graph structure, and then the Polygon can be extracted from the second graph structure after the deletion operation.
[0093] Fig. 9 This is a schematic diagram of the boundary line of the problem that cannot be repaired as described in this disclosure. Fig. 9 As shown, there are terminal branches that cannot be repaired. Then, we can first determine the problem node with degree 1, that is, the problem node o, and delete the problem segment 1 where the problem node o is located. Then, node p becomes a problem node with degree 1 (the previous degree was 2). Accordingly, the problem segment 2 where the problem node p is located can also be deleted. After this processing, the degrees of the remaining nodes are all at least 2.
[0094] Through the above processing, the second graph structure can be further optimized, thereby facilitating subsequent Polygon extraction and improving the accuracy of the obtained Polygon by removing interference.
[0095] In addition, in some embodiments of the present disclosure, when extracting Polygons from the second graph structure, for any two closed polygons (adjacent rings) whose boundary lines overlap, the position information of the two closed polygons can be extracted separately according to the principle of minimizing the total area of the two extracted closed polygons.
[0096] Fig.10 Schematic diagram of any two closed polygons with overlapping boundary lines and corresponding combinations described in the present disclosure. Fig.10 As shown, there are many combinations of two closed polygons in topological morphology, such as the first combination and the second combination shown, among which the first combination is the correct combination. In the second combination, the area formed by merging closed polygon 1 and closed polygon 2 is taken as a closed polygon, then the following extraction rules can be defined: according to the principle of minimizing the total area of the two closed polygons extracted, the position information of the two closed polygons is extracted respectively, that is, the overlapping area between any two closed polygons is 0, thereby avoiding the problem of extraction errors and improving the accuracy of the extraction results.
[0097] Based on the above introduction, Fig.11 FIG. 1 is a schematic diagram of the overall implementation process of the vectorization processing method of block-shaped geographic elements described in the present disclosure. Fig.11 As shown, for the image to be processed, it can be preprocessed first, such as binarization and thinning. Then, the first graph structure can be constructed according to the refined binary image, and the first graph structure can be geometrically reshaped, that is, the problematic boundary line in the first graph structure is repaired to obtain the repaired second graph structure. Then, the second graph structure can be extracted, that is, Polygon is extracted therefrom, so as to realize the conversion of raster data into vector data. Vector data refers to the text representation (WKT, Well-Know Text) of the feature space object. WKT is used to represent the geometric space graphics of the vector, including points, lines, surfaces, etc., among which the surface is represented by the Polygon.
[0098] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are expressed as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the described order of actions, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present disclosure.
[0099] The above is an introduction to the method embodiment. The following is a further explanation of the scheme disclosed in the present invention through an apparatus embodiment.
[0100] Fig.12 FIG. 1 is a schematic diagram of the structure of an embodiment 1200 of the vector processing device for block-shaped geographic elements disclosed in the present invention. Fig.12 As shown, it includes: an acquisition module 1201, a construction module 1202, a repair module 1203 and an extraction module 1204.
[0101] The acquisition module 1201 is used to acquire the image to be processed, where the image to be processed includes the boundary line information of the block-shaped geographic elements.
[0102] The construction module 1202 is used to construct a first graph structure corresponding to the image to be processed by taking the position information of the boundary pixel points as nodes and according to the connectivity relationship between the boundary pixel points, where the boundary pixel points are the pixel points constituting the boundary line.
[0103] The repair module 1203 is used to repair the problematic boundary line in the first graph structure to obtain a repaired second graph structure.
[0104] The extraction module 1204 is used to extract the position information of the closed polygon from the second graph structure as the required vectorization processing result.
[0105] By adopting the scheme described in the above-mentioned device embodiment, considering that in many cases the boundary line information obtained has outlined the approximate outline of the block geographic element, it can be repaired, that is, for the image to be processed including the boundary line information of the block geographic element, a corresponding first graph structure can be constructed, and the problematic boundary lines in the first graph structure can be repaired to obtain a repaired second graph structure, and then the position information of the closed polygon can be extracted from the second graph structure, that is, the required Polygon can be obtained, thereby reducing the waste of low-quality data and improving the yield of Polygon.
[0106] In some embodiments of the present disclosure, the construction module 1202 constructs the first graph structure corresponding to the image to be processed in a manner that may include: binarizing the image to be processed to obtain a binary image, wherein the values of boundary pixels in the binary image are greater than the values of non-boundary pixels, and constructing the first graph structure based on the binary image; or, binarizing the image to be processed to obtain a binary image, and refining the binary image, and constructing the first graph structure based on the refined binary image.
[0107] In some embodiments of the present disclosure, the image to be processed may also be a line-annotated channel heat map, which is one of M heat maps generated by a semantic segmentation model, where M is a positive integer greater than 1, and the M heat maps are used by the semantic segmentation model to generate a semantic segmentation result image corresponding to the original object. Accordingly, the construction module 1202 may use a fixed threshold algorithm to binarize the line-annotated channel heat map to obtain a binary image, or may use a local threshold algorithm to binarize the line-annotated channel heat map to obtain a binary image.
[0108] Furthermore, the construction module 1202 may perform vectorization processing on the obtained binary image or the refined binary image, so as to construct a corresponding first graph structure.
[0109] In some embodiments of the present disclosure, the way in which the construction module 1202 constructs the first graph structure may include: constructing a third graph structure using an 8-connected search method, and using the third graph structure as the first graph structure, or constructing a third graph structure using an 8-connected search method, and performing thinning processing on the third graph structure to obtain the first graph structure.
[0110] In addition, in some embodiments of the present disclosure, when the construction module 1202 adopts the 8-connected search method to construct the third graph structure, for any boundary pixel point, the search direction corresponding to the boundary pixel point can be determined according to the principle that the priority of pixel points that are directly adjacent to the boundary pixel point is higher than the priority of pixel points that are diagonally adjacent to the boundary pixel point, wherein the pixel points that are directly adjacent to the boundary pixel point include: pixel points located in the upper, lower, left and right directions of the boundary pixel point within a 3*3 area with the boundary pixel point as the center point, and the pixel points that are diagonally adjacent to the boundary pixel point include: pixel points located in the upper left, lower left, upper right and lower right directions of the boundary pixel point within the 3*3 area.
[0111] After acquiring the first graph structure, the repair module 1203 may repair the problematic boundary line in the first graph structure, thereby obtaining a second graph structure.
[0112] In some embodiments of the present disclosure, the repair module 1203 may repair the problematic boundary line in the first graph structure by sequentially executing a predetermined first geometric reshaping operation and a second geometric reshaping operation.
[0113] In some embodiments of the present disclosure, the repair module 1203 performing the first geometric reshaping operation may include: determining nodes with a degree of 1 from the first graph structure as problem nodes, and respectively determining the problem line segments where each problem node is located, where the problem line segment is a continuous boundary line, and then performing the following processing for each problem line segment: adding other problem line segments that can be connected to the problem line segment as candidate line segments to the line segment set corresponding to the problem line segment; in response to determining that the line segment sets corresponding to each problem line segment are all empty, terminating the first geometric reshaping operation; in response to determining that at least one line segment set is not empty, performing connection processing between the problem line segments according to the non-empty line segment sets, and repeatedly performing the first geometric reshaping operation on the first graph structure after the connection processing.
[0114] In addition, in some embodiments of the present disclosure, the repair module 1203 may include: determining the inflection point in the broken line-shaped boundary line containing the problem node from the first graph structure; performing the following processing for each problem node: in response to determining that the problem node meets the following predetermined requirements: both ends of the boundary line where the problem node is located are problem nodes, and there is no inflection point in the boundary line, determining the boundary line as a problem segment; in response to determining that the problem node does not meet the predetermined requirements, determining the boundary line between the problem node and the predetermined inflection point as the problem segment, and the predetermined inflection point is the inflection point in the boundary line where the problem node is located that is closest to the problem node.
[0115] In some embodiments of the present disclosure, the repair module 1203 may perform the following processing on each problem line segment: use the problem line segment as a line segment to be processed; perform linear regression fitting on the line segment to be processed to obtain a regression line; set a parallel line parallel to the regression line on both sides of the regression line, and the two parallel lines are both of a predetermined length, which is greater than the length of the regression line, and the distances between the two parallel lines and the regression line are equal; determine the problem line segment outside the line segment to be processed that is located between the two parallel lines, as other problem line segments that can be connected to the line segment to be processed, and add them to the line segment set corresponding to the line segment to be processed.
[0116] In addition, in some embodiments of the present disclosure, the repair module 1203 may perform the following processing for each non-empty line segment set: determine the problem line segment in the line segment set that is closest to the problem node in the problem line segment corresponding to the line segment set, and connect the problem line segment that is closest to the problem line segment corresponding to the line segment set.
[0117] By performing the first geometric reshaping operation, only the existing nodes in the first graph structure can be connected, and the problem of disconnection at corners, that is, unclosed corners, cannot be solved. Therefore, the second geometric reshaping operation needs to be further performed.
[0118] In some embodiments of the present disclosure, the repair module 1203 performing the second geometric reshaping operation may include: determining a node with a degree of 1 from the fourth graph structure as a problem node, the fourth graph structure being the first graph structure after performing the first geometric reshaping operation, and respectively determining the problem line segments where each problem node is located, the problem line segments being a continuous boundary line, and then starting from each problem node, generating extension lines of the problem line segments where each problem node is located, the extension lines are all of predetermined lengths, and respectively obtaining the intersection points between each extension line and the boundary line in the fourth graph structure and other extension lines, and then determining the newly added nodes in the fourth graph structure based on the intersection points, and connecting the newly added nodes to the problem nodes on the extension lines to obtain the second graph structure.
[0119] In some embodiments of the present disclosure, the repair module 1203 may perform the following processing for each extension line: in response to determining that the number of intersections corresponding to the extension line is 1, and determining that the fourth graph structure does not include the node corresponding to the intersection, adding the intersection as a newly added node to the fourth graph structure, and connecting the newly added node to the problem node on the extension line; in response to determining that the number of intersections corresponding to the extension line is greater than 1, selecting the intersection closest to the problem node on the extension line, and in response to determining that the fourth graph structure does not include the node corresponding to the selected intersection, adding the selected intersection as a newly added node to the fourth graph structure, and connecting the newly added node to the problem node on the extension line.
[0120] In addition, in some embodiments of the present disclosure, the repair module 1203 can also perform the following processing for each extension line: in response to determining that the number of intersections corresponding to the extension line is 1, and determining that the fourth graph structure includes the node corresponding to the intersection, connecting the node corresponding to the intersection to the problem node on the extension line; in response to determining that the number of intersections corresponding to the extension line is greater than 1, selecting the intersection closest to the problem node on the extension line, and in response to determining that the fourth graph structure includes the node corresponding to the selected intersection, connecting the node corresponding to the selected intersection to the problem node on the extension line.
[0121] After obtaining the second graph structure by performing the first geometric reshaping operation and the second geometric reshaping operation, the extraction module 1204 may extract the Polygon from the second graph structure.
[0122] In some embodiments of the present disclosure, in response to determining that there are still problematic boundary lines that cannot be repaired in the second graph structure, the extraction module 1204 may first delete the problematic boundary lines that cannot be repaired from the second graph structure, and then extract the Polygon from the second graph structure after the deletion operation.
[0123] In addition, in some embodiments of the present disclosure, when the extraction module 1204 extracts Polygon from the second graph structure, for any two closed polygons whose boundary lines overlap, the position information of the two closed polygons can be extracted separately according to the principle of minimizing the total area of the two extracted closed polygons.
[0124] Fig.12 The specific working process of the device embodiment shown can refer to the relevant description in the aforementioned method embodiment, which will not be repeated here.
[0125] The solution disclosed in the present disclosure can be applied to the field of artificial intelligence, especially computer vision, knowledge graph, deep learning, image processing and electronic map. Artificial intelligence is a discipline that studies how to use computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It has both hardware-level technology and software-level technology. Artificial intelligence hardware technology generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing. Artificial intelligence software technology mainly includes computer vision technology, speech recognition technology, natural language processing technology, machine learning / deep learning, big data processing technology, knowledge graph technology and other major directions.
[0126] The images and the like in the embodiments described in this disclosure are not targeted at a specific user and do not reflect the personal information of a specific user. In the technical solution of this disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0127] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0128] Fig.13 A schematic block diagram of an electronic device 1300 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0129] like Fig.13 As shown, the device 1300 includes a computing unit 1301, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1302 or a computer program loaded from a storage unit 1308 to a random access memory (RAM) 1303. In RAM 1303, various programs and data required for the operation of the device 1300 can also be stored. The computing unit 1301, ROM 1302 and RAM 1303 are connected to each other via a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.
[0130] A number of components in the device 1300 are connected to the I / O interface 1305, including: an input unit 1306, such as a keyboard, a mouse, etc.; an output unit 1307, such as various types of displays, speakers, etc.; a storage unit 1308, such as a disk, an optical disk, etc.; and a communication unit 1309, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1309 allows the device 1300 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0131] The computing unit 1301 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI, Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSP, Digital Signal Processing), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1301 performs the various methods and processes described above, such as the methods described in the present disclosure. For example, in some embodiments, the methods described in the present disclosure may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1308. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1300 via the ROM 1302 and / or the communication unit 1309. When the computer program is loaded into the RAM 1303 and executed by the computing unit 1301, one or more steps of the methods described in the present disclosure may be performed. Alternatively, in other embodiments, the computing unit 1301 may be configured to execute the method described in the present disclosure in any other appropriate manner (for example, by means of firmware).
[0132] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard parts (ASSPs), system on chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0133] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0134] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory (EPROM, Electronically Programmable Read-Only Memory), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM, Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0135] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a cathode ray tube (CRT) or a liquid crystal display (LCD) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0136] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0137] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0138] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0139] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A vector processing method for block-shaped geographic elements, comprising: Acquire an image to be processed, wherein the image to be processed includes boundary line information of block-shaped geographic elements; Taking the position information of the boundary pixel points as nodes, and constructing a first graph structure corresponding to the image to be processed according to the connectivity relationship between the boundary pixel points, wherein the boundary pixel points are the pixel points constituting the boundary line; Repairing the problematic boundary line in the first graph structure to obtain a repaired second graph structure; The position information of the closed polygon is extracted from the second graph structure as the required vectorization processing result.
2. The method according to claim 1, wherein: The constructing the first graph structure corresponding to the image to be processed comprises: Binarizing the image to be processed to obtain a binary image, wherein the values of the boundary pixels in the binary image are greater than the values of the non-boundary pixels, and constructing the first graph structure according to the binary image; Alternatively, the image to be processed is binarized to obtain the binary image, and the binary image is thinned to construct the first graph structure according to the thinned binary image.
3. The method according to claim 2, wherein: The image to be processed includes: a line-annotated channel heat map, the line-annotated channel heat map is one of M heat maps generated by a semantic segmentation model, M is a positive integer greater than 1, and the M heat maps are used for the semantic segmentation model to generate a semantic segmentation result image corresponding to the original object; The binarization of the image to be processed to obtain a binary image includes: using a fixed threshold algorithm to binarize the line annotation channel heat map to obtain the binary image, or using a local threshold algorithm to binarize the line annotation channel heat map to obtain the binary image.
4. The method according to claim 2, wherein: The constructing the first graph structure includes: Constructing a third graph structure by using an 8-connectivity search method, and using the third graph structure as the first graph structure; Alternatively, the third graph structure is constructed by using the 8-connected search method, and the third graph structure is thinned to obtain the first graph structure.
5. The method according to claim 4, wherein: The constructing the third graph structure by using the 8-connectivity search method includes: During the search process, for any boundary pixel point, the search direction corresponding to the boundary pixel point is determined according to the principle that the priority of the pixel point that is directly adjacent to the boundary pixel point is higher than the priority of the pixel point that is diagonally adjacent to the boundary pixel point; Among them, the pixel points that are directly adjacent to the boundary pixel points include: pixel points located in the upper, lower, left and right directions of the boundary pixel points within a 3*3 area with the boundary pixel point as the center point; the pixel points that are diagonally adjacent to the boundary pixel points include: pixel points located in the upper left, lower left, upper right and lower right directions of the boundary pixel points within the 3*3 area.
6. The method according to claim 1, wherein: The repairing of the problematic boundary line in the first graph structure to obtain a repaired second graph structure comprises: The second graph structure is obtained by sequentially performing a predetermined first geometric reshaping operation and a second geometric reshaping operation to repair the problematic boundary line in the first graph structure.
7. The method according to claim 6, wherein: Performing the first geometric modification operation includes: Determine a node with a degree of 1 from the first graph structure as a problem node; Determine the problem line segment where each problem node is located, wherein the problem line segment is a continuous boundary line; For each problematic line segment, the following processing is performed respectively: other problematic line segments that are determined to be connectable to the problematic line segment are added as candidate line segments to the line segment set corresponding to the problematic line segment; In response to determining that the line segment sets corresponding to each problem line segment are empty, the first geometric reshaping operation is terminated. In response to determining that at least one line segment set is not empty, connection processing is performed between the problem line segments according to the non-empty line segment sets, and the first geometric reshaping operation is repeatedly performed on the first graph structure after the connection processing.
8. The method according to claim 7, wherein: The step of respectively determining the problem line segments where each problem node is located comprises: Determining an inflection point in a polyline-shaped boundary line containing a problem node from the first graph structure; For each problem node, the following processing is performed respectively: in response to determining that the problem node meets the following predetermined requirements: both ends of the boundary line where the problem node is located are problem nodes, and there is no inflection point in the boundary line, the boundary line is determined as the problem line segment; in response to determining that the problem node does not meet the predetermined requirements, the boundary line between the problem node and the predetermined inflection point is determined as the problem line segment, and the predetermined inflection point is the inflection point in the boundary line where the problem node is located that is closest to the problem node.
9. The method according to claim 7, wherein: The step of adding the other problem line segments that are determined to be connectable to the problem line segment as candidate line segments to the line segment set corresponding to the problem line segment includes: For each problematic line segment, perform the following processing: Taking the problematic line segment as a line segment to be processed; Performing linear regression fitting on the line segment to be processed to obtain a regression line; A parallel line parallel to the regression line is set on both sides of the regression line, the two parallel lines are both of a predetermined length, the predetermined length is greater than the length of the regression line, and the distances between the two parallel lines and the regression line are equal; Problem line segments other than the line segment to be processed between two parallel lines are determined as other problem line segments that can be connected to the line segment to be processed, and are added to the line segment set corresponding to the line segment to be processed.
10. The method according to claim 7, wherein: The connection processing between the problem line segments according to the line segment set which is not empty includes: For each non-empty line segment set, the following processing is performed respectively: determine the problem line segment in the line segment set that is closest to the problem node in the problem line segment corresponding to the line segment set, and connect the problem line segment with the problem line segment corresponding to the line segment set.
11. The method according to claim 6, wherein: Performing the second geometric modification operation includes: Determine a node with a degree of 1 from a fourth graph structure as a problem node, wherein the fourth graph structure is the first graph structure after performing the first geometric reshaping operation; Determine the problem line segment where each problem node is located, wherein the problem line segment is a continuous boundary line; Starting from each problem node, respectively, an extension line of the problem line segment where each problem node is located is generated, wherein each extension line has a predetermined length, and respectively obtains the intersection point between each extension line and the boundary line in the fourth graph structure and other extension lines; A newly added node in the fourth graph structure is determined according to the intersection point, and the newly added node is connected to the problem node on the extension line thereof to obtain the second graph structure.
12. The method according to claim 11, wherein: Determining a new node in the fourth graph structure according to the intersection point, and connecting the new node to the problem node on the extension line includes: For each extension line, perform the following processing: In response to determining that the number of intersection points corresponding to the extension line is 1 and determining that the fourth graph structure does not include the node corresponding to the intersection point, adding the intersection point as a newly added node to the fourth graph structure, and connecting the newly added node to the problematic node on the extension line; In response to determining that the number of intersections corresponding to the extension line is greater than one, the intersection closest to the problem node on the extension line is selected. In response to determining that the fourth graph structure does not include the node corresponding to the selected intersection, the selected intersection is added as a new node to the fourth graph structure, and the new node is connected to the problem node on the extension line.
13. The method according to claim 12, further comprising: In response to determining that the number of intersection points corresponding to the extension line is 1 and determining that the fourth graph structure includes the node corresponding to the intersection point, connecting the node corresponding to the intersection point to the problem node on the extension line; In response to determining that the number of intersection points corresponding to the extension line is greater than one, the intersection point closest to the problem node on the extension line is selected; in response to determining that the fourth graph structure includes the node corresponding to the selected intersection point, the node corresponding to the selected intersection point is connected to the problem node on the extension line.
14. The method according to claim 1 or 6, wherein: The extracting the position information of the closed polygon from the second graph structure comprises: In response to determining that there are still unrepaired problematic boundary lines in the second graph structure, the unrepaired problematic boundary lines are deleted from the second graph structure, and the position information of the closed polygon is extracted from the second graph structure after the deletion operation.
15. The method according to claim 1 or 6, wherein: The extracting the position information of the closed polygon from the second graph structure comprises: For any two closed polygons whose boundary lines overlap, the position information of the two closed polygons is extracted respectively according to the principle that the total area of the two closed polygons extracted is minimized.
16. A vector processing device for block-shaped geographic elements, comprising: Get modules, build modules, repair modules, and extract modules; The acquisition module is used to acquire the image to be processed, wherein the image to be processed includes the boundary line information of the block-shaped geographic elements; The construction module is used to construct a first graph structure corresponding to the image to be processed by taking the position information of the boundary pixel points as nodes and according to the connectivity relationship between the boundary pixel points, wherein the boundary pixel points are the pixel points constituting the boundary line; The repair module is used to repair the problematic boundary line in the first graph structure to obtain a repaired second graph structure; The extraction module is used to extract the position information of the closed polygon from the second graph structure as the required vectorization processing result.
17. The device according to claim 16, wherein: The construction module performs binarization processing on the image to be processed to obtain a binary image, wherein the values of the boundary pixels in the binary image are greater than the values of the non-boundary pixels, and the first graph structure is constructed according to the binary image; Alternatively, the construction module performs binarization processing on the image to be processed to obtain the binary image, and performs thinning processing on the binary image, and constructs the first graph structure according to the thinned binary image.
18. The device according to claim 17, wherein: The image to be processed includes: a line-annotated channel heat map, the line-annotated channel heat map is one of M heat maps generated by a semantic segmentation model, M is a positive integer greater than 1, and the M heat maps are used for the semantic segmentation model to generate a semantic segmentation result image corresponding to the original object; The construction module uses a fixed threshold algorithm to binarize the line-labeled channel heat map to obtain the binary image, or uses a local threshold algorithm to binarize the line-labeled channel heat map to obtain the binary image.
19. The device according to claim 17, wherein: The construction module constructs a third graph structure by using an 8-connectivity search method, and uses the third graph structure as the first graph structure; Alternatively, the construction module constructs the third graph structure by using the 8-connected search method, and performs a thinning process on the third graph structure to obtain the first graph structure.
20. The device according to claim 19, wherein When the construction module adopts the 8-connected search method to construct the third graph structure, for any boundary pixel point, the search direction corresponding to the boundary pixel point is determined according to the principle that the priority of the pixel point that is directly adjacent to the boundary pixel point is higher than the priority of the pixel point that is diagonally adjacent to the boundary pixel point; wherein the pixel point that is directly adjacent to the boundary pixel point includes: the pixel points located in the upper, lower, left and right directions of the boundary pixel point within a 3*3 area with the boundary pixel point as the center point, and the pixel points that are diagonally adjacent to the boundary pixel point include: the pixel points located in the upper left, lower left, upper right and lower right directions of the boundary pixel point within the 3*3 area.
21. The device according to claim 16, wherein: The repair module repairs the problematic boundary line in the first graph structure by sequentially executing a predetermined first geometric reshaping operation and a second geometric reshaping operation to obtain the second graph structure.
22. The device according to claim 21, wherein The repair module performs the first geometric reshaping operation including: determining nodes with a degree of 1 from the first graph structure as problem nodes; respectively determining the problem line segments where each problem node is located, wherein the problem line segment is a continuous boundary line; and performing the following processing for each problem line segment: adding other problem line segments that can be connected to the problem line segment as candidate line segments to the line segment set corresponding to the problem line segment, terminating the first geometric reshaping operation in response to determining that the line segment sets corresponding to each problem line segment are empty, performing connection processing between the problem line segments according to the non-empty line segment set in response to determining that at least one line segment set is not empty, and repeatedly performing the first geometric reshaping operation on the first graph structure after the connection processing.
23. The device according to claim 22, wherein: The repair module determines the inflection points in the broken line-shaped boundary line containing the problem node from the first graph structure, and performs the following processing for each problem node: in response to determining that the problem node meets the following predetermined requirements: both ends of the boundary line where the problem node is located are problem nodes, and there is no inflection point in the boundary line, the boundary line is determined as the problem line segment; in response to determining that the problem node does not meet the predetermined requirements, the boundary line between the problem node and the predetermined inflection point is determined as the problem line segment, and the predetermined inflection point is the inflection point in the boundary line where the problem node is located that is closest to the problem node.
24. The device according to claim 22, wherein: The repair module performs the following processing on each problem line segment: taking the problem line segment as the line segment to be processed, performing linear regression fitting on the line segment to be processed to obtain a regression line, setting a parallel line parallel to the regression line on both sides of the regression line, and both of the two parallel lines are of a predetermined length, the predetermined length is greater than the length of the regression line, and the distances between the two parallel lines and the regression line are equal, determining the problem line segment outside the line segment to be processed that is located between the two parallel lines, as other problem line segments that can be connected to the line segment to be processed, and adding them to the line segment set corresponding to the line segment to be processed.
25. The device according to claim 22, wherein: The repair module performs the following processing for each non-empty line segment set: determining the problem line segment in the line segment set that is closest to the problem node in the problem line segment corresponding to the line segment set, and connecting the problem line segment with the closest distance to the problem line segment corresponding to the line segment set.
26. The device according to claim 21, wherein The repair module performs the second geometric reshaping operation including: determining a node with a degree of 1 from a fourth graph structure as a problem node, the fourth graph structure being the first graph structure after performing the first geometric reshaping operation; determining the problem line segments where each problem node is located, the problem line segments being a continuous boundary line; starting from each problem node, generating extension lines of the problem line segments where each problem node is located, the extension lines are all of a predetermined length, and obtaining the intersection points of each extension line with the boundary line and other extension lines in the fourth graph structure; determining a newly added node in the fourth graph structure based on the intersection points, and connecting the newly added node to the problem node on the extension line to obtain the second graph structure.
27. The device according to claim 26, wherein: The repair module performs the following processing for each extension line: in response to determining that the number of intersection points corresponding to the extension line is 1, and determining that the fourth graph structure does not include the node corresponding to the intersection point, adding the intersection point as a newly added node to the fourth graph structure, and connecting the newly added node to the problem node on the extension line; in response to determining that the number of intersection points corresponding to the extension line is greater than 1, selecting the intersection point closest to the problem node on the extension line, and in response to determining that the fourth graph structure does not include the node corresponding to the selected intersection point, adding the selected intersection point as a newly added node to the fourth graph structure, and connecting the newly added node to the problem node on the extension line.
28. The device according to claim 27, wherein The repair module is further used to, in response to determining that the number of intersections corresponding to the extension line is 1 and determining that the fourth graph structure includes the node corresponding to the intersection, connect the node corresponding to the intersection with the problem node on the extension line; in response to determining that the number of intersections corresponding to the extension line is greater than 1, select the intersection closest to the problem node on the extension line; in response to determining that the fourth graph structure includes the node corresponding to the selected intersection, connect the node corresponding to the selected intersection with the problem node on the extension line.
29. The device according to claim 16 or 21, wherein: In response to determining that there are still unrepaired problematic boundary lines in the second graph structure, the extraction module deletes the unrepaired problematic boundary lines from the second graph structure, and extracts the position information of the closed polygon from the second graph structure after the deletion operation.
30. The device according to claim 16 or 21, wherein: The extraction module extracts the position information of any two closed polygons whose boundary lines overlap, respectively, according to the principle that the total area of the two closed polygons extracted is minimized.
31. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 15.
32. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1 to 15.
33. A computer program product, comprising a computer program / instructions, which implement the method according to any one of claims 1 to 15 when executed by a processor.