Vector diagram generation method and device, equipment and storage medium
Through the information extraction processing of multiple layers of the initial apartment diagram, the door information, window information, and room information are automatically obtained, and the problem of low vector graphs in existing technologies has been solved, and efficient vector graphs are achieved.
Patent Information
- Application Number
- CN202411329113.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2025-01-28
AI Technical Summary
In the prior art, data information is manually read from the initial floor plan and input vector image generation software, resulting in low efficiency in generating vector images.
Through information extraction and processing of the door layer, window layer and wall layer of the initial apartment diagram, automatically obtain the target apartment door information, window information, and room information, and generate the apartment vector diagram based on this information.
The information of automatically extraction of the initial -type diagram is implemented, which improves the efficiency of generating vector graphs, and reduces the time and errors of artificial operation.
Smart Images

Figure CN119379823A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image recognition technology, and in particular to a method, device, equipment and storage medium for generating a vector map. Background Art
[0002] In the home improvement industry, multiple virtual renderings of target apartment types can be provided to users so that target users can choose from a variety of virtual renderings. To construct a virtual rendering, it is necessary to obtain a two-dimensional vector diagram of the target apartment type.
[0003] In the prior art, the staff can obtain the initial floor plan of the target apartment, which is in the Drawing Exchange Format (DXF) format, which is a commonly used format for Computer Aided Design (CAD). The staff can read the data information in the initial floor plan (for example, the number of rooms, the size of the room, the position of the windows, etc.), and input the data information into the vector map generation software to obtain the vector map of the target apartment. However, it takes a lot of time to manually read the data information in the initial floor plan and manually input the data information into the vector map generation software, resulting in low efficiency in generating vector maps. Summary of the invention
[0004] The present application provides a method, device, equipment and storage medium for generating a vector diagram, so as to solve the problem of low efficiency in generating a vector diagram.
[0005] In a first aspect, the present application provides a method for generating a vector diagram, comprising: Obtaining an initial floor plan of the target apartment, wherein the initial floor plan includes a door layer, a window layer, and a wall layer; Performing information extraction processing on the door layer to obtain door information of the target apartment; Performing information extraction processing on the window layer to obtain window information of the target apartment; According to the door information and the window information, information extraction processing is performed on the wall layer to obtain room information of the target apartment; A floor plan vector diagram of the target floor plan is generated according to the door information, the window information and the room information.
[0006] In some possible embodiments, performing information extraction processing on the door layer to obtain the door information of the target apartment type includes: Identifying and obtaining a plurality of gate line segments in the gate layer; Determine the segment distance between any two gate segments; According to the line segment distance between any two door line segments, at least one door line segment set is determined from the plurality of door line segments, and the door type corresponding to each door line segment set is determined, where one door line segment set corresponds to one door; Determining the gate information includes: the at least one gate line segment set, and a gate type corresponding to each gate line segment set.
[0007] In some possible embodiments, determining at least one gate line segment set from the plurality of gate line segments according to the line segment distance between any two gate line segments includes: Generate the vertex corresponding to each gate line segment to obtain multiple vertices; For any two vertices, if the distance between the two gate line segments corresponding to the two vertices is less than or equal to a preset distance, an undirected edge between the two vertices is generated until an undirected graph is obtained, wherein the undirected graph includes the plurality of vertices and the undirected edge; Determining at least one connected subgraph in the undirected graph; For any connected subgraph, the gate line segments corresponding to the vertices in the connected subgraph are determined as a gate line segment set.
[0008] In some possible embodiments, for any gate line segment set, determining a gate type corresponding to the gate line segment set includes: Determine the line segment feature of each gate line segment in the gate line segment set and the number of gate line segments included in the gate line segment set; The gate type corresponding to the gate line segment set is determined according to the line segment feature of each gate line segment in the gate line segment set and the number of gate line segments included in the gate line segment set.
[0009] In some possible embodiments, the wall layer is subjected to information extraction processing according to the door information and the window information to obtain the room information of the target apartment type, including: According to the door information and the window information, auxiliary line segments are added to the wall layer to obtain a target wall layer, wherein the auxiliary line segments include door line segments and window line segments; Identify and obtain at least one annotation text and a plurality of line segments in the wall layer, wherein the annotation text is used for room annotation, and the plurality of line segments include wall line segments and the auxiliary line segments; For any annotated text, determine a line segment set corresponding to the annotated text from the multiple line segments, where one line segment set corresponds to one room; The room information is generated according to the line segment set corresponding to each annotation text.
[0010] In some possible embodiments, determining a line segment set corresponding to the annotated text from among the plurality of line segments includes: Determining the distance between the annotation text and each line segment of the plurality of line segments; Determine a target line segment among the plurality of line segments according to the distances between the annotated text and each line segment, wherein the distance between the target line segment and the annotated text is the smallest; Taking the first endpoint of the target line segment as the starting point, line segment search is performed among the multiple line segments until the multiple selected line segments found enclose a closed area, and the multiple selected line segments are determined as the line segment set corresponding to the annotated text.
[0011] In some possible embodiments, taking an endpoint of the target line segment as a starting point, searching for line segments among the multiple line segments until the multiple selected line segments found enclose a closed area, and determining the multiple selected line segments as a line segment set corresponding to the annotated text, includes: Determine, according to the first endpoint, a first selected line segment from among the multiple line segments, wherein an endpoint of the first selected line segment coincides with the first endpoint; According to the other endpoint of the i-th selected line segment, determine the i+1-th selected line segment from the other line segments except the first selected line segment among the multiple line segments, and one endpoint of the i+1-th selected line segment coincides with the other end of the i-th selected line segment; Among them, the i is successively 1, 2, ..., until the other endpoint of the Nth selected line segment coincides with the first endpoint, the N selected line segments are determined as the line segment set corresponding to the annotated text, and N is an integer greater than 1.
[0012] In a second aspect, an embodiment of the present application provides a device for generating a vector diagram, including an acquisition module, a first information extraction module, a second information extraction module, a third information extraction module, and a generation module: The acquisition module is used to acquire an initial floor plan of the target apartment, wherein the initial floor plan includes a door layer, a window layer and a wall layer; The first information extraction module is used to perform information extraction processing on the door layer to obtain the door information of the target apartment type; The second information extraction module is used to perform information extraction processing on the window layer to obtain the window information of the target apartment; The third information extraction module is used to perform information extraction processing on the wall layer according to the door information and the window information to obtain the room information of the target apartment; The generating module is used to generate a floor plan vector diagram of the target floor plan according to the door information, the window information and the room information.
[0013] In some possible embodiments, the first information extraction module is specifically used to: Identifying and obtaining a plurality of gate line segments in the gate layer; Determine the segment distance between any two gate segments; According to the line segment distance between any two door line segments, at least one door line segment set is determined from the plurality of door line segments, and the door type corresponding to each door line segment set is determined, where one door line segment set corresponds to one door; Determining the gate information includes: the at least one gate line segment set, and a gate type corresponding to each gate line segment set.
[0014] In some possible embodiments, the first information extraction module is specifically used to: Generate the vertex corresponding to each gate line segment to obtain multiple vertices; For any two vertices, if the distance between the two gate line segments corresponding to the two vertices is less than or equal to a preset distance, an undirected edge between the two vertices is generated until an undirected graph is obtained, wherein the undirected graph includes the plurality of vertices and the undirected edge; Determining at least one connected subgraph in the undirected graph; For any connected subgraph, the gate line segments corresponding to the vertices in the connected subgraph are determined as a gate line segment set.
[0015] In some possible embodiments, for any gate line segment set, the first information extraction module is specifically used to: Determine the line segment feature of each gate line segment in the gate line segment set and the number of gate line segments included in the gate line segment set; The gate type corresponding to the gate line segment set is determined according to the line segment feature of each gate line segment in the gate line segment set and the number of gate line segments included in the gate line segment set.
[0016] In some possible embodiments, the third information extraction module is specifically used for: According to the door information and the window information, auxiliary line segments are added to the wall layer to obtain a target wall layer, wherein the auxiliary line segments include door line segments and window line segments; Identify and obtain at least one annotation text and a plurality of line segments in the wall layer, wherein the annotation text is used for room annotation, and the plurality of line segments include wall line segments and the auxiliary line segments; For any annotated text, determine a line segment set corresponding to the annotated text from the multiple line segments, where one line segment set corresponds to one room; The room information is generated according to the line segment set corresponding to each annotation text.
[0017] In some possible embodiments, the third information extraction module is specifically used for: Determining the distance between the annotation text and each line segment of the plurality of line segments; Determine a target line segment among the plurality of line segments according to the distances between the annotated text and each line segment, wherein the distance between the target line segment and the annotated text is the smallest; Taking the first endpoint of the target line segment as the starting point, line segment search is performed among the multiple line segments until the multiple selected line segments found enclose a closed area, and the multiple selected line segments are determined as the line segment set corresponding to the annotated text.
[0018] In some possible embodiments, the third information extraction module is specifically used for: Determine, according to the first endpoint, a first selected line segment from among the multiple line segments, wherein an endpoint of the first selected line segment coincides with the first endpoint; According to the other endpoint of the i-th selected line segment, determine the i+1-th selected line segment from the other line segments except the first selected line segment among the multiple line segments, and one endpoint of the i+1-th selected line segment coincides with the other end of the i-th selected line segment; Among them, the i is successively 1, 2, ..., until the other endpoint of the Nth selected line segment coincides with the first endpoint, the N selected line segments are determined as the line segment set corresponding to the annotated text, and N is an integer greater than 1.
[0019] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor and a memory; the memory stores computer-executable instructions; the at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method for generating a vector diagram as described in the first aspect and various possible designs of the first aspect.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the method for generating a vector diagram as described in the first aspect and various possible designs of the first aspect is implemented.
[0021] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the method for generating a vector diagram as described in the first aspect and various possible designs of the first aspect.
[0022] The vector diagram generation method, device, equipment and storage medium provided in the present application can analyze and process multiple layers of the initial floor plan to obtain door and window information of each door and window and room information of each room, and generate a vector diagram of the target floor plan based on the door and window information and room information, which can automatically obtain room information and door and window information, thereby improving the efficiency of generating vector diagrams. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0024] Figure 1 A schematic diagram of an application scenario provided in an embodiment of the present application; Figure 2 A schematic diagram of a flow chart of a method for generating a vector diagram provided in an embodiment of the present application; Figure 3 A schematic diagram of a process for determining door information provided in an embodiment of the present application; Figure 4 A schematic diagram of a process for determining window information provided in an embodiment of the present application; Figure 5 A schematic diagram of a process for determining room information provided in an embodiment of the present application; Figure 6 A schematic diagram of the architecture of a method for generating a vector diagram provided in an embodiment of the present application; Figure 7 A schematic diagram of the structure of a vector diagram generation device provided in an embodiment of the present application; Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0025] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0026] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0027] Vector graphics, also known as vector graphics or object-oriented graphics, is a graphic representation method based on mathematical formulas. Images can be described by geometric primitives such as lines, curves, points, and polygons.
[0028] The characteristics of vector graphics are that they can be infinitely enlarged or reduced without distortion, regardless of resolution, and the file size is relatively small. They support editing and operation and are suitable for various types of image creation and design, such as graphic design, text design, some logo design, layout design, etc. Each object in a vector graphics is an independent entity with properties such as color, shape, outline, size and screen position. This type of image file contains independent separated images that can be freely and unlimitedly recombined.
[0029] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 , may include a terminal device 101 and a processing device 102. A user may upload an initial floor plan through the terminal device 101, and the terminal device 101 may process the initial floor plan sent by the processing device 102. The processing device 102 may obtain an initial floor plan of the target apartment, and the initial floor plan may be a floor plan in DXF format. The processing device 102 may determine a door layer, a window layer, and a wall layer in multiple layers according to the layer identifier of each layer in the initial floor plan. The door layer and the window image may be subjected to information extraction processing respectively to obtain the door information and the window information of the target apartment, and the wall layer may be subjected to information extraction processing according to the door information and the window information to obtain the room information of the target apartment. A floor plan vector diagram of the target apartment may be generated according to the door information, the window information, and the room information, and the floor plan vector diagram may be displayed in the terminal device 101.
[0030] In the prior art, a worker can obtain data information (e.g., number of rooms, room size, window positions, etc.) from an initial floor plan and input the data information into a vector map generation software to obtain a vector map of the target floor plan. However, manually reading the data information from the initial floor plan and manually inputting the data information into the vector map generation software takes a lot of time, resulting in low efficiency in generating vector maps.
[0031] The method provided in the embodiment of the present application can analyze and process multiple layers of the initial floor plan to obtain door information, window information and room information, and generate a vector diagram of the target floor plan based on the door information, window information and room information. This can automatically extract information from the initial floor plan and improve the efficiency of generating vector diagrams.
[0032] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0033] Figure 2 This is a flow chart of a method for generating a vector diagram provided in an embodiment of the present application. Figure 2 , the method may include: S201, obtaining an initial floor plan of a target apartment.
[0034] The execution subject of the embodiment of the present application may be a processing device, or a vector diagram generating device arranged in the processing device. The vector diagram generating device may be implemented by software, or by a combination of software and hardware.
[0035] The initial floor plan may include a door layer, a window layer and a wall layer, wherein each layer has a corresponding layer identifier, and the layer identifier is used to indicate the layer type of the layer.
[0036] Each layer can include points, line segments, and annotations.
[0037] The initial floor plan may be in text form, wherein the text form may be in DXF format, for example, it may include multiple line segments in each layer, the length of each line segment, the coordinates of the starting point and the end point of each line segment, multiple annotations, and the coordinates of each annotation, etc.
[0038] S202: extract information from the door layer to obtain door information of the target apartment.
[0039] The gate layer may include a plurality of gate line segments, and at least one gate line segment set may be determined among the plurality of gate line segments.
[0040] The gate information may include at least one gate segment set and a gate type corresponding to each gate segment set.
[0041] Each gate line segment set may include multiple gate line segments and endpoint coordinates of two endpoints of each gate line segment.
[0042] Door types can include sliding doors, swing doors, and revolving doors, among others.
[0043] S203: extract information from the window layer to obtain window information of the target apartment.
[0044] The window layer may include multiple window line segments, and at least one window line segment set may be determined among the multiple window line segments.
[0045] The window information may include at least one window segment set and a window type corresponding to each window segment set.
[0046] Each window line segment set may include multiple window line segments and endpoint coordinates of two endpoints of each window line segment.
[0047] Window types can include bay windows and floor-to-ceiling windows, etc.
[0048] S204: extract information from the wall layer according to the door information and the window information to obtain room information of the target apartment.
[0049] The target apartment type may include multiple rooms, and the room information of the target apartment type may be determined in the wall layer.
[0050] The room information may include at least one room line segment set, wherein each room line segment set includes a plurality of room line segments and endpoint coordinates of two endpoints of each room line segment.
[0051] S205: Generate a floor plan vector diagram of the target floor plan based on the door information, window information and room information.
[0052] The door information, window information and room information can be input into the vector diagram generating software to generate a floor plan vector diagram corresponding to the target floor plan.
[0053] When the workload is large, errors may occur when manually obtaining door information, window information and room information. The present application can perform information extraction and processing on the initial floor plan to obtain door information, window information and room information, thereby improving the accuracy of the information obtained and further improving the accuracy of the generated vector map.
[0054] The method for generating a vector diagram provided in the embodiment of the present application can perform information extraction processing on the door layer, window layer and wall layer of the initial floor plan to obtain door information, window information and room information. A vector diagram of the target floor plan can be generated based on the door information, window information and room information, thereby realizing automatic information extraction and improving the efficiency of generating vector diagrams.
[0055] Based on the above embodiments, Figure 3 , the execution process of extracting information from the door layer provided in the embodiment of the present application to obtain the door information of the target apartment is further explained.
[0056] Figure 3 A schematic diagram of a process for determining door information provided in an embodiment of the present application. Figure 3 , the method may include: S301. Identify and obtain multiple door line segments in a door layer.
[0057] Multiple gate line segments can be identified in the gate layer using a breadth-first algorithm.
[0058] Breadth-First Search (BFS) is a blind search method that systematically expands and checks all vertices in a graph to find multiple gate segments.
[0059] S302: Determine the line segment distance between any two door line segments.
[0060] The segment distance between any two gate segments can be determined in the following manner: the first gate segment includes a first endpoint and a second endpoint, the second gate segment includes a third endpoint and a fourth endpoint, the distance between each endpoint of the first gate segment and each endpoint of the second gate segment can be determined, and four endpoint distances can be obtained. The smallest endpoint distance among the four endpoint distances is determined as the distance between the first segment and the second segment.
[0061] For example, assuming that there are 4 gate line segments, namely gate line segments 1-4, assuming that the line segment distance between gate line segment 1 and gate line segment 2 is distance 1, the distance between gate line segment 1 and gate line segment 3 is distance 2, and the line segment distance between gate line segment 1 and gate line segment 4 is distance 3; the line segment distance between gate line segment 2 and gate line segment 3 is distance 4, the line segment distance between gate line segment 2 and gate line segment 4 is distance 5, and the line segment distance between gate line segment 3 and gate line segment 4 is distance 6, that is, 6 line segment distances can be determined.
[0062] S303: Determine at least one gate line segment set from a plurality of gate line segments according to the line segment distance between any two gate line segments.
[0063] The vertices corresponding to each gate line segment can be generated to obtain multiple vertices; for any two vertices, if the distance between the two gate line segments corresponding to the two vertices is less than or equal to the preset distance, an undirected edge between the two vertices is generated until an undirected graph is obtained; at least one connected subgraph is determined in the undirected graph; for any connected subgraph, the gate line segments corresponding to each vertex in the connected subgraph are determined as a gate line segment set.
[0064] An undirected graph can include multiple vertices and undirected edges. There may or may not be an undirected edge between any two vertices.
[0065] If any two vertices in an undirected graph can be connected, it is a connected subgraph.
[0066] For example, assuming that there are 4 gate segments, namely gate segments 1-4, then 4 vertices can be obtained, namely vertices 1-4, where gate segment 1 corresponds to vertex 1, gate segment 2 corresponds to vertex 2, gate segment 3 corresponds to vertex 3, and gate segment 4 corresponds to vertex 4. Assuming the distance between gate segment 1 and gate segment 2, and the distance between gate segment 1 and gate segment 3, undirected edges are generated between vertex 1 and vertex 2, and between vertex 1 and vertex 3. Assuming that the distance between gate segment 1 and gate segment 4, the distance between gate segment 2 and gate segment 3, the distance between gate segment 2 and gate segment 4, and the distance between gate segment 3 and gate segment 4 are greater than the preset distance, there are no undirected edges between vertex 1 and vertex 4, between vertex 2 and vertex 3, between vertex 2 and vertex 4, and between vertex 3 and vertex 4, and undirected edges can be obtained. Figure 1 In the undirected Figure 1 A connected subgraph can be determined in , and the connected subgraph includes vertex 1, vertex 2, vertex 3, the undirected edge between vertex 1 and vertex 2, and the undirected edge between vertex 1 and vertex 3. The gate segments 1-3 corresponding to vertices 1-3 can be determined as a gate segment set.
[0067] S304: Determine the door type corresponding to each door segment set.
[0068] Among them, a gate segment set corresponds to a gate.
[0069] For any gate segment set, the segment features of each gate segment in the gate segment set and the number of gate segments included in the gate segment set can be determined; based on the segment features of each gate segment in the gate segment set and the number of gate segments included in the gate segment set, the gate type corresponding to the gate segment set can be determined.
[0070] Segment features may include length, type, direction, intersection points between gate segments, etc.
[0071] For example, assuming that door segment set 1 has a total of 3 door segments, namely door segment 1, door segment 2 and door segment 3, assuming that door segment 1 is a quarter arc and is a dotted line type, the two ends of door segment 1 are respectively connected to one end of door segment 2 and door segment 3, and the other ends of door segment 2 and door segment 3 are connected, and door segment 2 and door segment 3 are straight lines and are solid lines. Then it can be determined that the door type corresponding to door segment set 1 is a single-leaf door.
[0072] S305: Determine door information.
[0073] The gate information may include at least one gate segment set and a gate type corresponding to each gate segment set.
[0074] The method for generating a vector diagram provided in the embodiment of the present application can perform information extraction processing on the door layer to obtain door information, wherein the door information includes at least one door line segment set and the door type corresponding to each door line segment set, thereby avoiding manual information extraction, improving the efficiency of obtaining the door information, and further improving the efficiency of generating the vector diagram.
[0075] Based on the above embodiments, Figure 4 , the execution process of extracting information from the window layer and obtaining the window information of the target apartment provided in the embodiment of the present application is further explained.
[0076] Figure 4 A schematic diagram of a process for determining window information provided by an embodiment of the present application. Figure 4 , the method comprising: S401. Identify and obtain multiple window line segments in the window layer.
[0077] S402: Determine the line segment distance between any two window line segments.
[0078] S403. Determine at least one window line segment set from a plurality of window line segments according to a line segment distance between any two window line segments.
[0079] S404: Determine the window type corresponding to each window segment set.
[0080] S405: Determine window information.
[0081] The execution process of S401-S404 can refer to the execution process of S301-S305, which will not be repeated here.
[0082] The method for generating a vector diagram provided in the embodiment of the present application can perform information extraction processing on the window layer to obtain window information. The window information includes at least one window line segment set and the window type corresponding to each window line segment set, thereby avoiding manual information extraction, improving the efficiency of obtaining window information, and further improving the efficiency of generating a vector diagram.
[0083] Based on the above embodiments, Figure 5 , the execution process of extracting information from the wall layer according to the door information and window information to obtain the room information of the target apartment provided in the embodiment of the present application is further explained.
[0084] Figure 5 A schematic diagram of a process for determining room information provided in an embodiment of the present application. Figure 5 , the method may include: S501. According to the door information and the window information, auxiliary line segments are added to the wall layer to obtain a target wall layer.
[0085] Auxiliary line segments may include door line segments and window line segments.
[0086] The target wall layer may include at least one closed area, and one closed area may correspond to one room.
[0087] S502: Identify and obtain at least one annotation text and multiple line segments in the wall layer.
[0088] The annotation text can be used to annotate rooms. For example, the text annotation can be for the master bedroom, second bedroom, bathroom, study, living room, etc.
[0089] The plurality of line segments may include wall line segments and auxiliary line segments.
[0090] S503: For any annotated text, determine the distance between the annotated text and each line segment in the plurality of line segments.
[0091] The middle position of the annotation text can be determined as the text position of the annotation text, and the perpendicular distance from the text position to the line segment can be determined as the distance between the annotation text and the line segment.
[0092] S504: Determine a target line segment from among the multiple line segments according to the distance between the annotated text and each line segment.
[0093] Among them, the distance between the target line segment and the annotated text is the smallest, and the target line segment may be a line segment of the room corresponding to the annotated text.
[0094] For example, assuming there are three line segments, namely line segments 1-3, and assuming that the distance from labeled text 1 to line segment 1 is 10, the distance from labeled text 2 to line segment 2 is 5, and the distance from labeled text 3 to line segment 3 is 8, then it can be determined that the target line segment is line segment 2.
[0095] S505 , taking the first endpoint of the target line segment as the starting point, searching for line segments among multiple line segments until the multiple selected line segments found enclose a closed area, and determining the multiple selected line segments as a line segment set corresponding to the annotation text.
[0096] The first endpoint of the target line segment may be used as a starting point, and a line segment search may be performed in a plurality of line segments in a preset direction, wherein the preset direction may be a clockwise direction or a counterclockwise direction.
[0097] A set of line segments can correspond to a room.
[0098] The first selected line segment can be determined from among multiple line segments based on the first endpoint, where one endpoint of the first selected line segment coincides with the first endpoint; and then the i+1th selected line segment can be determined from among the multiple line segments except the first selected line segment based on the other endpoint of the i-th selected line segment.
[0099] Among them, one endpoint of the (i+1)th selected line segment coincides with the other end of the (i)th selected line segment.
[0100] Among them, i is 1, 2, ... in sequence, until the other endpoint of the Nth selected line segment coincides with the first endpoint, the N selected line segments are determined as the line segment set corresponding to the annotation text, and N is an integer greater than 1.
[0101] For example, assuming that there are 6 line segments in total, namely line segments 1-6, and assuming that the target line segment for annotating text 1 is line segment 1, in a clockwise direction, determine that one endpoint of line segment 2 coincides with the first endpoint of line segment 1 (that is, line segment 2 is the first selected line segment), one endpoint of line segment 3 coincides with the other endpoint of line segment 2 (that is, line segment 3 is the second selected line segment), one endpoint of line segment 4 coincides with the other endpoint of line segment 3 (that is, line segment 4 is the third selected line segment), one endpoint of line segment 1 coincides with the other endpoint of line segment 4, and the other endpoint of line segment 1 is the first endpoint (that is, line segment 1 is the fourth selected line segment), and line segments 1-4 can form a closed area, then it can be determined that the line segment set corresponding to the annotated text 1 is {line segment 1, line segment 2, line segment 3 and line segment 4}, where N is 4.
[0102] S506: Generate room information according to the line segment set corresponding to each annotated text.
[0103] The room information may include at least one annotation text and a set of line segments corresponding to each annotation text.
[0104] For example, assuming there are three annotation texts, namely annotation text 1, annotation text 2 and annotation text 3, assuming that annotation text 1 corresponds to segment set 1, annotation text 2 corresponds to segment set 2, and annotation text 3 corresponds to segment set 3, then room information can be generated.
[0105] The method for generating a vector diagram provided in the embodiment of the present application can obtain a target wall layer based on door information and window information, determine at least one annotation text and multiple line segments in the target wall layer, determine the target line segment based on the distance between the annotation text and each line segment, take the first endpoint of the target line segment as the starting point, determine a closed area surrounded by multiple selected line segments among the multiple line segments, determine the multiple selected line segments as a set of line segments corresponding to the annotation text, obtain a set of line segments corresponding to the multiple annotation texts, thereby determining the room information, and realizing automatic extraction of room information, thereby improving the efficiency of generating a vector diagram.
[0106] Figure 6 This is a schematic diagram of the architecture of a method for generating a vector diagram provided in an embodiment of the present application. Figure 6 The initial floor plan of the target floor plan may include a door layer, a window layer, and a wall layer. Multiple door line segments can be identified in the door layer, and the line segment distance between any two door line segments can be determined to generate an undirected graph of multiple door line segments. At least one connected subgraph can be determined in the undirected graph, and the door line segments corresponding to each vertex in each connected subgraph are determined as a door line segment set. The door type of each door line segment set can be determined to obtain door information.
[0107] For window information, multiple window segments can be identified in the window layer, and an undirected graph of multiple window segments can be generated according to the segment distance between any two window segments. At least one connected subgraph can be determined in the undirected graph, and the window segments corresponding to each vertex in each connected subgraph are determined as a window segment set. The window type of each window segment set can be determined to obtain window information.
[0108] According to the door information and window information, auxiliary line segments are added to the wall layer to obtain the target wall layer. At least one annotation text and multiple line segments can be identified in the target wall layer. For any annotation text, the line segment set corresponding to the annotation text can be determined in multiple line segments to obtain the line segment set corresponding to each annotation text. Room information can be generated based on the line segment set corresponding to each annotation text. The floor plan vector diagram of the target apartment can be generated based on the door information, window information and room information.
[0109] Figure 7 This is a schematic diagram of the structure of a vector diagram generation device provided in an embodiment of the present application. Figure 7 The vector diagram generation device 10 may include an acquisition module 11, a first information extraction module 12, a second information extraction module 13, a third information extraction module 14 and a generation module 15: The acquisition module 11 is used to obtain an initial floor plan of the target apartment, wherein the initial floor plan includes a door layer, a window layer and a wall layer; The first information extraction module 12 is used to perform information extraction processing on the door layer to obtain the door information of the target apartment; The second information extraction module 13 is used to perform information extraction processing on the window layer to obtain the window information of the target apartment; The third information extraction module 14 is used to extract information from the wall layer according to the door information and the window information to obtain the room information of the target apartment; The generating module 15 is used to generate a floor plan vector diagram of the target floor plan according to the door information, the window information and the room information.
[0110] The vector diagram generation device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0111] In some possible embodiments, the first information extraction module 12 is specifically used for: Multiple door line segments are identified in the door layer; Determine the segment distance between any two gate segments; According to the line segment distance between any two door line segments, at least one door line segment set is determined from the multiple door line segments, and the door type corresponding to each door line segment set is determined, and one door line segment set corresponds to one door; Determining the gate information includes: at least one gate line segment set, and a gate type corresponding to each gate line segment set.
[0112] In some possible embodiments, the first information extraction module 12 is specifically used for: Generate the vertex corresponding to each gate line segment to obtain multiple vertices; For any two vertices, if the distance between the two gate line segments corresponding to the two vertices is less than or equal to the preset distance, an undirected edge between the two vertices is generated until an undirected graph is obtained, wherein the undirected graph includes multiple vertices and undirected edges; Determining at least one connected subgraph in the undirected graph; For any connected subgraph, the gate segments corresponding to each vertex in the connected subgraph are determined as a gate segment set.
[0113] In some possible embodiments, for any gate segment set, the first information extraction module 12 is specifically used to: Determine the line segment feature of each gate line segment in the gate line segment set and the number of gate line segments included in the gate line segment set; The gate type corresponding to the gate line segment set is determined according to the line segment feature of each gate line segment in the gate line segment set and the number of gate line segments included in the gate line segment set.
[0114] In some possible embodiments, the third information extraction module 14 is specifically used for: According to the door information and window information, auxiliary line segments are added to the wall layer to obtain the target wall layer. The auxiliary line segments include door line segments and window line segments. Recognize and obtain at least one annotation text and multiple line segments in the wall layer, the annotation text is used for room annotation, and the multiple line segments include wall line segments and auxiliary line segments; For any annotation text, determine the line segment set corresponding to the annotation text from multiple line segments, and one line segment set corresponds to one room; Generate room information based on the line segment set corresponding to each annotation text.
[0115] In some possible embodiments, the third information extraction module 14 is specifically used for: determining a distance between the annotation text and each of the plurality of line segments; According to the distance between the annotation text and each line segment, a target line segment is determined among multiple line segments, and the distance between the target line segment and the annotation text is the smallest; Taking the first endpoint of the target line segment as the starting point, line segment search is performed among multiple line segments until the multiple selected line segments found enclose a closed area, and the multiple selected line segments are determined as the line segment set corresponding to the annotation text.
[0116] In some possible embodiments, the third information extraction module 14 is specifically used for: According to the first endpoint, determining a first selected line segment from the plurality of line segments, wherein an endpoint of the first selected line segment coincides with the first endpoint; According to the other endpoint of the i-th selected line segment, determine the i+1-th selected line segment among the multiple line segments except the first selected line segment, and one endpoint of the i+1-th selected line segment coincides with the other end of the i-th selected line segment; Among them, i is 1, 2, ... in sequence, until the other endpoint of the Nth selected line segment coincides with the first endpoint, the N selected line segments are determined as the line segment set corresponding to the annotation text, and N is an integer greater than 1.
[0117] The vector diagram generation device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0118] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 The electronic device 20 may include a processor 21 and a memory 22. Exemplarily, the processor 21 and the memory 22 are interconnected via a bus 23.
[0119] The memory 22 stores computer executable instructions; The processor 21 executes the computer-executable instructions stored in the memory 22, so that the processor 21 executes the method for generating a vector diagram as shown in the above method embodiment.
[0120] Accordingly, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method for generating a vector diagram of the above method embodiment.
[0121] Accordingly, an embodiment of the present application may also provide a computer program product, including a computer program, which, when executed by a processor, can implement the method for generating a vector diagram shown in the above method embodiment.
[0122] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0123] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0124] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0125] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0126] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0127] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0128] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0129] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0130] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for generating a vector diagram, characterized in that: include: Obtaining an initial floor plan of the target apartment, wherein the initial floor plan includes a door layer, a window layer, and a wall layer; Performing information extraction processing on the door layer to obtain door information of the target apartment; Performing information extraction processing on the window layer to obtain window information of the target apartment; According to the door information and the window information, information extraction processing is performed on the wall layer to obtain room information of the target apartment; A floor plan vector diagram of the target floor plan is generated according to the door information, the window information and the room information.
2. The method according to claim 1, characterized in that Performing information extraction processing on the door layer to obtain the door information of the target apartment type includes: Identifying and obtaining a plurality of gate line segments in the gate layer; Determine the segment distance between any two gate segments; According to the line segment distance between any two door line segments, at least one door line segment set is determined from the plurality of door line segments, and the door type corresponding to each door line segment set is determined, where one door line segment set corresponds to one door; Determining the gate information includes: the at least one gate line segment set, and a gate type corresponding to each gate line segment set.
3. The method according to claim 2, characterized in that Determining at least one gate line segment set from the plurality of gate line segments according to the line segment distance between any two gate line segments, including: Generate the vertex corresponding to each gate line segment to obtain multiple vertices; For any two vertices, if the distance between the two gate line segments corresponding to the two vertices is less than or equal to a preset distance, an undirected edge between the two vertices is generated until an undirected graph is obtained, wherein the undirected graph includes the plurality of vertices and the undirected edge; Determining at least one connected subgraph in the undirected graph; For any connected subgraph, the gate line segments corresponding to the vertices in the connected subgraph are determined as a gate line segment set.
4. The method according to claim 2 or 3, characterized in that: For any gate segment set; determining the gate type corresponding to the gate segment set, including: Determine the line segment feature of each gate line segment in the gate line segment set and the number of gate line segments included in the gate line segment set; The gate type corresponding to the gate line segment set is determined according to the line segment feature of each gate line segment in the gate line segment set and the number of gate line segments included in the gate line segment set.
5. The method according to claim 1, characterized in that: According to the door information and the window information, the wall layer is subjected to information extraction processing to obtain room information of the target apartment type, including: According to the door information and the window information, auxiliary line segments are added to the wall layer to obtain a target wall layer, wherein the auxiliary line segments include door line segments and window line segments; Identify and obtain at least one annotation text and a plurality of line segments in the wall layer, wherein the annotation text is used for room annotation, and the plurality of line segments include wall line segments and the auxiliary line segments; For any annotated text, determine a line segment set corresponding to the annotated text from the multiple line segments, where one line segment set corresponds to one room; The room information is generated according to the line segment set corresponding to each annotation text.
6. The method according to claim 5, characterized in that Determining a line segment set corresponding to the annotated text from the plurality of line segments includes: Determining the distance between the annotation text and each line segment of the plurality of line segments; Determine a target line segment among the plurality of line segments according to the distances between the annotated text and each line segment, wherein the distance between the target line segment and the annotated text is the smallest; Taking the first endpoint of the target line segment as the starting point, line segment search is performed among the multiple line segments until the multiple selected line segments found enclose a closed area, and the multiple selected line segments are determined as the line segment set corresponding to the annotated text.
7. The method according to claim 6, characterized in that Taking an endpoint of the target line segment as a starting point, searching for line segments in the multiple line segments until the multiple selected line segments found enclose a closed area, and determining the multiple selected line segments as a line segment set corresponding to the annotated text, including: Determine, according to the first endpoint, a first selected line segment from among the multiple line segments, wherein an endpoint of the first selected line segment coincides with the first endpoint; According to the other endpoint of the i-th selected line segment, determine the i+1-th selected line segment from the other line segments except the first selected line segment among the multiple line segments, and one endpoint of the i+1-th selected line segment coincides with the other end of the i-th selected line segment; Among them, the i is successively 1, 2, ..., until the other endpoint of the Nth selected line segment coincides with the first endpoint, the N selected line segments are determined as the line segment set corresponding to the annotated text, and N is an integer greater than 1.
8. A device for generating a vector diagram, characterized in that: It includes an acquisition module, a first information extraction module, a second information extraction module, a third information extraction module and a generation module: The acquisition module is used to acquire an initial floor plan of the target apartment, wherein the initial floor plan includes a door layer, a window layer and a wall layer; The first information extraction module is used to perform information extraction processing on the door layer to obtain the door information of the target apartment type; The second information extraction module is used to perform information extraction processing on the window layer to obtain the window information of the target apartment; The third information extraction module is used to perform information extraction processing on the wall layer according to the door information and the window information to obtain the room information of the target apartment; The generating module is used to generate a floor plan vector diagram of the target floor plan according to the door information, the window information and the room information.
9. An electronic device, characterized in that: include: Memory and processor, The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor executes the method for generating a vector image according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method for generating a vector diagram according to any one of claims 1 to 7.