Method, system and storage medium for measuring distance between any two points in a three-dimensional model of an ancient building
By collecting images and 3D reconstruction of ancient buildings, and combining EXIF information and camera sensor information to calculate the actual distance between two corner points, the problem of difficulty in obtaining dimensional information in 3D models of ancient buildings is solved, and the problem of obtaining dimensional information without reference objects is realized. Accurate size estimation and improved repair efficiency.
Patent Information
- Application Number
- CN202411025325.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-07-30
AI Technical Summary
It is difficult to accurately obtain object size information in three-dimensional models of ancient buildings with existing technology, especially during the repair process after damage. The lack of size information will affect the repair efficiency.
By collecting two sets of images of the ancient building, using a reconstruction algorithm to generate a three-dimensional model, selecting two symmetrical corner points, calculating the actual distance between the two corner points based on the EXIF information of the image and the camera sensor information, and using the Euclidean distance ratio Calculate dimensions in three-dimensional space.
It achieves accurate estimation of the physical object size of ancient buildings without reference objects, avoids the inconvenience of repeated measurements after reconstruction, and improves the efficiency of ancient building restoration.
Smart Images

Figure CN118552603B
Abstract
Description
Technical Field
[0001] The invention relates to the field of distance measurement of three-dimensional reconstruction models, and a distance measurement method, system and storage medium for any two points in a three-dimensional model of an ancient building. Background Art
[0002] In the traditional scene reconstruction and rendering, a variety of novel view synthesis methods have been adopted. These methods are mainly based on technologies such as light field and structured ray marching (such as NeRF), and use methods such as deep learning and convolutional neural network (CNN) to improve the reconstruction and rendering effects. However, these methods still face challenges in terms of rendering speed, image quality, and effective representation of blank space. Recently, a series of new methods have emerged to address the speed and quality problems of methods such as NeRF, such as InstantNGP, Plenoxels, Gaussian Splatting, and Mip-NeRF360. These methods use different design choices and encoding strategies to improve rendering efficiency and image quality. These methods have achieved remarkable results in rendering speed, blank space representation, and image quality. However, the input of these methods is based on the sparse reconstruction of the image set by colmap, and the three-dimensional space of the point cloud storing the three-dimensional model does not have a fixed ratio value with the real world, which makes it difficult to obtain the size information of the object from the model. For the restoration of ancient buildings after damage, size is an essential key information. The lack of size information will consume a lot of time in the restoration process and affect the efficiency of ancient building restoration. Summary of the invention
[0003] The object of the present invention is to provide a distance measurement method, system and storage medium for any two points in a three-dimensional model of an ancient building without the need for a reference object to calculate the actual size of the ancient building to be measured.
[0004] In order to achieve the above object, the present invention adopts such technical solution:
[0005] The distance measurement method of any two points in the three-dimensional model of the ancient building includes the following steps performed in sequence:
[0006] S1: Capture two sets of images of the 3D model entity object to obtain a first image set and a second image set. When shooting, record the acquisition position of each image in the first image set and the interval distance between the camera positions corresponding to two adjacent acquisition positions;
[0007] S2: using the images in the second image set and using a reconstruction algorithm to perform three-dimensional reconstruction of the physical object to obtain a three-dimensional model of the physical object, selecting two corner points in the three-dimensional model, and the two corner points are symmetrically arranged with respect to the center of the physical object, and marking the corresponding positions of the two corner points in each image of the first image set in step S1;
[0008] S3: Measure the pixel length between two corner points in each image of the first image set, and calculate the actual distance between the two corner points through the EXIF information of the image and the camera sensor information. The specific steps are as follows:
[0009] S3-1: using an image tool to mark the two corner points of each image in the first image set in step S2 and perform pixel measurement on the image;
[0010] S3-2: Extract image resolution and focal length from the image’s EXIF information, and obtain camera sensor size information;
[0011] S3-3: Calculate the actual distance between the two corner points. The calculation formula is:
[0012] ;
[0013] in, is the actual distance between the two corner points, The height of the sensor of the camera used to capture the image, is the number of pixels at the height of the first image set obtained by shooting, is the number of images in the first image set excluding the image taken at the initial point. is the distance between the camera fixed point and the camera initial point of the remaining images except the image taken at the initial point, ={1,…, }, To remove the height pixel value of the corner point of the entity object in each image at the initial point, is the height pixel value of the corner point of the entity object in the initial point image, is the fixed focal length of the camera when taking the first set of images;
[0014] S4: Calculate the Euclidean distance between two corner points in the three-dimensional model in the point cloud three-dimensional space, and calculate the ratio between the actual distance and the three-dimensional space distance based on the actual distance between the two corner points in step S3. The specific steps are as follows:
[0015] The formula for calculating the Euclidean distance between two corner points in a three-dimensional model is as follows:
[0016] ;
[0017] in, is the distance between two corner points in the three-dimensional space of the point cloud, ( , , )and( , , ) are the coordinates of the two corner points in the three-dimensional space of the point cloud;
[0018] The ratio of actual distance to three-dimensional distance The calculation formula is as follows:
[0019] ;
[0020] in, is the actual distance between the two corner points calculated in step S3;
[0021] S5: The ratio calculated according to step S4 And the coordinates of the ancient building model in the point cloud three-dimensional space calculate the size between any two points.
[0022] Preferably, the image acquisition in step S1 specifically includes the following steps:
[0023] S1-1: Determine the camera shooting angle for the first image set. The shooting angle should satisfy the coincidence between the center of the physical object and the center of the camera viewing angle. Once the angle is determined, it remains unchanged.
[0024] S1-2: Take the current camera position as the initial point, lock the camera focal length to 4.49mm, and wait for the shooting route to be determined after taking an initial image;
[0025] S1-3: Determine the shooting route of the first image acquisition, and take the distance between the initial point and the center of the entity object as X , On the shooting route, an image is taken every X distance in a clockwise or counterclockwise direction around the physical object. After taking n images, the acquisition of the first image is terminated. All images must contain the whole picture of the physical object, otherwise, steps S1-1 to S1-3 are repeated;
[0026] S1-4: Use a drone to perform surround shooting with the physical object as the center at the angles of looking down, looking straight, and looking up to obtain a second image set. During the surround process, the angle between the lines between two adjacent camera positions and the center of the physical object is no more than 15 degrees. The number of images in the obtained second image set is no less than 72. Otherwise, repeat step S1-4.
[0027] Preferably, the step of calculating the size between any two points in step S5 is as follows:
[0028] S5-1: Determine the two corner points of the dimension to be measured in the 3D model and , and obtain it from the 3D model file and The point cloud coordinates ( , , )、( , , );
[0029] S5-2: The ratio of the two-point coordinates and the actual distance to the three-dimensional space distance Φ Calculate the actual size of two points L , the calculation formula is as follows:
[0030] .
[0031] Preferably, the reconstruction algorithm in step S2 is a 3D Gaussian splash algorithm or a neural radiation field.
[0032] A distance measurement system for any two points in a three-dimensional model of an ancient building comprises a memory and a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any one of the above methods.
[0033] A computer-readable storage medium stores a computer program, wherein the computer program implements the steps of any of the above methods when executed by a processor.
[0034] By adopting the above-mentioned design scheme, the beneficial effects of the present invention are as follows: the present invention introduces a method for calculating the actual size of an object in an image only through a set of image information and the interval distance between cameras. The method can accurately estimate the size of a physical object without a reference object. Secondly, for any three-dimensional reconstruction model or scene of an ancient building based on point cloud storage data, the present invention can obtain the size ratio between the real world and the three-dimensional space stored in the model by calculating the ratio of the measured size between the two corner points of the object and the Euclidean distance between the two corner points in the three-dimensional space. Through this ratio, the size information between any two points in the three-dimensional model of the ancient building can be easily obtained. The algorithm proposed by the present invention can effectively avoid the inconvenience caused by the relevant personnel returning to the site of the ancient building to repeatedly measure the size after reconstruction. Moreover, compared with the traditional distance measurement method, no reference object of known size is required in the captured image set, and the present invention has broad application prospects and market value. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 is a flow chart of the method of the present invention;
[0036] Figure 2 It is a schematic diagram of the position of the physical object, the optical center of the camera and the imaging surface of the sensor of the present invention;
[0037] Figure 3 It is a schematic diagram of camera imaging of the three-dimensional model of the present invention corresponding to the actual object at different distances. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only partial embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] The distance measurement method between any two points in the three-dimensional model of ancient buildings, such as Figure 1 As shown, the steps include the following steps performed in sequence:
[0040] S1: Capture two sets of images of the three-dimensional model entity object to obtain a first image set and a second image set. The acquisition device used in this embodiment is a DJI Mini 4K, and the sensor size is 1 / 2.3 inches (about 6.2 mm x 4.65 mm). The resolution of the captured image is 4000 x 3000 pixels, a total of 12 megapixels. When shooting, record the acquisition position of each image in the first image set and the interval distance between the camera positions corresponding to two adjacent acquisition positions;
[0041] The image acquisition in step S1 specifically includes the following steps:
[0042] S1-1: Determine the camera shooting angle for the first image set. The shooting angle should satisfy the coincidence between the center of the physical object and the center of the camera viewing angle. Once the angle is determined, it remains unchanged.
[0043] S1-2: Take the current camera position as the initial point, lock the camera focal length to 4.49mm, and wait for the shooting route to be determined after taking an initial image;
[0044] S1-3: Determine the shooting route of the first image acquisition, and take the distance between the initial point and the center of the entity object as X , On the shooting route, an image is taken every X distance in a clockwise or counterclockwise direction around the physical object. After taking n images, the acquisition of the first image is terminated. All images must contain the whole picture of the physical object, otherwise, steps S1-1 to S1-3 are repeated;
[0045] S1-4: Use a drone to perform surround shooting with the physical object as the center at the angles of looking down, looking straight, and looking up to obtain a second image set. During the surround process, the angle between the lines between two adjacent camera positions and the center of the physical object is no greater than 15 degrees. The number of images in the obtained second image set is no less than 72. Otherwise, repeat step S1-4;
[0046] S2: Using the images in the second image set and using the 3D Gaussian splatting algorithm to perform 3D reconstruction of the physical object, a 3D model of the physical object is obtained, and two relatively prominent corner points are selected in the 3D model. In this embodiment, the software used to open the model, select the corner points, and view the coordinates of the corner points is MeshLab, and the corresponding positions of the two corner points are marked in each image of the first image set in step S1;
[0047] S3: Figure 2 As shown, the pixel length between two corner points in each image of the first image set is measured, and the actual distance between the two corner points is estimated through the EXIF information of the image and the camera sensor information. The specific steps are as follows:
[0048] S3-1: using the image tool Photoshop, mark the two corner points of each image in the first image set in step S2 and measure the pixels of the image;
[0049] S3-2: Extract image resolution and focal length from the image's EXIF information, and obtain camera sensor size information through the camera manual or online channels;
[0050] S3-3: Calculate the actual distance between the two corner points. The calculation formula is:
[0051] ;
[0052] in, is the actual size value of the two corner points to be measured, The height of the sensor of the camera used to capture the image. In this embodiment, the height of the sensor of the camera used is 4.65 mm. The number of pixels at the height of the first image set obtained by shooting. In this embodiment, it is assumed that the image is shot in a horizontal direction (i.e., the width of the image resolution is greater than the height, and the resolution is, for example, 3840*2160). The number of pixels at the height means the number of pixels at the height of the image (for example, if the resolution is 3840*2160, 2160 is the number of pixels at the height).
[0053] is the number of images in the first image set excluding the image taken at the initial point, that is, the number of images in the first image set after deducting the first image. is the distance between the camera fixed point and the camera initial point of the remaining images except the image taken at the initial point, ={1,…, }, To remove the height pixel value of the corner point of the entity object in each image at the initial point, is the height pixel value of the corner point of the entity object in the initial point image, is the fixed focal length of the camera when the first set of images was taken.
[0054] S4: Calculate the Euclidean distance between two corner points in the three-dimensional model in the point cloud three-dimensional space, and calculate the ratio between the actual distance and the three-dimensional space distance based on the actual distance between the two corner points in step S3. The specific steps are as follows:
[0055] The formula for calculating the Euclidean distance between two corner points in a three-dimensional model is as follows:
[0056] ;
[0057] in, is the distance between two corner points in the three-dimensional space of the point cloud, ( , , )and( , , ) are the coordinates of the two corner points in the three-dimensional space of the point cloud;
[0058] The ratio of actual distance to three-dimensional distance The calculation formula is as follows:
[0059] ;
[0060] is the actual distance between the two corner points calculated in step S3;
[0061] S5: The ratio calculated according to step S4 And the coordinates of the ancient building model in the point cloud three-dimensional space calculate the size between any two points.
[0062] The steps for calculating the size between any two points in step S5 are as follows:
[0063] S5-1: Determine the two corner points of the dimension to be measured in the 3D model and , and obtain it from the 3D model file and The point cloud coordinates ( , , )、( , , );
[0064] S5-2: The ratio of the two-point coordinates and the actual distance to the three-dimensional space distance Φ Calculate the actual size of two points L , the calculation formula is as follows:
[0065] ;
[0066] In this embodiment, the two corner points selected in step S2 need to be symmetrical about the center of the physical object in step S1, otherwise the actual size result will be affected by the camera viewing angle deviation;
[0067] In this embodiment, the three-dimensional model can be obtained by a 3D Gaussian splash algorithm or a neural radiation field (NeRF) vision algorithm, or by drone oblique photography. However, in order to ensure that the precise coordinates of each point in the model can be obtained and the Euclidean distance between two points can be calculated, the three-dimensional model data must be saved in the form of a point cloud.
[0068] In an embodiment of the present application, a method for deriving the relationship between the distance between any two points of the ancient building to be measured and the distance between each position and the initial point when the camera takes the ranging image is provided. The specific derivation steps are as follows:
[0069] Step 1: Figure 2 This is a schematic diagram of the position of an ancient building to be measured, the optical center of a camera, and the imaging surface of a sensor provided in this embodiment. In the figure, is the pixel height of the image taken by the camera, is the pixel height of the ancient building in the image, is the focal length of the camera when shooting, c is the optical center of the camera, is the distance between the ancient building and the optical center of the camera when shooting. is the actual height of the ancient building. is the width of the camera's viewing angle.
[0070] like Figure 2 , according to trigonometric functions we can get:
[0071] ;
[0072] ;
[0073] Step 2: Derived from the trigonometric functions in step 1, we can get:
[0074] ;
[0075] ;
[0076] ;
[0077] Step 3: Figure 3 A schematic diagram of camera imaging of an ancient building model to be tested corresponding to an actual object at different distances provided in this embodiment. In the figure, is the distance between the ancient building and the optical center of the camera when the camera is in the initial position to shoot the ancient building to be tested. Keep the camera in focus The distance between the ancient building and the camera's optical center after moving a certain distance away without changing the distance. , let the pixel height of the ancient building to be measured in the image of the moved camera be , since the focal length is locked during the whole shooting process, it can be concluded from step 2:
[0078] ;
[0079] Step 4: Order for and The ratio of can be derived from step 3:
[0080] ;
[0081] Depend on Figure 3 It can be seen that >1.
[0082] Step 5: From steps 3 and 4, we can deduce:
[0083] ;
[0084] ;
[0085] ;
[0086] Step 6: From steps 1, 2, and 5, we can deduce:
[0087] ;
[0088] Step 7: To step 6, this embodiment has obtained the height of the ancient building to be measured , but its unit is pixel, we need to convert it into length unit, so we also need to get the height dimension value of the sensor of the camera used to take the image ,pass By comparing the height of the image to the height of the image, we can get the height of a single pixel on the sensor imaging surface in units of length, which can be derived from step 6:
[0089] ;
[0090] This embodiment also provides a distance measurement system for any two points in the three-dimensional model of the ancient building for implementing the above method.
[0091] A distance measuring system for any two points in a three-dimensional model of an ancient building comprises a memory and a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps of any one of the above methods.
[0092] In this embodiment, a storage medium storing a computer program that can be used to implement the above method is also provided.
[0093] A computer-readable storage medium stores a computer program, which implements the steps of any of the above methods when executed by a processor.
[0094] In summary, the present invention introduces a method for calculating the actual size of an object in an image only through a set of image information and the distance between cameras. This method can accurately estimate the size of a physical object without a reference object. Secondly, for any three-dimensional reconstruction model or scene of an ancient building based on point cloud storage data, the invention can obtain the size ratio between the real world and the three-dimensional space stored in the model by calculating the ratio of the measured size between the two corner points of the object and the Euclidean distance between the two corner points in the three-dimensional space. Through this ratio, the size information between any two points in the three-dimensional model of the ancient building can be easily obtained. The algorithm proposed by the invention can effectively avoid the inconvenience caused by the relevant personnel returning to the site of the ancient building to repeatedly measure the size after reconstruction, and compared with the traditional distance measurement method, no reference object of known size is required in the captured image set, and it has broad application prospects and market value.
[0095] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for measuring the distance between any two points in a three-dimensional model of an ancient building, characterized in that: The process includes the following steps: S1: Capture two sets of images of the 3D model entity object to obtain a first image set and a second image set. When shooting, record the acquisition position of each image in the first image set and the interval distance between the camera positions corresponding to two adjacent acquisition positions; S2: using the images in the second image set and using a reconstruction algorithm to perform three-dimensional reconstruction of the physical object to obtain a three-dimensional model of the physical object, selecting two corner points in the three-dimensional model, and the two corner points are symmetrically distributed about the center of the physical object, and marking the corresponding positions of the two corner points in each image of the first image set in step S1; S3: Measure the pixel length between two corner points in each image of the first image set, and calculate the actual distance between the two corner points through the EXIF information of the image and the camera sensor information. The specific steps are as follows: S3-1: using an image tool to mark the two corner points of each image in the first image set in step S2 and perform pixel measurement on the image; S3-2: Extract image resolution and focal length from the image’s EXIF information, and obtain camera sensor size information; S3-3: Calculate the actual distance between two corner points. The calculation formula is: ; in, is the actual distance between the two corner points, The height of the sensor of the camera used to capture the image, is the number of pixels at the height of the first image set obtained by shooting, is the number of images in the first image set excluding the image taken at the initial point. is the distance between the camera fixed point and the camera initial point of the remaining images except the image taken at the initial point, ={1,…, }, is the height pixel value of the corner points of the entity objects in each image except the initial point, is the height pixel value of the corner point of the entity object in the initial point image, is the fixed focal length of the camera when taking the first set of images; S4: Calculate the Euclidean distance between two corner points in the three-dimensional model in the point cloud three-dimensional space. According to the actual distance between the two corner points in step S3, calculate the ratio between the actual distance and the Euclidean distance between the two corner points in the point cloud three-dimensional space. The specific steps are as follows: The calculation formula of the Euclidean distance between two corner points in the three-dimensional space of the point cloud is as follows: ; in, is the Euclidean distance between two corner points in the three-dimensional space of the point cloud, ( , , )and( , , ) are the coordinates of the two corner points in the three-dimensional space of the point cloud; The ratio of the actual distance to the Euclidean distance in the point cloud 3D space The calculation formula is as follows: ; in, is the actual distance between the two corner points calculated in step S3; S5: The ratio calculated according to step S4 And the coordinates of the ancient building model in the point cloud three-dimensional space calculate the size between any two points.
2. The distance measurement method of any two points in the three-dimensional model of ancient buildings as claimed in claim 1, characterized in that: The image acquisition in step S1 specifically includes the following steps: S1-1: Determine the camera shooting angle of the first image set, the shooting angle satisfies that the center of the physical object coincides with the center of the camera viewing angle, and once the angle is determined, it remains unchanged; S1-2: Take the current camera position as the initial point, lock the camera focal length to 4.49mm, and wait for the shooting route to be determined after taking an initial image; S1-3: Determine the shooting route of the first image, and take the distance between the initial point and the center of the physical object as X , On the shooting route, an image is taken every X distance in a clockwise or counterclockwise direction around the physical object. After taking n images, the acquisition of the first image is terminated. All images must contain the whole picture of the physical object, otherwise, steps S1-1 to S1-3 are repeated; S1-4: Use a drone to perform surround shooting with the physical object as the center at the angles of looking down, looking straight, and looking up to obtain a second image set. During the surround process, the angle between the lines between two adjacent camera positions and the center of the physical object is no more than 15 degrees. The number of images in the obtained second image set is no less than 72. Otherwise, repeat step S1-4.
3. The distance measurement method of any two points in the three-dimensional model of ancient buildings as claimed in claim 1, characterized in that: The steps for calculating the size between any two points in step S5 are as follows: S5-1: Determine the two corner points of the dimension to be measured in the 3D model and , and obtain it from the 3D model file and The point cloud coordinates ( , , )、( , , ); S5-2: The ratio of the coordinates of two points and the actual distance to the Euclidean distance in the point cloud 3D space Φ Calculate the actual size of two points L , the calculation formula is as follows: 。 4. The distance measurement method of any two points in the three-dimensional model of ancient buildings as claimed in claim 1, characterized in that: The reconstruction algorithm in step S2 is a 3D Gaussian splash algorithm or a neural radiation field.
5. A distance measurement system for any two points in a three-dimensional model of an ancient building, comprising a memory and a processor, and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 4.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
