BIM model similarity calculation method, system, device and storage medium

By using three-dimensional virtual cameras and structural similarity index SSIM analysis on the BIM model, the problem of low-efficiency and inability to quantify the similarity before and after the BIM model is lightweighted, and rapid and automated similarity measurements are achieved and model comparison accuracy is improved.

CN117315295BActive Publication Date: 2025-09-02CHINA ELECTRONICS SYST ENG NO 2 CONSTR
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311256471.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-27
Publication Date
2025-09-02
Estimated Expiration
2043-09-27

AI Technical Summary

Technical Problem

In the prior art, the similarity comparison between BIM models before and after lightweighting depends on artificial visual judgment, which is inefficient and cannot be quantified, resulting in the similarity being subjective judgment.

Method used

A three-dimensional virtual camera is used to imitate artificial vision, render images from multiple angles on the spherical surface centered at the BIM model, and analyze the two-dimensional texture map using the structural similarity index SSIM, eliminate background interference, and quantify the similarity value.

Benefits of technology

Fast and automated BIM model similarity measurement is realized, which improves comparison efficiency and accuracy and reduces manual workload.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117315295B_ABST
    Figure CN117315295B_ABST
Patent Text Reader

Abstract

The present invention discloses a BIM model similarity calculation method, system, device and storage medium. The method includes: using a three-dimensional virtual camera to simulate artificial vision, rendering images of the BIM model before and after lightweighting at different positions on a sphere centered on the BIM model, generating multiple pairs of two-dimensional texture maps; using a structural similarity index to analyze each pair of two-dimensional texture maps to obtain a similarity index map, eliminating background pixel interference, and obtaining similarity index values, i.e., similarity values, of the BIM model before and after lightweighting in the two-dimensional texture map; combining each position angle and similarity value into an object and adding it to a result list; sorting the result list by similarity from small to large, and finally obtaining an ordered list of comparative similarities of various angles of the building structure and their position angles. The present invention is used for automatic comparison of BIM models before and after lightweighting, reducing manual workload, quantifying similarity, and improving model accuracy and project implementation efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a BIM model similarity comparison technology before and after lightweighting, and in particular to a BIM model similarity calculation method, system, device and storage medium. Background Art

[0002] After exporting BIM models (Building Information Models) from BIM software to common 3D formats (such as FBX and OBJ), the models often have a large number of vertices and triangles, resulting in a significant number of redundant points and faces. This affects the performance of rendering in 3D engines, necessitating lightweighting to remove these redundant points and faces. Currently, manual visual comparison of the pre- and post-lightening models from multiple angles is required to identify any differences.

[0003] Since the comparison of models before and after lightweighting requires manual visual comparison in a three-dimensional, surround-view, multi-angle manner, there are inherent problems such as low comparison efficiency and the similarity is subjective and cannot be quantified. Summary of the Invention

[0004] Purpose of the invention: The purpose of the present invention is to provide a BIM model similarity calculation method for automatic comparison of BIM models before and after lightweighting, reducing manual workload, and quantifying similarity to improve model accuracy and project implementation efficiency.

[0005] Technical solution: A BIM model similarity calculation method of the present invention includes:

[0006] Using a 3D virtual camera to simulate artificial vision, images of the Building Information Model (BIM) before and after lightweighting were rendered at different locations on a sphere centered on the Building Information Model (BIM), generating multiple pairs of 2D texture images. The structural similarity index (SSIM) was used to analyze each pair of 2D texture images to obtain a similarity index map. On this basis, after removing the interference of background pixels in the 3D space in the 2D texture map, the similarity index value (i.e., similarity value) of the Building Information Model portion before and after lightweighting in the 2D texture map was obtained.

[0007] Among them, the method for generating multiple pairs of two-dimensional texture maps is: placing the three-dimensional virtual cameras respectively on the sphere with the lightweight before and after BIM models as the center and the radius being the diagonal length diagonalLength of the boundary cube of the original BIM model at a horizontal angle α and a vertical angle β, and the three-dimensional virtual cameras are respectively oriented to the positions of the lightweight before and after BIM models; performing camera rendering on the original BIM model and the lightweight BIM model respectively to obtain the original two-dimensional texture map and the lightweight two-dimensional texture map; the vertical angle β is cyclically increased from -90 degrees to 90 degrees; for each β value, the horizontal angle α is cyclically increased from -180 degrees to 180 degrees, and the cyclic increment step of α and β is the set comparison angle θ, and for each α and each β, a pair of two-dimensional texture maps is obtained;

[0008] Each pair of α, β and similarity value is combined into an object and added to a result list. The result list is sorted from small to large by similarity, and finally an ordered list of the comparative similarity of each angle and its position angle is obtained.

[0009] Furthermore, before rendering the image, you need to do the following:

[0010] First, import the original BIM model and the lightweight BIM model into the 3D scene; set the contrast angle θ and the contrast image resolution;

[0011] Create rendering materials as the output objects when the camera renders the original BIM model and the lightweight BIM model respectively; create two 2D texture maps as the carriers of the images output by the camera to the rendering materials;

[0012] Calculate the diagonal length of the original BIM model boundary cube using the following formula: Where a, b, and c are the length, width, and height of the boundary cube of the original BIM model;

[0013] Set the camera's far clipping plane distance to 2 times the diagonal length diagonalLength to ensure that when the camera takes a picture of the model in subsequent steps, the depth of the camera's frustum can completely contain the model.

[0014] Furthermore, the contrast angle θ is an integer divisible by 360; the width and height of the rendering material are consistent with the set contrast image resolution; and the width and height of the two two-dimensional texture images are consistent with the set contrast image resolution.

[0015] Furthermore, for a given horizontal angle α and vertical angle β, the rotation of the three-dimensional virtual camera is set to the Euler angle (β, α, 0), and the position of the camera is set to the camera's rotation multiplied by the vector (0, 0, -diagonalLength); the original BIM model is displayed, the lightweight BIM model is hidden, camera rendering is performed, output to the rendering material, and then the pixel information in the rendering material is read into the original two-dimensional texture map; the original BIM model is hidden, the lightweight BIM model is displayed, camera rendering is performed, output to the rendering material, and then the pixel information in the rendering material is read into the lightweight two-dimensional texture map; a pair of two-dimensional texture maps is obtained.

[0016] Furthermore, the structural similarity index SSIM is used to analyze each pair of two-dimensional texture images to obtain a similarity index graph, specifically:

[0017] (1) Create the first two-dimensional array, named the original two-dimensional array img1, with width width and height height. The value of each array element is the grayscale value converted from the RGB color of the pixel at the same position in the original two-dimensional texture image according to the method of 0.2989*R+0.5870*G+0.1140*B;

[0018] (2) Create a second two-dimensional array, named the lightweight two-dimensional array img2, with a width of width and a height of height. The value of each array element is the grayscale value converted from the RGB color of the pixel at the same position in the lightweight two-dimensional texture image according to the method of 0.2989*R+0.5870*G+0.1140*B;

[0019] (3) Create a normalized Gaussian window of set size and standard deviation;

[0020] (4) For the original two-dimensional array img1, use Gaussian window filtering to obtain mu1;

[0021] (5) For the lightweight two-dimensional array img2, use Gaussian window filtering to obtain mu2;

[0022] (6) Multiply mu1 by mu2 to get mu1mu2;

[0023] (7) Multiply mu1 by mu1 to obtain mu1Sq;

[0024] (8) Multiply mu2 by mu2 to obtain mu2Sq;

[0025] (9) For the two-dimensional array obtained by multiplying img1 by img2, filter it with a Gaussian window and subtract mu1mu2 to obtain sigma12;

[0026] (10) For the two-dimensional array obtained by multiplying img1 by img1, filter it using a Gaussian window and subtract mu1Sq to obtain sigma1Sq;

[0027] (11) For the two-dimensional array obtained by multiplying img2 by img2, filter it using a Gaussian window and subtract mu2Sq to obtain sigma2Sq;

[0028] (12) Define the constant C1 with a value of 0.0001, define the constant C2 with a value of 0.0009, and calculate (2*mu1mu2+C1)*(2*sigma12+C2) / ((mu1Sq+mu2Sq+C1)*(sigma1Sq+sigma2Sq+C2)) to obtain the structural similarity index result map SSIM Map.

[0029] Furthermore, after removing the interference of the background pixels in the three-dimensional space in the two-dimensional texture image, the similarity index value of the building information model part before and after the lightweighting in the two-dimensional texture image is obtained, that is, the similarity value; specifically:

[0030] Define a double-precision variable total to record the accumulation of valid values ​​in the structural similarity index result map SSIM Map; define a long integer variable count to record the number of valid values; loop through each pixel of the original 2D texture map and the lightweight 2D texture map, and obtain two pixels for a given position px, py respectively; if the RGBA transparency value A of these two pixels is 0, that is, the pixel at this position is the 3D scene background outside the outline of the 3D BIM model captured by the camera, it is not considered a valid pixel point, and its value in the structural similarity index result map SSIM Map is ignored; otherwise, the value of the px, py position in the structural similarity index result map SSIM Map is accumulated to total, and 1 is added to count;

[0031] Divide total by count to obtain the structural similarity index after eliminating background interference, that is, the similarity value, which ranges from [0,1].

[0032] Furthermore, the increasing range of the vertical angle β includes -90 degrees and 90 degrees; the increasing range of the horizontal angle α includes -180 degrees but does not include 180 degrees.

[0033] Based on the same inventive concept, a BIM model similarity calculation system of the present invention includes:

[0034] A two-dimensional texture map generation module is used to use a three-dimensional virtual camera to simulate artificial vision, render images of the building information model before and after lightweighting at different positions on a sphere centered on the building information model (BIM), and generate multiple pairs of two-dimensional texture maps;

[0035] The similarity index calculation module is used to analyze each pair of 2D texture images using the structural similarity index (SSIM) to obtain a similarity index map. Based on this, after removing the interference of the 3D background pixels in the 2D texture map, the similarity index value of the building information model part before and after the lightweighting in the 2D texture map is obtained, i.e., the similarity value.

[0036] Among them, the method for generating multiple pairs of two-dimensional texture maps is: placing the three-dimensional virtual cameras respectively on the sphere with the lightweight before and after BIM models as the center and the radius being the diagonal length diagonalLength of the boundary cube of the original BIM model at a horizontal angle α and a vertical angle β, and the three-dimensional virtual cameras are respectively oriented to the positions of the lightweight before and after BIM models; performing camera rendering on the original BIM model and the lightweight BIM model respectively to obtain the original two-dimensional texture map and the lightweight two-dimensional texture map; the vertical angle β is cyclically increased from -90 degrees to 90 degrees; for each β value, the horizontal angle α is cyclically increased from -180 degrees to 180 degrees, and the cyclic increment step of α and β is the set comparison angle θ, and for each α and each β, a pair of two-dimensional texture maps is obtained;

[0037] And a list generation module is used to combine each pair of α, β and similarity value into an object and add it to a result list, sort the result list from small to large according to the similarity, and finally obtain an ordered list of the comparative similarity of each angle and its position angle.

[0038] Based on the same inventive concept, the present invention provides a BIM model similarity calculation device, the device comprising:

[0039] a memory storing executable program code;

[0040] a processor coupled to the memory;

[0041] The processor calls the executable program code stored in the memory to execute the above-mentioned BIM model similarity calculation method.

[0042] Based on the same inventive concept, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are called, the computer instructions are used to execute the above-mentioned BIM model similarity calculation method.

[0043] Beneficial effects: Compared with the prior art, the advantages of the present invention are:

[0044] The present invention uses a 3D engine virtual camera to simulate artificial vision. On a sphere centered on the BIM model, the present invention renders images of the two models before and after lightweighting from multiple angles. The images of the two models rendered at the same position are automatically analyzed and compared using the structural similarity index (SSIM) method to obtain a similarity index graph. On this basis, the interference of background pixels in the 3D space of the image is eliminated to obtain a similarity index value of the model part in the image, and then a quantitative similarity value is obtained.

[0045] Compared with the existing manual comparison of the differences before and after lightweighting, the present invention has the advantages of fast comparison speed, high efficiency, and the ability to quantify similarity; among them, the advantages of fast comparison speed and high efficiency are because the present invention adopts computer graphics technology and uses a computer virtual camera to simulate artificial vision, that is, it is achieved by using computer instead of manual technical means; among them, the advantage of being able to quantify similarity is because the present invention adopts the structural similarity index SSIM method for optimizing background elimination to compare images taken at the same angle of the model before and after lightweighting. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 It is a flow chart of the method of the present invention;

[0047] Figure 2 It is the image rendering and comparison sub-flowchart;

[0048] Figure 3 is a schematic diagram of camera position I, where (a) is the original BIM model and (b) is the lightweight BIM model;

[0049] Figure 4 is a schematic diagram of camera position II, where (a) is the original BIM model and (b) is the lightweight BIM model;

[0050] Figure 5 Schematic diagram of camera position III, where (a) is the original BIM model and (b) is the lightweight BIM model. DETAILED DESCRIPTION

[0051] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0052] The present invention is a method for comparing the similarity of a three-dimensional building information model before and after lightweighting based on a three-dimensional virtual camera and a structural similarity index. Computer graphics technology is mainly used, and a three-dimensional virtual camera is used to simulate artificial vision to render images of the building information model (BIM) before and after lightweighting at different positions on a sphere centered on the three-dimensional building information model of the building structure. At each position, the two three-dimensional building information models (BIM) before and after lightweighting are rendered separately to generate a pair of two-dimensional texture maps of the building structure. The structural similarity index (SSIM) is used to analyze each pair of two-dimensional texture maps of the building structure to obtain a similarity index map of the building structure. On this basis, after eliminating the interference of background pixels in the three-dimensional space in the two-dimensional texture map of the building structure, the similarity index value of the building information model part in the two-dimensional texture map of the building structure, i.e., the similarity value, is obtained. A list of combination objects of similarity values ​​and angles at various positions of the building structure is sorted according to the similarity values, and finally a quantified, ascending-ordered list of similarity values ​​and their positions and angles on a sphere centered on the BIM model is obtained.

[0053] like Figure 1 As shown, a BIM model similarity calculation method of the present invention includes the following steps:

[0054] (1) Create a three-dimensional scene in a three-dimensional engine, that is, create a three-dimensional space containing a three-dimensional coordinate system, a virtual camera, and a parallel light source.

[0055] (2) Import the original BIM model and the lightweight BIM model of the building structure into the three-dimensional scene.

[0056] (3) Set the contrast angle θ, which must be an integer divisible by 360. The contrast angle is the interval angle between the two comparisons of the two-dimensional texture images of the building structure.

[0057] (4) Set the resolution of the comparison image, such as 1024 pixels in width x 1024 pixels in height. The comparison image is a two-dimensional texture image of the building structure before and after the comparison.

[0058] (5) Create a rendering material and set it as the output object of the camera. The width and height of the rendering material should be consistent with the set contrast image resolution.

[0059] (6) Create two two-dimensional texture maps, which serve as carriers of the images output by the camera to the rendered material. The width and height of the two two-dimensional texture maps are consistent with the set comparison image resolution.

[0060] (7) Calculate the diagonal length of the boundary cube of the original BIM model of the building structure. The calculation formula is: Where a, b, and c are the length, width, and height of the boundary cube of the original BIM model of the building structure.

[0061] (8) The camera far clipping plane distance is set to 2 times the diagonal length diagonalLength to ensure that when the camera takes pictures of the original BIM model and the lightweight BIM model of the building structure in the subsequent steps, the depth of the camera's frustum can completely contain the original BIM model and the lightweight BIM model of the building structure.

[0062] (9) Set the camera vertical angle β, the initial value is -90 degrees.

[0063] (10) Determine whether β is less than or equal to 90 degrees. If yes, proceed to step (11); if not, jump to step (19).

[0064] (11) Determine whether β is equal to -90 degrees or 90 degrees. If yes, proceed to step (12); if not, jump to step (15).

[0065] (12) Set the camera horizontal angle α to 0 degrees.

[0066] (13) Execute the image rendering and comparison sub-process, such as Figure 2 shown.

[0067] (14) β increases by θ and jumps to step (10).

[0068] (15) Set the camera horizontal angle α, the initial value is -180 degrees.

[0069] (16) Determine whether α is less than 180 degrees. If so, proceed to step (17); if not, jump to step (14).

[0070] (17) Execute the image rendering and comparison sub-process, such as Figure 2 shown.

[0071] (18) α increases by θ and jumps to step (16).

[0072] (19) The list of result objects containing similarity and angles α, β is arranged in ascending order according to similarity, and an ordered comparison result list of the original BIM model and the lightweight BIM model of the building structure is obtained.

[0073] The purpose of steps (9) to (19) is to select multiple points on a sphere centered at the origin (i.e., the location of the original BIM model of the building structure and the lightweight BIM model), with the comparison angle θ as the step length; the spherical meridian direction is now called the vertical direction, and the spherical latitude direction is called the horizontal direction. Set the vertical angle β, starting from -90 degrees (inclusive) and cyclically increasing to 90 degrees (inclusive), with a step length of the set comparison angle θ; for each β value, set the horizontal angle α, starting from -180 degrees (inclusive) and cyclically increasing to 180 (not included), with a step length of the set comparison angle θ. During the camera rendering process, the first three camera positions are as follows: Figure 3 (a) and (b) Figure 4 (a) and (b) and Figure 5 As shown in (a) and (b), for each α and each β, the camera is directed toward the center of the original BIM model and the lightweight BIM model of the corresponding building structure to render the image and calculate the structural similarity index.

[0074] like Figure 2 As shown, the image rendering and comparison sub-process, the specific steps are:

[0075] (101) For a given horizontal angle α and vertical angle β, set the camera's rotation to the Euler angles (β, α, 0). Set the camera's position to the camera's rotation multiplied by the vector (0, 0, -diagonalLength). This means the camera is placed at a horizontal angle α and a vertical angle β on a sphere with a radius of diagonalLength centered at the origin, with the camera facing the origin, which is also the location of the model.

[0076] (102) Display the original BIM model of the building structure, hide the lightweight BIM model, perform camera rendering, output the object as the set rendering material, and then read the pixel information in the rendering material into the original two-dimensional texture map.

[0077] (103) The original BIM model of the building structure is hidden, the lightweight BIM model is displayed, camera rendering is performed, the output object is the set rendering material, and then the pixel information in the rendering material is read into the lightweight two-dimensional texture map.

[0078] (104) Based on the original two-dimensional texture map and the lightweight two-dimensional texture map, the structural similarity index method is used to calculate the structural similarity index result map SSIM Map of the building structure.

[0079] (105) Define a double-precision type variable total to record the accumulation of valid values ​​in the two-dimensional map SSIM Map of the structural similarity index of the building structure. Define a long integer variable count to record the number of valid values. Loop through each pixel of the original two-dimensional texture map and the lightweight two-dimensional texture map, and obtain two pixels for a given position px, py. If the RGBA transparency value A of these two pixels is 0, that is, the pixel at this position is the three-dimensional scene background outside the outline of the three-dimensional BIM model captured by the camera, it is not regarded as a valid pixel point, and its value in the two-dimensional map SSIM Map of the structural similarity index of the building structure is ignored; otherwise, the value of the px, py position in the SSIM Map of the structural similarity index of the building structure is accumulated to total, and 1 is added to count. Specifically:

[0080] 1) Define a double-precision variable, total, to record the cumulative total of valid values ​​in the SSIMMap (structural similarity index result map). Define a long-integer variable, count, to record the number of valid values.

[0081] 2) Define a horizontal count i with an initial value of 0. The horizontal count is used to horizontally traverse the pixels of the original two-dimensional texture image and the lightweight two-dimensional texture image, and is also used to horizontally traverse the pixels in the structural similarity index result image.

[0082] 3) Determine whether i is less than the pixel width value of the structural similarity index result map. If yes, proceed to step 4); if not, proceed to step (106).

[0083] 4) Define a longitudinal count j with an initial value of 0. The longitudinal count is used to longitudinally traverse the pixels of the original two-dimensional texture image and the lightweight two-dimensional texture image, and is also used to longitudinally traverse the pixels in the structural similarity index result image.

[0084] 5) Determine whether j is less than the pixel height value of the structural similarity index result map. If yes, proceed to step 6); if not, jump to step 10).

[0085] 6) Get the pixels at position (i, j) in the two 2D texture images respectively, denoted as p1 and p2.

[0086] 7) Determine whether at least one of the transparency channel values ​​of the colors of pixels p1 and p2 is greater than 0. If yes, proceed to step 8); if not, jump to step 9).

[0087] 8) Add the value at position (i, j) in the structural similarity index graph to the total number of indicators, and increase the number of pixels count by 1.

[0088] 9) The vertical count j is incremented by 1 and the process goes to step 5).

[0089] 10) The horizontal count i is incremented by 1 and the process goes to step 3).

[0090] (106) The total number of indicators total is divided by the number of pixels count to obtain or filter out the structural similarity index value of the transparent background pixels, that is, the similarity.

[0091] (107) Add the combination object of similarity and current spherical position angle α, β to the result list.

[0092] Example:

[0093] The present invention can be implemented using a 3D engine tool such as Unity or Unreal Engine. The present invention is described in detail using Unity as an example.

[0094] (1) Set up a 3D scene, including a camera and parallel light. Use the default parameters for the parallel light. Set the camera's near clipping plane distance to 0.001 to prevent the BIM model of the building structure from being less than this distance from the camera and failing to render the model image completely. Set the camera projection mode to perspective and the field of view angle to 60 degrees.

[0095] (2) Import the original BIM model and the lightweight BIM model of the building structure into the 3D scene, and set the positions of both models to the origin (0,0,0).

[0096] (3) Set the contrast angle θ, such as 30 degrees, that is, the horizontal and vertical directions are contrasted once every θ angle.

[0097] (4) Calculate the diagonal lengths of the boundary lengths a, b, and c of the original BIM model of the building structure. Denote it as diagonal length diagonalLength.

[0098] (5) Set the resolution of the comparison image, such as 1024 pixels x 1024 pixels, which are recorded as width and height respectively.

[0099] (6) Create a rendering material, RenderTexture in Unity, set it as the output object of the camera, set the width and height of the rendering material to the width and height of the set contrast image resolution, and set its depth to 24.

[0100] (7) Set the camera's far clipping plane distance farClipPlane to 2 times diagonalLength.

[0101] (8) Create two two-dimensional texture maps, Texture2D, of the same size and parameters. Their width and height are the width and height of the comparison image resolution, respectively. The format is RGBA32, that is, R, G, B, A, and the four channels are all 8 bits. One of the two-dimensional texture maps is named the original two-dimensional texture map and is used to store the image data of the original BIM model of the building structure. The other two-dimensional texture map is named the lightweight two-dimensional texture map and is used to store the image data of the lightweight BIM model.

[0102] (9) The purpose of the current step is to select multiple points on the sphere centered at the origin (i.e., the location of the model) with the comparison angle θ as the step size. The spherical meridian direction is now called the vertical direction, and the spherical latitude direction is called the horizontal direction. Set the vertical angle β, starting from -90 degrees (inclusive) and cyclically increasing to 90 degrees (inclusive), with the step size being the set comparison angle θ; for each β value, set the horizontal angle α, starting from -180 degrees (inclusive) and cyclically increasing to 180 degrees (not included), with the step size being the set comparison angle θ. For each α and each β, make a camera rendering image and calculate the structural similarity index. The specific method is shown in the steps below:

[0103] (a) For a given horizontal angle α and vertical angle β, set the camera rotation to the Euler angles (β, α, 0) and the camera position to the camera rotation multiplied by the vector (0, 0, -diagonalLength). This places the camera at a horizontal angle α and a vertical angle β on a sphere with a radius of diagonalLength centered at the origin, with the camera facing the origin. The current camera parameter settings fully encompass the current model in depth, width, and height.

[0104] (b) Display the original BIM model of the building structure, hide the lightweight BIM model, perform camera rendering, output the object as the set rendering material, and then read the pixel information in the rendering material into the original 2D texture map.

[0105] (c) Hide the original BIM model of the building structure, display the lightweight BIM model, perform camera rendering, output the object as the set rendering material, and then read the pixel information in the rendering material into the lightweight 2D texture map.

[0106] (d) Based on the original 2D texture image and the lightweight 2D texture image, calculate the SSIM Map of the building structure. See the following steps for details:

[0107] 1) Create the first two-dimensional array, named the original two-dimensional array img1, with width width and height height. The value of each array element is the grayscale value converted from the RGB color of the pixel at the same position in the original two-dimensional texture image according to the method of 0.2989*R+0.5870*G+0.1140*B.

[0108] 2) Create a second two-dimensional array and name it the lightweight two-dimensional array img2, with width width and height height. The value of each array element is the grayscale value converted from the RGB color of the pixel at the same position in the lightweight two-dimensional texture image according to the method of 0.2989*R+0.5870*G+0.1140*B.

[0109] 3) Create a normalized Gaussian window of size 11 and standard deviation 1.5.

[0110] 4) For the original two-dimensional array, use Gaussian window filtering to obtain mu1.

[0111] 5) For the lightweight two-dimensional array, use Gaussian window filtering to obtain mu2.

[0112] 6) Multiply mu1 by mu2 to get mu1mu2.

[0113] 7) Multiply mu1 by mu1 to get mu1Sq.

[0114] 8) Multiply mu2 by mu2 to get mu2Sq.

[0115] 9) For the two-dimensional array obtained by multiplying img1 by img2, use the Gaussian window to filter the result, and then subtract mu1mu2 to get sigma12.

[0116] 10) For the two-dimensional array obtained by multiplying img1 by img1, filter the result with a Gaussian window and subtract mu1Sq from it to get sigma1Sq.

[0117] 11) For the two-dimensional array obtained by multiplying img2 by img2, filter the result with a Gaussian window and subtract mu2Sq from it to get sigma2Sq.

[0118] 12) Define constant C1 as 0.0001 and constant C2 as 0.0009.

[0119] 13) Calculate (2*mu1mu2+C1)*(2*sigma12+C2) / ((mu1Sq+mu2Sq+C1)*(sigma1Sq+sigma2Sq+C2)) to obtain the structural similarity index result map SSIM Map.

[0120] (e) Define a double-precision variable total to record the cumulative valid values ​​in the structural similarity index result map SSIMMap of the building structure. Define a long-integer variable count to record the number of valid values.

[0121] (f) Define a horizontal count i with an initial value of 0. This horizontal count is used to horizontally traverse the pixels of the original two-dimensional texture image and the lightweight two-dimensional texture image, and is also used to horizontally traverse the pixels in the structural similarity index result image.

[0122] (g) Determine whether i is less than the pixel width value of the structural similarity index result image. If yes, proceed to step (h); if not, proceed to step (o).

[0123] (h) Define a longitudinal count j with an initial value of 0. This longitudinal count is used to longitudinally traverse the pixels of the original two-dimensional texture image and the lightweight two-dimensional texture image, and is also used to longitudinally traverse the pixels in the structural similarity index result image.

[0124] (i) Determine whether j is less than the pixel height value of the structural similarity index result map. If so, continue with step (j); if not, jump to step (n).

[0125] (j) Get the pixels at position (i, j) in the two 2D texture images, denoted as p1 and p2 respectively.

[0126] (k) Determine whether at least one of the transparency channel values ​​of the colors of pixels p1 and p2 is greater than 0. If yes, proceed to step (1); if not, jump to step (m).

[0127] (l) Add the value at position (i, j) in the structural similarity index graph to the total number of indicators, and increase the number of pixels count by 1.

[0128] (m) The vertical count j is incremented by 1 and the process goes to step (i).

[0129] (n) The horizontal count i is incremented by 1 and the process jumps to step (g).

[0130] (o) Divide the total number of indicators total by the number of pixels count to obtain the structural similarity index value of the transparent background pixels or filter them out, that is, the similarity.

[0131] (p) Add the combination object of similarity and current spherical position angle α, β to the result list.

[0132] (10) The result list is sorted from small to large according to the similarity, and finally an ordered list of the comparative similarity of each angle of the building structure and its position angle is obtained.

[0133] In summary, the present invention can be applied to the digital twin industry based on BIM models. It primarily addresses the low efficiency of manual comparison of the similarity between lightweight BIM models and the original model, as well as the inability to quantify similarity. The present invention is used to automatically compare BIM models before and after lightweighting, reducing manual workload and quantifying similarity, thereby improving model accuracy and project implementation efficiency.

[0134] Based on the same inventive concept, a BIM model similarity calculation system of the present invention includes:

[0135] A two-dimensional texture map generation module is used to use a three-dimensional virtual camera to simulate artificial vision, render images of the building information model before and after lightweighting at different positions on a sphere centered on the building information model (BIM), and generate multiple pairs of two-dimensional texture maps;

[0136] The similarity index calculation module is used to analyze each pair of 2D texture images using the structural similarity index (SSIM) to obtain a similarity index map. Based on this, after removing the interference of the 3D background pixels in the 2D texture map, the similarity index value of the building information model part before and after the lightweighting in the 2D texture map is obtained, i.e., the similarity value.

[0137] Among them, the method for generating multiple pairs of two-dimensional texture maps is: placing the three-dimensional virtual cameras respectively on the sphere with the lightweight before and after BIM models as the center and the radius being the diagonal length diagonalLength of the boundary cube of the original BIM model at a horizontal angle α and a vertical angle β, and the three-dimensional virtual cameras are respectively oriented to the positions of the lightweight before and after BIM models; performing camera rendering on the original BIM model and the lightweight BIM model respectively to obtain the original two-dimensional texture map and the lightweight two-dimensional texture map; the vertical angle β is cyclically increased from -90 degrees to 90 degrees; for each β value, the horizontal angle α is cyclically increased from -180 degrees to 180 degrees, and the cyclic increment step of α and β is the set comparison angle θ, and for each α and each β, a pair of two-dimensional texture maps is obtained;

[0138] And a list generation module is used to combine each pair of α, β and similarity value into an object and add it to a result list, sort the result list from small to large according to the similarity, and finally obtain an ordered list of the comparative similarity of each angle and its position angle.

[0139] Based on the same inventive concept, the present invention provides a BIM model similarity calculation device, which may include: a memory storing executable program code; a processor coupled to the memory; the processor calls the executable program code stored in the memory to execute the steps in the BIM model similarity calculation method described in Example 1.

[0140] The memory may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. The device may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the memory may be used to read and write non-removable, non-volatile magnetic media (commonly referred to as a "hard drive"). A program / utility having a set (at least one) of program modules may be stored in, for example, the memory, such program modules including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules typically perform the functions and / or methods of the embodiments described herein.

[0141] The processor executes various functional applications and data processing by running the programs stored in the memory, such as implementing the method provided in the first embodiment of the present invention.

[0142] Based on the same inventive concept, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are called, the computer instructions are used to execute the above-mentioned BIM model similarity calculation method.

[0143] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or components, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by an instruction execution system, device or device or used in combination with it.

[0144] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0145] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0146] Computer program code for performing the operations of the present invention can be written in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, C#, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0147] Of course, the computer-executable instructions of a storage medium provided by an embodiment of the present invention are not limited to the above method operations, but can also execute related operations in the method provided by any embodiment of the present invention.

Claims

1. A method for calculating BIM model similarity, characterized in that: include: Using a 3D virtual camera to simulate artificial vision, the building information model before and after lightweighting is rendered at different positions and angles on a sphere centered on the building information model (BIM) of the building structure, generating multiple pairs of 2D texture maps of the building structure. The structural similarity index SSIM is used to analyze each pair of two-dimensional texture images of the building structure to obtain a similarity index map. On this basis, after removing the interference of the three-dimensional background pixels in the two-dimensional texture map of the building structure, the similarity index value of the building information model part before and after the lightweighting of the two-dimensional texture map of the building structure is obtained, that is, the similarity value. Each pair of position angle and similarity value is combined into an object and added to the result list. Finally, the result list is sorted from small to large by similarity, and finally an ordered list of the comparative similarity of each angle of the building structure and its position angle is obtained; The method for rendering an image is as follows: placing a 3D virtual camera at a position with a horizontal angle α and a vertical angle β on a sphere with a radius equal to the diagonal length of the bounding cube of the original BIM model and centered on the BIM models before and after lightweighting, and the 3D virtual camera is oriented toward the positions of the BIM models before and after lightweighting; performing camera rendering on the original BIM model and the BIM model after lightweighting, respectively, to obtain an original 2D texture map and a 2D texture map after lightweighting; The vertical angle β is cyclically increased from -90 degrees to 90 degrees. For each β value, the horizontal angle α is cyclically increased from -180 degrees to 180 degrees. The cyclic increment step of α and β is the set contrast angle θ. For each α and each β, a pair of two-dimensional texture images are obtained. The method for obtaining the similarity value is as follows: define a double-precision type variable total to record the accumulation of valid values ​​in the structural similarity index result map SSIM Map; define a long integer variable count to record the number of valid values; loop through each pixel of the original two-dimensional texture map and the lightweight two-dimensional texture map, and obtain two pixels for a given position px, py respectively; if the RGBA transparency value A of these two pixels is 0, that is, the pixel at this position is the three-dimensional scene background outside the outline of the three-dimensional BIM model captured by the camera, it is not regarded as a valid pixel point, and its value in the structural similarity index result map SSIM Map is ignored; otherwise, the value of the px, py position in the structural similarity index result map SSIM Map is accumulated to total, and 1 is added to count at the same time; divide total by count to obtain the structural similarity index after eliminating background interference, that is, the similarity value, which ranges from [0,1].

2. A BIM model similarity calculation method according to claim 1, characterized in that: Before rendering the image, you need to do the following: First, import the original BIM model and the lightweight BIM model into the 3D scene; set the contrast angle θ and the contrast image resolution; Create a rendering material as the output object when the camera renders the original BIM model and the lightweight BIM model respectively; create two 2D texture maps as the carriers of the images output by the camera to the rendering material; Calculate the diagonal length of the original BIM model boundary cube using the following formula: Where a, b, and c are the length, width, and height of the boundary cube of the original BIM model; Set the camera's far clipping plane distance to 2 times the diagonal length diagonalLength to ensure that when the camera takes a picture of the model in subsequent steps, the depth of the camera's frustum can completely contain the model.

3. A BIM model similarity calculation method according to claim 2, characterized in that: The contrast angle θ is an integer divisible by 360; the width and height of the rendering material are consistent with the set contrast image resolution; the width and height of the two 2D texture images are consistent with the set contrast image resolution.

4. A BIM model similarity calculation method according to claim 1, characterized in that: For a given horizontal angle α and vertical angle β, set the rotation of the 3D virtual camera to the Euler angle (β, α, 0), and set the position of the camera to the camera's rotation multiplied by the vector (0, 0, -diagonalLength); Display the original BIM model, hide the lightweight BIM model, perform camera rendering, output the object as the set rendering material, and then read the pixel information in the rendering material into the original 2D texture map; hide the original BIM model, display the lightweight BIM model, perform camera rendering, output the object as the set rendering material, and then read the pixel information in the rendering material into the lightweight 2D texture map; obtain paired 2D texture maps.

5. A BIM model similarity calculation method according to claim 1, characterized in that: Each pair of two-dimensional texture images is analyzed using the structural similarity index SSIM to obtain a similarity index graph, specifically: (1) Create the first two-dimensional array, named the original two-dimensional array img1, with width width and height height. The value of each array element is the grayscale value converted from the RGB color of the pixel at the same position in the original two-dimensional texture image according to the method of 0.2989*R+0.5870*G+0.1140*B; (2) Create a second two-dimensional array, named the lightweight two-dimensional array img2, with a width of width and a height of height. The value of each array element is the grayscale value converted from the RGB color of the pixel at the same position in the lightweight two-dimensional texture image according to the method of 0.2989*R+0.5870*G+0.1140*B; (3) Create a normalized Gaussian window of set size and standard deviation; (4) For the original two-dimensional array img1, use Gaussian window filtering to obtain mu1; (5) For the lightweight two-dimensional array img2, use Gaussian window filtering to obtain mu2; (6) Multiply mu1 by mu2 to get mu1mu2; (7) Multiply mu1 by mu1 to obtain mu1Sq; (8) Multiply mu2 by mu2 to obtain mu2Sq; (9) For the two-dimensional array obtained by multiplying img1 by img2, filter it with a Gaussian window and subtract mu1mu2 to obtain sigma12; (10) For the two-dimensional array obtained by multiplying img1 by img1, filter it using a Gaussian window and subtract mu1Sq to obtain sigma1Sq; (11) For the two-dimensional array obtained by multiplying img2 by img2, filter it using a Gaussian window and subtract mu2Sq to obtain sigma2Sq; (12) Define the constant C1 with a value of 0.0001, define the constant C2 with a value of 0.0009, and calculate (2*mu1mu2+C1)*(2*sigma12+C2) / ((mu1Sq+mu2Sq+C1)*(sigma1Sq+sigma2Sq+C2)) to obtain the structural similarity index result map SSIM Map.

6. A BIM model similarity calculation method according to claim 1, characterized in that: The increasing range of the vertical angle β includes -90 degrees and 90 degrees; the increasing range of the horizontal angle α includes -180 degrees but does not include 180 degrees.

7. A BIM model similarity calculation system, characterized in that: include: A two-dimensional texture map generation module is used to use a three-dimensional virtual camera to simulate artificial vision, render images of the building information model before and after lightweighting at different positions on a sphere centered on the building information model (BIM) of the building structure, and generate multiple pairs of two-dimensional texture maps; Multiple pairs of two-dimensional texture map generation units are used to place three-dimensional virtual cameras at positions with a horizontal angle α and a vertical angle β on a sphere with a radius equal to the diagonal length diagonalLength of the bounding cube of the original BIM model and centered on the before and after lightweight BIM models, and the three-dimensional virtual cameras are respectively oriented toward the positions of the before and after lightweight BIM models; perform camera rendering on the original BIM model and the lightweight BIM model respectively to obtain an original two-dimensional texture map and a lightweight two-dimensional texture map; The vertical angle β is cyclically increased from -90 degrees to 90 degrees. For each β value, the horizontal angle α is cyclically increased from -180 degrees to 180 degrees. The cyclic increment step of α and β is the set contrast angle θ. For each α and each β, a pair of two-dimensional texture images are obtained. The similarity index calculation module is used to analyze the two-dimensional texture images of each pair of building structures using the structural similarity index SSIM to obtain a similarity index map. Based on this, after removing the interference of the three-dimensional background pixels in the two-dimensional texture map, the similarity index value of the building information model part before and after the lightweighting in the two-dimensional texture map is obtained, that is, the similarity value; The similarity value acquisition unit is used to define a double-precision type variable total, which is used to record the accumulation of valid values ​​in the structural similarity index result map SSIM Map; define a long integer variable count, which is used to record the number of valid values; loop through each pixel of the original two-dimensional texture map and the lightweight two-dimensional texture map, and obtain two pixels for a given position px, py respectively; if the RGBA transparency value A of these two pixels is 0, that is, the pixel at this position is the three-dimensional scene background outside the outline of the three-dimensional BIM model captured by the camera, it is not regarded as a valid pixel point, and its value in the structural similarity index result map SSIM Map is ignored; otherwise, the value of the px, py position in the structural similarity index result map SSIM Map is accumulated to total, and 1 is added to count at the same time; divide total by count to obtain the structural similarity index after eliminating background interference, that is, the similarity value, which ranges from [0, 1]; And a list generation module is used to combine each pair of α, β and similarity value into an object and add it to a result list, sort the result list from small to large according to the similarity, and finally obtain an ordered list of the comparative similarity of each angle of the building structure and its position angle.

8. A BIM model similarity calculation device, characterized in that: The device comprises: a memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the BIM model similarity calculation method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and when the computer instructions are called, they are used to execute the BIM model similarity calculation method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Data management system and method of prefabricated part based on BIM cloud platform

    CN113947688A

  • Contour determination method and device of BIM model, terminal and storage medium

    CN114937051A