Hierarchical statistical map legend element automatic recognition and extraction method and device
By using density-based clustering algorithms and image semantic segmentation models, automatic identification and extraction of legend elements in hierarchical statistical maps were achieved, solving the problem of inaccurate identification in existing technologies and improving the accuracy and adaptability of identification and extraction.
Patent Information
- Application Number
- CN202511277327.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-09
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2045-09-09
AI Technical Summary
Existing technologies lack robustness and universality in the identification and extraction of legend elements in hierarchical statistical maps, making it difficult to adapt to the actual needs of diverse map styles and unstructured layouts.
A density-based clustering algorithm is adopted. By performing a binarization masking operation on the hierarchical statistical map, the main map region is identified and segmented, the working domain of the non-main map region is obtained, and the pixel points of the legend elements are filtered by two clustering operations. The legend color blocks and hierarchical explanatory text are extracted by combining the image semantic segmentation model.
It improves the accuracy of legend feature identification and extraction, adapts to the needs of diverse map styles and unstructured layout, and ensures flexibility and robustness.
Smart Images

Figure CN120783364B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cartography and geographic information system, and particularly relates to a hierarchical statistical map legend element automatic identification and extraction method and device. BACKGROUND
[0002] A hierarchical statistical map is a thematic map, and different colors can be used to correspond to the numerical value of the data in a spatial unit. Key elements of a hierarchical statistical map generally include: a map name, a legend, a main map and auxiliary elements, etc. The map name indicates the theme, spatial range and other information expressed by the map; the legend generally includes a legend color block and its corresponding hierarchical description; the main map generally includes a base layer and a thematic layer; map notes, scales, small maps, compasses, etc. all belong to auxiliary elements, which are used to assist in understanding the map. Figure One
[0003] In the field of geographic information systems and map making, map interpretation is an important link to realize intelligent application of maps. Map interpretation not only involves the identification of symbols, labels and visual elements on the map, but also requires comprehensive deconstruction and analysis of the spatial structure, statistical unit and semantic connotation expressed by the map. Under this background, how to realize fast and accurate interpretation of map content with the help of intelligent methods has become the key to technical development.
[0004] In a hierarchical statistical map (Choropleth map), the map legend contains a lot of information, and is an important part of map interpretation. The legend clearly shows the correspondence between color and numerical interval, so that the reader can correctly interpret the quantitative information behind the color and understand the comparison relationship and distribution pattern between regions.
[0005] With the development of deep learning technology in the field of image segmentation, automatic identification and extraction of map elements have been gradually realized in the task of intelligent map interpretation. However, the current technology can accurately process text information in the map, but there are still deficiencies in the identification of legend elements, which affects map analysis. In traditional intelligent map interpretation tasks, the identification and extraction of legend elements often rely on manual annotation or rule setting, but lack of robustness and universality, and are difficult to adapt to the actual needs of map style diversification and unstructured layout.
[0006] Therefore, it is necessary to provide a hierarchical statistical map legend element automatic identification and extraction method. SUMMARY
[0007] The present application provides a hierarchical statistical map legend element automatic identification and extraction method and device. The technical scheme is as follows:
[0008] On the one hand, a hierarchical statistical map legend element automatic identification and extraction method is provided, and the method comprises:
[0009] obtain a hierarchical statistical map to be identified, and identify and segment a main map region from the hierarchical statistical map;
[0010] perform a binary mask operation on the main map region in the hierarchical statistical map based on the segmentation result of the main map region, to obtain a working domain of a non-main map region;
[0011] perform two times of clustering on pixel points in the working domain in sequence by using a density-based clustering algorithm according to spatial position distribution of the legend element in the hierarchical statistical map, to gradually filter out pixel points belonging to the legend element, and identify a target legend;
[0012] perform legend color block extraction and hierarchical description text extraction on the identified target legend, to obtain an extraction result.
[0013] On the other hand, a hierarchical statistical map legend element automatic identification and extraction device is provided, which comprises:
[0014] an obtaining unit, configured to obtain a hierarchical statistical map to be identified, and identify and segment a main map region from the hierarchical statistical map;
[0015] a mask unit, configured to perform a binary mask operation on the main map region in the hierarchical statistical map based on the segmentation result of the main map region, to obtain a working domain of a non-main map region;
[0016] an identifying unit, configured to perform two times of clustering on pixel points in the working domain in sequence by using a density-based clustering algorithm according to spatial position distribution of the legend element in the hierarchical statistical map, to gradually filter out pixel points belonging to the legend element, and identify a target legend;
[0017] an extracting unit, configured to perform legend color block extraction and hierarchical description text extraction on the identified target legend, to obtain an extraction result.
[0018] On the other hand, a computer device is provided, which comprises a memory and a processor, the memory is configured to store a computer program, and the processor is configured to execute the computer program stored in the memory, to realize steps of the hierarchical statistical map legend element automatic identification and extraction method.
[0019] On the other hand, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to realize steps of the hierarchical statistical map legend element automatic identification and extraction method.
[0020] In another aspect, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the hierarchical statistical map legend element automatic identification and extraction method described above.
[0021] The technical solution provided by the present application can bring at least the following beneficial effects:
[0022] In the embodiment of the present application, the identification and extraction of the legend element is divided into two processes, i.e., the identification of the legend element and the extraction of the legend information, which are performed in sequence. In the identification process of the legend element, the working domain of the non-main graph region is first obtained, and then the pixel points in the working domain are clustered twice in sequence according to the spatial position distribution of the legend element in the hierarchical statistical map by using the density-based clustering algorithm, so as to gradually filter out the pixel points belonging to the legend element, thereby identifying the target legend. After the target legend is obtained, the extraction of the legend information is performed, thereby obtaining the extraction result of the target legend. The present solution can adapt to the actual needs of diversified map styles and unstructured layout modes, and can improve the accuracy of the identification and extraction of the legend element while ensuring flexibility and robustness. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0024] Figure 1 is a flow chart of a hierarchical statistical map legend element automatic identification and extraction method provided by an embodiment of the present application;
[0025] Figure 2 is a flow chart of a legend identification process provided by an embodiment of the present application;
[0026] Figure 3 is a flow chart of a legend information extraction process provided by an embodiment of the present application;
[0027] Figure 4 is a structural diagram of a hierarchical statistical map legend element automatic identification and extraction device provided by an embodiment of the present application;
[0028] Figure 5 is a hardware architecture diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0029] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0030] Please refer to Figure 1 The embodiment of the present application provides a hierarchical statistical map legend element automatic identification and extraction method, which comprises the following steps:
[0031] Step 100: acquiring a hierarchical statistical map to be identified, and identifying and segmenting a main map region from the hierarchical statistical map;
[0032] Step 102: based on the segmentation result of the main map region, performing a binary mask operation on the main map region in the hierarchical statistical map to obtain a work domain of a non-main map region;
[0033] Step 104: using a density-based clustering algorithm, performing twice clustering on pixel points in the work domain according to the spatial position distribution of the legend element in the hierarchical statistical map, to gradually filter out the pixel points belonging to the legend element, and identifying a target legend;
[0034] Step 106: performing legend color block extraction and hierarchical description text extraction on the identified target legend to obtain an extraction result.
[0035] In the embodiment of the present application, the identification and extraction of the legend element are divided into two processes of identification of the legend element and extraction of the legend information, which are performed in sequence. In the identification process of the legend element, first, the work domain of the non-main map region is acquired, and then the density-based clustering algorithm is used to perform twice clustering on the pixel points in the work domain according to the spatial position distribution of the legend element in the hierarchical statistical map, to gradually filter out the pixel points belonging to the legend element, so as to identify the target legend. After the target legend is obtained, the extraction of the legend information is performed, so as to obtain the extraction result of the target legend. The present scheme can adapt to the actual needs of diversified map styles and unstructured layout modes, and can improve the accuracy of identification and extraction of the legend element while ensuring flexibility and robustness.
[0036] In the embodiment of the present application, steps 100 to 104 are the identification process of the legend element, and step 106 is the extraction process of the legend information. Please refer to Figure 2 and Figure 3 , Figure 2 is a flowchart of the legend identification process, Figure 3 is a flowchart of the legend information extraction process. The following will be described with reference to Figure 2and Figure 3 To Figure 1 The execution manner of each step shown in the figure is described.
[0037] First, the steps 100 and 102 are described simultaneously.
[0038] In the embodiment of the application, the hierarchical statistical map to be identified can be in a raster image format such as png / jpg / jpeg, and when the main map area is identified and segmented, an adaptive resolution adjustment algorithm of an image semantic segmentation model SAM (Segment Anything Model) can be used, without the need for map size preprocessing. Specifically, the image semantic segmentation model is used to construct a text-image dual-modal feature mapping space in combination with a semantic parsing mechanism, and a text prompt vector with clear semantics such as “main map” or “map” is injected to identify and segment the main map area in a text-image alignment mechanism. The main map area is the main body area of the map, please refer to Figure 2 The second step in the figure is the main map area.
[0039] After the main map area is segmented, a binary mask operation can be performed on the segmented main map area based on the segmentation result of the main map area. This step preserves the spatial topology structure of the non-main map area, providing a denoised work domain for subsequent legend detection, please refer to Figure 2 The third step in the figure is the work domain of the non-main map area obtained.
[0040] Then, for step 104, a density-based clustering algorithm is used to perform two clustering operations on the pixel points in the work domain according to the spatial position distribution of the legend elements in the hierarchical statistical map, to gradually filter out the pixel points belonging to the legend elements, and to identify the target legend.
[0041] In the embodiment of the application, in order to identify the legend elements from the work domain, a density-based clustering algorithm can be used. Specifically, this step can include:
[0042] Step 1040: binary processing is performed on the work domain to achieve foreground and background segmentation;
[0043] Step 1042: the first minimum sampling pixel number is used to sample the foreground pixel points in the work domain for the first time, and the first clustering radius is used to cluster the pixel points obtained by this sampling to obtain a plurality of first clusters;
[0044] Step 1044: For each one-time clustering, it is determined whether the one-time clustering is a potential legend area by using a set condition, and if not, the one-time clustering is removed.
[0045] Step 1046: The pixel points in the remaining one-time clustering after removal are secondly sampled by using a second minimum sampling pixel point, and the pixel points obtained by the sampling are clustered by using a second clustering radius, and the circumscribed rectangle area corresponding to the secondary clustering with the most pixel points is taken as a target legend; the second minimum sampling pixel number is greater than the first minimum sampling pixel number, and the second clustering radius is greater than the first clustering radius.
[0046] In the two clustering processes of the embodiment of the application, the minimum sampling pixel point and the clustering radius are set, and the parameter values of the two parameters in the first clustering are smaller than the parameter values set in the second clustering, because the first clustering faces all the pixel points in the entire working domain, and the number of pixel points is large, if the minimum sampling pixel point and the clustering radius are too large, the pixel points not belonging to the same class may be clustered as the same class, therefore, the first minimum sampling pixel point and the first clustering radius are set to be small, for example, the first minimum sampling pixel point is 10, and the first clustering radius is 10 pixel points, then the pixel points belonging to the same class can be clustered as the same class to obtain a plurality of one-time clusterings. In the second clustering, because the clusterings not being the potential legend area are removed in step 1044, the number of remaining pixel points is small, and the clustering parameters are more relaxed than the first clustering, but the information should not be lost in the clustering process, therefore, the second minimum sampling pixel point and the second clustering radius need to be set appropriately, for example, the second minimum sampling pixel point is 20, and the second clustering radius is 60 pixel points, so that the legend features can be more finely aggregated.
[0047] In step 1044, a plurality of one-time clusterings are obtained after the first clustering, in order to filter out inappropriate clusterings, each one-time clustering can be identified by using a set condition.
[0048] In an embodiment of the application, when it is determined whether the one-time clustering is a potential legend area by using a set condition, the one-time clustering can be identified by using at least one of the following conditions:
[0049] The first condition: it is determined whether the area of the circumscribed rectangle of the one-time clustering is within a set area threshold range, and if yes, the one-time clustering is a potential legend area.
[0050] The second condition: it is determined whether the clustering center of the one-time clustering is within a set area, and if yes, the one-time clustering is a potential legend area.
[0051] In the first condition, since the legend area in the hierarchical statistical map is generally rectangular, and the area of the legend area has a certain proportion in the entire hierarchical statistical map, whether the area of the circumscribed rectangle is within a set area threshold range can be used to determine whether the primary cluster is a potential legend area. In an implementation, the area threshold range can be implemented by the number of pixels of the legend area; for example, the area threshold range is that the number of pixels is not less than 100 pixels and not more than 500 pixels; in another implementation, the area threshold range can also be implemented by the proportion of the legend area in the entire hierarchical statistical map; for example, the area threshold range is that the area proportion of the legend area to the hierarchical statistical map is not less than 1 / 4 and not more than 1 / 3. Thus, whether the area of the circumscribed rectangle of the primary cluster is within the set area threshold range can be determined, and if yes, it indicates that the primary cluster is a potential legend area, otherwise, the primary cluster is removed.
[0052] In the second condition, since the legend area in the hierarchical statistical map is generally located at a specified position, such as the lower left or upper left of the entire hierarchical statistical map, the position of the legend area can be determined in advance to input a set region; for example, the set region is a rectangular region, and the four vertices of the rectangular region are expressed by the positions of the four pixels of the rectangular region. Thus, whether the position of the cluster center of the primary cluster is within the set region can be determined, and if yes, it indicates that the primary cluster is a potential legend area, otherwise, the primary cluster is removed.
[0053] By using the set conditions to screen the primary clusters, noise points can be removed, and primary clusters belonging to potential legend areas are retained.
[0054] Further, in order to ensure that the retained region has sufficient spatial information, a specified number of primary clusters with the most pixels can also be selected from the primary clusters screened by the above two set conditions, for subsequent secondary cluster analysis on the specified number of primary clusters with the most pixels.
[0055] In the secondary cluster analysis, since the appropriate second minimum sampling pixel and the second cluster radius are set, the number of pixels contained in the obtained secondary clusters will be more relative to the primary clusters, and for the working domain from which the main map area is removed, the legend element belongs to the area with the largest area, so in the obtained multiple secondary clusters, the circumscribed rectangle region corresponding to the secondary cluster with the most pixels is directly determined as the target legend. In this way, the integrity and accuracy of the finally extracted legend area can be ensured.
[0056] The legend element identification process of the embodiment of the present application ensures identification accuracy and improves processing efficiency; and the identification process can be used to identify the legend element regardless of the map style and layout mode of the hierarchical statistical map, ensuring robustness and universality of the identification process.
[0057] After obtaining the target legend, the target legend can be segmented. In one implementation, when segmenting the target legend, a certain buffer area can be added on the basis of the circumscribed rectangle to ensure that the legend part of the hierarchical statistical map is cut out.
[0058] Finally, for step 106, the target legend identified is subjected to legend color block extraction and hierarchical description text extraction to obtain an extraction result.
[0059] The extraction of the legend information includes two aspects of information, one is the legend color block, and the other is the hierarchical description text corresponding to the legend color block. In the embodiment of the present application, the extraction process is described with reference to Figure 3 The extraction method can include the following steps 1060-1066:
[0060] Step 1060: obtaining a legend picture obtained after segmenting the target legend;
[0061] Step 1062: automatically segmenting the legend picture by using an image semantic segmentation model to obtain a plurality of segmentation objects;
[0062] Step 1064: screening the plurality of segmentation objects by using a mask method to obtain a plurality of legend color blocks;
[0063] In the embodiment of the present application, in the mask screening process, at least any one of the following features can be used for screening: mask quality score, mask area proportion of the legend picture, and mask shape feature; so that the masks that do not meet the requirements can be excluded.
[0064] In one implementation, the mask quality score can be automatically generated by the semantic segmentation model, and the parameters are set to be that the stability score is greater than a first set value (such as 0.98) and the predicted intersection over union is greater than a second set value (such as 0.98).
[0065] In one implementation, the mask area proportion of the legend picture can be calculated by the ratio of the number of mask pixel points to the total number of pixel points of the legend picture. For example, it is required to be greater than 0.005 and less than 0.03.
[0066] In one implementation, the mask shape feature can be achieved through the mask's aspect ratio. For example, the aspect ratio must be greater than 0.2 and less than 0.6. Considering that a group of legend color blocks usually have similar aspect ratios, masks with aspect ratios exceeding a third preset value (set according to actual needs, such as 0.15) can be further removed.
[0067] After filtering through the mask as described above, not only can the accuracy and completeness of the legend information be guaranteed, but duplicates can also be removed.
[0068] Step 1066: Sort the legend color blocks according to their coordinates, calculate the bounding rectangle of the corresponding hierarchical explanatory text for each legend color block in order of sorting, and cut the entire hierarchical explanatory text according to the bounding rectangle of each hierarchical explanatory text. Then, perform text recognition on the cut hierarchical explanatory text to obtain the legend color blocks and their corresponding hierarchical explanatory text.
[0069] After extracting valid legend color blocks, in order to ensure their association with hierarchical explanatory text and avoid confusion after legend color block segmentation, the legend color blocks can be sorted according to their coordinates. Then, the bounding rectangle of the corresponding hierarchical explanatory text is calculated for each legend color block in sequence according to the sorting. This achieves spatial association between legend color blocks and corresponding hierarchical explanatory text, ensuring the correct mapping between legend color blocks and corresponding hierarchical explanatory text after subsequent text recognition, and avoiding the problem of legend color blocks and hierarchical explanatory text not corresponding after segmentation.
[0070] In one implementation, the step of calculating the bounding rectangle of the corresponding hierarchical explanatory text for each legend color block in sequence, and then segmenting the entire hierarchical explanatory text according to the bounding rectangle of each hierarchical explanatory text, includes:
[0071] For the i-th legend color block, calculate the bounding rectangle of the corresponding hierarchical explanatory text using the following formula:
[0072]
[0073]
[0074]
[0075] Where a and b are the length and width of the bounding rectangle of the hierarchical description text corresponding to the i-th color block. For the first The center coordinates of each color block For the first The maximum and minimum values of the x-coordinate of each color block For the first Each color block corresponds to the coordinates of the four vertices of the outer rectangle of the hierarchical explanatory text. the length and the width of the legend picture; for representing columns, for representing rows;
[0076] the four vertex coordinates of the circumscribed rectangle of the plurality of color blocks are arranged in order, and a circumscribed rectangle of the entire hierarchical description text is obtained by cutting the entire hierarchical description text using the circumscribed rectangle of the entire hierarchical description text.
[0077] That is, the first vertex coordinate the minimum value of the vertex coordinates of the circumscribed rectangle of the plurality of color blocks is selected as the first vertex coordinate of the circumscribed rectangle of the entire hierarchical description text ; the second vertex coordinate the minimum value of the vertex coordinates of the circumscribed rectangle of the plurality of color blocks is selected as the second vertex coordinate of the circumscribed rectangle of the entire hierarchical description text ; the third vertex coordinate the maximum value of the vertex coordinates of the circumscribed rectangle of the plurality of color blocks is selected as the third vertex coordinate of the circumscribed rectangle of the entire hierarchical description text ; and the fourth vertex coordinate the maximum value of the vertex coordinates of the circumscribed rectangle of the plurality of color blocks is selected as the fourth vertex coordinate of the circumscribed rectangle of the entire hierarchical description text .
[0078] In the text recognition of the segmented hierarchical description text, an OCR recognition system can be used to obtain the hierarchical description text corresponding to the legend color block.
[0079] In the embodiment of the present application, the extraction process of the legend information is described in detail in the following. Figure 3 ,
[0080] After the legend information is extracted, the map metadata corresponding to the hierarchical statistical map and the legend information can be stored in the hierarchical statistical map database to ensure long-term storage and repeatable analysis of the data.
[0081] Referring to Figure 4 , the embodiment of the present application provides a device for automatically identifying and extracting legend elements of a hierarchical statistical map, which comprises:
[0082] The acquisition unit 400 is configured to acquire a hierarchical statistical map to be identified, and identify and segment a main map region from the hierarchical statistical map.
[0083] The mask unit 402 is configured to perform a binary mask operation on the main map region in the hierarchical statistical map based on the segmentation result of the main map region, to obtain a working domain of a non-main map region.
[0084] The recognition unit 404 is configured to perform two times of clustering on the pixel points in the working area according to the spatial position distribution of the legend element in the hierarchical statistical map by using a density-based clustering algorithm, so as to gradually filter the pixel points belonging to the legend element, and to recognize the target legend.
[0085] The extraction unit 406 is configured to perform legend color block extraction and hierarchical description text extraction on the target legend recognized by the recognition unit 406, and to obtain an extraction result.
[0086] In an embodiment of the present application, the recognition unit is specifically configured to perform the following operations:
[0087] The working area is subjected to binarization processing to realize foreground and background segmentation;
[0088] The first minimum sampling pixel number is used to perform first sampling on the pixel points of the foreground in the working area, and the first clustering radius is used to perform clustering on the pixel points obtained by the sampling, to obtain a plurality of primary clusters;
[0089] For each primary cluster, the following operation is performed: whether the primary cluster is a potential legend area is identified by using a set condition, and if not, the primary cluster is excluded;
[0090] The second minimum sampling pixel number is used to perform second sampling on the pixel points in the primary cluster remaining after the exclusion, and the second clustering radius is used to perform clustering on the pixel points obtained by the sampling, and the circumscribed rectangle area corresponding to the secondary cluster with the most pixel points is taken as the target legend; the second minimum sampling pixel number is greater than the first minimum sampling pixel number, and the second clustering radius is greater than the first clustering radius.
[0091] In an embodiment of the present application, when the recognition unit performs the operation of identifying whether the primary cluster is a potential legend area by using a set condition, the operation specifically includes: determining whether the area of the circumscribed rectangle of the primary cluster is within a set area threshold range, and if yes, the primary cluster is a potential legend area.
[0092] In an embodiment of the present application, when the recognition unit performs the operation of identifying whether the primary cluster is a potential legend area by using a set condition, the operation specifically includes: determining whether the clustering center of the primary cluster is within a set area, and if yes, the primary cluster is a potential legend area.
[0093] In an embodiment of the present application, the extraction unit is specifically configured to perform the following operations:
[0094] The legend picture obtained after the target legend is segmented is acquired;
[0095] The image is automatically segmented using an image semantic segmentation model to obtain multiple segmentation objects;
[0096] For the multiple segmented objects, a mask method is used for filtering to obtain several legendary color blocks;
[0097] The legend color blocks are sorted according to their coordinates. The bounding rectangle of the corresponding hierarchical explanatory text is calculated for each legend color block in sequence. The entire hierarchical explanatory text is then segmented based on the bounding rectangle of each hierarchical explanatory text. Text recognition is then performed on the segmented hierarchical explanatory text to obtain the legend color blocks and their corresponding hierarchical explanatory text.
[0098] In one embodiment of the present invention, when the extraction unit performs the step of calculating the bounding rectangle of the corresponding hierarchical explanatory text for each legend color block in order of sorting, and cutting the entire hierarchical explanatory text according to the bounding rectangle of each hierarchical explanatory text, the specific steps include:
[0099] For the i-th legend color block, calculate the bounding rectangle of the corresponding hierarchical explanatory text using the following formula:
[0100]
[0101]
[0102]
[0103] Where a and b are the length and width of the bounding rectangle of the hierarchical description text corresponding to the i-th color block. For the first The center coordinates of each color block For the first The maximum and minimum values of the x-coordinate of each color block For the first Each color block corresponds to the coordinates of the four vertices of the outer rectangle of the hierarchical explanatory text. The length and width of the illustration image; Used to characterize columns, Used to represent rows;
[0104] Given the coordinates of the four vertices of the bounding rectangle of multiple color blocks, according to Arrange them sequentially to obtain the bounding rectangle of the entire hierarchical description text, and then use the bounding rectangle of the entire hierarchical description text to cut the entire hierarchical description text.
[0105] It should be noted that: the hierarchical statistical map legend element automatic identification and extraction device provided by the above embodiment is only exemplified by the division of the above functional modules. In actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the hierarchical statistical map legend element automatic identification and extraction device and the hierarchical statistical map legend element automatic identification and extraction method provided by the above embodiment belong to the same concept, and the specific implementation process is described in the method embodiment. Here, it is not repeated.
[0106] Embodiments of the present application also provide a computer device, which refers to Figure 5 The computer device includes a processor and a memory, and the memory stores at least one instruction, at least one program, a code set or an instruction set. The at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the hierarchical statistical map legend element automatic identification and extraction method provided by the above method embodiments.
[0107] Embodiments of the present application also provide a computer readable storage medium, which stores at least one instruction, at least one program, a code set or an instruction set. The at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the hierarchical statistical map legend element automatic identification and extraction method provided by the above method embodiments.
[0108] Embodiments of the present application also provide a computer program product, which includes a computer program. The processor of the computer device reads the computer program from the computer readable storage medium. The processor executes the computer program, so that the computer device executes the hierarchical statistical map legend element automatic identification and extraction method described in any of the above embodiments.
[0109] For the convenience of description, the above system or device is described as various modules or units in function. Of course, in the implementation of the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0110] From the description of the above embodiments, those skilled in the art can clearly understand that the present application can be realized by means of software and necessary general hardware platform. Based on such understanding, the technical solutions of the present application can be embodied in the form of software product, which can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including a plurality of instructions to make a computer device (which can be a personal computer, server, or network device, etc.) execute the method described in each embodiment or some part of the embodiment of the present application.
[0111] Finally, it is to be understood that the phraseology or terminology such as "first", "second", "third", "fourth", etc. is merely used to distinguish or identify a specific entity or step from another entity or step without necessarily requiring or implying any actual such relationship or order between such entities or steps. Moreover, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the recited element.
[0112] The above description is merely that of the preferred embodiments of the application and modifications and alterations are possible without departing from the principles of the application as it is understood that this application is intended to cover whatever falls within the scope of the claims hereinafter appended.
Claims
1. A hierarchical statistical map legend feature automatic recognition and extraction method, characterized in that, The method comprises: acquiring a hierarchical statistical map to be identified, and identifying and segmenting a main map region from the hierarchical statistical map; based on the segmentation result of the main map region, performing a binary mask operation on the main map region in the hierarchical statistical map to obtain a working domain of a non-main map region; performing binary processing on the working domain to realize foreground and background segmentation; performing first sampling on the pixel points of the foreground in the working domain by using a first minimum sampling pixel number, and performing clustering on the pixel points obtained by this sampling by using a first clustering radius to obtain a plurality of primary clusters; for each primary cluster, the following operations are performed: using a set condition to identify whether the primary cluster is a potential legend region, and if not, the primary cluster is excluded; performing second sampling on the pixel points in the primary cluster remaining after the exclusion by using a second minimum sampling pixel number, and performing clustering on the pixel points obtained by this sampling by using a second clustering radius, and taking the circumscribed rectangle region of the secondary cluster with the most pixel points obtained as the target legend identified; performing legend color block extraction and hierarchical description text extraction on the target legend identified to obtain an extraction result; the use of a set condition to identify whether the primary cluster is a potential legend region comprises: determining whether the area of the circumscribed rectangle of the primary cluster is within a set area threshold range, and if so, the primary cluster is a potential legend region; and / or, determining whether the clustering center of the primary cluster is within a set region, and if so, the primary cluster is a potential legend region; the set region is input in advance after determining the location of the legend region in the entire hierarchical statistical map; the set region is a rectangular region, and the positions of the four pixel points of the rectangular region express the four vertices of the rectangular region.
2. The method of claim 1, wherein, the legend color block extraction and hierarchical description text extraction on the target legend identified comprises: acquiring a legend picture obtained after segmentation of the target legend; performing automatic segmentation on the legend picture by using an image semantic segmentation model to obtain a plurality of segmentation objects; for the plurality of segmentation objects, filtering by using a mask method to obtain a plurality of legend color blocks; sorting according to the coordinates of the legend color blocks, calculating the circumscribed rectangle of the corresponding hierarchical description text for each legend color block in order according to the sorting, cutting the entire hierarchical description text according to the circumscribed rectangle of each hierarchical description text, and performing text recognition on the cut hierarchical description text to obtain the legend color block and the corresponding hierarchical description text.
3. The method of claim 2, wherein, the calculation of the circumscribed rectangle of the corresponding hierarchical description text for each legend color block in order according to the sorting and the cutting of the entire hierarchical description text according to the circumscribed rectangle of each hierarchical description text comprises: for the i-th legend color block, the circumscribed rectangle of the corresponding hierarchical description text is calculated by using the following formula: wherein a and b are the length and width of the circumscribed rectangle of the i-th color block corresponding to the hierarchical description text, is the center point coordinate of the i-th color block, is the maximum and minimum of the horizontal coordinate of the i-th color block, is the maximum and minimum of the horizontal coordinate of the i-th color block, is the maximum and minimum of the horizontal coordinate of the i-th color block, is the maximum and minimum of the horizontal coordinate of the i-th color block, is the four vertex coordinates of the circumscribed rectangle of the i-th color block corresponding to the hierarchical description text; is the length and width of the legend picture; is used to represent the column, is used to represent the row; According to the four vertex coordinates of the circumscribed rectangle of the multiple color blocks, the arrangement is performed in sequence to obtain the circumscribed rectangle of the entire hierarchical description text, and the entire hierarchical description text is cut by using the circumscribed rectangle of the entire hierarchical description text. According to the four vertex coordinates of the circumscribed rectangle of the multiple color blocks, the arrangement is performed in sequence to obtain the circumscribed rectangle of the entire hierarchical description text, and the entire hierarchical description text is cut by using the circumscribed rectangle of the entire hierarchical description text.
4. A device for automatically recognizing and extracting hierarchical statistical map legend elements, characterized by, implemented based on the hierarchical statistical map legend element automatic identification extraction method in any one of claims 1-3, the device comprises: An acquisition unit is configured to acquire a hierarchical statistical map to be identified, and identify and segment a main map region from the hierarchical statistical map; A mask unit is configured to perform a binary mask operation on the main map region in the hierarchical statistical map based on a segmentation result of the main map region, to obtain a work domain of a non-main map region; An identification unit is configured to perform two times of clustering in sequence on pixel points in the work domain by using a density-based clustering algorithm, according to spatial position distribution of legend elements in the hierarchical statistical map, to gradually filter out the pixel points belonging to the legend elements, and identify a target legend. An extraction unit is configured to perform legend color block extraction and hierarchical description text extraction on the identified target legend, to obtain an extraction result.
5. A computer device, comprising: The computer device comprises a memory and a processor, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to realize the steps of the method in any one of claims 1-3.
6. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, and the computer program is executed by the processor to realize the steps of the method in any one of claims 1-3.
7. A computer program product, characterised in that, The computer program is executed by the processor to realize the steps of the method in any one of claims 1-3.
Citation Information
Patent Citations
Automatic extraction and vectorization method for geographical surface elements of thematic map
CN112991536A