Building outline recognition method, device, equipment and storage medium
By extracting the coordinate information of the outline and keywords from the architectural general drawings, and using keywords to match the building outline, the problem of low intelligence in manual identification of building outlines is solved, and rapid and accurate building outline recognition is achieved, improving efficiency and intelligence is improved degree.
Patent Information
- Application Number
- CN202111623405.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2041-12-28
AI Technical Summary
In the prior art, the identification of building profiles in the general architectural drawings relies on manual completion, which is low in intelligence, resulting in labor-consuming and low efficiency.
By determining the target layer from the drawing, obtaining the coordinate information of the outline and keywords, using keywords to match the building outline, and automatically identifying the building type, achieving fast and accurate building outline recognition.
Without manual intervention, the intelligence of building profile recognition is improved, fast and accurate identification results are achieved, and labor costs are reduced.
Smart Images

Figure CN114444169B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent analysis of drawings, and in particular to a method, device, equipment and storage medium for recognizing building outlines. Background Art
[0002] In the general building plan, there are many types of buildings, such as residential buildings, water rooms, garbage rooms, substations, voltage regulating stations, etc. When reviewing the general building plan, it is necessary to review whether the distance between functional facilities such as substations and garbage rooms and residential buildings meets the construction industry standards. For example, the distance between the garbage room and the residential building must exceed the preset distance, otherwise, the drawn general building plan is considered not to meet the construction industry standards.
[0003] When reviewing the general plan of a building, it is necessary to first identify the type of building outlines that each building outline belongs to, so as to further determine whether the distance between two buildings meets the standards of the construction industry. However, at present, this work is mostly done manually, which is labor-intensive and has a low degree of intelligence. Summary of the invention
[0004] The present application provides a method, device, equipment and storage medium for identifying building outlines, which are used to solve the technical problem of low intelligence level in manual identification of building outlines in the prior art.
[0005] In a first aspect, an embodiment of the present application provides a method for recognizing a building outline, comprising:
[0006] From the drawing, determine at least one target layer where each building outline is located;
[0007] Obtaining first coordinate information of each contour in the at least one target layer;
[0008] From the drawing, searching for at least one preset keyword and obtaining second coordinate information of each of the keywords;
[0009] According to the first coordinate information and the second coordinate information, a target outline that matches each of the keywords is determined, the target outline is determined to be a building outline, and the building type corresponding to the keyword is used as the type of the building outline.
[0010] Optionally, determining at least one target layer where each building outline is located from the drawing includes:
[0011] For each layer in the drawing, if there is a graphic element intersecting with at least one of the keywords, the layer is taken as a candidate layer;
[0012] From each of the candidate layers, layers that do not meet the building outline characteristics are excluded to obtain at least one target layer.
[0013] Optionally, for each layer in the drawing, if there is a graphic element intersecting with at least one of the keywords, taking the layer as a candidate layer includes:
[0014] Printing the first circumscribed rectangle of each of the keywords on the same second image, and filling each of the first circumscribed rectangles respectively to obtain a text image;
[0015] Parsing the drawings layer by layer to obtain graphic elements corresponding to each layer;
[0016] For each of the layers, a target primitive is extracted from the primitives corresponding to the layer, and the target primitive is printed on a third image to obtain a primitive image; a pixel-wise AND operation is performed on the primitive image and the text image to obtain a target image; if there are pixels with pixel values greater than zero in the target image, it is determined that there are primitives in the layer that intersect with the keyword, and the layer is determined as the candidate layer.
[0017] Optionally, extracting the target graphic element from the graphic elements corresponding to the layer includes:
[0018] From all the graphic elements of the layer, the graphic elements that are not within a preset color threshold range are removed to obtain the target graphic element.
[0019] Optionally, excluding layers that do not conform to building outline features from the candidate layers to obtain at least one target layer includes:
[0020] For each candidate layer, if the candidate layer satisfies any one of the preset conditions, the candidate layer is excluded to obtain at least one target layer;
[0021] The preset conditions include:
[0022] The building area of each contour in the candidate layer is not within the first preset building area threshold;
[0023] In the candidate layer, there is a first designated contour whose area is larger than a preset area, and keywords exceeding a first preset ratio in the at least one keyword all fall into the first designated contour;
[0024] In the candidate layer, there is a second specified contour that satisfies: among the at least one keyword, a proportion of the keywords falling within the second specified contour is less than a second preset proportion;
[0025] In the candidate layer, there is at least one third specified contour whose area ratio to the area of the minimum circumscribed rectangle of the third specified contour is less than a third preset ratio, and the ratio of the number of the third specified contours to the number of all contours in the candidate layer exceeds a fourth preset ratio;
[0026] In the candidate layers, any two of the contours are interlaced or embedded with each other.
[0027] Optionally, determining the target contour that each of the keywords matches according to the first coordinate information and the second coordinate information includes:
[0028] Printing all the graphic elements of the at least one target layer on the same first image, and dividing the first image into a plurality of grids;
[0029] Calculating a second center coordinate value of each keyword according to the second coordinate information; allocating each of the keywords to the plurality of grids according to the second center coordinate value;
[0030] Calculating a first center coordinate value of each of the contours according to the first coordinate information;
[0031] For each of the keywords, according to the first center coordinate value and the second center coordinate value, it is determined that there is a target contour and the keyword falling into the same grid, and the ratio of the area of the intersection of the first circumscribed rectangle of the keyword and the second circumscribed rectangle of the target contour to the target area is greater than a preset ratio, then it is determined that the target contour matches the keyword;
[0032] The target area is a smaller value between the area of the first circumscribed rectangle and the area of the second circumscribed rectangle.
[0033] Optionally, the obtaining of first coordinate information of each contour in the at least one target layer includes:
[0034] Performing a closing operation on the first image to obtain estimated coordinate values of all contours in the first image;
[0035] Each of the contours is filled according to the estimated coordinate values, and an opening operation is performed on each filled contour to obtain first coordinate information of each contour.
[0036] Optionally, before determining that the target outline is a building outline and taking the building type corresponding to the keyword as the type of the building outline, the method further includes:
[0037] For each of the contours, if it is determined that the area of the contour is within the second preset building area threshold, the type of the contour is preliminarily determined to be the first type; if the area of the contour is within the third preset building area threshold, the type of the contour is preliminarily determined to be the second type.
[0038] In a second aspect, an embodiment of the present application provides a device for recognizing a building outline, comprising:
[0039] A first determination module is used to determine at least one target layer where each building outline is located from the drawing;
[0040] An acquisition module, used for acquiring first coordinate information of each contour in the at least one target layer;
[0041] A second determination module is used to search for at least one preset keyword from the drawing and obtain second coordinate information of each of the keywords;
[0042] The third determination module is used to determine the target outline that each of the keywords matches according to the first coordinate information and the second coordinate information, determine that the target outline is a building outline, and use the building type corresponding to the keyword as the type of the building outline.
[0043] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a communication bus, wherein the processor and the memory communicate with each other via the communication bus;
[0044] The memory is used to store computer programs;
[0045] The processor is used to execute the program stored in the memory to implement the building outline recognition method described in the first aspect.
[0046] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method for recognizing a building outline described in the first aspect.
[0047] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application determines the layer where the building outline is located from multiple layers of the drawing, and then determines the target outline that matches the keyword based on the first coordinate information of each outline and the second coordinate information of each keyword. The target outline is the building outline, and the building type corresponding to the keyword is the type of the building outline. The technical solution provided by the embodiment of the present application, based on the business feature that the building outline is marked with building-related keywords, can quickly and accurately identify the building outline by matching the building outline with keywords and determining the type of the building outline, without manual work, and has a high degree of intelligence. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0050] Figure 1 A schematic diagram of a flow chart of a method for identifying a building outline provided in an embodiment of the present application;
[0051] Figure 2 A schematic diagram of the structure of a device for identifying building outlines provided in an embodiment of the present application;
[0052] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0054] In order to solve the technical problem of low intelligence level in the prior art of manually identifying building outlines, the present application embodiment provides a method for identifying building outlines, such as Figure 1 As shown, the building outline recognition method specifically includes:
[0055] Step 101, determining at least one target layer where each building outline is located from the drawing;
[0056] When designers draw building outlines, they may draw all building outlines on the same target layer, or they may draw the building outlines on different target layers, that is, the target layers where the building outlines are located may be one, two, or more.
[0057] When identifying the target layer, the target layers where the building outlines are located can be identified according to the characteristics of the building outlines. Among them, a very important feature of the building outline is that the building name, type, number of floors and height and other keywords are marked inside the building outline. Based on this business feature of the building outline, the following method can be used to determine the target layer where the building outline is located from all the layers of the drawing.
[0058] Among them, the method for determining the target layer where the building outline is located from all the layers of the drawing is: for each layer in the drawing, if there is a graphic element that intersects with at least one keyword, the layer is used as a candidate layer; from each of the candidate layers, the layers that do not meet the building outline characteristics are excluded to obtain at least one target layer.
[0059] Specifically, the first circumscribed rectangle of each keyword is printed on the same second image, and each first circumscribed rectangle is filled respectively to obtain a text image; the drawing is parsed layer by layer to obtain the graphic element corresponding to each layer; for each layer, the target graphic element is extracted from the graphic element corresponding to the layer, and the target graphic element is printed on the third image to obtain the graphic element image; the graphic element image and the text image are subjected to a pixel-wise AND operation to obtain the target image; if there are pixels with a pixel value greater than zero in the target image, it is determined that there are graphic elements in the layer that intersect with the keyword, and the layer is determined as the candidate layer.
[0060] Among them, the text containing keywords such as "#", "Building", "Building", etc. can be searched by regular search, such as "8#", "Building 2", and "6F". For the first bounding rectangle of the keyword, it can be expanded on the basis of the minimum bounding rectangle as the first bounding rectangle. In specific implementation, it can be expanded by 5 pixel units on the basis of the first bounding rectangle, and then the first bounding rectangles of all keywords are printed on the same second image, and the first bounding rectangles are filled. In specific implementation, for the sake of simplicity of calculation, the second image can be a binary image.
[0061] When extracting the target primitive, the primitives that are not within the preset color threshold range are removed from all the primitives in the layer to obtain the target primitive. Since the building outlines are drawn using bright color primitives, the HSV color threshold can be set according to the drawing conditions to remove the gray primitives in each layer and only retain the target primitives using bright colors, that is, the primitives of the building outlines.
[0062] Then, the layers are traversed, and the target primitives in each layer are printed to the third image respectively. The size of the third image corresponding to each layer is the same, and the size is the same as that of the second image. In the specific implementation, the third image can be a binary image. Then, for each layer, the layer image and the text image of the layer are used as a modulus to perform a bitwise AND operation on the pixels. If the operation result shows that the image pixel is greater than 0, it proves that the layer has primitives that intersect with the keyword, and the layer is determined as a candidate layer.
[0063] Then, the candidate layers are checked one by one, and the candidate layers that do not meet the building outline characteristics are excluded according to the following conditions. The remaining candidate layers are the layers where the building outline is located, that is, the target layers.
[0064] Wherein, for each candidate layer, if the candidate layer satisfies any one of the preset conditions, the candidate layer is excluded to obtain at least one target layer. Wherein, it should be noted that for each candidate layer, there may be one contour or more than two contours.
[0065] The preset conditions include:
[0066] 1) The building area of each contour in the candidate layer is not within the first preset building area threshold;
[0067] The first preset building area may be set to 15 to 5000 square meters. If the building areas of all contours in a candidate layer do not meet the building area threshold of 15 to 5000 square meters, the candidate layer is excluded.
[0068] 2) In the candidate layer, there is a first designated contour whose area is larger than a preset area, and keywords exceeding a first preset ratio in the at least one keyword all fall into the first designated contour;
[0069] The preset area can be set to 5000 square meters. If in a candidate layer, there is a contour with an area larger than 5000 square meters and contains 70% of all keywords, it is determined that there is an abnormally large contour in the candidate layer, and the candidate layer is excluded.
[0070] 3) In the candidate layer, there is a second specified contour satisfying: among the at least one keyword, the proportion of the keywords falling within the second specified contour is less than a second preset proportion;
[0071] The second preset ratio can be set to 2%. If in a candidate layer, the number of keywords contained in a certain contour accounts for less than 2% of all keywords, it means that the intersection ratio of the contour and the keyword is too small, and the candidate layer is excluded.
[0072] 4) In the candidate layer, there is at least one third specified contour whose area ratio to the area of the minimum circumscribed rectangle of the third specified contour is smaller than a third preset ratio, and the ratio of the number of the third specified contours to the number of all contours in the candidate layer exceeds a fourth preset ratio;
[0073] Among them, the third preset ratio can be set to 2%, and the fourth preset ratio can be set to 50%; if in a candidate layer, there is at least one contour whose area ratio to the area of the minimum circumscribed rectangle of the contour is less than 2%, and the number of such contours accounts for more than 50% of all contours in the candidate layer, it means that there are many irregular and special-shaped contours in the candidate layer, and the candidate layer is excluded.
[0074] 5) In the candidate layers, any two of the contours are interlaced or embedded with each other.
[0075] Specifically, for a candidate layer, the minimum enclosing rectangle of each contour in the candidate layer is obtained, and the contour is re-extracted based on the minimum enclosing rectangle. If the ratio of the number of newly extracted contours to the number of contours in the previous candidate layer is less than a preset value, it is determined that the contours in the layer are interlaced and embedded with each other, and the candidate layer is excluded. The preset value can be set to 0.3.
[0076] In addition, it should be noted that in the embodiment of the present application, contours can be extracted from each layer of the drawing using the cvFindContours function in OpenCV.
[0077] Step 102, obtaining first coordinate information of each contour in at least one target layer;
[0078] After eliminating the interference layer, the image in the target layer where the building outline is located is spatially segmented to obtain different types of building outlines. First, the first coordinate information of each outline in the target layer is extracted. Specifically, all the graphic elements of the at least one target layer are printed on the same first image, and the first image is divided into multiple grids; in fact, all the outlines in the target layer are printed on the first image, wherein, in the specific implementation, the first image can be a binary image. Then, a closing operation is performed on the first image to obtain the estimated coordinate values of all the outlines in the first image; each of the outlines is filled according to the estimated coordinate values, and an opening operation is performed on each filled outline to obtain the first coordinate information of each outline.
[0079] A closing operation is performed on the first image to repair the unclosed line segments in each contour, and the coordinate information of all contours of the image is obtained; then, the obtained contours are filled one by one and an opening operation is performed to remove possible connecting lines between different contours, and the coordinate information of each contour is obtained again, that is, the first coordinate information of each contour.
[0080] Step 103, searching for at least one preset keyword from the drawing and obtaining the second coordinate information of each keyword;
[0081] In the specific implementation, regular search can be used to search for texts containing keywords such as "#", "Building", "Building", etc., such as "8#", "Building 2", and "6F". At this time, the keywords are mainly divided into two categories: residential and functional facilities such as garbage stations and water pump rooms.
[0082] In architectural drawings, keywords are actually composed of graphics elements, each of which has its own coordinate information. The second coordinate information of the keyword can be determined based on the coordinate information of each graphics element that constitutes the keyword.
[0083] Step 104, determining the target outline that matches each keyword according to the first coordinate information and the second coordinate information, determining that the target outline is a building outline, and using the building type corresponding to the keyword as the type of the building outline.
[0084] In a specific implementation, printing all the graphic elements of the at least one target layer on the same first image actually means printing all the contours in the target layer on the first image and dividing the first image into a plurality of grids; calculating the second center coordinate value of each keyword according to the second coordinate information; assigning each of the keywords to the plurality of grids according to the second center coordinate value; calculating the first center coordinate value of each of the contours according to the first coordinate information; for each of the keywords, determining, according to the first center coordinate value and the second center coordinate value, that there is a target contour and the keyword falling into the same grid, and if the ratio of the area of the intersection of the first circumscribed rectangle of the keyword and the second circumscribed rectangle of the target contour to the target area is greater than a preset ratio, then determining that the target contour matches the keyword; wherein the target area is the smaller value between the area of the first circumscribed rectangle and the area of the second circumscribed rectangle.
[0085] In the specific implementation, the first image can be a binary image to reduce the amount of calculation. Specifically, the first image can be divided into m*n grids, and according to the second center coordinate value of each keyword, it is determined which grid the second center coordinate value belongs to, and the keyword is assigned to the corresponding grid. According to the first center coordinate value of each contour, it can be determined which grid the first center coordinate value belongs to. If the first center coordinate value of a contour and the second center coordinate value of the keyword both fall in the same grid, it means that the contour matches the keyword, and the contour is likely to be a building contour. At this time, it is necessary to combine the area of the second circumscribed rectangle of the contour and the area of the first circumscribed rectangle of the keyword for further judgment. If the ratio of the area of the intersection of the first circumscribed rectangle of the keyword and the second circumscribed rectangle of the target contour to the target area is greater than a preset ratio, wherein the preset ratio can be set to 0.6. If the ratio is greater than 0.6, it means that the contour is a building contour, and the keyword is a keyword that matches the building contour. If the keyword is a residence, the type of the building contour is a residence. If the keyword is a garbage room, the type of the building contour is a garbage room, and the garbage room belongs to a functional facility.
[0086] In the embodiment of the present application, the layer where the building outline is located is determined from multiple layers of the drawing, and then the target outline that matches the keyword is determined based on the first coordinate information of each outline and the second coordinate information of each keyword. The target outline is the building outline, and the building type corresponding to the keyword is the type of the building outline. The technical solution provided in the embodiment of the present application is based on the business feature that the building outline is marked with building-related keywords. By matching the building outline with keywords and determining the type of the building outline, the building outline can be quickly and accurately identified without manual work, and the degree of intelligence is high.
[0087] In addition, in a specific embodiment, before determining that the target outline is a building outline and taking the building type corresponding to the keyword as the type of the building outline, the type of the outline may also be roughly determined in combination with the area.
[0088] Specifically, for each of the contours, if it is determined that the area of the contour is within the second preset building area threshold, the type of the contour is preliminarily determined to be the first type; if the area of the contour is within the third preset building area threshold, the type of the contour is preliminarily determined to be the second type.
[0089] Among them, the second preset building area threshold can be set to 280 to 5,000 square meters, and the first type can be a residential building; the third preset building area threshold can be set to 15 to 350 square meters, and the second type can be a functional facility, such as a garbage room, a substation, a voltage regulating station, etc.
[0090] If the area of a contour is between 280 and 5,000 square meters, it is considered that the contour may be a residence. If the area of a contour is between 15 and 350 square meters, it is considered that the contour may be a functional facility. Based on the area, it is possible to roughly determine whether a contour is a residence or a functional facility, but it is possible that a contour corresponds to multiple types. Therefore, using the area to determine the type of contour is not very accurate, and it can only roughly determine the possible type.
[0091] Based on the same concept, a device for identifying building outlines is provided in the embodiment of the present application. The specific implementation of the device can be found in the description of the method embodiment part, and the repeated parts will not be repeated. Figure 2 As shown, the device mainly includes:
[0092] The first determination module 201 is used to determine at least one target layer where each building outline is located from the drawing;
[0093] An acquisition module 202 is used to acquire first coordinate information of each contour in the at least one target layer;
[0094] The second determining module 203 is used to search for at least one preset keyword from the drawing and obtain the second coordinate information of each of the keywords;
[0095] The third determination module 204 is used to determine the target outline that each of the keywords matches according to the first coordinate information and the second coordinate information, determine that the target outline is a building outline, and use the building type corresponding to the keyword as the type of the building outline.
[0096] In a specific embodiment, the first determination module 201 is used to, for each layer in the drawing, if there is a graphic element that intersects with at least one of the keywords, take the layer as a candidate layer; from each of the candidate layers, exclude the layers that do not meet the building outline characteristics to obtain at least one target layer.
[0097] In a specific embodiment, the first determination module 201 is used to print the first circumscribed rectangle of each of the keywords on the same second image, and fill each of the first circumscribed rectangles respectively to obtain a text image; parse the drawing layer by layer to obtain the graphic element corresponding to each of the layers; for each of the layers, extract the target graphic element from the graphic element corresponding to the layer, print the target graphic element on the third image to obtain the graphic element image; perform a pixel-wise AND operation on the graphic element image and the text image to obtain the target image; if there are pixels with pixel values greater than zero in the target image, it is determined that there are graphic elements in the layer that intersect with the keyword, and the layer is determined as the candidate layer.
[0098] In a specific embodiment, the first determining module 201 is used to remove the graphics elements that are not within a preset color threshold range from all graphics elements of the layer to obtain the target graphics element.
[0099] In a specific embodiment, the first determination module 201 is used for excluding each candidate layer if the candidate layer satisfies any one of the preset conditions, and obtaining at least one target layer; wherein the preset conditions include: the building area of each contour in the candidate layer is not within a first preset building area threshold; in the candidate layer, there is a first specified contour with an area larger than the preset area, and the keywords in the at least one keyword exceeding a first preset ratio all fall into the first specified contour; in the candidate layer, there is a second specified contour satisfying: the proportion of the keywords in the at least one keyword falling into the second specified contour is less than a second preset ratio; in the candidate layer, there is at least one third specified contour whose area ratio to the area of the minimum circumscribed rectangle of the third specified contour is less than a third preset ratio, and the proportion of the number of the third specified contours to the number of all contours in the candidate layer exceeds a fourth preset ratio; in the candidate layer, there are any two contours interlaced or embedded with each other.
[0100] In a specific embodiment, the third determination module 204 is used to print all the graphics elements of the at least one target layer on the same first image, and divide the first image into multiple grids; calculate the second center coordinate value of each keyword according to the second coordinate information; allocate each of the keywords to the multiple grids according to the second center coordinate value; calculate the first center coordinate value of each of the contours according to the first coordinate information; for each of the keywords, determine, according to the first center coordinate value and the second center coordinate value, whether there is a target contour and the keyword falling into the same grid, and the ratio of the area of the intersection of the first circumscribed rectangle of the keyword and the second circumscribed rectangle of the target contour to the target area is greater than a preset ratio, then determine that the target contour matches the keyword; wherein the target area is the smaller value between the area of the first circumscribed rectangle and the area of the second circumscribed rectangle.
[0101] In a specific embodiment, the acquisition module 202 is used to perform a closing operation on the first image to obtain estimated coordinate values of all contours in the first image; fill each contour according to the estimated coordinate value, and perform an opening operation on each filled contour to obtain the first coordinate information of each contour.
[0102] In a specific embodiment, a device for identifying building outlines provided in the embodiments of the present application also includes: a preliminary judgment module, which is used to preliminarily judge the type of each outline as the first type if it is determined that the area of the outline is within a second preset building area threshold; if the area of the outline is within a third preset building area threshold, preliminarily judge the type of the outline as the second type.
[0103] Based on the same concept, an electronic device is also provided in the embodiment of the present application, such as Figure 3 As shown, the electronic device mainly includes: a processor 301, a memory 302 and a communication bus 303, wherein the processor 301 and the memory 302 communicate with each other through the communication bus 303. The memory 302 stores a program executable by the processor 301, and the processor 301 executes the program stored in the memory 302 to implement the following steps:
[0104] From the drawing, determine at least one target layer where each building outline is located;
[0105] Obtaining first coordinate information of each contour in the at least one target layer;
[0106] From the drawing, searching for at least one preset keyword and obtaining second coordinate information of each of the keywords;
[0107] According to the first coordinate information and the second coordinate information, a target outline that matches each of the keywords is determined, the target outline is determined to be a building outline, and the building type corresponding to the keyword is used as the type of the building outline.
[0108] The communication bus 303 mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 303 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0109] The memory 302 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Alternatively, the memory may also be at least one storage device located away from the processor 301 .
[0110] The above-mentioned processor 301 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0111] In another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed on a computer, the computer executes a method for recognizing a building outline described in the above embodiment.
[0112] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction is transmitted from a website site, a computer, a server or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape, etc.), an optical medium (such as a DVD) or a semiconductor medium (such as a solid-state hard disk), etc.
[0113] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0114] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for recognizing building outlines, characterized in that: include: From the drawing, determine at least one target layer where each building outline is located; Obtaining first coordinate information of each contour in the at least one target layer; From the drawing, searching for at least one preset keyword and obtaining second coordinate information of each of the keywords; Determine, according to the first coordinate information and the second coordinate information, a target outline that matches each of the keywords, determine that the target outline is a building outline, and use the building type corresponding to the keyword as the type of the building outline; The step of determining the target contours that each of the keywords matches according to the first coordinate information and the second coordinate information includes: Printing all the graphic elements of the at least one target layer into a first image, and dividing the first image into a plurality of grids; Calculating a second center coordinate value of each keyword according to the second coordinate information; allocating each of the keywords to the plurality of grids according to the second center coordinate value; Calculating a first center coordinate value of each of the contours according to the first coordinate information; For each of the keywords, according to the first center coordinate value and the second center coordinate value, it is determined that there is a target contour and the keyword falling into the same grid, and the ratio of the area of the intersection of the first circumscribed rectangle of the keyword and the second circumscribed rectangle of the target contour to the target area is greater than a preset ratio, then it is determined that the target contour matches the keyword; The target area is the smaller value between the area of the first circumscribed rectangle and the area of the second circumscribed rectangle; The obtaining of first coordinate information of each contour in the at least one target layer includes: Performing a closing operation on the first image to obtain estimated coordinate values of all contours in the first image; Each of the contours is filled according to the estimated coordinate values, and an opening operation is performed on each filled contour to obtain first coordinate information of each contour.
2. The method for recognizing building outlines according to claim 1, characterized in that: Determining at least one target layer where each building outline is located from the drawing includes: For each layer in the drawing, if there is a graphic element intersecting with at least one of the keywords, the layer is taken as a candidate layer; From each of the candidate layers, layers that do not meet the building outline characteristics are excluded to obtain at least one target layer.
3. The method for recognizing building outlines according to claim 2, characterized in that: For each layer in the drawing, if there is a graphic element intersecting with at least one of the keywords, the layer is taken as a candidate layer, including: Printing the first circumscribed rectangle of each of the keywords on the same second image, and filling each of the first circumscribed rectangles respectively to obtain a text image; Parsing the drawings layer by layer to obtain graphic elements corresponding to each layer; For each of the layers, a target primitive is extracted from the primitives corresponding to the layer, and the target primitive is printed on a third image to obtain a primitive image; a pixel-wise AND operation is performed on the primitive image and the text image to obtain a target image; if there are pixels with pixel values greater than zero in the target image, it is determined that there are primitives in the layer that intersect with the keyword, and the layer is determined as the candidate layer.
4. The method for recognizing building outlines according to claim 3, characterized in that: The step of extracting a target graphic element from the graphic elements corresponding to the layer includes: From all the graphic elements of the layer, the graphic elements that are not within a preset color threshold range are removed to obtain the target graphic element.
5. The method for recognizing building outlines according to claim 2, characterized in that: The step of excluding layers that do not conform to the building outline feature from the candidate layers to obtain at least one target layer includes: For each candidate layer, if the candidate layer satisfies any one of the preset conditions, the candidate layer is excluded to obtain at least one target layer; The preset conditions include: The building area of each contour in the candidate layer is not within the first preset building area threshold; In the candidate layer, there is a first designated contour whose area is larger than a preset area, and keywords exceeding a first preset ratio in the at least one keyword all fall into the first designated contour; In the candidate layer, there is a second specified contour that satisfies: among the at least one keyword, a proportion of the keywords falling within the second specified contour is less than a second preset proportion; In the candidate layer, there is at least one third specified contour whose area ratio to the area of the minimum circumscribed rectangle of the third specified contour is less than a third preset ratio, and the ratio of the number of the third specified contours to the number of all contours in the candidate layer exceeds a fourth preset ratio; In the candidate layers, any two of the contours are interlaced or embedded with each other.
6. The method for recognizing building outlines according to claim 1, characterized in that: Before determining that the target outline is a building outline and taking the building type corresponding to the keyword as the type of the building outline, the method further includes: For each of the contours, if it is determined that the area of the contour is within the second preset building area threshold, the type of the contour is preliminarily determined to be the first type; if the area of the contour is within the third preset building area threshold, the type of the contour is preliminarily determined to be the second type.
7. A device for identifying building outlines, characterized in that: include: A first determination module is used to determine at least one target layer where each building outline is located from the drawing; An acquisition module, used for acquiring first coordinate information of each contour in the at least one target layer; A second determination module is used to search for at least one preset keyword from the drawing and obtain second coordinate information of each of the keywords; A third determination module is used to determine the target outline that each of the keywords matches according to the first coordinate information and the second coordinate information, determine that the target outline is a building outline, and use the building type corresponding to the keyword as the type of the building outline; The step of determining the target contours that each of the keywords matches according to the first coordinate information and the second coordinate information includes: Printing all the graphic elements of the at least one target layer into a first image, and dividing the first image into a plurality of grids; Calculating a second center coordinate value of each keyword according to the second coordinate information; allocating each of the keywords to the plurality of grids according to the second center coordinate value; Calculating a first center coordinate value of each of the contours according to the first coordinate information; For each of the keywords, according to the first center coordinate value and the second center coordinate value, it is determined that there is a target contour and the keyword falling into the same grid, and the ratio of the area of the intersection of the first circumscribed rectangle of the keyword and the second circumscribed rectangle of the target contour to the target area is greater than a preset ratio, then it is determined that the target contour matches the keyword; The target area is the smaller value between the area of the first circumscribed rectangle and the area of the second circumscribed rectangle; The obtaining of first coordinate information of each contour in the at least one target layer includes: Performing a closing operation on the first image to obtain estimated coordinate values of all contours in the first image; Each of the contours is filled according to the estimated coordinate values, and an opening operation is performed on each filled contour to obtain first coordinate information of each contour.
8. An electronic device, characterized in that: include: A processor, a memory and a communication bus, wherein the processor and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to execute the program stored in the memory to implement the building outline recognition method described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for recognizing a building outline according to any one of claims 1 to 6 is implemented.
