Conversion method and system based on DXF format map, storage medium and electronic equipment

By employing an automated conversion method using recursive traversal and a custom scale, the accuracy and efficiency issues of converting DXF format maps to PGM format maps were resolved. This enabled high-precision and efficient conversion of DXF format maps to PGM format maps required by SLAM systems, adapting to different SLAM application scenarios and robot platforms.

CN121614531APending Publication Date: 2026-03-06SHANGHAI YUJIANG INTELLIGENT MACHINE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511721677.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-21
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

In the existing technology, the process of converting DXF format maps into PGM format maps required by SLAM systems relies on manual operation, resulting in insufficient accuracy and low efficiency of the generated PGM format maps, which makes it difficult to meet the high-efficiency application requirements of SLAM systems.

Method used

It employs recursive traversal of DXF format maps to extract primitive information, and achieves automated conversion from DXF format to PGM format maps through a custom scale and coordinate transformation matrix. This includes recursively expanding and inserting blocks, determining physical dimensions, and coordinate transformation, and supports structured storage and classification management of primitive information.

Benefits of technology

It achieves end-to-end automated conversion from DXF format maps to PGM format maps, improving map accuracy and generation efficiency, ensuring geometric and data consistency of maps, reducing human error, having wider adaptability, and supporting custom map resolution and accuracy adjustments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121614531A_ABST
    Figure CN121614531A_ABST
Patent Text Reader

Abstract

The invention provides a conversion method and system based on a DXF format map, a storage medium and electronic equipment. The method comprises the steps that all primitives in the DXF format map are traversed in a recursive mode, and primitive information is extracted; determining physical size information corresponding to a PGM format map according to the primitive information; determining a coordinate transformation matrix from a physical coordinate system to an image coordinate system according to a custom scale and the primitive information; and determining a PGM format map corresponding to the DXF format map according to the custom scale, the physical size information, the primitive information and the coordinate transformation matrix. According to the method, end-to-end automatic conversion from the map in the DXF format to the map in the PGM format is realized, manual intervention is not needed, and the map generation efficiency and the map precision are greatly improved; the method also supports a user to customize a proportional scale, can adjust the size and precision of the map according to different application scenes and conditions, and is higher in flexibility and wider in adaptability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of navigation technology and relates to a conversion method, system, storage medium and electronic device based on DXF format maps. Background Technology

[0002] DWG (Drawing) is a binary file format native to AutoCAD software and is widely used for engineering drawing design and data storage in manufacturing, engineering construction, urban planning, and robot navigation. However, the DWG format is proprietary to Autodesk, and its core data structure is not publicly available. This makes it difficult for third-party systems (such as Simultaneous Localization and Mapping (SLAM) navigation systems) to directly parse and integrate it, resulting in technical bottlenecks such as poor compatibility and high development costs.

[0003] To address the challenges of cross-platform data exchange, Autodesk introduced the Drawing Exchange Format (DXF). This open-source text and binary format supports the exchange of graphic information between most CAD software programs, becoming the core carrier for exporting CAD data.

[0004] Robot SLAM systems typically use grid maps as an environmental representation. Portable Graymap (PGM) format is a simple and open bitmap image file format specifically designed for storing grayscale images. It has the advantages of being lightweight and easy to be read and processed by SLAM algorithms, making it a commonly used file format for grid maps.

[0005] Currently, converting DXF format maps to PGM format maps compatible with SLAM systems mainly relies on manual operation. The specific process is as follows: first, the DWG format map is manually exported from AutoCAD as a Portable Network Graphics (PNG) format map; then, post-processing such as scaling and thresholding is performed using image processing tools, and finally, it is converted into a PGM format map. This manual process results in significant errors in the generated PGM format map, and the conversion process is time-consuming and laborious, making it difficult to meet the accurate and efficient application requirements of SLAM systems. Summary of the Invention

[0006] This application provides a method, system, storage medium, and electronic device for converting DXF format maps, which solves the problems of insufficient accuracy and low conversion efficiency of PGM format maps generated by existing conversion methods.

[0007] In a first aspect, this application provides a conversion method based on a DXF format map, comprising: recursively traversing all primitives in the DXF format map and extracting primitive information; determining the physical size information corresponding to the PGM format map based on the primitive information; determining a coordinate transformation matrix from the physical coordinate system to the image coordinate system based on a custom scale and the primitive information; and determining the PGM format map corresponding to the DXF format map based on the custom scale, the physical size information, the primitive information, and the coordinate transformation matrix.

[0008] In one implementation of the first aspect, during the process of recursively traversing all primitives in the DXF format map and extracting primitive information, if a primitive type is detected as a basic primitive, the corresponding basic primitive information is directly extracted; if a primitive type is detected as an insertion block, all nested sub-primitives within the insertion block are recursively expanded until the insertion block is completely recursively decomposed into basic primitives, and all basic primitive information and parameter information of the insertion block are completely extracted.

[0009] In one implementation of the first aspect, the basic primitive information includes the geometric type and key parameter information of the basic primitive.

[0010] In one implementation of the first aspect, determining the physical size information corresponding to the PGM format map based on the primitive information includes: determining a minimum bounding box based on the primitive information, wherein the minimum bounding box is the smallest rectangular area that surrounds all primitives in the DXF format map; and determining the physical size information corresponding to the PGM format map based on the minimum bounding box.

[0011] In one implementation of the first aspect, determining the PGM format map corresponding to the DXF format map based on the primitive information, the custom scale, the physical size information, and the coordinate transformation matrix includes: determining the pixel size information of the PGM format map based on the custom scale and the physical size information; creating an initial blank map in PGM format based on the pixel size information; and transferring the primitive information onto the initial blank map based on the coordinate transformation matrix to generate the PGM format map corresponding to the DXF format map.

[0012] In one implementation of the first aspect, the method further includes: storing the graphic element information in a database according to a preset classification rule.

[0013] In one implementation of the first aspect, the method further includes: generating a description file for the PGM format map, the description file including at least the corner coordinate information of the PGM format map and the custom scale.

[0014] Secondly, this application provides a conversion system based on DXF format maps, comprising: an image receiving module for receiving DXF format maps; an image processing module for converting the DXF format maps into PGM format maps according to the DXF format map conversion method described in any implementation of the first aspect; and an image output module for outputting the PGM format maps.

[0015] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the DXF format map conversion method described in any implementation of the first aspect.

[0016] Fourthly, this application provides an electronic device, the electronic device comprising: a memory storing a computer program thereon; and a processor communicatively connected to the memory, which, when executing the computer program, implements the DXF format map conversion method according to any implementation of the first aspect.

[0017] As described above, the conversion method, system, storage medium, and electronic device based on DXF format maps described in this application have the following beneficial effects:

[0018] 1. The recursive traversal parsing mechanism can completely extract all primitive information of the DXF format map, avoiding map distortion caused by missing information (such as missing obstacles or size deviations), ensuring the geometric consistency between the converted map and the original DXF format map, and significantly improving the accuracy of the generated PGM format map.

[0019] 2. Supports user-defined map resolution (or scale), allowing adjustment of map size and accuracy based on different SLAM application scenarios, robot platforms, sensor accuracy, and navigation algorithms, resulting in greater flexibility and wider adaptability.

[0020] 3. By adopting a dynamic coordinate mapping method, the coordinate transformation matrix can be adjusted in real time according to changes in input parameters (such as custom scale, primitive information, etc.), achieving precise alignment between the two coordinate systems and further improving the accuracy of PGM format maps.

[0021] 4. The extracted map element information is stored and classified according to preset classification rules, transforming the raw data of the unstructured DXF format map into structured database records. This realizes the structuring and standardization of map element data, improves the efficiency of data query and extraction, ensures data consistency and traceability, and provides efficient data support for the subsequent processing of DXF format maps.

[0022] 5. Determine the physical size of the PGM format map by calculating the minimum bounding box, ensuring that the generated PGM format map has no redundant space and can completely cover all the primitive information of the DXF format map.

[0023] 6. It achieves end-to-end automated conversion from DXF format maps to PGM format maps without manual intervention, greatly improving map generation efficiency and reducing operating costs and human error. Attached Figure Description

[0024] Figure 1 The diagram shows an application scenario of the DXF format map conversion method described in this application embodiment.

[0025] Figure 2 The diagram shows the overall flow of the DXF format map conversion method described in this application embodiment.

[0026] Figure 3 The diagram shown is a partial flowchart of the DXF format map conversion method described in this application embodiment.

[0027] Figure 4 The diagram shows a detailed flowchart of the DXF format map conversion method described in this application embodiment.

[0028] Figure 5 The diagram shown is a structural diagram of the DXF format map conversion system described in the embodiments of this application.

[0029] Figure 6 The diagram shown is a structural schematic of an electronic device according to an embodiment of this disclosure. Detailed Implementation

[0030] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.

[0031] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. Therefore, the drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0032] Figure 1The illustration schematically depicts an application scenario of a DXF format map conversion method, system, storage medium, and electronic device according to embodiments of the present disclosure.

[0033] like Figure 1 As shown, the application scenario according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0034] Users can interact with server 105 via network 104 using at least one of the first terminal device 101, second terminal device 102, and third terminal device 103 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, second terminal device 102, and third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0035] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0036] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.

[0037] It should be noted that the DXF format map conversion method provided in this disclosure can generally be executed by server 105. Correspondingly, the DXF format map conversion system provided in this disclosure can generally be located in server 105. The DXF format map conversion method provided in this disclosure can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the storage medium or electronic device for the DXF format map conversion provided in this disclosure can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.

[0038] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0039] The technical solutions in the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0040] like Figure 2 As shown, this embodiment provides a conversion method based on DXF format maps, including:

[0041] S11: A conversion system based on DXF format maps recursively traverses all graphic elements in the DXF format map and extracts graphic element information.

[0042] For example, during the recursive traversal of all primitives within the model space of the DXF format map in this conversion system, differentiated processing is applied based on the entity type of the primitives: if the primitive type is detected as a basic primitive (such as a line, polyline, circle, ellipse, arc, etc.), the basic primitive information is directly extracted; if the primitive type is detected as an insert block, the system further enters the corresponding CAD block definition structure, recursively expanding all nested sub-primaries within it layer by layer until the insert block is completely decomposed into basic primitives, and all basic primitive information and parameter information contained in the insert block are completely extracted. This method obtains complete and comprehensive geometric data of the DXF format map, ensuring the accuracy of subsequent PGM format map generation.

[0043] It should be noted that the above-mentioned insertion block is a multi-level composite graphic unit composed of multiple basic graphic elements. Nesting is allowed within the block, that is, an insertion block can contain multiple sub-blocks, and sub-blocks can further nest lower-level blocks or basic graphic elements.

[0044] It should be noted that the above basic graphic element information includes the geometric type and key parameter information of the basic graphic element. The geometric type is, for example, a straight line, a polyline, a circle, an ellipse, an arc, etc., and the key parameter information includes, for example, the starting point coordinates, ending point coordinates, center coordinates, radius width, starting angle, and ending angle of the basic graphic element.

[0045] It should be understood that while the conversion system extracts information about all basic primitives in the insertion block by unfolding the insertion block layer by layer, it also extracts the parameter information of the insertion block as a whole (such as the coordinates of the insertion point, the scaling ratio, and the rotation angle).

[0046] It should be noted that recursive traversal is an algorithmic strategy that repeatedly calls its own function. The core logic is to decompose a complex problem into subproblems with similar structures, solve them layer by layer, and then merge the results. In the DXF format map parsing scenario of this application, recursive traversal uses the expansion of nested CAD blocks. Specifically, when an INSERT block is encountered, its own function is called to enter the definition of that block, continuing to traverse its internal sub-primitives. If all sub-primitives after this recursion are basic primitives, the recursion stops, and the primitive information is extracted. This allows us to start from the outermost block, penetrating all nested levels layer by layer, ultimately expanding the entire drawing into basic primitives, ensuring the acquisition of complete geometric information.

[0047] In some specific embodiments, after S11, the method further includes storing the primitive information extracted in S11 into a database according to a preset classification rule.

[0048] Specifically, the information of all basic graphic elements and parameter information of the inserted blocks corresponding to the DXF format map extracted by S11 are classified and stored in the database according to the preset classification rules. The raw data of the unstructured DXF format map is transformed into structured database records, realizing the structuring and standardization of graphic data, improving the efficiency of data query and extraction, ensuring data consistency and traceability, and providing efficient data support for the subsequent processing of DXF format maps.

[0049] For example, the preset classification rule can be based on the geometric structure type defined by the basic primitives. As shown in Table 1, the information of all extracted primitives is classified according to their geometric structure, and then the core parameters corresponding to each classification are stored.

[0050] Table 1

[0051]

[0052] It should be noted that if the graphic element is an insertion block, its graphic element information includes not only the basic graphic element information corresponding to the insertion block, but also the insertion point coordinates, scaling ratio, and rotation angle corresponding to the insertion block.

[0053] Optionally, the aforementioned database supports horizontal scaling (such as database sharding and table management) to handle large amounts of map and data data, and also supports cross-system data interaction. For example, it can interface with other systems (such as Building Information Modeling (BIM) platforms, engineering management software, and Geographic Information Systems (GIS)) through Application Programming Interface (API) to further enhance system scalability.

[0054] S12: Determine the physical size information corresponding to the PGM format map based on the element information. Specifically, determine the minimum bounding box based on the element information. The minimum bounding box is the smallest rectangular area that encloses all elements in the DXF format map; determine the physical size information corresponding to the PGM format map based on the minimum bounding box.

[0055] In some embodiments, S12 specifically includes: the conversion system traverses the coordinate data of all elements of the DXF format map in the database, determines the extreme values ​​(maximum and minimum values) of the coordinates of the entire DXF format map in the X and Y directions, and thereby determines the smallest rectangular region (i.e., the minimum bounding box) that surrounds all elements in the DXF format map, which serves as the basis for the extent of the PGM format map. The difference between the maximum and minimum values ​​of the X-direction coordinates corresponds to the width of the minimum rectangular region; the difference between the maximum and minimum values ​​of the Y-direction coordinates corresponds to the height of the minimum rectangular region. Calculating the minimum bounding box ensures that the generated PGM format map extent has no redundant space and completely covers all element information of the DXF format map.

[0056] For example, the determination of the minimum bounding box and the size of the PGM format map can be implemented programmatically. The specific programming logic is as follows: First, initialize the variables used to record coordinate extrema: the minimum values ​​in the X and Y directions are initially set to negative infinity (indicating that there are no smaller coordinates initially), and the maximum values ​​in the X and Y directions are initially set to positive infinity (indicating that there are no larger coordinates initially). Then, iterate through all primitives in the DXF format map, extracting coordinates and updating extrema based on the primitive's geometric type (e.g., line, polyline, circle, ellipse, arc, etc.). For example, for a line, take the coordinates of the start and end points, and update the extrema after scaling; for a lightweight polyline, obtain the coordinates of all vertices, scale, and update the extrema; for a circle, take the center coordinates, scale, and update the extrema. Scaling is done according to a unit scaling factor, such as converting millimeters to meters, mainly for unifying coordinate units. Based on the coordinate extreme values ​​obtained from the above steps, calculate the size of the image in physical space (e.g., in meters): obtain the width in the X direction by subtracting the minimum value in the X direction (x1) from the maximum value in the X direction (x2), and obtain the height in the Y direction by subtracting the minimum value in the Y direction (y1) from the maximum value in the Y direction (y2). At the same time, print out the original physical coordinate range of the PGM format map ([x1,y1] to [x2,y2]).

[0057] Optionally, to avoid truncating edge elements of the PGM format map, border padding can be added around the PGM format map. For example, using 1% of the original width of the PGM format map as the padding value, the original coordinate range of the PGM format map is extended outward by a certain distance.

[0058] S13: Determine the coordinate transformation matrix from the physical coordinate system (i.e., the world coordinate system) to the image coordinate system (corresponding to the PGM format map coordinate system) based on the custom scale (i.e., the custom map resolution) and primitive information, so as to realize the affine transformation from the physical dimension to the pixel dimension.

[0059] Taking the primitive as an insertion block as an example, the process of determining the coordinate transformation matrix in S13 is further introduced. The primitive information of the insertion block includes the key parameters and attributes of the insertion block.

[0060] First, input the key parameters of the insertion block (such as the insertion point coordinates, scaling factor, and rotation angle) into the relevant function. The insertion point coordinates represent the specific position of the insertion block in the world coordinate system, the scaling factor represents the scaling coefficient of the insertion block in the X and Y directions, and the rotation angle represents the angle of rotation of the insertion block around the insertion point. The relevant function can be, for example, the `(get_transform_matrix)` function. It should be noted that if the insertion block has a multi-level nested structure, the parent transformation corresponding to that level must also be input into the relevant function. The parent transformation represents the coordinate transformation rule corresponding to the previous level and is used for superposition calculations of different levels.

[0061] Second, based on the attributes of the inserted block, a basic transformation rule (represented by a matrix, called the local transformation matrix) is generated. This rule can simultaneously implement scaling, rotation, and translation operations. For example, scaling and rotation are implemented through the first two columns of the matrix. The scaling factor in the X direction is combined with the cosine of the rotation angle to control the scaling and rotation effect of the inserted block in the X direction; the scaling factor in the Y direction is combined with the sine of the rotation angle to control the scaling and rotation effect of the inserted block in the Y direction. The translation direction and amount are controlled through the third column of the matrix. Combined with the coordinates of the insertion point of the inserted block, this ensures that the entire inserted block is moved to the correct position.

[0062] It should be noted that if the inserted block is a multi-level nested structure, the relevant function will generate a combined transformation rule based on the parent transformation and basic transformation rules of the inserted block. In other words, the coordinates of the inserted block (child block) will first be transformed according to its own rules, and then according to the rules of the next level inserted block (parent block), and finally obtain the correct position (for example, the child block is first shrunk and rotated, and then moves with the parent block).

[0063] Third, the relevant functions output the final coordinate transformation matrix based on a custom scale, where the custom scale is used to control the scaling ratio of the inserted block.

[0064] The above process extracts the translation, scaling, and rotation attributes of the inserted block, constructs an affine transformation matrix by combining it with a custom scale (and superimposes the parent transformation if nested), and outputs the final coordinate transformation matrix, so that the coordinates of the inserted block can be accurately mapped from the world coordinate system to the image coordinate system, providing a coordinate transformation basis for the subsequent drawing of PGM format maps.

[0065] S14: Determine the PGM format map corresponding to the DXF format map based on the custom scale, physical size information, graphic element information, and coordinate transformation matrix.

[0066] For example, such as Figure 3 As shown, S14 specifically includes:

[0067] S141: Determine the pixel size information of the PGM format map based on the custom scale (i.e., the custom map resolution) and physical size information.

[0068] For example, the determination process of S141 may be: dividing the physical width (e.g., in meters) of the PGM format map by the map resolution (e.g., in meters / pixels) to obtain the pixel width of the PGM format map, and dividing the physical height (e.g., in meters) of the PGM format map by the map resolution (e.g., in meters / pixels) to obtain the pixel height of the PGM format map.

[0069] S142: Create an initial blank map in PGM format based on the pixel size information. The pixel size of the initial blank map is consistent with the pixel size information of the PGM format map determined in S141.

[0070] For example, S142 specifically includes: first, constructing a PGM format grayscale image buffer corresponding to the target pixel size, and uniformly setting the region representing free space to a first grayscale value (usually 255, corresponding to white), thus preparing the foundation for all primitives in the subsequent conversion to a DXF format map. In subsequent operations, the obstacle regions corresponding to these primitives will be labeled with a second grayscale value (e.g., 0, corresponding to black), thereby generating a PGM format map with grayscale distribution characteristics of free space and obstacles.

[0071] S143: Based on the coordinate transformation matrix, transfer the primitive information onto the initial blank map to generate a PGM format map corresponding to the DXF format map.

[0072] For example, S143 specifically includes: traversing each primitive corresponding to the DXF format map in the database, transforming the geometric coordinates of each primitive from the world coordinate system (physical dimension) to the image coordinate system (pixel dimension) according to the coordinate transformation matrix, and drawing the primitive into the initialized grayscale image buffer.

[0073] It should be noted that when drawing basic primitives, the drawing is performed based on the key coordinates of the basic primitive (such as the coordinates corresponding to the core parameters in Table 1) and in combination with the coordinate transformation matrix and the user-defined resolution (or user-defined scale). When drawing composite primitives composed of basic primitives, they need to be exploded and decomposed first, and then drawn according to the drawing logic of the basic primitives.

[0074] It should be noted that when traversing DXF format map primitives, if the primitive type is identified as a hatch (usually a wall, obstacle area, etc.), the world coordinates of the boundary vertices of the hatch can be extracted first. These world coordinates are then converted to image coordinates using a coordinate transformation matrix. A polygonal region is drawn based on the image coordinates, and this polygonal region is then filled with the obstacle color (set to the second grayscale value, such as 0 (corresponding to black)). Therefore, when the SLAM system reads this PGM format map, it can identify these hatched areas as obstacles, thereby enabling the robot to perceive the environment and avoid obstacles.

[0075] In some specific embodiments, after S11, the method further includes generating a specification file for the PGM format map to facilitate reading and recognition by the SLAM system. This specification file includes at least the corner coordinate information of the PGM format map and a custom resolution (or custom scale). The custom resolution is used for subsequent conversion of the image coordinates back to world coordinates; the corner coordinate information refers to the... Figure 4 The image coordinates of each corner in a PGM format map can be used for scenarios such as map alignment and scale verification.

[0076] For example, the conversion system of this application can read, recognize and preliminarily process DXF format maps through the ezdxf library, wherein the preliminary processing includes, for example, the extraction of key parameters of map elements and the organization of map element information.

[0077] It should be noted that the ezdxf library is an open-source Python library. Through the ezdxf library's interface, the conversion system can directly load the target DXF format map and accurately locate the model space of the CAD drawing (the area where the core graphic data of the drawing is located). This provides a data entry point for the subsequent recursive traversal of graphic elements, avoiding the complex operation of the conversion system directly parsing the DXF format map, greatly reducing development costs, and ensuring the accuracy of graphic element information extraction.

[0078] Figure 4 A possible detailed process for converting a DXF format map to a PGM format map according to the conversion method of this application is shown.

[0079] The scope of protection for the DXF format map conversion method described in this application is not limited to the execution order of the steps listed in this embodiment. Any solution implemented by adding, subtracting, or replacing steps in the prior art based on the principles of this application is included within the scope of protection of this application.

[0080] This application also provides a conversion system based on DXF format maps. The DXF format map conversion system can implement the DXF format map conversion method described in this application. However, the implementation device of the DXF format map conversion method described in this application includes, but is not limited to, the structure of the DXF format map conversion system listed in this embodiment. All structural modifications and substitutions of the prior art made in accordance with the principles of this application are included within the protection scope of this application.

[0081] like Figure 5 As shown, this embodiment provides a conversion system based on DXF format maps, including an image receiving module 301, an image processing module 302, and an image output module 303. The image receiving module 301 is used to receive DXF format maps, the image processing module 302 is used to convert the DXF format maps into PGM format maps according to the conversion method based on DXF format maps described in any of the above embodiments, and the image output module 303 is used to output the PGM format maps.

[0082] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, or methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules / units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or modules or units may be electrical, mechanical, or other forms.

[0083] The modules / units described as separate components may or may not be physically separate. The components shown as modules / units may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules / units can be selected to achieve the objectives of the embodiments of this application, depending on actual needs. For example, the functional modules / units in the various embodiments of this application may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.

[0084] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0085] Figure 6 The diagram shown is a structural schematic of an electronic device according to an embodiment of this disclosure. Figure 6 As shown, the electronic device provided in this disclosure includes a processor and a memory. The memory is configured to store an executable program. The processor is configured to execute the program to cause the electronic device to perform the DXF format map conversion method according to any of the above embodiments.

[0086] Preferably, the processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0087] This embodiment also includes one or more of the following: a multimedia component, an input / output (I / O) interface, and a communication component.

[0088] The multimedia component may include a screen and an audio component. The screen may be, for example, a touchscreen, and the audio component is configured to output and / or input audio signals. For example, the audio component may include a microphone configured to receive external audio signals. The received audio signals may be further stored in memory or transmitted via a communication component. The audio component also includes at least one speaker configured to output audio signals. The I / O interface provides an interface between the processor and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. The communication component is configured to enable wired or wireless communication between the timer and other devices. Wireless communication may include Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, or 4G, or a combination thereof; therefore, the corresponding communication component may include a Wi-Fi module, a Bluetooth module, or an NFC module.

[0089] This application proposes a conversion method, system, storage medium, and electronic device based on DXF format maps, which has the following beneficial effects:

[0090] 1. The recursive traversal parsing mechanism can completely extract all primitive information of the DXF format map, avoiding map distortion caused by missing information (such as missing obstacles or size deviations), ensuring the geometric consistency between the converted map and the original DXF format map, and significantly improving the accuracy of the generated PGM format map.

[0091] 2. Supports user-defined map resolution (or scale), allowing adjustment of map size and accuracy based on different SLAM application scenarios, robot platforms, sensor accuracy, and navigation algorithms, resulting in greater flexibility and wider adaptability.

[0092] 3. By adopting a dynamic coordinate mapping method, the coordinate transformation matrix can be adjusted in real time according to changes in input parameters (such as custom scale, primitive information, etc.), achieving precise alignment between the two coordinate systems and further improving the accuracy of PGM format maps.

[0093] 4. The extracted map element information is stored and classified according to preset classification rules, transforming the raw data of the unstructured DXF format map into structured database records. This realizes the structuring and standardization of map element data, improves the efficiency of data query and extraction, ensures data consistency and traceability, and provides efficient data support for the subsequent processing of DXF format maps.

[0094] 5. Determine the physical size of the PGM format map by calculating the minimum bounding box, ensuring that the generated PGM format map has no redundant space and can completely cover all the primitive information of the DXF format map.

[0095] 6. It achieves end-to-end automated conversion from DXF format maps to PGM format maps without manual intervention, greatly improving map generation efficiency and reducing operating costs and human error.

[0096] This application also provides a computer-readable storage medium. Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing a processor. The program can be stored in a computer-readable storage medium, which is a non-transitory medium, such as random access memory, read-only memory, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof. The storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state drive (SSD)).

[0097] This application embodiment may also provide a computer program product comprising one or more computer instructions. When the computer instructions are loaded and executed on a computing device, all or part of the processes or functions described in this application embodiment are generated. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0098] When the computer program product is executed by a computer, the computer performs the method described in the foregoing method embodiments. The computer program product can be a software installation package; when the foregoing method is required, the computer program product can be downloaded and executed on the computer.

[0099] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.

[0100] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.

Claims

1. A conversion method based on DXF format map, characterized in that, The method comprises the following steps: recursively traversing all primitives in a DXF format map and extracting primitive information; determining physical size information corresponding to a PGM format map according to the primitive information; determining a coordinate transformation matrix from a physical coordinate system to an image coordinate system according to a custom scale and the primitive information; determining a PGM format map corresponding to the DXF format map according to the custom scale, the physical size information, the primitive information and the coordinate transformation matrix.

2. The DXF format map-based conversion method of claim 1, wherein, In the process of recursively traversing all primitives in the DXF format map and extracting primitive information, if a primitive type is detected as a basic primitive, corresponding basic primitive information is directly extracted; if a primitive type is detected as an inserted block, all child primitives nested inside the inserted block are recursively expanded until the inserted block is completely recursively disassembled into basic primitives, and all basic primitive information corresponding to the inserted block and parameter information of the inserted block are completely extracted.

3. The DXF format map-based conversion method of claim 2, wherein, The basic primitive information comprises a geometric type and key parameter information of the basic primitive.

4. The DXF format map-based conversion method of claim 1, wherein, Determining physical size information corresponding to a PGM format map according to the primitive information comprises the following steps: determining a minimum bounding box according to the primitive information, the minimum bounding box being a minimum rectangular region enclosing all primitives in the DXF format map; determining physical size information corresponding to the PGM format map according to the minimum bounding box.

5. The DXF format map-based conversion method of claim 1, wherein, Determining a PGM format map corresponding to the DXF format map according to the primitive information, the custom scale, the physical size information and the coordinate transformation matrix comprises the following steps: determining pixel size information of the PGM format map according to the custom scale and the physical size information; creating an initial blank PGM format map according to the pixel size information; transferring the primitive information to the initial blank map according to the coordinate transformation matrix to generate a PGM format map corresponding to the DXF format map.

6. The DXF format map-based conversion method of claim 1, wherein, The method further comprises storing the primitive information in a database according to a preset classification rule.

7. The DXF format map-based conversion method of claim 1, wherein, The method further comprises generating an explanation file of the PGM format map, the explanation file comprising at least corner point coordinate information of the PGM format map and the custom scale.

8. A DXF format map-based conversion system, characterized by, The method comprises the following steps: an image receiving module configured to receive a DXF format map; an image processing module configured to convert the DXF format map into a PGM format map according to the conversion method based on a DXF format map in any one of claims 1 to 7; an image output module configured to output the PGM format map.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by a processor to implement the conversion method based on a DXF format map in any one of claims 1 to 7.

10. An electronic device, comprising: The electronic device comprises: a memory having a computer program stored thereon; a processor in communication with the memory, which, when executing the computer program, implements the conversion method based on a DXF format map in any one of claims 1 to 7.