A contour determination method and device of a BIM model, a terminal and a storage medium

By using image recognition technology to render and perform edge calculations on BIM models, the problem of high difficulty in contour calculation when the BIM model is large is solved, and fast and efficient two-dimensional contour determination is achieved, which is suitable for lightweight applications on web browsers and mobile devices.

CN114937051BActive Publication Date: 2026-02-17SHANGHAI CONSTRUCTION FOURTH CONSTRUCTION GROUP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210687801.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-17
Publication Date
2026-02-17
Estimated Expiration
2042-06-17

AI Technical Summary

Technical Problem

When the BIM model is large, it is difficult to calculate the outline using geometric methods, especially when the grid data of the building model is complex. This results in excessive consumption of computing resources and time, which affects the rapid conversion of the BIM model and its application on multiple platforms.

Method used

By using image recognition technology and a virtual camera to render the BIM model, a binary image is generated. Edge calculation and vectorization are then performed to determine the two-dimensional outline of the BIM model, avoiding multiple traversals of complex grid data.

Benefits of technology

It reduces computational complexity and improves the computational efficiency of BIM model outlines, making it suitable for lightweight BIM models and multi-platform applications, especially for rapid conversion between web browsers and mobile devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114937051B_ABST
    Figure CN114937051B_ABST
Patent Text Reader

Abstract

The application discloses a contour determination method and device of a BIM model, a terminal and a storage medium, and the method comprises the following steps: acquiring a BIM model to be calculated, and acquiring model parameters of the BIM model to be calculated; importing the BIM model to be calculated into a pre-set graphics engine; creating a virtual camera in the graphics engine; rendering the BIM model to be calculated by using the virtual camera in combination with the model parameters of the BIM model to be calculated, so as to obtain a binary image of the BIM model to be calculated; and performing edge calculation and vectorization processing on the binary image of the BIM model to be calculated, so as to obtain a two-dimensional contour of the BIM model to be calculated. According to the scheme, the contour of the BIM model is determined by using the image recognition method in the case that the volume of the BIM model is large, and the calculation difficulty can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of construction engineering information technology, specifically relating to a method, device, terminal and storage medium for determining the contour of a BIM model, particularly relating to a method, device, terminal and storage medium for rapid calculation of the two-dimensional contour of a BIM model based on image recognition, and more specifically relating to a method, device, terminal and storage medium for batch and rapid calculation of the two-dimensional outer contour of a BIM three-dimensional model based on an image recognition algorithm. Background Technology

[0002] In the field of construction engineering informatization, native BIM (Building Information Modeling) models are typically quite large. A native BIM model refers to the original BIM model created by modelers using software such as Revit, without subsequent processing such as weight reduction. A BIM model includes the geometric and engineering information of all components that make up a building, and is composed of models from multiple disciplines such as architecture, structure, and MEP (Mechanical, Electrical, and Plumbing). For example, the BIM model of a hospital in Shanghai contains hundreds of thousands of components, and the number of triangular faces in the 3D model is in the tens of millions. For instance, the MEP model of the hospital's pediatric comprehensive building (project area 57,670 square meters), stored in RVT format, occupies 1.6GB of storage space.

[0003] Some solutions use geometric methods to calculate the outline of the BIM model. However, if the grid data of the building's BIM model is complex (e.g., the number of triangular faces of a single valve can reach around 30,000), and the size of the BIM model increases as the building's volume increases, then calculating the outline of the BIM model becomes quite difficult.

[0004] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The purpose of this invention is to provide a method, apparatus, terminal, and storage medium for determining the outline of a BIM model, in order to solve the problem that it is difficult to calculate the outline of a BIM model using geometric methods when the BIM model is large in size. The invention aims to reduce the computational difficulty by using image recognition to determine the outline of a BIM model when the BIM model is large in size.

[0006] This invention provides a method for determining the contour of a BIM model, comprising: acquiring a BIM model to be calculated and acquiring model parameters of the BIM model to be calculated; importing the BIM model to be calculated into a pre-set graphics engine; creating a virtual camera in the graphics engine; using the virtual camera and the model parameters of the BIM model to be calculated to render the BIM model to be calculated, thereby obtaining a binarized image of the BIM model to be calculated; and performing edge calculation and vectorization processing on the binarized image of the BIM model to be calculated to obtain a two-dimensional contour of the BIM model to be calculated.

[0007] In some implementations, the model parameters of the BIM model to be calculated include: the bounding box information of the BIM model to be calculated, and all material channels of the BIM model to be calculated; using the virtual camera, combined with the model parameters of the BIM model to be calculated, to render the BIM model to be calculated, to obtain a binarized image of the BIM model to be calculated, including: adjusting the camera view of the virtual camera to the application plane of the camera's outer contour; setting the camera parameters of the virtual camera based on the bounding box information of the BIM model to be calculated; determining the graphics parameters of the graphics processor based on all material channels of the BIM model to be calculated while the graphics processor of the virtual camera is running; creating a new rendering texture according to the graphics parameters, using the rendering texture to render the current image of the virtual camera onto a preset target rendering texture, to obtain the current rendering texture of the virtual camera; creating a texture without an alpha channel according to the current rendering texture, writing the pixels of the current rendering texture into the texture without an alpha channel, and saving it as a bitmap as the binarized image of the BIM model to be calculated.

[0008] In some implementations, setting the camera parameters of the virtual camera based on the bounding box information of the BIM model to be calculated includes: determining the coordinates of the virtual camera as the center of the bounding box in the bounding box information of the BIM model to be calculated; determining the view range of the virtual camera as the distance between the maximum and minimum coordinates in the bounding box information of the BIM model to be calculated; determining the view background of the virtual camera as a first preset color; and determining the culling mask layer of the virtual camera as a layer containing only the BIM model to be calculated, thereby obtaining the camera parameters of the virtual camera; and / or, determining the graphics parameters of the graphics processor based on all material channels of the BIM model to be calculated includes: determining the shading color of the fragment shader of the graphics processor as a second preset color; and creating a material using the fragment shader; and assigning all material channels of the BIM model to be calculated to the material of the fragment shader, thereby obtaining the graphics parameters of the graphics processor.

[0009] In some implementations, edge calculation and vectorization are performed on the binarized image of the BIM model to be calculated to obtain a two-dimensional contour of the BIM model. This includes: performing a convolution operation on the binarized image of the BIM model to be calculated to determine all pixels in the binarized image whose pixel values ​​exceed a set threshold, and forming a set of coordinates for these pixels, denoted as the contour point coordinate set of the BIM model to be calculated; performing vectorization on the edge points in the contour point coordinate set of the BIM model to be calculated to obtain a first subset and a second subset; performing filtering on the first subset and the second subset respectively to obtain a vertex coordinate set; storing the coordinates of each vertex coordinate set in the original order of the contour point coordinate set to form a new contour point coordinate set; transforming the coordinates of all coordinates in the new contour point coordinate set from the binarized bitmap coordinate system to the applied plane coordinate system according to the camera parameters of the virtual camera; and converting the coordinates of the new contour point coordinate set in the applied plane coordinate system. All coordinate points in the set are connected sequentially to outline the two-dimensional contour of the BIM model to be calculated. Preferably, the first subset and the second subset are filtered to obtain a vertex coordinate point set, including: for each subset of the first subset and the second subset, the coordinate points of the starting point and the coordinate points of the ending point are connected by a straight line according to the order of the coordinate points in the subset, and the distances between the coordinate points of the starting point and the ending point and the straight line are determined, and the coordinate point with the largest distance and the largest distance are determined; if the largest distance is less than a preset distance threshold, then only the coordinate points of the starting point and the ending point are retained in the subset, and other coordinate points are discarded, and the retained coordinate points are stored in the vertex coordinate point set; if the largest distance is greater than or equal to the preset distance threshold, then the subset is divided into two secondary subsets from the coordinate point with the largest distance, and the filtering process is continued for each of the two secondary subsets in the same way as the filtering process for each subset of the first subset and the second subset.

[0010] In conjunction with the above method, another aspect of the present invention provides a device for determining the contour of a BIM model, comprising: an acquisition unit configured to acquire a BIM model to be calculated and to acquire model parameters of the BIM model to be calculated; a determination unit configured to import the BIM model to be calculated into a pre-set graphics engine; the determination unit is further configured to create a virtual camera in the graphics engine; the determination unit is further configured to use the virtual camera, in conjunction with the model parameters of the BIM model to be calculated, to render the BIM model to be calculated, thereby obtaining a binarized image of the BIM model to be calculated; the determination unit is further configured to perform edge calculation and vectorization processing on the binarized image of the BIM model to be calculated, thereby obtaining a two-dimensional contour of the BIM model to be calculated.

[0011] In some implementations, the model parameters of the BIM model to be calculated include: the bounding box information of the BIM model to be calculated, and all material channels of the BIM model to be calculated; the determining unit uses the virtual camera, combined with the model parameters of the BIM model to be calculated, to render the BIM model to be calculated, and obtain a binarized image of the BIM model to be calculated, including: adjusting the camera view of the virtual camera to the application plane of the camera's outer contour; setting the camera parameters of the virtual camera based on the bounding box information of the BIM model to be calculated; determining the graphics parameters of the graphics processor based on all material channels of the BIM model to be calculated while the graphics processor of the virtual camera is running; creating a new rendering texture according to the graphics parameters, and using the rendering texture to render the current image of the virtual camera onto a preset target rendering texture to obtain the current rendering texture of the virtual camera; creating a texture without an alpha channel according to the current rendering texture, writing the pixels of the current rendering texture into the texture without an alpha channel, and saving it as a bitmap as the binarized image of the BIM model to be calculated.

[0012] In some implementations, the determining unit sets the camera parameters of the virtual camera based on the bounding box information of the BIM model to be calculated, including: determining the coordinates of the virtual camera as the center of the bounding box in the bounding box information of the BIM model to be calculated; determining the view range of the virtual camera as the distance between the maximum and minimum coordinates in the bounding box information of the BIM model to be calculated; determining the view background of the virtual camera as a first preset color; and determining the culling mask layer of the virtual camera as a layer containing only the BIM model to be calculated, thereby obtaining the camera parameters of the virtual camera; and / or, the determining unit determines the graphics parameters of the graphics processor based on all material channels of the BIM model to be calculated, including: determining the shading color of the fragment shader of the graphics processor as a second preset color; and creating a material using the fragment shader; and assigning all material channels of the BIM model to be calculated to the material of the fragment shader, thereby obtaining the graphics parameters of the graphics processor.

[0013] In some embodiments, the determining unit performs edge calculation and vectorization processing on the binarized image of the BIM model to be calculated to obtain a two-dimensional contour of the BIM model to be calculated, including: performing a convolution operation on the binarized image of the BIM model to be calculated to determine all pixels in the binarized image of the BIM model to be calculated whose pixel values ​​exceed a set threshold, and forming a set of coordinates of these pixels, denoted as the contour point coordinate set of the BIM model to be calculated; performing vectorization operation on the edge points in the contour point coordinate set of the BIM model to be calculated to obtain a first subset and a second subset; performing filtering processing on the first subset and the second subset respectively to obtain a vertex coordinate point set; storing each coordinate point in the vertex coordinate point set in the original order of the contour point coordinate set to form a new contour point coordinate set; transforming the coordinates of all coordinate points in the new contour point coordinate set from the binarized bitmap coordinate system to the applied plane coordinate system according to the camera parameters of the virtual camera; and converting the coordinates of the new contour point coordinate set in the applied plane coordinate system. All coordinate points in the set are connected sequentially to outline the two-dimensional contour of the BIM model to be calculated. Preferably, the determining unit performs filtering processing on the first subset and the second subset respectively to obtain a vertex coordinate point set, including: for each subset in the first subset and the second subset, connecting the coordinate points of the starting point and the coordinate points of the ending point with a straight line according to the order of the coordinate points in the subset, and determining the distances between the coordinate points of the starting point and the ending point and the straight line, determining the coordinate point with the largest distance and the largest distance; if the largest distance is less than a preset distance threshold, then in the subset, only the coordinate points of the starting point and the ending point are retained, and other coordinate points are discarded, and the retained coordinate points are stored in the vertex coordinate point set; if the largest distance is greater than or equal to the preset distance threshold, then for the subset, it is divided into two secondary subsets from the coordinate point with the largest distance, and the filtering processing is continued for each of the two secondary subsets in the same way as for each subset in the first subset and the second subset.

[0014] In conjunction with the above-described device, the present invention further provides a terminal, comprising: the above-described device for determining the outline of a BIM model.

[0015] In conjunction with the above method, the present invention further provides a storage medium comprising a stored program, wherein, when the program is executed, the device on which the storage medium is located executes the above-described method for determining the contour of a BIM model.

[0016] Therefore, the solution of the present invention can obtain the outline of the BIM model by rendering a binarized image, performing edge calculation and vectorization processing on the BIM model to be calculated. Thus, by using image recognition to determine the outline of the BIM model when the BIM model is large, the calculation difficulty can be reduced.

[0017] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention.

[0018] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0019] Figure 1 This is a flowchart illustrating an embodiment of the BIM model contour determination method of the present invention.

[0020] Figure 2 This is a flowchart illustrating an embodiment of the method of the present invention for rendering the BIM model to be calculated.

[0021] Figure 3 This is a flowchart illustrating an embodiment of the method of the present invention for edge calculation and vectorization processing of the binarized image of the BIM model to be calculated.

[0022] Figure 4 This is a flowchart illustrating an embodiment of the method of the present invention in which the first subset and the second subset are respectively filtered.

[0023] Figure 5 This is a schematic diagram of a structure of an embodiment of the BIM model contour determination device of the present invention;

[0024] Figure 6 This is a flowchart illustrating an embodiment of the image recognition-based method for rapid calculation of two-dimensional contours of BIM models according to the present invention.

[0025] Figure 7 The diagram shows the structure of the BIM model in the graphics engine, where (a) is the structure of the MEP model in the graphics engine, and (b) is the structure of the MEP and building model in the graphics engine.

[0026] Figure 8 A diagram illustrating the adjustment of the virtual camera's perspective;

[0027] Figure 9 This is a schematic diagram of a virtual camera view.

[0028] Figure 10 This is a schematic diagram of virtual camera parameters;

[0029] Figure 11 This is a schematic diagram of a binarized image;

[0030] Figure 12 The diagram shows the JSON structure and file of the contour points, where (a) is a diagram of the output JSON file (containing information such as model name, number, and contour point set), and (b) is a diagram of the output file saved on the computer.

[0031] Figure 13 This is a schematic diagram illustrating the effect of applying the 2.5D engine.

[0032] Figure 14 This is a schematic diagram comparing the effects of geometric methods and the image recognition-based BIM model 2D contour rapid calculation scheme of the present invention.

[0033] Referring to the accompanying drawings, the reference numerals in the embodiments of the present invention are as follows:

[0034] 102 - Acquisition unit; 104 - Control unit. Detailed Implementation

[0035] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0036] Considering the current limitations of browser and mobile device performance, using native 3D models can lead to slow loading, model tearing, and lag in user interaction when the BIM model is large (project area exceeding 50,000 square meters). This makes native BIM models unsuitable for multi-platform applications such as web browsers and mobile devices. Therefore, some solutions propose a 2.5D web-based model for web browsers, where BIM model interaction primarily relies on its 2D outline on the application view plane. The 2.5D web-based model converts the 3D model into a series of interactive 2D models: the model status that the user needs to view (such as the status of air conditioning equipment on a certain floor of a building) is rendered as a 2D image in advance, the 2D outline of each device on the image plane is calculated, and stored on the server; when the user views, the corresponding image and outline information are loaded (when the user clicks on a device in the image, the interaction can be completed by determining which device's outline the clicked location falls within).

[0037] However, the current BIM model's mesh data is quite complex (the number of triangular faces of a single valve can reach around 30,000), and as the building's volume increases, the volume of the BIM model also increases. At this point, using some geometric methods from the scheme to calculate the outline of the BIM model will consume a lot of computing resources and time, which is not conducive to the rapid conversion of the BIM model and its application on multiple platforms.

[0038] Some geometric methods in certain solutions require multiple traversals of the point and line data of the 3D model. Specifically, this involves: Step S1, projecting all points and lines of the model onto the plane of the applied image; Step S2, selecting the point with the smallest y-value as the current point; Step S3, traversing all points connected to the current point, calculating the line L with the smallest angle between the connecting line and the positive x-axis, and selecting that point as the current point; Step S4, traversing all lines of the model, calculating whether they intersect with line L. If an intersection exists, the intersection point is selected as the current point, and the current point is added to the contour array; Step S5, if the current point and the starting point are the same, the process ends; otherwise, step S3 is repeated. It is evident that while some geometric methods in these solutions are precise calculation methods, they involve multiple traversals of the model mesh data, resulting in high time complexity. When the BIM model mesh data is complex, the computation time increases significantly.

[0039] According to an embodiment of the present invention, a method for determining the contour of a BIM model is provided, such as... Figure 1 The diagram shows a flowchart of an embodiment of the method of the present invention. The method for determining the contour of the BIM model may include steps S110 to S150.

[0040] In step S110, the BIM model to be calculated is obtained, and the model parameters of the BIM model to be calculated are obtained. The BIM model to be calculated includes: a building model and a mechanical and electrical (MEP) model.

[0041] In step S120, the BIM model to be calculated is imported into a pre-set graphics engine.

[0042] In step S130, a virtual camera is created in the graphics engine. This step of creating the virtual camera can be accomplished by writing a program. The method provided by this invention mainly involves acquiring a binary image through a graphics engine, then performing edge detection and corresponding processing on the binary image. Creating the virtual camera is a specific, automated step in acquiring the binary image.

[0043] In step S140, the virtual camera is used to render the BIM model to be calculated in combination with the model parameters of the BIM model to be calculated, so as to obtain a binarized image of the BIM model to be calculated.

[0044] The methods shown in steps S110 to S140 can be automated through programming. After the code is written, the user only needs to import the BIM model into the graphics engine and run the code script to output a file containing the BIM model outline information. Specifically, the BIM model is first imported into the graphics engine, pre-coded according to the methods shown in steps S110 to S140, and then the code script can be run to automatically complete subsequent operations such as reading model data, creating cameras, and rendering.

[0045] In some implementations, the model parameters of the BIM model to be calculated include: the bounding box information of the BIM model to be calculated, and all material channels of the BIM model to be calculated.

[0046] The specific process of using the virtual camera in step S140, combined with the model parameters of the BIM model to be calculated, to render the BIM model to be calculated and obtain a binarized image of the BIM model to be calculated, is illustrated in the following exemplary description.

[0047] The following is combined Figure 2 The diagram shows a flowchart of an embodiment of the method of the present invention for rendering the BIM model to be calculated. It further illustrates the specific process of rendering the BIM model to be calculated in step S140, including steps S210 to S250.

[0048] Step S210: Adjust the camera view of the virtual camera to the application plane of the camera's outer contour.

[0049] Figure 6 This is a flowchart illustrating an embodiment of the image recognition-based method for rapid calculation of two-dimensional contours in BIM models according to the present invention. Figure 6 As shown, the present invention provides a method for rapid calculation of two-dimensional contours of BIM models based on image recognition, which specifically includes the following steps:

[0050] The first step is to render the binarized image, as detailed in the following example.

[0051] Step 1: Import the BIM model to be calculated into the graphics engine. The term "engine," borrowed from the machinery industry, signifies its core position within the entire system. It can also be described as a "low-level function library supporting the application" or an abstraction for a specific application. Some of the better graphics engines include OGRE, OpenGVS, Vtree, and OSG.

[0052] BIM models are stored in computers as spatial data of points and lines, while graphics engines can render point and line data into visual images. The method of the present invention can be used in mainstream graphics engines currently on the market, such as Unity and Unreal Engine.

[0053] Figure 7 This is a structural diagram of a BIM model in a graphics engine. Taking the BIM model of the first floor of a hospital outpatient building as an example, step 1 specifically involves importing the BIM model to be calculated into the graphics engine, including the architectural model and MEP (Mechanical, Electrical, and Plumbing) model of the hospital's first floor, such as... Figure 7 .

[0054] Step 2: Virtual camera processing.

[0055] Step 2.1: Create a virtual camera and adjust the Rotation (camera view) of the created virtual camera to the application plane of the outer contour.

[0056] Adjusting the rotation (camera viewpoint) of the created virtual camera to the application plane of its outer contour can be achieved by pre-coding and setting the virtual camera parameters in the graphics engine according to the user's desired application plane. This is equivalent to adjusting the camera's shooting angle so that the camera is directly facing the application plane. For example... Figure 8 The three values ​​of Rotation(x,y,z) are used. The specific calculation requires the normal vector of the application plane to ensure that the camera's orientation vector is aligned with the normal vector of the application plane.

[0057] A 2D profile is generated by projecting the model onto a plane. The plane on which the user needs the profile information is the application plane. For example, if the profile information needs to be used in the top view of the first floor, the application plane is the horizontal plane of the first floor slab.

[0058] Figure 8 This is a diagram illustrating the adjustment of the virtual camera's viewpoint. Taking a BIM model of the first floor of a hospital outpatient building as an example, step 2.1 could specifically involve creating a virtual camera and adjusting the Rotation (camera viewpoint) to the application plane of the outer contour, such as... Figure 8 The viewpoint used here is (45, -45, 0), with a size of 8192*8192 pixels, and a right-handed coordinate system with the origin at the lower left corner.

[0059] Step S220: Based on the bounding box information of the BIM model to be calculated, set the camera parameters of the virtual camera.

[0060] In some implementations, step S220, based on the bounding box information of the BIM model to be calculated, sets the camera parameters of the virtual camera, including: determining the coordinates of the virtual camera as the center of the bounding box in the bounding box information of the BIM model to be calculated; determining the view range of the virtual camera as the distance between the maximum and minimum coordinates in the bounding box information of the BIM model to be calculated; determining the view background of the virtual camera as a first preset color; and determining the culling mask layer of the virtual camera as a layer that only contains the BIM model to be calculated, thereby obtaining the camera parameters of the virtual camera.

[0061] like Figure 6 As shown, the present invention provides a method for rapid calculation of two-dimensional contours of BIM models based on image recognition, which further includes the following steps:

[0062] Step 2.2: Extract the BoundingBox information of the BIM model to be calculated, set the coordinates of the virtual camera to the center of the BoundingBox, and set the view range to the distance between the max and min coordinates in the BoundingBox. This step ensures that the virtual camera can just contain the BIM model to be calculated.

[0063] Figure 9 This is a schematic diagram of the virtual camera view. Taking the BIM model of the 1st floor of a hospital outpatient building as an example, step 2.2 can specifically involve extracting the BoundingBox information of the BIM model to be calculated, setting the coordinates of the virtual camera to the center of the BoundingBox (here, (39.6566, 106.9695, -92.6413), and setting the view extent to the distance between the max and min coordinates within the BoundingBox (here, 1.017491). This step ensures that the virtual camera perfectly encompasses the BIM model to be calculated. The camera view is shown below. Figure 9 .

[0064] Step 2.3: Set the background of the virtual camera view to black (RGB(0,0,0)).

[0065] Taking the BIM model of the 1st floor of a hospital outpatient building as an example, step 2.3 can specifically be to set the background of the virtual camera view to black (RGB(0,0,0)).

[0066] Step 2.4: Set the camera's Culling Mash to include only the layers of the BIM model to be calculated ("To be calculated"), and record the current camera parameters.

[0067] Figure 10This is a schematic diagram of virtual camera parameters. Taking the BIM model of the 1st floor of a hospital outpatient building as an example, step 2.4 can specifically be to set the camera's Culling Mash to only include the layer of the BIM model to be calculated ("To be calculated"), and record the current camera parameters (including Position and orthographicSize), as shown in the diagram. Figure 10 .

[0068] Step S230: With the graphics processor of the virtual camera running, determine the graphics parameters of the graphics processor based on all material channels of the BIM model to be calculated.

[0069] In some implementations, step S230, based on all material channels of the BIM model to be calculated, determines the graphics parameters of the graphics processor, including: setting the shading color of the fragment shader of the graphics processor to a second preset color, and creating a material using the fragment shader. All material channels of the BIM model to be calculated are then assigned to the materials of the fragment shader to obtain the graphics parameters of the graphics processor.

[0070] like Figure 6 As shown, the present invention provides a method for rapid calculation of two-dimensional contours of BIM models based on image recognition, which further includes the following steps:

[0071] Step 3: BIM model processing.

[0072] Step 3.1: Write a shader that runs on the graphics processor. Write the Fragment Shader as a constant value - white (RGB(255,255,255)) and create a material that uses this shader.

[0073] Step 3.2: Obtain all material channels of the BIM model to be calculated and assign them all to the materials created in Step 3.1.

[0074] A model may consist of multiple parts with different materials. For example, the umbrella handle is made of metal and the canopy is made of fabric, so these two materials can be assigned to the object through two material channels. In step 3.2, assigning the same material to all material channels is to make the entire model a single color, effectively distinguishing it from the background color, i.e., for image "binarization," which facilitates subsequent edge detection.

[0075] Step 3.3: Set the layer of the BIM model to be calculated to "To be calculated".

[0076] Step S240: Create a new rendering texture according to the graphic parameters, and use the rendering texture to render the current image of the virtual camera onto the preset target rendering texture to obtain the current rendering texture of the virtual camera, so as to realize the preprocessing of the model material of the BIM model to be calculated.

[0077] Step S250: Create a new texture without an alpha channel based on the current rendered texture. After writing the pixels of the current rendered texture into the texture without an alpha channel, save it as a bitmap as the binarized image of the BIM model to be calculated.

[0078] like Figure 6 As shown, the present invention provides a method for rapid calculation of two-dimensional contours of BIM models based on image recognition, which further includes the following steps:

[0079] Step 4: Read the virtual camera image.

[0080] Step 4.1: Create a new rendering texture and render the current virtual camera image onto the target rendering texture. After preprocessing the virtual camera and model materials, the rendered image is now a strictly binarized image without noise.

[0081] Figure 11 This is a schematic diagram of a binarized image. Taking the BIM model of the 1st floor of a hospital outpatient building as an example, step 4.1 can specifically involve creating a new rendering texture, here with a size of 500*500 pixels. The current virtual camera image is rendered onto the target rendering texture. After preprocessing the virtual camera and model materials, the rendered image is now a strictly binarized image without noise, such as... Figure 11 .

[0082] Step 4.2: Create a new Texture2D without an alpha channel, write the pixels of the rendered texture, and save it as a bitmap, such as bitmap g.

[0083] The rendered texture is an intermediate product of the graphics engine's rendering process. Texture2D can receive its pixel values; this process is done by the computer and requires specifying the texture's color format. For example, in this usage example, it is specified as RGB24 format, which does not contain an alpha channel.

[0084] In step 4, the resolution of the rendered binarized image is adjustable. Higher resolution results in more accurate contour calculations, but also takes longer. Therefore, the solution of this invention offers controllable accuracy, allowing for time-saving adjustments based on requirements. In this invention, the binarized image is rendered automatically, and its resolution is adjustable, affecting the amount of data required for convolution operations. Thus, contour accuracy and production time are controllable. Compared to some solutions where the geometric calculation process is fixed, this invention allows for decision-making based on the actual project production situation.

[0085] In step 4.1, the rendering texture size can be specified in the program code beforehand. If there is sufficient time in the actual production project, a higher resolution can be specified, such as 1080*1080 pixels; conversely, a lower resolution can be specified to reduce the computational load. The computational load of convolution operations and vectorization is related to the image resolution. The higher the resolution, the more pixels there are in the image, and the greater the computational load of the convolution operation; at the same time, more edge points are generated, and the computational load of subsequent edge point set vectorization will also increase.

[0086] In step S150, edge calculation and vectorization are performed on the binarized image of the BIM model to be calculated to obtain the two-dimensional contour of the BIM model to be calculated.

[0087] Considering that the geometric calculation methods of related solutions are affected by the number of triangles in the BIM model, this invention provides a method for rapidly calculating the 2D outer contour of BIM models with large overall size and numerous triangles per model. This method is used for lightweight, multi-platform applications of BIM models and can quickly calculate the 2D contour of complex BIM models using image recognition technology. By employing image recognition, this invention avoids the problems of high time complexity associated with geometric methods that traverse model mesh data, thus improving computational efficiency.

[0088] In some implementations, the specific process of performing edge calculation and vectorization on the binarized image of the BIM model to be calculated in step S150 to obtain the two-dimensional contour of the BIM model to be calculated is described in the following exemplary description.

[0089] The following is combined Figure 3 The diagram shows an embodiment of the method of the present invention for edge calculation and vectorization processing of the binarized image of the BIM model to be calculated. It further illustrates the specific process of edge calculation and vectorization processing of the binarized image of the BIM model to be calculated in step S150, including steps S310 to S350.

[0090] Step S310: Perform convolution operation on the binarized image of the BIM model to be calculated to determine all pixels in the binarized image of the BIM model whose pixel values ​​exceed a set threshold, and form a set of coordinates for these pixels, denoted as the contour point coordinate set of the BIM model to be calculated. The contour point coordinate set of the BIM model to be calculated is denoted as the contour point coordinate set contours.

[0091] Step S320: Vectorize the edge points in the set of contour point coordinates of the BIM model to be calculated to obtain a first subset and a second subset. The first subset is set Q1, and the second subset is set Q2.

[0092] Step S330: Filter the first subset and the second subset respectively to obtain the vertex coordinate point set.

[0093] In some implementations, the specific process of filtering the first subset and the second subset in step S330 to obtain the vertex coordinate point set is described in the following exemplary description.

[0094] The following is combined Figure 4 The flowchart shown is a schematic diagram of an embodiment of the method of the present invention in which the first subset and the second subset are filtered respectively. The specific process of filtering the first subset and the second subset in step S330 is further explained, including steps S410 to S430.

[0095] Step S410: For each subset in the first subset and the second subset, connect the coordinates of the starting point and the coordinates of the ending point with a straight line according to the order of the coordinates of the coordinates in the subset, and determine the distances between the other coordinates between the starting point and the ending point and the straight line, and determine the coordinates with the largest distance and the largest distance.

[0096] Step S420: If the maximum distance is less than the preset distance threshold, then in the subset, only the coordinates of the starting point and the ending point are retained, and other coordinates are discarded. The retained coordinates are stored in the vertex coordinate set.

[0097] Step S430: If the maximum distance is greater than or equal to a preset distance threshold, then for the subset, it is divided into two secondary subsets from the coordinate point with the maximum distance, and the filtering process is continued for each secondary subset in the two secondary subsets in the manner of filtering each subset in the first subset and the second subset.

[0098] like Figure 6 As shown, the present invention provides a method for rapid calculation of two-dimensional contours of BIM models based on image recognition, which further includes the following steps:

[0099] Step 6.2: Connect the starting point p0 and the ending point pn of the curve with a straight line L(p0, pn). Calculate the distances of all other points on the curve to the straight line L(p0, pn), and find the point pm with the largest distance and its distance dmax. If dmax is less than the threshold (2 pixels), only the starting points p0 and pn are retained in the current point set, and the other points are discarded. Proceed to step 6.4. Otherwise, proceed to step 6.3.

[0100] Step 6.3: Divide the set of points of the curve into two segments from point pm, and perform step 6.2 on the two sets of points of the curve respectively.

[0101] Step 6.4 Store the retained coordinate points into the set approx in their original order.

[0102] Step S340: Store the coordinates of each vertex coordinate point in the set of vertex coordinates in the original order of the contour point coordinate set to form a new contour point coordinate set. The new contour point coordinate set is, for example, the set approx.

[0103] Step S350: Based on the camera parameters of the virtual camera, transform the coordinates of all coordinate points in the new contour point coordinate set from the binary bitmap coordinate system to the applied plane coordinate system. In the applied plane coordinate system, connect all coordinate points in the new contour point coordinate set sequentially to outline the two-dimensional contour of the BIM model to be calculated.

[0104] like Figure 6 As shown, the present invention provides a method for rapid calculation of two-dimensional contours of BIM models based on image recognition, which further includes the following steps:

[0105] The second step is edge computing and vectorization, as detailed in the following example.

[0106] Step 5: Perform convolution operation on the bitmap obtained in step 4.2. The Roberts operator is used here: traverse the pixels, calculate the pixel value according to formula (1), and compare the result with the threshold (100 here). Store the coordinates of pixels that exceed the threshold in the collection contours.

[0107]

[0108] Where X is the x-coordinate of the pixel, Y is the y-coordinate of the pixel, F(x,y) is the pixel value of pixel (x,y), and G(x,y) is the result of the convolution operation of pixel (x,y).

[0109] In this invention, the image recognition method uses pixel value convolution to calculate the hollow areas in the middle of the device. Compared to some geometric methods that can only calculate the outer contour, this invention supports hollow models, thus solving the problem of incorrect judgment when the user clicks on the hollow parts of the component.

[0110] Step 6: Vectorize edge points, such as using the Douglas-Peukcer algorithm to vectorize pixel outlines.

[0111] Step 6.0: The ordered set `contours` can already describe the two-dimensional closed contour of the model. However, describing a contour only requires the coordinates of its vertices, and the set contains a large number of redundant points. A large number of redundant points will result in a larger data volume, which is not conducive to the lightweight application of the BIM model. Furthermore, these redundant points may also cause jagged edges in the contour. Therefore, it is necessary to vectorize the edge points.

[0112] Step 6.1: The set of contour point coordinates, contours, forms a closed contour. Split the set contours into sets Q1 and Q2 such that Q1∪Q2=contours, and sets Q1 and Q2 have the same number of points. Also, the points contained in sets Q1 and Q2 are continuous points. Then, perform step 6.2 on the two sets of curve points respectively.

[0113] In this process, splitting typically involves dividing the set into two subsets of equal size. This iterative approach is highly efficient, similar to a binary search. This is also the case in the example presented in this article. For instance, if the set `contours` consists of ordered points 1, 2, ..., 2000, then it is split into two subsets: Q1, consisting of ordered points 1, 2, ..., 1000; and Q2, consisting of ordered points 1001, 1002, ..., 2000.

[0114] Step 7: Based on the virtual camera parameters saved in Step 2.2, convert the coordinates of all points in the approx set from binary bitmap coordinates to application plane coordinates. Connect the points in the approx set sequentially in the application plane coordinate system to outline the two-dimensional contour of the BIM model. These points can accurately describe the contour of the model, including the hollowed-out model, and the number of contour points is relatively concise.

[0115] Figure 12 This is a schematic diagram of the JSON structure and file for the outline points. Taking the BIM model of the 1st floor of a hospital outpatient building as an example, step 7 can specifically be: based on the virtual camera parameters saved in step 2.2, set the coordinates p of all points in the approx set. i The conversion from binary bitmap coordinates to applied plane coordinates is shown in formula (2).

[0116]

[0117] Among them, w u To apply the planar pixel width, w i L is the pixel width of the binarized image of this contour. u To apply the plan view dimensions, L i The view size of the virtual camera used for binarizing the image, O′ i This represents the coordinates of the origin of the binarized image in the applied plane coordinate system. Finally, it is stored in a JSON file format, such as... Figure 12 .

[0118] Figure 13 This is a schematic diagram illustrating the application effect of the 2.5D engine. Connecting the points in the approx set sequentially in the applied coordinate plane creates the 2D outline of the BIM model. The calculation results show good performance when applied to the 2.5D graphics engine, as shown below. Figure 13 .

[0119] Figure 14 This table compares the performance of some geometric methods with the solution of this invention. In some solutions, geometric methods are affected by the number of triangles in a single BIM model; as the total number and detail of the BIM model increase, the computation time increases significantly. However, the solution of this invention, based on image recognition, is independent of the number of triangles in the BIM model. It is more efficient even with complex BIM models, and is not constrained by the complexity of the model. For example, it can improve computational efficiency by more than double. Figure 14 The time comparison is shown. Furthermore, the solution of this invention is a multi-threaded, parallel algorithm, which is practical and scalable.

[0120] By employing the technical solution of this embodiment, the outline of the BIM model can be obtained by rendering a binarized image, performing edge calculation and vectorization processing on the BIM model to be calculated. Thus, by using image recognition methods to determine the outline of the BIM model when the BIM model is large, the calculation difficulty can be reduced.

[0121] According to embodiments of the present invention, a contour determination apparatus for a BIM model corresponding to a contour determination method for a BIM model is also provided. See also Figure 5 The diagram shows a structural schematic of an embodiment of the device of the present invention. The contour determination device for the BIM model may include: an acquisition unit 102 and a determination unit 104.

[0122] The acquisition unit 102 is configured to acquire the BIM model to be calculated and to acquire the model parameters of the BIM model to be calculated. The BIM model to be calculated includes: a building model and a mechanical and electrical (MEP) model. The specific functions and processing of the acquisition unit 102 are described in step S110.

[0123] The determination unit 104 is configured to import the BIM model to be calculated into a pre-set graphics engine. The specific functions and processing of the determination unit 104 are described in step S120.

[0124] The determining unit 104 is also configured to create a virtual camera in the graphics engine. The specific functions and processing of the determining unit 104 are further described in step S130.

[0125] The determining unit 104 is further configured to use the virtual camera, in conjunction with the model parameters of the BIM model to be calculated, to render the BIM model to be calculated, thereby obtaining a binarized image of the BIM model to be calculated. The specific functions and processing of this determining unit 104 are further described in step S140.

[0126] In some implementations, the model parameters of the BIM model to be calculated include: the bounding box information of the BIM model to be calculated, and all material channels of the BIM model to be calculated.

[0127] The determining unit 104, using the virtual camera and in conjunction with the model parameters of the BIM model to be calculated, renders the BIM model to be calculated to obtain a binarized image of the BIM model to be calculated, including:

[0128] The determining unit 104 is further configured to adjust the camera viewpoint of the virtual camera to the application plane of the camera's outer contour. The specific functions and processing of the determining unit 104 are further described in step S210.

[0129] Figure 6 This is a flowchart illustrating an embodiment of the image recognition-based method for rapid calculation of two-dimensional contours in BIM models according to the present invention. Figure 6 As shown, the present invention provides a method for rapid calculation of two-dimensional contours of BIM models based on image recognition, which specifically includes the following steps:

[0130] The first step is to render the binarized image, as detailed in the following example.

[0131] Step 1: Import the BIM model to be calculated into the graphics engine. The term "engine," borrowed from the machinery industry, signifies its core position within the entire system. It can also be described as a "low-level function library supporting the application" or an abstraction for a specific application. Some of the better graphics engines include OGRE, OpenGVS, Vtree, and OSG.

[0132] BIM models are stored in computers as spatial data of points and lines, while graphics engines can render point and line data into visual images. The method of the present invention can be used in mainstream graphics engines currently on the market, such as Unity and Unreal Engine.

[0133] Figure 7 This is a structural diagram of a BIM model in a graphics engine. Taking the BIM model of the first floor of a hospital outpatient building as an example, step 1 specifically involves importing the BIM model to be calculated into the graphics engine, including the architectural model and MEP (Mechanical, Electrical, and Plumbing) model of the hospital's first floor, such as... Figure 7 .

[0134] Step 2: Virtual camera processing.

[0135] Step 2.1: Create a virtual camera and adjust the Rotation (camera view) of the created virtual camera to the application plane of the outer contour.

[0136] This involves setting the parameters of the virtual camera in the graphics engine through pre-coding and the application plane required by the user. This is equivalent to adjusting the camera's angle so that it faces the application plane directly. For example... Figure 8 The three values ​​of Rotation(x,y,z) are used. The specific calculation requires the normal vector of the application plane to ensure that the camera's orientation vector is aligned with the normal vector of the application plane.

[0137] Figure 8 This is a diagram illustrating the adjustment of the virtual camera's viewpoint. Taking a BIM model of the first floor of a hospital outpatient building as an example, step 2.1 could specifically involve creating a virtual camera and adjusting the Rotation (camera viewpoint) to the application plane of the outer contour, such as... Figure 8 The viewpoint used here is (45, -45, 0), with a size of 8192*8192 pixels, and a right-handed coordinate system with the origin at the lower left corner.

[0138] The determining unit 104 is further configured to set the camera parameters of the virtual camera based on the bounding box information of the BIM model to be calculated. The specific functions and processing of the determining unit 104 are further described in step S220.

[0139] In some embodiments, the determining unit 104 sets the camera parameters of the virtual camera based on the bounding box information of the BIM model to be calculated, including: the determining unit 104 is further configured to determine the coordinates of the virtual camera as the center of the bounding box in the bounding box information of the BIM model to be calculated, determine the view range of the virtual camera as the distance between the maximum and minimum coordinates in the bounding box information of the BIM model to be calculated, determine the view background of the virtual camera as a first set color, and determine the culling mask layer of the virtual camera as a layer that only contains the BIM model to be calculated, thereby obtaining the camera parameters of the virtual camera.

[0140] like Figure 6 As shown, the present invention provides a method for rapid calculation of two-dimensional contours of BIM models based on image recognition, which further includes the following steps:

[0141] Step 2.2: Extract the BoundingBox information of the BIM model to be calculated, set the coordinates of the virtual camera to the center of the BoundingBox, and set the view range to the distance between the max and min coordinates in the BoundingBox. This step ensures that the virtual camera can just contain the BIM model to be calculated.

[0142] Figure 9 This is a schematic diagram of the virtual camera view. Taking the BIM model of the 1st floor of a hospital outpatient building as an example, step 2.2 can specifically involve extracting the BoundingBox information of the BIM model to be calculated, setting the coordinates of the virtual camera to the center of the BoundingBox (here, (39.6566, 106.9695, -92.6413), and setting the view extent to the distance between the max and min coordinates within the BoundingBox (here, 1.017491). This step ensures that the virtual camera perfectly encompasses the BIM model to be calculated. The camera view is shown below. Figure 9 .

[0143] Step 2.3: Set the background of the virtual camera view to black (RGB(0,0,0)).

[0144] Taking the BIM model of the 1st floor of a hospital outpatient building as an example, step 2.3 can specifically be to set the background of the virtual camera view to black (RGB(0,0,0)).

[0145] Step 2.4: Set the camera's Culling Mash to include only the layers of the BIM model to be calculated ("To be calculated"), and record the current camera parameters.

[0146] Figure 10This is a schematic diagram of virtual camera parameters. Taking the BIM model of the 1st floor of a hospital outpatient building as an example, step 2.4 can specifically be to set the camera's Culling Mash to only include the layer of the BIM model to be calculated ("To be calculated"), and record the current camera parameters (including Position and orthographicSize), as shown in the diagram. Figure 10 .

[0147] The determining unit 104 is further configured to determine the graphics parameters of the graphics processor based on all material channels of the BIM model to be calculated, when the graphics processor of the virtual camera is running. The specific functions and processing of this determining unit 104 are further described in step S230.

[0148] In some implementations, the determining unit 104 determines the graphics parameters of the graphics processor based on all material channels of the BIM model to be calculated. Specifically, the determining unit 104 is further configured to determine the shading color of the fragment shader of the graphics processor as a second preset color and create a material using the fragment shader. All material channels of the BIM model to be calculated are assigned to the materials of the fragment shader to obtain the graphics parameters of the graphics processor.

[0149] like Figure 6 As shown, the present invention provides a method for rapid calculation of two-dimensional contours of BIM models based on image recognition, which further includes the following steps:

[0150] Step 3: BIM model processing.

[0151] Step 3.1: Write a shader that runs on the graphics processor. Write the Fragment Shader as a constant value - white (RGB(255,255,255)) and create a material that uses this shader.

[0152] Step 3.2: Obtain all material channels of the BIM model to be calculated and assign them all to the materials created in Step 3.1.

[0153] Step 3.3: Set the layer of the BIM model to be calculated to "To be calculated".

[0154] The determining unit 104 is further configured to create a new rendering texture based on the graphic parameters, and use the rendering texture to render the current image of the virtual camera onto a preset target rendering texture to obtain the current rendering texture of the virtual camera, thereby achieving preprocessing of the model material of the BIM model to be calculated. The specific functions and processing of this determining unit 104 are also described in step S240.

[0155] The determining unit 104 is further configured to create a new texture without an alpha channel based on the current rendered texture, write the pixels of the current rendered texture into the texture without an alpha channel, and save it as a bitmap as the binarized image of the BIM model to be calculated. The specific functions and processing of this determining unit 104 are also described in step S250.

[0156] like Figure 6 As shown, the present invention provides a method for rapid calculation of two-dimensional contours of BIM models based on image recognition, which further includes the following steps:

[0157] Step 4: Read the virtual camera image.

[0158] Step 4.1: Create a new rendering texture and render the current virtual camera image onto the target rendering texture. After preprocessing the virtual camera and model materials, the rendered image is now a strictly binarized image without noise.

[0159] Figure 11 This is a schematic diagram of a binarized image. Taking the BIM model of the 1st floor of a hospital outpatient building as an example, step 4.1 can specifically involve creating a new rendering texture, here with a size of 500*500 pixels. The current virtual camera image is rendered onto the target rendering texture. After preprocessing the virtual camera and model materials, the rendered image is now a strictly binarized image without noise, such as... Figure 11 .

[0160] Step 4.2: Create a new Texture2D without an alpha channel, write the pixels of the rendered texture, and save it as a bitmap, such as bitmap g.

[0161] In step 4, the resolution of the rendered binarized image is adjustable. Higher resolution results in more accurate contour calculations, but also takes longer. Therefore, the solution of this invention offers controllable accuracy, allowing for time-saving adjustments based on requirements. In this invention, the binarized image is rendered automatically, and its resolution is adjustable, affecting the amount of data required for convolution operations. Thus, contour accuracy and production time are controllable. Compared to some solutions where the geometric calculation process is fixed, this invention allows for decision-making based on the actual project production situation.

[0162] The determining unit 104 is further configured to perform edge calculation and vectorization processing on the binarized image of the BIM model to be calculated, to obtain the two-dimensional contour of the BIM model to be calculated. The specific functions and processing of this determining unit 104 are further described in step S150.

[0163] Considering that the geometric calculation methods of related solutions are affected by the number of triangles in the BIM model, this invention provides a method for rapidly calculating the 2D outer contour of BIM models with large overall size and numerous triangles per model. This method is used for lightweight, multi-platform applications of BIM models and can quickly calculate the 2D contour of complex BIM models using image recognition technology. By employing image recognition, this invention avoids the problems of high time complexity associated with geometric methods that traverse model mesh data, thus improving computational efficiency.

[0164] In some embodiments, the determining unit 104 performs edge calculation and vectorization processing on the binarized image of the BIM model to be calculated to obtain the two-dimensional contour of the BIM model to be calculated, including:

[0165] The determining unit 104 is further configured to perform a convolution operation on the binarized image of the BIM model to be calculated, to determine all pixels in the binarized image of the BIM model whose pixel values ​​exceed a set threshold, and to form a set of coordinates for these pixels, denoted as the contour point coordinate set of the BIM model to be calculated. The contour point coordinate set of the BIM model to be calculated is, for example, the contour point coordinate set `contours`. The specific functions and processing of the determining unit 104 are further described in step S310.

[0166] The determining unit 104 is further configured to perform vectorization operations on the edge points in the set of contour point coordinates of the BIM model to be calculated, to obtain a first subset and a second subset. The first subset is set Q1, and the second subset is set Q2. The specific functions and processing of this determining unit 104 are further described in step S320.

[0167] The determining unit 104 is further configured to perform filtering processes on the first subset and the second subset respectively to obtain a set of vertex coordinates. The specific functions and processing of the determining unit 104 are further described in step S330.

[0168] In some embodiments, the determining unit 104 performs filtering processing on the first subset and the second subset respectively to obtain a set of vertex coordinate points, including:

[0169] The determining unit 104 is further configured to, for each subset of the first subset and the second subset, connect the coordinates of the starting point and the coordinates of the ending point with a straight line according to the order of the coordinates of the coordinates in the subset, determine the distances between the coordinates of the starting point and the ending point and the straight line, and determine the coordinate point with the largest distance and the largest distance. The specific functions and processing of the determining unit 104 are further described in step S410.

[0170] The determining unit 104 is further configured to, if the maximum distance is less than a preset distance threshold, retain only the coordinates of the starting point and the ending point in the subset, discard other coordinates, and store the retained coordinates in the vertex coordinate set. The specific function and processing of the determining unit 104 are further described in step S420.

[0171] The determining unit 104 is further configured to, if the maximum distance is greater than or equal to a preset distance threshold, divide the subset into two secondary subsets from the coordinate point with the maximum distance, and continue filtering each of the two secondary subsets in the manner of filtering each subset in the first subset and the second subset. The specific function and processing of the determining unit 104 are further described in step S430.

[0172] like Figure 6 As shown, the present invention provides a method for rapid calculation of two-dimensional contours of BIM models based on image recognition, which further includes the following steps:

[0173] Step 6.2: Connect the starting point p0 and the ending point pn of the curve with a straight line L(p0, pn). Calculate the distances of all other points on the curve to the straight line L(p0, pn), and find the point pm with the largest distance and its distance dmax. If dmax is less than the threshold (2 pixels), only the starting points p0 and pn are retained in the current point set, and the other points are discarded. Proceed to step 6.4. Otherwise, proceed to step 6.3.

[0174] Step 6.3: Divide the set of points of the curve into two segments from point pm, and perform step 6.2 on the two sets of points of the curve respectively.

[0175] Step 6.4 Store the retained coordinate points into the set approx in their original order.

[0176] The determining unit 104 is further configured to store each coordinate point in the vertex coordinate set in the original order of the contour point coordinate set, forming a new contour point coordinate set. The new contour point coordinate set is, for example, the set approx. The specific functions and processing of this determining unit 104 are further described in step S340.

[0177] The determining unit 104 is further configured to transform the coordinates of all coordinate points in the new contour point coordinate set from the binary bitmap coordinate system to the applied plane coordinate system based on the camera parameters of the virtual camera. In the applied plane coordinate system, all coordinate points in the new contour point coordinate set are connected sequentially to outline the two-dimensional contour of the BIM model to be calculated. The specific functions and processing of this determining unit 104 are further described in step S350.

[0178] like Figure 6 As shown, the present invention provides a method for rapid calculation of two-dimensional contours of BIM models based on image recognition, which further includes the following steps:

[0179] The second step is edge computing and vectorization, as detailed in the following example.

[0180] Step 5: Perform convolution operation on the bitmap obtained in step 4.2. The Roberts operator is used here: traverse the pixels, calculate the pixel value according to formula (1), and compare the result with the threshold (100 here). Store the coordinates of pixels that exceed the threshold in the collection contours.

[0181]

[0182] In this invention, the image recognition method uses pixel value convolution to calculate the hollow areas in the middle of the device. Compared to some geometric methods that can only calculate the outer contour, this invention supports hollow models, thus solving the problem of incorrect judgment when the user clicks on the hollow parts of the component.

[0183] Step 6: Vectorize edge points, such as using the Douglas-Peukcer algorithm to vectorize pixel outlines.

[0184] Step 6.0: The ordered set `contours` can already describe the two-dimensional closed contour of the model. However, describing a contour only requires the coordinates of its vertices, and the set contains a large number of redundant points. A large number of redundant points will result in a larger data volume, which is not conducive to the lightweight application of the BIM model. Furthermore, these redundant points may also cause jagged edges in the contour. Therefore, it is necessary to vectorize the edge points.

[0185] Step 6.1: The set of contour point coordinates, contours, forms a closed contour. Split the set contours into sets Q1 and Q2 such that Q1∪Q2=contours, and sets Q1 and Q2 have the same number of points. Also, the points contained in sets Q1 and Q2 are continuous points. Then, perform step 6.2 on the two sets of curve points respectively.

[0186] Step 7: Based on the virtual camera parameters saved in Step 2.2, convert the coordinates of all points in the approx set from binary bitmap coordinates to application plane coordinates. Connect the points in the approx set sequentially in the application plane coordinate system to outline the two-dimensional contour of the BIM model. These points can accurately describe the contour of the model, including the hollowed-out model, and the number of contour points is relatively concise.

[0187] Figure 12 This is a schematic diagram of the JSON structure and file for the outline points. Taking the BIM model of the 1st floor of a hospital outpatient building as an example, step 7 can specifically be: based on the virtual camera parameters saved in step 2.2, set the coordinates p of all points in the approx set. i The conversion from binary bitmap coordinates to applied plane coordinates is shown in formula (2).

[0188]

[0189] Among them, w u To apply the planar pixel width, w i L is the pixel width of the binarized image of this contour. u To apply the plan view dimensions, L i The view size of the virtual camera used for binarizing the image, O′ i This represents the coordinates of the origin of the binarized image in the applied plane coordinate system. Finally, it is stored in a JSON file format, such as... Figure 12 .

[0190] Figure 13 This is a schematic diagram illustrating the application effect of the 2.5D engine. Connecting the points in the approx set sequentially in the applied coordinate plane creates the 2D outline of the BIM model. The calculation results show good performance when applied to the 2.5D graphics engine, as shown below. Figure 13 .

[0191] Figure 14 This table compares the performance of some geometric methods with the solution of this invention. In some solutions, geometric methods are affected by the number of triangles in a single BIM model; as the total number and detail of the BIM model increase, the computation time increases significantly. However, the solution of this invention, based on image recognition, is independent of the number of triangles in the BIM model. It is more efficient even with complex BIM models, and is not constrained by the complexity of the model. For example, it can improve computational efficiency by more than double. Figure 14 The time comparison is shown. Furthermore, the solution of this invention is a multi-threaded, parallel algorithm, which is practical and scalable.

[0192] Since the processing and functions implemented by the device in this embodiment are basically the same as the embodiments, principles and examples of the aforementioned methods, any details not covered in the description of this embodiment can be found in the relevant descriptions in the aforementioned embodiments, and will not be repeated here.

[0193] By employing the technical solution of this invention, the outline of the BIM model can be obtained by rendering a binarized image, performing edge calculation and vectorization processing on the BIM model to be calculated. Image recognition technology can be used to quickly calculate the two-dimensional outline of complex BIM models.

[0194] According to an embodiment of the present invention, a terminal corresponding to a contour determination device for a BIM model is also provided. This terminal may include the contour determination device for the BIM model described above.

[0195] Since the processing and functions implemented by the terminal in this embodiment are basically the same as the embodiments, principles and examples of the aforementioned device, any details not covered in this embodiment can be found in the relevant descriptions in the aforementioned embodiments, and will not be repeated here.

[0196] By employing the technical solution of this invention, the outline of the BIM model can be obtained by rendering a binarized image, performing edge calculation and vectorization processing on the BIM model to be calculated. The accuracy can be adjusted according to the requirements, which can save time.

[0197] According to an embodiment of the present invention, a storage medium corresponding to a contour determination method for a BIM model is also provided. The storage medium includes a stored program, wherein the program controls the device where the storage medium is located to execute the contour determination method for the BIM model described above when it is running.

[0198] Since the processing and functions implemented by the storage medium in this embodiment are basically the same as the embodiments, principles and examples of the aforementioned methods, any details not covered in this embodiment can be found in the relevant descriptions in the aforementioned embodiments, and will not be repeated here.

[0199] By employing the technical solution of this invention, the outline of the BIM model can be obtained by rendering a binarized image, performing edge calculation and vectorization processing on the BIM model to be calculated. This results in higher computational efficiency when the BIM model is complex.

[0200] In summary, it is readily understood by those skilled in the art that, without conflict, the aforementioned advantageous methods can be freely combined and superimposed.

[0201] The above description is merely an embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of the claims of the present invention.

Claims

1. A method of contour determination of a BIM model, characterized in that, The method comprises the following steps: acquiring a BIM model to be calculated and acquiring model parameters of the BIM model to be calculated; the BIM model to be calculated comprises a building model and a mechanical and electrical model; the model parameters of the BIM model to be calculated comprise bounding box information of the BIM model to be calculated and all material channels of the BIM model to be calculated; the BIM model to be calculated is imported into a pre-set graphics engine; a virtual camera is created in the graphics engine; the camera view angle of the virtual camera is adjusted to the application plane of the camera outer contour; the camera parameters of the virtual camera are set based on the bounding box information of the BIM model to be calculated; the graphics parameters of the graphics processor of the virtual camera are determined based on all the material channels of the BIM model to be calculated in the case that the graphics processor of the virtual camera is running; a new rendering texture is created according to the graphics parameters; the current picture of the virtual camera is rendered onto a pre-set target rendering texture by using the rendering texture, so that a current rendering texture of the virtual camera is obtained; a texture without a transparent channel is newly created according to the current rendering texture; after the pixels of the current rendering texture are written into the texture without the transparent channel, the texture without the transparent channel is saved as a bitmap, which is used as a binary image of the BIM model to be calculated; edge calculation and vectorization processing are performed on the binary image of the BIM model to be calculated, so that a two-dimensional contour of the BIM model to be calculated is obtained.

2. The method of claim 1, wherein, Wherein, the camera parameters of the virtual camera are set based on the bounding box information of the BIM model to be calculated, which comprises: the coordinates of the virtual camera are determined as the center of the bounding box in the bounding box information of the BIM model to be calculated; the view range of the virtual camera is determined as the distance between the maximum coordinates and the minimum coordinates in the bounding box information of the BIM model to be calculated; the view background of the virtual camera is determined as a first set color; and the culling mask usage layer of the virtual camera is determined as a layer containing only the BIM model to be calculated, so that the camera parameters of the virtual camera are obtained; and / or, the graphics parameters of the graphics processor are determined based on all the material channels of the BIM model to be calculated, which comprises: the color of the fragment shader of the graphics processor is determined as a second set color, and a material using the fragment shader is created; all the material channels of the BIM model to be calculated are assigned to the material of the fragment shader, so that the graphics parameters of the graphics processor are obtained.

3. The method of claim 1 or 2, wherein, the edge calculation and vectorization processing are performed on the binary image of the BIM model to be calculated, so that a two-dimensional contour of the BIM model to be calculated is obtained, which comprises: convolution operation is performed on the binary image of the BIM model to be calculated to determine all the pixel points in the binary image of the BIM model to be calculated whose pixel values exceed a set threshold, and the coordinates of the pixel points are formed into a set, which is recorded as the contour point coordinate set of the BIM model to be calculated; Vectorize edge points in the set of contour point coordinates of the BIM model to be calculated to obtain a first sub-set and a second sub-set; Respectively screen the first sub-set and the second sub-set to obtain a set of vertex coordinate points; Store each coordinate point in the set of vertex coordinate points in the original order in the set of contour point coordinates to form a new set of contour point coordinates; According to the camera parameters of the virtual camera, convert the coordinates of all coordinate points in the new set of contour point coordinates from a binary bitmap coordinate system to an application plane coordinate system; in the application plane coordinate system, sequentially connect all coordinate points in the new set of contour point coordinates to outline a two-dimensional contour of the BIM model to be calculated.

4. The method of claim 3, wherein, Respectively screen the first sub-set and the second sub-set to obtain a set of vertex coordinate points, including: For each of the first sub-set and the second sub-set, connect the coordinate point of the starting point and the coordinate point of the ending point into a straight line in the order of the coordinate points in the sub-set, determine the distance between the other coordinate points and the straight line between the coordinate point of the starting point and the coordinate point of the ending point, determine the coordinate point with the maximum distance and the maximum distance; If the maximum distance is less than a preset distance threshold, only the coordinate point of the starting point and the coordinate point of the ending point are retained in the sub-set, and the other coordinate points are discarded, and the retained coordinate points are stored in the set of vertex coordinate points; If the maximum distance is greater than or equal to the preset distance threshold, the sub-set is divided into two secondary sub-sets from the coordinate point with the maximum distance, and the screening processing is continued for each of the two secondary sub-sets in the manner of screening processing for each of the first sub-set and the second sub-set.

5. A device for determining an outline of a BIM model, characterized in that including: The obtaining unit is configured to obtain a BIM model to be calculated and obtain model parameters of the BIM model to be calculated; The BIM model to be calculated includes a building model and a mechanical and electrical model; the model parameters of the BIM model to be calculated include bounding box information of the BIM model to be calculated and all material channels of the BIM model to be calculated; The determination unit is configured to import the BIM model to be calculated into a pre-set graphics engine; The determination unit is further configured to create a virtual camera in the graphics engine; The determination unit is further configured to adjust a camera view angle of the virtual camera to an application plane of a camera outline, set camera parameters of the virtual camera based on bounding box information of the BIM model to be calculated, determine graphics parameters of the graphics processor based on all material channels of the BIM model to be calculated in a case that the graphics processor of the virtual camera is running, create a new rendering texture according to the graphics parameters, render a current picture of the virtual camera to a preset target rendering texture by using the rendering texture, and obtain a current rendering texture of the virtual camera, create a texture without a transparent channel according to the current rendering texture, save the texture without the transparent channel as a bitmap after writing pixels of the current rendering texture into the texture without the transparent channel, and use the bitmap as a binary image of the BIM model to be calculated. The determination unit is further configured to perform edge calculation and vectorization processing on the binary image of the BIM model to be calculated, and obtain a two-dimensional contour of the BIM model to be calculated.

6. The apparatus for determining contours of a BIM model of claim 5, wherein, In the method, The determination unit sets the camera parameters of the virtual camera based on the bounding box information of the BIM model to be calculated, including: determining a coordinate of the virtual camera as a center of a bounding box in the bounding box information of the BIM model to be calculated, determining a view range of the virtual camera as a distance between a maximum coordinate and a minimum coordinate in the bounding box information of the BIM model to be calculated, determining a view background of the virtual camera as a first set color, and determining a culling mask usage layer of the virtual camera as a layer containing only the BIM model to be calculated, to obtain the camera parameters of the virtual camera. And / or The determination unit determines the graphics parameters of the graphics processor based on all material channels of the BIM model to be calculated, including: determining a coloring color of a fragment shader of the graphics processor as a second set color, and creating a material using the fragment shader, and assigning all material channels of the BIM model to be calculated to the material of the fragment shader to obtain the graphics parameters of the graphics processor.

7. The BIM model contouring apparatus of claim 5 or 6, wherein, The determination unit performs edge calculation and vectorization processing on the binary image of the BIM model to be calculated to obtain a two-dimensional contour of the BIM model to be calculated, including: performing convolution operation on the binary image of the BIM model to be calculated to determine all pixel points in the binary image of the BIM model to be calculated whose pixel values exceed a set threshold, and forming a set of coordinates of the pixel points as a contour point coordinate set of the BIM model to be calculated; performing vectorization operation on edge points in the contour point coordinate set of the BIM model to be calculated to obtain a first sub-set and a second sub-set; performing screening processing on the first sub-set and the second sub-set respectively to obtain a vertex coordinate point set; storing each coordinate point in the vertex coordinate point set in the original order in the contour point coordinate set to form a new contour point coordinate set. According to the camera parameters of the virtual camera, coordinates of all coordinate points in the new contour point coordinate set are converted from a binary bitmap coordinate system to an application plane coordinate system; under the application plane coordinate system, all coordinate points in the new contour point coordinate set are sequentially connected to outline a two-dimensional contour of the BIM model to be calculated.

8. The apparatus for determining contours of a BIM model according to claim 7, wherein, The determining unit respectively performs screening processing on the first sub-set and the second sub-set to obtain a vertex coordinate point set, including: For each of the first sub-set and the second sub-set, according to the order of the coordinate points in the sub-set, a straight line is connected by a starting point coordinate point and an ending point coordinate point, and the distance between other coordinate points and the straight line is determined, the coordinate point with the maximum distance is determined, and the maximum distance is determined; If the maximum distance is less than a preset distance threshold, only the starting point coordinate point and the ending point coordinate point are retained in the sub-set, and the other coordinate points are discarded, and the retained coordinate points are stored in the vertex coordinate point set; If the maximum distance is greater than or equal to the preset distance threshold, the sub-set is divided into two secondary sub-sets from the coordinate point with the maximum distance, and the screening processing is continued for each of the two secondary sub-sets in the manner of screening processing for each of the first sub-set and the second sub-set.

9. A terminal, characterized by comprising: including: The contour determination device of the BIM model according to any one of claims 5 to 8.

10. A storage medium, characterized by The storage medium includes a stored program, wherein when the program runs, the device where the storage medium is located performs the contour determination method of the BIM model according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • BIM model external contour rapid extraction method

    CN110349225A

  • BIM (Building Information Modeling)-driven water conveyance canal aerial image region-of-interest extraction method

    CN112241690A