Indoor area identification method, electronic equipment, storage medium and program product
By converting wall data into polygons and constructing an adjacency matrix, the indoor area is automatically identified, which solves the problem that lines cannot be closed in loops in complex floor plans, and improves the drawing efficiency and accuracy.
Patent Information
- Application Number
- CN202411959456.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-05-16
AI Technical Summary
When drawing complex floor plans, the prior art is difficult to effectively deal with the problem that multiple lines cannot be connected in a closed loop in sequence, resulting in low drawing efficiency and reduced accuracy.
By converting wall data into wall polygons and merging multiple wall polygons and structuring an adjacency matrix, the indoor area is automatically identified and determined, and the need for additional connection lines is avoided.
The efficiency and accuracy of floor plan drawing are improved, ensuring that the final floor plan drawn is consistent with the actual floor plan.
Smart Images

Figure CN120014101A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to an indoor area recognition method, electronic equipment, storage medium and program product. Background Art
[0002] With the continuous development of computer technology, the application fields of computer technology are constantly expanding. For example, after installing drawing software on the computer, draftsmen can use the drawing software to draw diagrams in various fields, such as floor plans.
[0003] In the prior art, draftsmen draw lines representing walls on drawing software based on apartment data, such as the starting point and end point of the wall. When drawing indoor areas, draftsmen need to consider the thickness of the wall and whether multiple lines can be connected end to end in sequence to form a closed loop, such as the end point of line 1 is connected to the starting point of line 2, the end point of line 2 is connected to the starting point of line 3, the end point of line 3 is connected to the starting point of line 4, and the end point of line 4 is connected to the starting point of line 1, thereby forming a closed loop.
[0004] When processing complex apartment data, if multiple lines cannot be connected end to end to form a closed loop, the draftsman may add additional connecting lines to form a closed loop, which not only reduces the drawing efficiency, but also causes the final apartment plan to be inconsistent with the actual apartment plan, thereby reducing the drawing accuracy of the apartment plan. Summary of the invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present disclosure provide an indoor area recognition method, an electronic device, a storage medium and a program product, which improve the efficiency and accuracy of drawing floor plans.
[0006] The present disclosure provides a method for identifying an indoor area, the method comprising:
[0007] Generate multiple wall polygons according to multiple wall data;
[0008] Merging the wall polygons having a common portion among the plurality of wall polygons to obtain at least one merged whole polygon;
[0009] If there are at least two counterclockwise polygons having a common point in the at least one overall polygon, constructing an adjacency matrix according to the at least two counterclockwise polygons;
[0010] Traversing the adjacency matrix to obtain at least one closed loop;
[0011] An area enclosed by a clockwise polygon in the at least one overall polygon and a clockwise closed loop in the at least one closed loop is determined as an indoor area.
[0012] The present disclosure also provides an indoor area recognition device, which includes:
[0013] A generating module, used for generating a plurality of wall polygons according to a plurality of wall data;
[0014] A merging module, used for merging the wall polygons having a common part among the plurality of wall polygons to obtain at least one merged whole polygon;
[0015] A construction module, configured to construct an adjacency matrix according to at least two counterclockwise polygons having a common point in the at least one overall polygon;
[0016] A traversal module, used for traversing the adjacency matrix to obtain at least one closed loop;
[0017] The determination module is used to determine the area enclosed by the clockwise polygon in the at least one overall polygon and the clockwise closed loop in the at least one closed loop as an indoor area.
[0018] The present disclosure also provides an electronic device, the electronic device comprising:
[0019] one or more processors;
[0020] A storage device for storing one or more programs;
[0021] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0022] The embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described above is implemented.
[0023] The embodiment of the present disclosure further provides a computer program product, including computer program instructions, which implement the above method when executed by a processor.
[0024] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has at least the following advantages:
[0025] The indoor area recognition method provided by the embodiment of the present disclosure converts wall data into wall polygons, merges the wall polygons with common parts in multiple wall polygons, and obtains at least one merged whole polygon. Further, an adjacency matrix is constructed based on at least two counterclockwise polygons with common points in the at least one whole polygon, and the adjacency matrix is traversed to obtain at least one closed loop. Further, the area enclosed by the clockwise polygons in the at least one whole polygon and the closed loop in the clockwise direction in the at least one closed loop is determined as an indoor area, so that the indoor area is determined based on a set of points, and it is not required that multiple lines representing the wall are sequentially connected end to end to form a closed loop. Therefore, when processing complex apartment data, there is no need to add additional connecting lines to piece together closed loops, which not only improves the efficiency of drawing the apartment map, but also ensures that the final apartment map is consistent with the actual apartment, thereby improving the drawing accuracy of the apartment map. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0027] Figure 1 is a flow chart of an indoor area recognition method in an embodiment of the present disclosure;
[0028] Figure 2 is a schematic diagram of a wall polygon in an embodiment of the present disclosure;
[0029] Figure 3 is a schematic diagram of merging wall polygons in an embodiment of the present disclosure;
[0030] Figure 4 A schematic diagram of another wall polygon merging method in an embodiment of the present disclosure;
[0031] Figure 5 is a schematic diagram of an indoor area in an embodiment of the present disclosure;
[0032] Figure 6 is a schematic diagram of a wall arc segmentation in an embodiment of the present disclosure;
[0033] Figure 7 is a flow chart of another indoor area recognition method in an embodiment of the present disclosure;
[0034] Figure 8 is a schematic diagram of an indoor area in an embodiment of the present disclosure;
[0035] Fig. 9A schematic diagram of another indoor area type identification in an embodiment of the present disclosure;
[0036] Fig.10 is a flow chart of another indoor area recognition method in an embodiment of the present disclosure;
[0037] Fig.11 is a structural schematic diagram of an indoor area recognition device in an embodiment of the present disclosure;
[0038] Fig.12 It is a structural schematic diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0039] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0040] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0041] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0042] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0043] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0044] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0045] Figure 1 This is a flow chart of an indoor area recognition method in an embodiment of the present disclosure. The method can be executed by an indoor area recognition device, which can be implemented in software and / or hardware. The device can be configured in a mapping terminal, such as an electronic terminal, specifically including but not limited to a smart phone, a PDA, a tablet computer, a wearable device with a display screen, a desktop computer, a laptop computer, an all-in-one machine, a smart home device, etc. Alternatively, the device can also be configured in a server or a server cluster.
[0046] like Figure 1 As shown, the method may specifically include the following steps:
[0047] S101. Generate multiple wall polygons according to multiple wall data.
[0048] For example, the drawing terminal stores apartment data, and the apartment data includes relevant data of all walls in the apartment. Here, the relevant data of a wall is recorded as wall data. The wall data may specifically include the starting point of the wall, the end point of the wall, the thickness of the wall, the curvature of the wall, etc. In some embodiments, the wall data may also be recorded as wall attributes. Since a plurality of walls are included in an apartment, the apartment data includes a plurality of wall data. It is understandable that a plurality of apartment data may be stored in the drawing terminal. Here, taking an apartment data as an example, the process of obtaining all indoor areas in the apartment based on the plurality of wall data included in the apartment data is introduced. In addition, the wall data is not limited to including the starting point of the wall, the end point of the wall, the thickness of the wall, the curvature of the wall, etc., and may also include other attributes of the wall, such as the height of the wall, the structure of the wall, etc.
[0049] Specifically, this embodiment can generate a wall polygon according to each wall data, thereby generating multiple wall polygons according to multiple wall data. For example, when the wall curvature is 0, the wall polygon generated according to the wall starting point, wall end point, and wall thickness is a rectangle. Figure 2 As shown, point A indicates the starting point of the wall, and point B indicates the end point of the wall. The wall polygon generated according to the starting point, end point, and thickness of the wall is Figure 2 In the disclosed embodiment, the wall polygon can be represented by a set of points in counterclockwise order. Figure 2 The rectangle shown can be represented by a point set [A, B, C, D, A]. Specifically, the coordinates of each point in the point set [A, B, C, D, A] are stored in the drawing terminal. When the drawing terminal needs to process the rectangle, it only needs to retrieve the coordinates of each point in the point set [A, B, C, D, A] to obtain the rectangle. In other words, the embodiment of the present disclosure can convert each wall data into a point set in counterclockwise order to represent the wall polygon.
[0050] S102: Merge the wall polygons having a common portion among the plurality of wall polygons to obtain at least one merged whole polygon.
[0051] For example, after the multiple wall data included in the apartment data are converted into wall polygons respectively, the multiple wall polygons obtained by the conversion are merged. Specifically, if there are common parts between some of the multiple wall polygons, these wall polygons are merged into an integral polygon. If there are no common parts between any wall polygon and other wall polygons in the multiple wall polygons, any wall polygon is regarded as an integral polygon. After the merging process, at least one integral polygon is obtained.
[0052] Optionally, merging the wall polygons having a common portion among the plurality of wall polygons includes: merging the wall polygons having a common edge or an overlapping portion among the plurality of wall polygons.
[0053] like Figure 3 As shown, there is an overlapping part between the wall polygon represented by the point set [1, 2, 3, 4, 1] and the wall polygon represented by the point set [5, 6, 7, 3, 5], and the merged overall polygon is represented by the point set [1, 6, 7, 3, 4, 1].
[0054] like Figure 4 As shown, there is an overlapping part between the wall polygon represented by the point set [1, 2, 3, 4, 1] and the wall polygon represented by the point set [4, 5, 6, 7, 4], there is an overlapping part between the wall polygon represented by the point set [1, 2, 3, 4, 1] and the wall polygon represented by the point set [10, 9, 8, 3, 10], there is a common edge between the wall polygon represented by the point set [4, 5, 6, 7, 4] and the wall polygon represented by the point set [6, 5, 8, 9, 6], there is a common edge between the wall polygon represented by the point set [10, 9, 8, 3, 10] and the wall polygon represented by the point set [6, 5, 8, 9, 6], and after merging, two overall polygons are obtained. One of the two overall polygons is an external overall polygon, and the other overall polygon is an internal overall polygon. In this embodiment, the external overall polygon is represented by a point set in counterclockwise order, and the internal overall polygon is represented by a point set in clockwise order. Therefore, as Figure 4The two overall polygons shown are the overall polygon represented by the point set [4, 5, 8, 3, 4] and the overall polygon represented by the point set [7, 10, 9, 6, 7]. That is, in the embodiment of the present disclosure, each overall polygon obtained after merging multiple wall polygons is directional, that is, each overall polygon is represented by a point set in clockwise order or a point set in counterclockwise order. Specifically, in this embodiment, the overall polygon represented by a point set in clockwise order is recorded as a clockwise polygon, that is, an overall polygon in the clockwise direction. The overall polygon represented by a point set in counterclockwise order is recorded as a counterclockwise polygon, that is, an overall polygon in the counterclockwise direction.
[0055] It is understandable that the reason why the external overall polygon is represented by a set of points in counterclockwise order and the internal overall polygon is represented by a set of points in clockwise order in this embodiment is mainly derived from the conventions of computer graphics and Geographic Information System (GIS). This specification is mainly used to distinguish the outer contour (outer ring) and the internal hole (inner ring) of the polygon to ensure consistent direction definition, so as to maintain accuracy in subsequent geometric operations and rendering. Specifically, in GIS data standardization, it is usually stipulated that the outer ring of the polygon of the planar data adopts the counterclockwise direction, while the inner ring adopts the clockwise direction, so as to automatically identify the hole. This convention facilitates the parsing of polygons and determines spatial relationships, such as containment relationships and adjacency relationships. In graphics, it is a common specification to define the outer ring using the counterclockwise direction, especially in three-dimensional rendering and rasterization. The unification of the order direction helps to determine the direction of the surface normal vector, which is crucial in geometric operations such as lighting calculations and collision detection.
[0056] S103: If there are at least two counterclockwise polygons having a common point in the at least one overall polygon, construct an adjacency matrix according to the at least two counterclockwise polygons.
[0057] like Figure 4 As shown, after the merging process, two whole polygons are obtained, and there is a counterclockwise polygon among the two whole polygons, that is, the whole polygon represented by the point set [4, 5, 8, 3, 4]. Since there are no at least two counterclockwise polygons, there are no at least two counterclockwise polygons with common points, and it is not necessary to construct an adjacency matrix at this time. In other embodiments, after the merging process, multiple whole polygons are obtained, and it is necessary to determine whether there are at least two counterclockwise polygons with common points among the multiple whole polygons. If so, an adjacency matrix is constructed based on the at least two counterclockwise polygons with common points. If not, the adjacency matrix is not constructed.
[0058] Optionally, the at least two counterclockwise polygons include a first counterclockwise polygon represented by a first point set, and a second counterclockwise polygon represented by a second point set; constructing an adjacency matrix based on the at least two counterclockwise polygons, including: traversing each point in the first point set and the second point set, and determining the next point of the point in the first counterclockwise polygon and / or the second counterclockwise polygon; constructing an adjacency matrix based on each point in the first point set and the second point set, and the next point of each point in the first counterclockwise polygon and / or the second counterclockwise polygon, respectively.
[0059] For example Figure 5 As shown, the overall polygon represented by the point set [1, 2, 3, 4, 1] and the overall polygon represented by the point set [5, 6, 7, 8, 3, 9, 10, 2, 5] are the overall polygons obtained after the merging process, and these two overall polygons are counterclockwise polygons. In addition, there are common points between these two overall polygons, namely point 2 and point 3. Here, the point set [1, 2, 3, 4, 1] is recorded as the first point set, and the overall polygon represented by the point set [1, 2, 3, 4, 1] is recorded as the first counterclockwise polygon. The point set [5, 6, 7, 8, 3, 9, 10, 2, 5] is recorded as the second point set, and the overall polygon represented by the point set [5, 6, 7, 8, 3, 9, 10, 2, 5] is recorded as the second counterclockwise polygon. Further, an adjacency matrix is constructed based on the point set [1, 2, 3, 4, 1] and the point set [5, 6, 7, 8, 3, 9, 10, 2, 5]. When constructing the adjacency matrix, traverse each point in the point set [1, 2, 3, 4, 1] and the point set [5, 6, 7, 8, 3, 9, 10, 2, 5] to determine the next point of the point in the first counterclockwise polygon and / or the second counterclockwise polygon, that is, it is necessary to consider each point in the point set [1, 2, 3, 4, 1] and the point set [5, 6, 7, 8, 3, 9, 10, 2, 5], as well as the points that each point can reach. For example, point 1 only appears in the point set [1, 2, 3, 4, 1], and point 1 can reach point 2, so 1: [2] is used to represent point 1 to point 2. For another example, point 2 appears in both the point set [1, 2, 3, 4, 1] and the point set [5, 6, 7, 8, 3, 9, 10, 2, 5]. According to the point set [1, 2, 3, 4, 1], we know that point 2 can reach point 3. According to the point set [5, 6, 7, 8, 3, 9, 10, 2, 5], we know that point 2 can reach point 5. Therefore, 2: [3, 5] is used to indicate that point 2 can reach point 3 or point 5, and so on. The resulting adjacency matrix is represented as: 1: [2], 2: [3, 5], 3: [4, 9], 4: [1], 5: [6], 6: [7], 7: [8], 8: [3], 9:
[10] , 10: [2].
[0060] Understandably, Figure 5 The case where two counterclockwise polygons have a common point is used as an example for schematic illustration. In some other embodiments, there may be a case where more counterclockwise polygons have a common point.
[0061] S104: traverse the adjacency matrix to obtain at least one closed loop.
[0062] For example, after constructing the adjacency matrix, the adjacency matrix is traversed to find all possible closed loops, that is, at least one closed loop. Similarly, each closed loop is represented by a set of points.
[0063] S105: Determine an area enclosed by a clockwise polygon in the at least one overall polygon and a closed loop in a clockwise direction in the at least one closed loop as an indoor area.
[0064] Specifically, after obtaining at least one closed loop by traversing the adjacency matrix, the at least one closed loop is filtered. The specific filtering method may be to remove the closed loop represented by the set of points in counterclockwise order, i.e., the closed loop in the counterclockwise direction, and retain the closed loop represented by the set of points in clockwise order, i.e., the closed loop in the clockwise direction. Further, the clockwise polygon in at least one overall polygon obtained after the merging process and the area enclosed by the closed loop in the clockwise direction in the at least one closed loop are determined as the indoor area. Among them, the clockwise polygon in at least one overall polygon can also be recorded as the overall polygon in the clockwise direction.
[0065] The indoor area recognition method provided by the embodiment of the present disclosure converts wall data into wall polygons, merges the wall polygons with common parts in multiple wall polygons, and obtains at least one merged whole polygon. Further, an adjacency matrix is constructed based on at least two counterclockwise polygons with common points in the at least one whole polygon, and the adjacency matrix is traversed to obtain at least one closed loop. Further, the area enclosed by the clockwise polygons in the at least one whole polygon and the closed loop in the clockwise direction in the at least one closed loop is determined as an indoor area, so that the indoor area is determined based on a set of points, and it is not required that multiple lines representing the wall are sequentially connected end to end to form a closed loop. Therefore, when processing complex apartment data, there is no need to add additional connecting lines to piece together closed loops, which not only improves the efficiency of drawing the apartment map, but also ensures that the final apartment map is consistent with the actual apartment, thereby improving the drawing accuracy of the apartment map.
[0066] In addition, by converting wall data into wall polygons, not only the method of area drawing is expanded, but also the parsing process of apartment data is simplified, and the processing efficiency of apartment data is improved, especially the processing efficiency of complex apartment data.
[0067] In addition, by merging the wall polygons with common parts among the multiple wall polygons, the integrity and accuracy of the wall polygons are ensured. In addition, by constructing an adjacency matrix and traversing the adjacency matrix, multiple wall polygons with no common edges or overlapping parts but common points can be automatically identified and processed, thereby improving the recognition efficiency of indoor areas. Finally, by filtering at least one closed loop obtained after traversing the adjacency matrix, a closed loop in the clockwise direction is obtained, and the indoor area is determined according to the closed loop in the clockwise direction, thereby filtering out the valid indoor area, ensuring the complete and accurate analysis of the apartment data, and especially improving the processing efficiency and accuracy of complex apartment data.
[0068] It is understandable that the wall may be a curved wall or a non-curved wall. Therefore, when converting the wall data into a wall polygon, it is necessary to process each case separately, which is described below in conjunction with a specific embodiment.
[0069] Optionally, the wall data includes at least a wall starting point, a wall end point, a wall thickness, and a wall curvature; multiple wall polygons are generated based on multiple wall data, including: if the wall curvature is 0, a wall polygon is generated based on the wall starting point, the wall end point, and the wall thickness; if the wall curvature is not 0, a wall arc is generated based on the wall starting point, the wall end point, the wall thickness, and the wall curvature, and the wall arc is segmented to obtain multiple segmentation points, and the multiple segmentation points constitute a wall polygon.
[0070] For example, when the wall curvature is 0, the wall polygon generated according to the wall starting point, wall end point, and wall thickness is a rectangle. Figure 2 As shown, point A indicates the starting point of the wall, and point B indicates the end point of the wall. The wall polygon generated according to the starting point, end point, and thickness of the wall is Figure 2 The rectangle shown.
[0071] When the wall curvature is not 0, the wall curvature is generated according to the wall starting point, wall end point, wall thickness, and wall curvature. Figure 6As shown, when the curvature of the wall is not 0, the arc height h is calculated according to the curvature of the wall, and the center and radius corresponding to the wall arc are calculated according to the arc height h. Further, the wall arc is generated according to the wall starting point A, the wall end point B, the wall thickness, the center and the radius. Then, the wall arc is segmented, which can be equally spaced or unequally spaced, so as to obtain multiple segmentation points. In the process of segmenting the wall arc, the arc segment between two adjacent segmentation points is approximately a straight line. After the segmentation is completed, the coordinates of all segmentation points are retained, and the wall polygon can be obtained by connecting each two adjacent segmentation points with a straight line.
[0072] Optionally, traverse the adjacency matrix to obtain at least one closed loop, including Figure 7 The following steps are shown:
[0073] S701, traverse the adjacency matrix to obtain multiple closed loops.
[0074] For example, after constructing the adjacency matrix, a depth first search (DFS) method is used to traverse the adjacency matrix to find all possible closed loops. Similarly, each closed loop is represented by a set of points.
[0075] S702: Remove duplicate closed loops corresponding to the same area among the multiple closed loops to obtain at least one closed loop.
[0076] However, among all possible closed loops obtained by traversing the adjacency matrix using the DFS method, there may be duplicate closed loops. For example, the area enclosed by the closed loop represented by the point set [1, 2, 3, 4, 1] and the area enclosed by the closed loop represented by the point set [2, 3, 4, 1, 2] are the same area, namely, matrix 1234. In other words, the closed loop represented by the point set [1, 2, 3, 4, 1] and the closed loop represented by the point set [2, 3, 4, 1, 2] correspond to the same area, namely, the closed loop represented by the point set [1, 2, 3, 4, 1] and the closed loop represented by the point set [2, 3, 4, 1, 2] are duplicated. Therefore, only one of the point set [1, 2, 3, 4, 1] and the point set [2, 3, 4, 1, 2] needs to be retained. Figure 5 In the case shown, after traversing the adjacency matrix using DFS and removing duplicates, we can finally obtain closed loops represented by the point set [1, 2, 3, 4, 1], the point set [2, 5, 6, 7, 8, 3, 4, 1, 2], the point set [3, 9, 10, 2, 3], and the point set [3, 9, 10, 2, 5, 6, 7, 8, 3] respectively.
[0077] For example Figure 5As shown, after traversing the adjacency matrix and removing duplicates, the closed loops represented by the point set [1, 2, 3, 4, 1], the point set [2, 5, 6, 7, 8, 3, 4, 1, 2], the point set [3, 9, 10, 2, 3], and the point set [3, 9, 10, 2, 5, 6, 7, 8, 3] are obtained. Further, the direction order of the points in each point set is determined. If the direction order of the points in the point set is clockwise, then the closed loop represented by the point set is a clockwise closed loop. If the direction order of the points in the point set is counterclockwise, then the closed loop represented by the point set is a counterclockwise closed loop. Since the point set [1, 2, 3, 4, 1], the point set [2, 5, 6, 7, 8, 3, 4, 1, 2], and the point set [3, 9, 10, 2, 5, 6, 7, 8, 3] are respectively counterclockwise point sets, and the point set [3, 9, 10, 2, 3] is a clockwise point set, therefore, the counterclockwise point set is removed, the clockwise point set is retained, and the closed loop represented by the clockwise point set, i.e., the area enclosed by the clockwise closed loop, is determined as the indoor area, for example Figure 5 The shaded portion shown is an indoor area. In addition, if there is a clockwise polygon in at least one of the overall polygons obtained after the merging process, and such clockwise polygons may be one or more, then such one or more clockwise polygons are also determined as indoor areas. Specifically, one clockwise polygon is an indoor area. That is to say, in some embodiments, multiple wall polygons are merged to obtain multiple overall polygons, and the multiple overall polygons contain not only clockwise polygons but also at least two counterclockwise polygons with common points. In this case, not only the clockwise polygons (which may be one or more) in the multiple overall polygons can be determined as indoor areas, but also an adjacency matrix can be constructed based on the at least two counterclockwise polygons, and the adjacency matrix can be traversed to obtain at least one closed loop, and the area enclosed by the closed loop in the clockwise direction in the at least one closed loop can be determined as an indoor area.
[0078] Optionally, the method further includes: if there are not at least two counterclockwise polygons having a common point in the at least one overall polygon, determining a clockwise polygon in the at least one overall polygon as an indoor area.
[0079] For example, after the merging process, an overall polygon is obtained, and the overall polygon is a counterclockwise polygon, and at this time there is no indoor area.
[0080] For another example, after the merging process, multiple whole polygons are obtained, and there is a counterclockwise polygon among the multiple whole polygons, then there is no need to construct an adjacency matrix. If the multiple whole polygons include at least one clockwise polygon, then the at least one clockwise polygon is determined as an indoor area. Figure 4 As shown in the figure, after the merging process, two whole polygons are obtained, of which there is only one counterclockwise polygon, and there is no need to construct an adjacency matrix. However, there is a clockwise polygon, that is, the whole polygon represented by the point set [7, 10, 9, 6, 7]. Here, the clockwise polygon is determined as the indoor area. Figure 8 As shown, after the merging process, three whole polygons are obtained, such as the whole polygon represented by the point set [1, 2, 3, 4, 1], the whole polygon represented by the point set [5, 6, 7, 8, 5], and the whole polygon represented by the point set [9, 10, 11, 12, 9]. Among them, the whole polygon represented by the point set [1, 2, 3, 4, 1] is a counterclockwise polygon, and the whole polygon represented by the point set [5, 6, 7, 8, 5] and the whole polygon represented by the point set [9, 10, 11, 12, 9] are clockwise polygons. Here, the whole polygon represented by the point set [5, 6, 7, 8, 5] and the whole polygon represented by the point set [9, 10, 11, 12, 9] are respectively determined as indoor areas.
[0081] For another example, after the merging process, multiple overall polygons are obtained, and there are multiple counterclockwise polygons among the multiple overall polygons, but there are not at least two counterclockwise polygons with common points among the multiple counterclockwise polygons, then there is no need to construct an adjacency matrix. If the multiple overall polygons include at least one clockwise polygon, then the at least one clockwise polygon is respectively determined as an indoor area.
[0082] Optionally, after determining that the area is an indoor area, the method further includes: identifying the type of the indoor area.
[0083] like Fig. 9 As shown, in Figure 5 On the basis of, after determining that the shaded part is an indoor area, the type of the indoor area can be further identified. For example, if the indoor area is a bedroom, the indoor area is marked. Here, not only can the indoor area be marked as a bedroom, but the size of the indoor area can also be marked. In other embodiments, a data structure corresponding to the indoor area can also be constructed. For example, the data structure includes the coordinates of the path points of the indoor area (for example, point 3, point 9, point 10, point 2), the size of the indoor area (for example, 2.3 square meters), the type of the indoor area (for example, a bedroom), etc. Further, the data structure can be stored in a drawing terminal. When the indoor area needs to be displayed, the drawing terminal can generate and display the indoor area according to the data structure. It can be understood that Figure 4 , Figure 8 The obtained indoor area can be processed similarly, which will not be described here.
[0084] The disclosed embodiment realizes automatic recognition of various indoor areas in a complex apartment by converting wall data into wall polygons, merging wall polygons, constructing an adjacency matrix, traversing the adjacency matrix, and determining the direction of polygon points.
[0085] Fig.10 Flow chart of a method for indoor area recognition in an embodiment of the present disclosure, the method includes the following steps:
[0086] S1001. Obtain current apartment type data.
[0087] S1002: Read wall data.
[0088] S1003: Determine whether the wall is an arc. If yes, execute S1005; otherwise, execute S1004.
[0089] S1004: Determine the wall polygon path points.
[0090] Specifically, the wall polygon path points may be vertices of the wall polygon, such as four vertices of a rectangle.
[0091] S1005: Calculate the center and radius of the circle corresponding to the wall arc, and segment the wall arc.
[0092] S1006: Generate wall polygons.
[0093] S1007. Merge wall polygons.
[0094] S1008: Determine the overall polygon in the counterclockwise direction.
[0095] S1009: Determine whether there is a common point. If yes, execute S1010, otherwise execute S1011.
[0096] S1010. Find a closed loop.
[0097] For example, construct an adjacency matrix, traverse the adjacency matrix, and obtain at least one closed loop.
[0098] S1011: Determine the area enclosed by the overall polygon in the clockwise direction and the closed loop in the clockwise direction as the indoor area.
[0099] S1012: Identify the type of the indoor area.
[0100] It can be understood that the specific process and principle of S1001-S1012 can refer to the contents described in the above embodiment and will not be repeated here.
[0101] Fig.11FIG. 1 is a schematic diagram of the structure of an indoor area recognition device in an embodiment of the present disclosure. The device provided in the embodiment of the present disclosure can be configured in a drawing terminal, a server or a server cluster. Fig.11 As shown, the indoor area recognition device 110 specifically includes: a generation module 111, a merging module 112, a construction module 113, a traversal module 114, and a determination module 115.
[0102] Among them, the generation module 111 is used to generate multiple wall polygons according to multiple wall data; the merging module 112 is used to merge the wall polygons with common parts in the multiple wall polygons to obtain at least one merged whole polygon; the construction module 113 is used to construct an adjacency matrix according to the at least two counterclockwise polygons when there are at least two counterclockwise polygons with common points in the at least one whole polygon; the traversal module 114 is used to traverse the adjacency matrix to obtain at least one closed loop; the determination module 115 is used to determine the area enclosed by the clockwise polygon in the at least one whole polygon and the clockwise closed loop in the at least one closed loop as an indoor area.
[0103] Optionally, the wall data includes at least a wall starting point, a wall end point, a wall thickness, and a wall curvature; when the generation module 111 generates multiple wall polygons based on multiple wall data, it is specifically used for: if the wall curvature is 0, then generating a wall polygon based on the wall starting point, the wall end point, and the wall thickness; if the wall curvature is not 0, then generating a wall arc line based on the wall starting point, the wall end point, the wall thickness, and the wall curvature, and segmenting the wall arc line to obtain multiple segmentation points, and the multiple segmentation points constitute a wall polygon.
[0104] Optionally, when the merging module 112 merges the wall polygons having a common portion among the plurality of wall polygons, it is specifically configured to merge the wall polygons having a common edge or an overlapping portion among the plurality of wall polygons.
[0105] Optionally, the at least two counterclockwise polygons include a first counterclockwise polygon represented by a first point set, and a second counterclockwise polygon represented by a second point set; when the construction module 113 constructs an adjacency matrix based on the at least two counterclockwise polygons, it is specifically used to: traverse each point in the first point set and the second point set to determine the next point of the point in the first counterclockwise polygon and / or the second counterclockwise polygon; construct an adjacency matrix based on each point in the first point set and the second point set, and the next point of each point in the first counterclockwise polygon and / or the second counterclockwise polygon, respectively.
[0106] Optionally, when the traversal module 114 traverses the adjacency matrix to obtain at least one closed loop, it is specifically used to: traverse the adjacency matrix to obtain multiple closed loops; and remove duplicate closed loops corresponding to the same area in the multiple closed loops to obtain at least one closed loop.
[0107] Optionally, the determination module 115 is further configured to: if there are no at least two counterclockwise polygons having a common point in the at least one overall polygon, determine a clockwise polygon in the at least one overall polygon as an indoor area.
[0108] Optionally, the indoor area recognition device 110 further includes: an identification module 116, which is used to identify the type of the indoor area.
[0109] The device provided in the embodiment of the present disclosure can execute the method steps provided in the method embodiment of the present disclosure, and the beneficial effects thereof are not described in detail here.
[0110] Fig.12 FIG. 1 is a schematic diagram of the structure of an electronic device in an embodiment of the present disclosure. The electronic device may be a drawing terminal as described above, such as an electronic terminal. Fig.12 , which shows a schematic diagram of the structure of an electronic device 1200 suitable for implementing the embodiment of the present disclosure. The electronic device 1200 in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), wearable electronic devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc. Fig.12 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0111] like Fig.12 As shown, the electronic device 1200 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1202 or a program loaded from a storage device 1208 to a random access memory (RAM) 1203 to implement the method of the embodiment described in the present disclosure. In the RAM 1203, various programs and data required for the operation of the electronic device 1200 are also stored. The processing device 1201, the ROM 1202, and the RAM 1203 are connected to each other via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0112] Typically, the following devices may be connected to the I / O interface 1205: an input device 1206 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1207 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1208 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1209. The communication device 1209 may allow the electronic device 1200 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.12 The electronic device 1200 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0113] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart, thereby implementing the method as described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1209, or installed from the storage device 1208, or installed from the ROM 1202. When the computer program is executed by the processing device 1201, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0114] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0115] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0116] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0117] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0118] Generate multiple wall polygons according to multiple wall data;
[0119] Merging the wall polygons having common parts among the plurality of wall polygons to obtain at least one merged whole polygon;
[0120] If there are at least two counterclockwise polygons having a common point in the at least one overall polygon, constructing an adjacency matrix according to the at least two counterclockwise polygons;
[0121] Traversing the adjacency matrix to obtain at least one closed loop;
[0122] An area enclosed by a clockwise polygon in the at least one overall polygon and a clockwise closed loop in the at least one closed loop is determined as an indoor area.
[0123] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.
[0124] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0125] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0126] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0127] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0128] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0129] The present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, any method provided in the present disclosure is implemented.
[0130] The embodiments of the present disclosure further provide a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the method described above is implemented.
[0131] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0132] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0133] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A method for indoor area recognition, characterized in that: The method comprises: Generate multiple wall polygons according to multiple wall data; Merging the wall polygons having common parts among the plurality of wall polygons to obtain at least one merged whole polygon; If there are at least two counterclockwise polygons having a common point in the at least one overall polygon, constructing an adjacency matrix according to the at least two counterclockwise polygons; Traversing the adjacency matrix to obtain at least one closed loop; An area enclosed by a clockwise polygon in the at least one overall polygon and a clockwise closed loop in the at least one closed loop is determined as an indoor area.
2. The method according to claim 1, characterized in that The wall data at least includes the wall starting point, the wall end point, the wall thickness, and the wall curvature; Generate multiple wall polygons based on multiple wall data, including: If the wall curvature is 0, a wall polygon is generated based on the wall start point, wall end point, and wall thickness; If the wall curvature is not 0, a wall arc is generated according to the wall starting point, the wall end point, the wall thickness and the wall curvature, and the wall arc is segmented to obtain a plurality of segmentation points, which constitute a wall polygon.
3. The method according to claim 1, characterized in that Merging the wall polygons having a common portion among the plurality of wall polygons, comprising: The wall polygons having common edges or overlapping parts among the multiple wall polygons are merged.
4. The method according to claim 1, characterized in that: The at least two counterclockwise polygons include a first counterclockwise polygon represented by a first set of points, and a second counterclockwise polygon represented by a second set of points; Constructing an adjacency matrix according to the at least two counterclockwise polygons, comprising: Traversing each point in the first point set and the second point set, and determining the next point of the point in the first counterclockwise polygon and / or the second counterclockwise polygon; An adjacency matrix is constructed according to each point in the first point set and the second point set, and the next point of each point in the first counterclockwise polygon and / or the second counterclockwise polygon.
5. The method according to claim 1, characterized in that Traversing the adjacency matrix to obtain at least one closed loop includes: Traversing the adjacency matrix to obtain multiple closed loops; Closed loops corresponding to the same area among the multiple closed loops are deduplicated to obtain at least one closed loop.
6. The method according to claim 1, characterized in that The method further comprises: If there are not at least two counterclockwise polygons having a common point in the at least one overall polygon, the clockwise polygon in the at least one overall polygon is determined as an indoor area.
7. The method according to claim 1 or 6, characterized in that: After determining that the area is an indoor area, the method further includes: The type of the indoor area is identified.
8. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer program product, comprising computer program instructions, which, when executed by a processor, implement the method according to any one of claims 1 to 7.