Symbolic geographic feature vectorization method, device and equipment based on pattern matching
Patent Information
- Application Number
- CN202410188157.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-20
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2044-02-20
AI Technical Summary
在提取符号地理要素的过程中,除了存在上述解译地形图面临的常规问题之外,提取符号地理要素还需要面临符号地理要素与其他线性地理要素频繁相交,如符号地理要素与道路和广场等线性地理要素频繁相交,并且这些地理要素都具有相似的颜色,从而带来的颜色混叠的问题
[0016]This application provides a method, apparatus, and device for vectorizing symbolic geographic elements based on pattern matching. The method involves acquiring a topographic map to be processed and target symbolic geographic elements; preprocessing the topographic map based on the target symbolic geographic elements to obtain a corresponding grayscale image; then, based on pattern matching, traversing the grayscale image according to a preset geographic element template until the grayscale image has been completely traversed by the preset geographic element template, obtaining the geographic coordinates of all target symbolic geographic elements in the grayscale image. The traversal includes calculating the similarity between the grayscale image matrix corresponding to the preset geographic element template and a submatrix of the same size as the preset geographic element template on the grayscale image to obtain candidate element points; and determining and identifying element points based on the candidate element points. The coordinates of the center point of the identified feature point are used as the geographic coordinates of the target symbol geographic feature. Based on the preset elimination rules, the symbol geographic features corresponding to the identified feature points are eliminated according to the preset geographic feature template. Based on this, a grayscale image corresponding to the topographic map to be processed can be obtained through preprocessing to eliminate colors in the topographic map to be processed except for the colors of the target symbol geographic features, thereby avoiding background interference and solving the problem of color mixing. At the same time, template matching is used to traverse the grayscale image according to the preset geographic feature template to obtain the geographic coordinates of all target symbol geographic features in the grayscale image, solving the problems caused by the low quality and large quantity of topographic maps, thereby improving the automation level of scanned topographic map interpretation.
Smart Images

Figure CN118069876B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing, and more particularly to the field of remote sensing information technology, specifically to a method, apparatus, and device for vectorizing symbolic geographic features based on pattern matching. Background Technology
[0002] Topographic maps carry rich geographical information over a long period of time, and extracting geographical information from topographic maps helps in understanding environmental change and other geographically related research fields. Topographic map vectorization mainly involves the extraction of key geographical elements such as symbols, lines, and text.
[0003] Since most topographic maps are stored in paper format, scanned topographic maps suffer from problems such as uneven thickness, blurriness, and overlapping of geographic features due to printing and improper storage. Furthermore, most topographic maps are drawn at very large sizes, making manual interpretation extremely time-consuming and labor-intensive. Therefore, both the quality and quantity of topographic maps pose significant challenges to interpretation, leading to increasing research efforts focused on improving the automation of scanned topographic map interpretation.
[0004] Symbolic geographic features carry most of the location and attribute information of geographic features in a topographic map. In the process of extracting symbolic geographic features, in addition to the common problems encountered in interpreting topographic maps, there is also the issue of color mixing caused by the frequent intersections of symbolic geographic features with other linear geographic features, such as roads and squares, where these geographic features often have similar colors. Summary of the Invention
[0005] This disclosure provides a method, apparatus, and device for vectorizing symbolic geographic features based on pattern matching.
[0006] According to a first aspect of this disclosure, a method for vectorizing symbolic geographic features based on pattern matching is provided. The method includes: Acquire the topographic map to be processed and the geographic features of the target symbols; The topographic map to be processed is preprocessed based on the target symbol geographic elements to obtain the corresponding grayscale map; Based on pattern matching, the grayscale image is traversed according to a preset geographic feature template until the grayscale image has been completely traversed by the preset geographic feature template, thereby obtaining the geographic coordinates of all target symbol geographic features in the grayscale image. The traversal includes calculating the similarity between the grayscale image matrix corresponding to the preset geographic feature template and a submatrix on the grayscale image that has the same size as the preset geographic feature template, thereby obtaining candidate feature points; identifying feature points based on the candidate feature points, and using the coordinates corresponding to the center point of the identified feature points as the geographic coordinates of the target symbol geographic features; and eliminating symbol geographic features corresponding to the identified feature points based on preset elimination rules and the preset geographic feature template.
[0007] In addition to the aspects and any possible implementations described above, a further implementation is provided, wherein the preprocessing of the topographic map to be processed based on the target symbol geographic features to obtain the corresponding grayscale image includes: Based on preset color filtering rules, the topographic map to be processed is preprocessed according to the RGB three-channel color set of the target symbol geographic element in order to eliminate colors in the topographic map to be processed other than the color of the target symbol geographic element. The preprocessed topographic map to be processed is then subjected to grayscale processing to obtain the corresponding grayscale image.
[0008] As described above and in any possible implementation, a further implementation is provided, wherein the preprocessing of the topographic map to be processed based on the target symbol geographic features to obtain the corresponding grayscale image further includes: The topographic map to be processed is then subjected to watermark removal.
[0009] In addition to the aspects and any possible implementations described above, a further implementation is provided, wherein calculating the similarity between the grayscale image matrix corresponding to the preset geographic feature template and the sub-matrix on the grayscale image that has the same size as the preset geographic feature template, to obtain candidate feature points includes: Calculate the distance between the grayscale image matrix corresponding to the preset geographic feature template and the submatrix on the grayscale image that has the same size as the preset geographic feature template; Candidate feature points are determined based on the distance and the preset matching threshold.
[0010] In addition to the aspects described above and any possible implementations, a further implementation is provided, wherein determining the identification feature points based on the candidate feature points includes: Based on the bubble sort algorithm, the identification feature points are determined according to the candidate feature points.
[0011] In addition to the aspects and any possible implementations described above, a further implementation is provided in which the preset geographic feature template is obtained by cropping the grayscale image based on the bounding rectangle of the target symbol geographic feature.
[0012] In addition to the aspects and any possible implementations described above, a further implementation is provided in which the preset geographic feature template is obtained by cropping the topographic map to be processed according to the bounding rectangle of the target symbol geographic feature, and then preprocessing the cropped topographic map to be processed according to the target symbol geographic feature.
[0013] According to a second aspect of this disclosure, a pattern-matching-based symbolic geographic feature vectorization apparatus is provided. The apparatus includes: The acquisition module is used to acquire the topographic map to be processed and the geographic features of the target symbols; The processing module is used to preprocess the topographic map to be processed based on the target symbol geographic features to obtain the corresponding grayscale map; The processing module is further configured to traverse the grayscale image based on pattern matching and a preset geographic feature template until the grayscale image has been traversed by the preset geographic feature template, thereby obtaining the geographic coordinates of all target symbol geographic features in the grayscale image. The traversal includes calculating the similarity between the grayscale image matrix corresponding to the preset geographic feature template and a submatrix on the grayscale image that is the same size as the preset geographic feature template, thereby obtaining candidate feature points; determining identification feature points based on the candidate feature points, and using the coordinates corresponding to the center point of the identification feature point as the geographic coordinates of the target symbol geographic features; and eliminating the symbol geographic features corresponding to the determined identification feature points based on preset elimination rules and the preset geographic feature template.
[0014] According to a third aspect of this disclosure, an electronic device is provided. The electronic device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the program to implement the method described above.
[0015] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the method described above.
[0016] This application provides a method, apparatus, and device for vectorizing symbolic geographic elements based on pattern matching. The method involves acquiring a topographic map to be processed and target symbolic geographic elements; preprocessing the topographic map based on the target symbolic geographic elements to obtain a corresponding grayscale image; then, based on pattern matching, traversing the grayscale image according to a preset geographic element template until the grayscale image has been completely traversed by the preset geographic element template, obtaining the geographic coordinates of all target symbolic geographic elements in the grayscale image. The traversal includes calculating the similarity between the grayscale image matrix corresponding to the preset geographic element template and a submatrix of the same size as the preset geographic element template on the grayscale image to obtain candidate element points; and determining and identifying element points based on the candidate element points. The coordinates of the center point of the identified feature point are used as the geographic coordinates of the target symbol geographic feature. Based on the preset elimination rules, the symbol geographic features corresponding to the identified feature points are eliminated according to the preset geographic feature template. Based on this, a grayscale image corresponding to the topographic map to be processed can be obtained through preprocessing to eliminate colors in the topographic map to be processed except for the colors of the target symbol geographic features, thereby avoiding background interference and solving the problem of color mixing. At the same time, template matching is used to traverse the grayscale image according to the preset geographic feature template to obtain the geographic coordinates of all target symbol geographic features in the grayscale image, solving the problems caused by the low quality and large quantity of topographic maps, thereby improving the automation level of scanned topographic map interpretation.
[0017] It should be understood that the description in the Summary of the Invention is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0018] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. The drawings are provided for a better understanding of the invention and are not intended to limit the scope of this disclosure. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein: Figure 1 A flowchart of a pattern-matching-based symbolic geographic feature vectorization method according to an embodiment of the present disclosure is shown; Figure 2 A schematic diagram of a grayscale image according to an embodiment of the present disclosure is shown; Figure 3 A schematic diagram is shown illustrating the elimination of symbolic geographic features corresponding to identified feature points according to an embodiment of the present disclosure; Figure 4 A block diagram of a pattern-matching-based symbolic geographic feature vectorization apparatus according to an embodiment of the present disclosure is shown; Figure 5 A block diagram of an exemplary electronic device capable of implementing embodiments of the present disclosure is shown. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0020] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0021] In this disclosure, a grayscale image corresponding to the topographic map to be processed can be obtained through preprocessing to eliminate colors in the topographic map except for the colors of the target symbol geographic elements, thereby avoiding background interference and solving the problem of color aliasing. At the same time, template matching is used to traverse the grayscale image according to the preset geographic element template to obtain the geographic coordinates of all target symbol geographic elements in the grayscale image, solving the problems caused by the low quality and large quantity of topographic maps, thereby improving the automation level of scanning topographic map interpretation.
[0022] Figure 1 A flowchart of a pattern-matching-based symbolic geographic feature vectorization method 100 according to an embodiment of the present disclosure is shown.
[0023] In box 110, obtain the topographic map to be processed and the geographic features of the target symbol.
[0024] In some embodiments, the topographic map to be processed can be a topographic map in various file formats, such as a scanned topographic map or an electronic topographic map.
[0025] In some embodiments, the target symbolic geographic feature can be a symbolic geographic feature in the topographic map to be processed that retains its shape, size, color, and orientation, and can be set according to the user's actual needs.
[0026] In box 120, the topographic map to be processed is preprocessed according to the geographic features of the target symbol to obtain the corresponding grayscale map.
[0027] In some embodiments, preprocessing includes background interference removal and grayscale processing. Background interference removal can be achieved by eliminating colors other than the color of the target symbol geographic feature in the topographic map to be processed; grayscale processing can be achieved by RGB to grayscale conversion.
[0028] In some embodiments, the topographic map to be processed, with a width of W and a length of H, can be represented by the symbol A∈i. W×H In this case, in a topographic map of width W and length H, the RGB three-channel pixel value at position (w,h) in row w and column h can be denoted as a. w,h =[r w,h ,g w,h ,b w,h Based on the color of the target symbol geographic features, i.e., the RGB values, the color of all non-target symbol geographic features on the topographic map to be processed (width W, length H) can be set to white, i.e., R=255; G=255; B=255.
[0029] In some embodiments, to further facilitate subsequent processing, the topographic map to be processed after removing background interference is subjected to grayscale processing to obtain a single-channel grayscale image, which can be denoted as... .
[0030] For example, if the target symbol geographic feature is set to a graphic belonging to the pink color gamut, then after the preprocessing process of removing background interference and grayscale processing, only the graphic belonging to the pink color gamut is retained in the topographic map to be processed, and all other graphics are removed. Then, the topographic map with only the graphic belonging to the pink color gamut is subjected to grayscale processing to obtain the topographic map after processing, that is, the corresponding grayscale map.
[0031] like Figure 2 As shown, Figure 2 (a) is the original topographic map, i.e., the topographic map to be processed. If the target symbol geographic feature is set to the graphic belonging to the pink color gamut, then after the preprocessing process of removing background interference and grayscale processing, Figure 2 (b) is the processed topographic map, which is the corresponding grayscale image.
[0032] In some embodiments, a new one can also be created with Same size all-zero single-channel tag image Y∈R W×H , used to mark the location of target symbol geographic features.
[0033] In box 130, based on pattern matching, the grayscale image is traversed according to a preset geographic feature template until the grayscale image has been traversed by the preset geographic feature template, obtaining the geographic coordinates of all target symbol geographic features in the grayscale image; the traversal includes calculating the similarity between the grayscale image matrix corresponding to the preset geographic feature template and the submatrix on the grayscale image that has the same size as the preset geographic feature template, obtaining candidate feature points; determining identification feature points based on the candidate feature points, and using the coordinates corresponding to the center point of the identification feature point as the geographic coordinates of the target symbol geographic feature; and eliminating the symbol geographic features corresponding to the determined identification feature points according to the preset elimination rules and the preset geographic feature template.
[0034] In some embodiments, preset geographic feature templates can be set according to the user's actual operation.
[0035] In some embodiments, taking advantage of the fact that the size and orientation of the target symbol geographic feature remain unchanged, a preset geographic feature template with length K and width K is created by using the bounding rectangle of the target symbol geographic feature, and the corresponding grayscale matrix M∈i is obtained. K×K .
[0036] It should be noted that, to address issues such as uneven line thickness, blurriness, and aliasing of symbolic geographic features caused by improper printing or storage in the topographic map being processed, multiple target symbolic geographic features with visually identifiable line thicknesses can be selected from different topographic maps to create preset geographic feature templates. Typically, three preset geographic feature templates can be selected to represent fine, medium, and coarse features, respectively. In specific practical problems, the number of preset geographic feature templates can be determined based on the characteristics of the target symbolic geographic features and the quality of the topographic map. For example, if the aforementioned problems of uneven line thickness, blurriness, and aliasing of symbolic geographic features do not exist, only one preset geographic feature template can be selected.
[0037] In some embodiments, considering that the thickness of the topographic map lines for the target symbol geographic features varies in different scenarios, three elevation point templates, i.e., three preset geographic feature templates, will be created to represent elevation point features of different thicknesses. The grayscale matrix corresponding to the three preset geographic feature templates, i.e., M, is... 1 ∈i K×K M 2 ∈i K×K M 3 ∈i K×K K can be set to 19.
[0038] In some embodiments, pattern matching is used, employing the three preset geographic feature templates mentioned above, to perform traversal matching on the grayscale image model. That is, taking the position of the upper left corner of the grayscale image as the zero point, the similarity is calculated row by row and column by column with the K×K, such as 19×19, submatrix on the grayscale image from left to right and from top to bottom. Based on the preset threshold, it is determined whether the current traversal position is a candidate feature point.
[0039] In some embodiments, a matching bubble algorithm can be designed to determine whether a candidate feature point is a real symbolic feature, i.e., to identify the feature point. This mainly involves comparing the similarity between the submatrix to the right and below the candidate feature point and a preset geographic feature template to determine whether the current candidate feature point is the optimal candidate location.
[0040] like Figure 3 As shown, in order to eliminate the influence of the target symbol geographic features corresponding to the identified feature points in the current traversal on subsequent traversals, such as when different vector results are calculated based on a single identified target symbol geographic feature, a preset geographic feature template can be used to eliminate the currently identified target symbol geographic features, i.e., to eliminate the identifier.
[0041] In some embodiments, the preset elimination rule may include: .
[0042] In summary, the above methods are applicable to various file formats such as scanned topographic maps and electronic topographic maps. They are well-suited for symbolic geographic features in topographic maps whose size, shape, and color remain unchanged. Furthermore, they effectively address the color mixing problem caused by the overlapping of numerous geographic features such as contour lines, roads, and rivers. With minimal manpower, material resources, and time costs, these methods are suitable for the automatic identification of symbolic geographic features in large batches of topographic maps.
[0043] According to the embodiments of this disclosure, the following technical effects are achieved: Obtaining to-be-processed topographic maps and target symbol geographic features; then preprocessing the to-be-processed topographic map according to the target symbol geographic features to obtain a corresponding grayscale image; then traversing the grayscale image according to a preset geographic feature template based on pattern matching until the grayscale image is completely traversed by the preset geographic feature template, so as to obtain the geographic coordinates of all target symbol geographic features in the grayscale image; the traversal comprises: calculating the similarity between the grayscale image matrix corresponding to the preset geographic feature template and the sub-matrix with the same size as the preset geographic feature template on the grayscale image to obtain candidate feature points; determining recognition feature points according to the candidate feature points, and taking the coordinates corresponding to the center point position of the recognition feature points as the geographic coordinates of the target symbol geographic features; eliminating the symbol geographic features corresponding to the determined recognition feature points according to the preset geographic feature template based on a preset elimination rule; based on the method, the grayscale image corresponding to the to-be-processed topographic map can be obtained through preprocessing, so as to eliminate the colors other than the color of the target symbol geographic features in the to-be-processed topographic map, thereby avoiding background interference to solve the problem of color aliasing. Meanwhile, template matching is used to traverse the grayscale image according to the preset geographic feature template, obtain the geographic coordinates of all target symbol geographic features in the grayscale image, and solve the problems caused by low quality and large quantity of topographic maps, thereby improving the automation degree of scanned topographic map interpretation.
[0044] In some embodiments, the step of preprocessing the to-be-processed topographic map according to the target symbol geographic features to obtain a corresponding grayscale image comprises: preprocessing the to-be-processed topographic map according to the RGB three-channel color set of the target symbol geographic features based on a preset color screening rule, so as to eliminate colors other than the color of the target symbol geographic features in the to-be-processed topographic map; performing grayscale processing on the preprocessed to-be-processed topographic map to obtain a corresponding grayscale image.
[0045] In some embodiments, based on a preset color screening rule, the interference from the rest is removed by eliminating colors except the elevation points and the elevation values in the to-be-processed topographic map.
[0046] In some embodiments, if Γ is the color set of the target symbol geographic features, the pixels after the background interference removal preprocessing can be recorded as , wherein the preset color screening rules comprise: .
[0047] In some embodiments, when the elevation points and the elevation values are the target symbol geographic features, through color analysis, the RGB three-channel color set of the elevation points belongs to the geographic features of the pink color gamut, that is Γ={r<255||r=g||b<r}, therefore, color screening is performed through the preset color screening rule, and the pixels after the background interference preprocessing is .
[0048] In some embodiments, after performing background interference removal preprocessing, the topographic map to be processed after background interference removal preprocessing will also be subjected to grayscale processing.
[0049] According to embodiments of this disclosure, based on preset color filtering rules, only pixels within the RGB three-channel color set of the target symbol geographic feature are retained in the topographic map to be processed, and pixels not within the color set are changed to white in order to remove interference from other geographic features of different colors and perform grayscale processing, which facilitates faster subsequent pattern matching.
[0050] In some embodiments, the above-mentioned preprocessing of the topographic map to be processed based on the target symbol geographic features to obtain the corresponding grayscale map further includes: Watermark removal is performed on the topographic map to be processed.
[0051] In some embodiments, for topographic maps containing watermark information interference, watermark removal processing can be performed on the topographic map to remove the interference of watermark information on subsequent processing.
[0052] In some embodiments, watermark information can be removed in batches from topographic maps using Photoshop.
[0053] According to embodiments of this disclosure, the above process can remove watermark information from the topographic map to be processed, thereby avoiding interference from the watermark information in subsequent processing.
[0054] In some embodiments, the calculation of the similarity between the grayscale image matrix corresponding to the preset geographic feature template and the sub-matrix on the grayscale image that has the same size as the preset geographic feature template to obtain candidate feature points includes: Calculate the distance between the grayscale matrix corresponding to the preset geographic feature template and the submatrix on the grayscale map that has the same size as the preset geographic feature template; Candidate feature points are determined based on distance and a preset matching threshold.
[0055] In some embodiments, the similarity can be calculated by using distance calculation methods such as Euclidean distance and cosine similarity to calculate the similarity between the grayscale image matrix corresponding to the preset geographic feature template and the submatrix on the grayscale image that has the same size as the preset geographic feature template.
[0056] In some embodiments, for ease of description, Euclidean distance will be selected as the similarity metric.
[0057] In some embodiments, the current traversal position (w, h) is taken as the top-left vertex, and K is the grayscale submatrix corresponding to the side length, denoted as S=A. w:w+K,h:h+K ∈i K×KFor example, S=A w:w+K,h:h+K ∈i 19×19 This allows us to determine whether the current traversal position is a candidate feature point.
[0058] In some embodiments, the Euclidean distances between the current submatrix S and the three preset geographic feature templates are first calculated, as shown below: .
[0059] Where d(S,M) represents the Euclidean distance between matrix S and matrix M.
[0060] In some embodiments, the minimum distance can be used as the similarity between the current submatrix and the preset geographic feature template, i.e., d * (S,M)=min{d1(S,M 1 ),d2(S,M 2 ),d3(S,M 3 )}.
[0061] In some embodiments, the preset matching threshold can be specifically set according to the user's actual needs, and the preset matching threshold is denoted as... If d * (S,M)≤ Mark (w,h) as a candidate feature point.
[0062] For example, after testing, a preset matching threshold can be set to 6. If d * If (S,M)≤6, mark (w,h) as a candidate feature point.
[0063] According to embodiments of this disclosure, the above-described method provides a specific way to calculate similarity, thereby obtaining candidate feature points and further improving the automation level of scanned topographic map interpretation.
[0064] In some embodiments, determining the identification feature points based on candidate feature points includes: Based on the bubble sort algorithm, the identification feature points are determined according to the candidate feature points.
[0065] In some embodiments, the preset matching threshold is determined based on the actual value of the Euclidean distance. On the one hand, finding an accurate threshold is difficult; a threshold that is too small will cause the target symbol geographic features to be missed, while a threshold that is too large will cause many non-target symbol geographic features to be identified. On the other hand, due to printing issues, different topographic maps have different thresholds.
[0066] In some embodiments, in order to improve the robustness of the preset matching threshold, a matching bubble method can be designed, that is, based on the bubble sorting algorithm, to determine whether the candidate feature point is a recognition feature point, that is, a real symbol feature.
[0067] In some embodiments, pattern matching is used to find the right neighbor submatrix of the currently determined candidate feature point during the traversal process, that is, the submatrix S with the top-left vertex position (w, h+1). R =A w:w+19,h+1:h+1+19 ∈i 19×19 The similarity is obtained by calculating its Euclidean distance from the preset geographic feature template, d. * (S R M)=min{d1(S R M 1 ),d2(S R M 2 ),d3(S R M 3 Compare the similarity d between the submatrix corresponding to the current traversed position and the preset geographic feature template. * (S,M) and right neighbor submatrix S R similarity d between the feature template and the feature template * (S R M). If d * (S,M)>d * (S R If , M), then (w, h) is removed as a candidate feature point, and the traversal continues. If d * (S,M)≤d * (S R If (w, h) is a candidate feature point, then (w, h) is kept as the candidate feature point. Continue to find its next-neighbor submatrix, that is, the submatrix S with its top-left vertex at (w+1, h). B =A w+1:w+1+19,h:h+19 ∈i 19×19 The similarity is obtained by calculating its Euclidean distance from the preset geographic feature template, d. * (S B M)=min{d1(S B M 1 ),d2(S B M 2 ),d3(S B M 3 Compare the similarity d between the current submatrix and the preset geographic feature template. * (S,M) and the next neighbor submatrix S B similarity d between the preset geographic feature template * (S R M). If d * (S,M)>d * (S R If , M), then (w, h) is removed as a candidate feature point, and the traversal continues. If d * (S,M)≤d* (S R If (w,h) is a given point, then (w,h) is marked as the identification feature point, and its center point position is marked, i.e., y w+K / / 2,h+K / / 2 =1, such as y w+9,h+9 =1. Here, / / represents the integer division symbol.
[0068] In some embodiments, pattern matching is used, such as traversing the grayscale image corresponding to the topographic map to be processed in a sliding window manner to match the target symbol geographic features, thereby obtaining the absolute image coordinates of the target symbol geographic features, and then obtaining the geographic coordinates of the target symbol geographic features, thus completing the vectorization of the target symbol geographic features.
[0069] In some embodiments, for determining the identified feature points based on candidate feature points using the bubble sort algorithm, the above pattern matching algorithm can be as follows: Input: Grayscale image A∈i W×H Element Template M 1 ∈i K×K M 2 ∈i K×K M 3 ∈i K×K threshold ; while w <W-K do while h <H-K do S=A w:w+K,h:h+K ; d * (S,M)=min{d1(S,M 1 ),d2(S,M 2 ),d3(S,M 3 )}; if d * (S,M)≤
[0070] if h+ <H-K S R =A w:w+K,h+1:h+1+K ; d * (S R M)=min{d1(S R M 1 ),d2(S R M 2 ),d3(S R M 3 )}; if d * (S,M)>d * (S R M) j = j + 1; continue? elif w+1 <W-K S B =A w+1:w+1+K,h:h+K ; d * (S B M)=min{d1(S B M 1 ),d2(S B M 2 ),d3(S B M 3 )}; if d * (S,M)>d * (S R M) j = j + 2; continue? y w+K / / 2,h+K / / 2 =1; ; h = h + 1; w = w + 1.
[0071] According to embodiments of this disclosure, the above-described method provides a specific way to determine and identify feature points, further improving the automation level of scanned topographic map interpretation.
[0072] In some embodiments, the aforementioned preset geographic feature template is obtained by cropping the grayscale image based on the bounding rectangle of the target symbol geographic feature.
[0073] In some embodiments, to improve processing efficiency, the grayscale image obtained after preprocessing can be directly cropped to obtain a preset geographic feature template, thus completing the template creation.
[0074] According to embodiments of this disclosure, a specific template creation method is provided through the above-described approach, thereby improving the efficiency of template creation.
[0075] In some embodiments, the aforementioned preset geographic feature template is obtained by cropping the topographic map to be processed based on the bounding rectangle of the target symbol geographic feature, and then preprocessing the cropped topographic map based on the target symbol geographic feature.
[0076] In some embodiments, to improve the accuracy of the template, the topographic map to be processed can be directly cropped according to the bounding rectangle of the target symbol geographic feature. Then, based on the color of the target symbol geographic feature, a preset geographic feature template is obtained through preprocessing such as background interference and grayscale processing, thus completing the template creation.
[0077] According to embodiments of this disclosure, a specific template creation method is provided through the above-described approach, thereby improving the accuracy of template creation.
[0078] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, because according to this disclosure, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this disclosure.
[0079] The above is an introduction to the method embodiments. The following describes the solution described in this disclosure further through device embodiments.
[0080] Figure 4 A block diagram of a pattern-matching-based symbolic geographic feature vectorization apparatus 400 according to an embodiment of the present disclosure is shown. Figure 4 As shown, the device 400 includes: The acquisition module 410 is used to acquire the topographic map to be processed and the geographic features of the target symbol; Processing module 420 is used to preprocess the topographic map to be processed based on the geographic features of the target symbols to obtain the corresponding grayscale map; The processing module 420 is further configured to traverse the grayscale image based on pattern matching and a preset geographic feature template until the grayscale image has been traversed by the preset geographic feature template, thereby obtaining the geographic coordinates of all target symbol geographic features in the grayscale image. The traversal includes calculating the similarity between the grayscale image matrix corresponding to the preset geographic feature template and a submatrix on the grayscale image that is the same size as the preset geographic feature template, thereby obtaining candidate feature points. Based on the candidate feature points, identification feature points are determined, and the coordinates corresponding to the center point of the identification feature points are used as the geographic coordinates of the target symbol geographic features. Based on preset elimination rules, the symbol geographic features corresponding to the determined identification feature points are eliminated according to the preset geographic feature template.
[0081] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the described module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0082] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0083] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0084] Figure 5 A block diagram of an exemplary electronic device 500 capable of implementing embodiments 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, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0085] Electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in ROM 502 or a computer program loaded into RAM 503 from storage unit 508. RAM 503 can also store various programs and data required for the operation of electronic device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. I / O interface 505 is also connected to bus 504.
[0086] Multiple components in electronic device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows electronic device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0087] Computing unit 501 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Computing unit 501 performs the various methods and processes described above, such as method 100. For example, in some embodiments, method 100 may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 508.
[0088] In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by computing unit 501, one or more steps of method 100 described above may be performed. Alternatively, in other embodiments, computing unit 501 may be configured to perform method 100 by any other suitable means (e.g., by means of firmware).
[0089] 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 products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0090] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0091] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0092] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, 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 voice input, speech input, or tactile input).
[0093] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0094] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0095] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0096] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for vectorizing symbolic geographic features based on pattern matching, characterized in that, include: Acquire the topographic map to be processed and the geographic features of the target symbols; The topographic map to be processed is preprocessed based on the target symbol geographic elements to obtain the corresponding grayscale map; The step of preprocessing the topographic map to be processed according to the target symbol geographic features to obtain the corresponding grayscale image includes: preprocessing the topographic map to be processed according to the RGB three-channel color set of the target symbol geographic features based on preset color filtering rules, so as to eliminate colors in the topographic map to be processed other than the colors of the target symbol geographic features; and performing grayscale processing on the preprocessed topographic map to obtain the corresponding grayscale image. Based on pattern matching, the grayscale image is traversed according to a preset geographic feature template until the grayscale image has been completely traversed by the preset geographic feature template, thereby obtaining the geographic coordinates of all target symbol geographic features in the grayscale image. The traversal includes calculating the similarity between the grayscale image matrix corresponding to the preset geographic feature template and a submatrix on the grayscale image that has the same size as the preset geographic feature template, thereby obtaining candidate feature points; identifying feature points based on the candidate feature points, and using the coordinates corresponding to the center point of the identified feature point as the geographic coordinates of the target symbol geographic feature; based on a preset elimination rule, when different vector results are calculated based on an identified target symbol geographic feature, the symbol geographic feature corresponding to the identified feature point is eliminated according to the preset geographic feature template. The process of determining the identification point based on the candidate point includes: using a bubble sort algorithm, determining whether the current candidate point is the best candidate point location by comparing the similarity between the submatrix to the right and below the candidate point and the preset geographic feature template.
2. The method according to claim 1, characterized in that, The step of preprocessing the topographic map to be processed based on the target symbol geographic features to obtain the corresponding grayscale map further includes: The topographic map to be processed is then subjected to watermark removal.
3. The method according to claim 1, characterized in that, The similarity between the grayscale image matrix corresponding to the preset geographic feature template and the sub-matrix of the grayscale image that has the same size as the preset geographic feature template is calculated to obtain candidate feature points, including: Calculate the distance between the grayscale image matrix corresponding to the preset geographic feature template and the submatrix on the grayscale image that has the same size as the preset geographic feature template; Candidate feature points are determined based on the distance and the preset matching threshold.
4. The method according to any one of claims 1 to 3, characterized in that, The preset geographic element template is obtained by cropping the grayscale image based on the bounding rectangle of the target symbol geographic element.
5. The method according to any one of claims 1 to 3, characterized in that, The preset geographic element template is obtained by cropping the topographic map to be processed based on the bounding rectangle of the target symbol geographic element, and then preprocessing the cropped topographic map based on the target symbol geographic element.
6. A device for vectorizing symbolic geographic features based on pattern matching, characterized in that, include: The acquisition module is used to acquire the topographic map to be processed and the geographic features of the target symbols; The processing module is used to preprocess the topographic map to be processed based on the target symbol geographic features to obtain the corresponding grayscale map; The processing module is specifically used to preprocess the topographic map to be processed based on a preset color filtering rule and according to the RGB three-channel color set of the target symbol geographic element, so as to eliminate colors in the topographic map to be processed other than the color of the target symbol geographic element. The preprocessed topographic map to be processed is subjected to grayscale processing to obtain the corresponding grayscale image; The processing module is further configured to traverse the grayscale image based on pattern matching and a preset geographic feature template until the grayscale image has been traversed by the preset geographic feature template, thereby obtaining the geographic coordinates of all target symbol geographic features in the grayscale image. The traversal includes calculating the similarity between the grayscale image matrix corresponding to the preset geographic feature template and a submatrix on the grayscale image that is the same size as the preset geographic feature template, thereby obtaining candidate feature points. Based on the candidate feature points, identification feature points are determined, and the coordinates corresponding to the center point of the identification feature point are used as the geographic coordinates of the target symbol geographic features. Based on preset elimination rules, when different vector results are calculated based on an identified target symbolic geographic feature, the symbolic geographic features corresponding to the identified feature points are eliminated according to the preset geographic feature template; wherein, determining the identified feature points according to the candidate feature points includes: based on the bubble sort algorithm, determining whether the current candidate feature point is the best candidate point position by comparing the similarity between the submatrix to the right and below the candidate feature point and the preset geographic feature template.
7. An electronic device, characterized in that, include: At least one processor; as well as A memory that is communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in any one of claims 1-5.
8. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-5.
Citation Information
Patent Citations
Soldered ball surface defect detection device and method based on machine vision
CN101424645A
Quantitative colloidal gold test paper detection method and system based on computer vision
CN117058359A
Method and device for supporting confirmation of map symbol recognition result, and recording medium
JP2002063545A