A method, system and apparatus for measuring the dimensions of a building
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN YJY BUILDING TECH
- Filing Date
- 2025-12-22
- Publication Date
- 2026-08-07
AI Technical Summary
[0002]传统的建筑尺寸测量主要依赖钢卷尺、激光测距仪等测量工具,存在显著局限性:一是测量效率低,人工逐点测量模式难以适配大型建筑的测量需求;二是测量精度差,人工操作误差及环境因素干扰易导致数据偏差;三是安全风险高,高空区域测量需专业人员作业,存在坠落等安全隐患
本发明提供的一种建筑尺寸测量方法、系统及装置,通过电驱平台实现三维移动,可根据建筑尺寸,调整激光点定位位置,适配不同规格的建筑,突破现有技术仅能测量特定尺寸物体的局限;本方案通过前期校准和激光测距读数校正,结合像素与实际距离之间的转换系数,建筑尺寸测量误差可≤0.5%;本方案通过语义分割模型,自动分割建筑区域,无需人工干预,测量流程可实现全程自动化,效率较人工辅助测量提升5倍以上,满足建筑批量测量需求;本方案无需接触建筑表面,可在远距离完成测量,避免高空作业或近距离测量的安全风险,同时不会对建筑表面造成损伤。
Smart Images

Figure CN121810759B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of building dimension measurement technology, and in particular to a building dimension measurement method, system and device. Background Technology
[0002] Traditional building dimension measurement mainly relies on measuring tools such as steel tape measures and laser rangefinders, which have significant limitations: First, the measurement efficiency is low, and the manual point-by-point measurement mode is difficult to adapt to the measurement needs of large buildings; second, the measurement accuracy is poor, and human operation errors and environmental factors can easily lead to data deviations; third, the safety risks are high, and measurements in high-altitude areas require professional personnel to operate, which poses safety hazards such as falls.
[0003] With the continuous development of computer vision and laser ranging technologies, non-contact measurement is gradually becoming a trend in the field of building surveying. However, existing technologies still have many shortcomings and cannot meet the measurement needs of building dimensions, as follows: Patent application CN106767399B, entitled "A Non-Contact Measurement Method for the Volume of Logistics Goods Based on Binocular Stereo Vision and Point Laser Rangefinder," discloses a method that uses two parallel cameras to acquire images, combines this with a point laser rangefinder to obtain depth information, establishes a geometric projection relationship between the left and right images, and achieves feature point matching and 3D reconstruction. This solution primarily relies on a binocular vision system, requires fixed baseline distance and camera pose, and is only suitable for measuring regular goods on logistics conveyor belts; it cannot be adapted to the large size and diverse specifications of buildings.
[0004] A journal article titled "A Laser Ranging Self-Calibration Method and System for Image Measurement of Fatigue Cracks in Steel Bridge Deck" (Huang Bin et al., Journal of Chang'an University, 2025) proposed a self-calibration method based on a monocular camera and laser ranging. Specifically, it acquires the object's surface position information through three laser ranging modules, solves the object's surface equation and homography matrix, and realizes the size measurement of cracks in steel bridges. This method requires a fixed measurement pose and dedicated mounting equipment, and is only suitable for detecting small defects such as cracks. It does not cover the overall dimensions of large-scale buildings, and its adaptability and functional coverage do not meet the requirements of this application.
[0005] A journal article titled "Design of a Non-Contact Object Size and Shape Measurement System" (Ding Yanyan et al., Laser Journal, 2023) discloses a non-contact measurement system based on an embedded microprocessor, combined with a high-definition camera and a laser rangefinder. This system identifies the size and shape of regular objects (planar or spherical) through guided image filtering, angle measurement, and color recognition. However, the laser rangefinder module in this system is fixed and cannot adjust its position according to changes in building dimensions. Furthermore, it can only handle simple, regular shapes and cannot recognize complex building facades, thus exhibiting significant limitations in automation and measurement range.
[0006] In summary, existing non-contact measurement technologies generally suffer from poor adaptability, insufficient accuracy, low automation, and limited functionality, making it difficult to meet the needs of rapid, accurate, and fully automated measurement in construction. Summary of the Invention
[0007] The purpose of this invention is to provide a method, system, and apparatus for measuring building dimensions to solve at least one of the aforementioned technical problems existing in the prior art.
[0008] In a first aspect, to solve the above-mentioned technical problems, the present invention provides a method for measuring building dimensions, comprising the following steps: Step 1: Set up the size measurement device and perform preliminary calibration, which includes a laser rangefinder, a monocular camera, and an electric drive platform; the monocular camera is located at the center of the electric drive platform, and four laser rangefinders are located at the four corners of the electric drive platform; the laser emission direction is perpendicular to the electric drive platform and parallel to the optical axis of the monocular camera.
[0009] In one feasible implementation, the preliminary calibration specifically includes: The monocular camera was calibrated using Zhang Zhengyou's flat-panel calibration method, and its internal and external parameters were acquired and stored. Move the electric drive platform to the standard calibration area, calibrate the initial physical coordinates of the four laser rangefinders using a standard-size calibration plate (a building with known length and width), and record the installation offset of each laser rangefinder relative to the center of the platform. The electric drive platform is moved a preset distance along the X, Y and Z directions respectively. The laser rangefinder readings are compared with the actual distance the platform moves to establish a three-degree-of-freedom position correction model, including the current positioning coordinates of the platform and the angle between the laser emission direction and the world coordinate system, for subsequent coordinate correction. This lays a solid foundation for accurate image acquisition and laser rangefinder positioning in subsequent steps. At the same time, it keeps the laser rangefinder as parallel to the ground as possible, thereby reducing measurement errors in subsequent steps.
[0010] In one feasible implementation, the electric drive platform includes a servo motor and / or a stepper motor and / or a linear module to enable three-dimensional movement and precise positioning of the platform.
[0011] Step 2: Move the platform of the electric drive platform so that the laser points (spots) of each laser rangefinder are projected onto the corresponding corner points of the building facade to be measured. Collect the laser ranging data after the previous calibration as the physical coordinates of the laser points. At the same time, collect the building image through a monocular camera. The building image includes the laser points and the building facade.
[0012] In one feasible implementation, the physical coordinates of the laser point belong to the world coordinate system and can be denoted as ( ). ), ( ), ( )and( ).
[0013] Step 3: After preprocessing the building image, extract the pixel coordinates of the laser points to provide a high-precision (±1 pixel) image reference for subsequent calculations.
[0014] In one feasible implementation, step 3 specifically includes: Step 31: Obtain the candidate region mask for laser points through noise suppression, HSV color gamut conversion, mask extraction and mask morphology optimization.
[0015] In one feasible implementation, step 31 specifically includes: Step 311: Apply a Gaussian convolution kernel of a preset size (standard deviation of Gaussian function). (Set to 1.2) The original image of the building image is smoothed to obtain a smooth image. This can effectively suppress Gaussian noise and salt-and-pepper noise by using the normal distribution characteristics and weighted averaging of adjacent pixels. Step 312: Select the original image as the guide image and perform guided filtering on the smoothed image (filter radius is 5, regularization parameter is 5). (Set to 100) to obtain a Gaussian filtered image. This can eliminate high-frequency interference from building surface texture while preserving the grayscale difference between the laser point and the background, thus ensuring that the edges of the laser point are clear and not blurry. Step 313: Convert the Gaussian filtered image to the HSV color gamut, set the threshold range for the V channel, and filter out the high-brightness areas from the Gaussian filtered image; Step 314: Set the threshold range for the S channel to remove pure white background reflections from the Gaussian filtered image; Step 315: Perform a logical AND operation on the filtering results of the V channel and S channel to generate a binary mask that only contains the candidate region of the laser point, thereby eliminating more than 95% of non-target pixels and greatly reducing the amount of computation in subsequent processing. Step 316: Perform morphological closing operation (3*3 rectangular structuring element) on the binarized mask to fill the (tiny) holes inside the laser points (caused by noise); then perform morphological opening operation (3*3 rectangular structuring element) to remove noise attached to the mask edges, and obtain a laser point candidate region mask (with complete outline and clean interior).
[0016] Step 32: Based on the laser point candidate region mask, after extracting the candidate region, determine the laser point region image through edge detection and contour feature filtering to avoid interference from workshop light reflection, building surface markers, etc.
[0017] In one feasible implementation, step 32 specifically includes: Step 321: Extract the edge of the Gaussian-filtered image after the laser point candidate region masking to obtain the candidate region. Then, based on the preset double threshold, extract the continuous edge contour of the laser point through Gaussian gradient calculation, non-maximum suppression and hysteresis thresholding to ensure that the edge is free of breakage and redundant edge. Step 322: (using the findContours function of OpenCV tool) After extracting all contours of the candidate region, set the filtering conditions based on the geometric features of the laser point (circle or approximately circle) to filter out the laser point region image.
[0018] In one feasible implementation, the screening criteria include: Filtering condition 1: Based on the actual size of the laser point (the pixel area after imaging is usually between 50-200 pixels), set the area threshold range to eliminate excessively small noise contours and excessively large background interference areas. Filtering criterion 2: Based on roundness Calculation formula ,in, Represents the area of the outline. This indicates the perimeter of the outline and sets a roundness threshold range to eliminate irregular, non-circular outlines. Filtering condition 3: Calculate the ratio of the minimum bounding rectangle of the contour to the contour area, and filter out contours with a ratio ≤ preset threshold in order to further eliminate non-laser point interference.
[0019] Step 33: For the laser point area image, the center pixel coordinates are solved by fitting algorithm, and the final center pixel coordinates are obtained by multi-frame averaging optimization to improve the stability of the center pixel coordinates.
[0020] In one feasible implementation, step 33 specifically includes: Step 331: Using the least squares method, fit a circle to the edge contour of the laser point and solve for the coordinates of the circle center. The specific calculation formula includes: ; in, Indicates the coordinates of the center of the circle; Indicates the radius of the circle; Using all pixels on the edge contour as samples, an error function is constructed. By minimizing the error function through partial derivatives, the coordinates of the circle center and the radius of the circle can be obtained. Step 332: Since the building image can be multiple frames taken under the same conditions, and the above steps are performed separately to obtain multiple sets of center coordinates, the Grubbs criterion is used to remove abnormal center coordinates (i.e., center coordinates that deviate from the mean by more than 2 standard deviations) from the multiple sets of center coordinates from the multiple frames. The arithmetic mean of the remaining center coordinates is then taken to obtain the four (precise) laser point center pixel coordinates. ( ), ( ), ( )and ( ).
[0021] Step 4: Based on the physical coordinates of the laser point and the center pixel coordinates of the laser point, calculate the relative coordinates of the laser point on the object surface, solve the homography transformation matrix, perform perspective correction on the building image, obtain the orthophoto image, and obtain the conversion coefficient between the pixel and the actual distance. This eliminates the errors caused by the perspective distortion of the monocular camera and the non-ideal plane of the building surface, establishes a high-precision mapping relationship between the pixel and the actual distance, and provides a benchmark for subsequent measurements.
[0022] In one feasible implementation, step 4 specifically includes: Step 41: Based on the previous calibration data and laser ranging data, solve the physical coordinates of the laser point in the world coordinate system through spatial geometric calculations.
[0023] Specifically, firstly, based on the current positioning coordinates of the electric drive platform ( , , ) and the installation offset of each laser rangefinder relative to the center of the platform ( , Combining the platform's attitude information (such as pitch, roll, and yaw angles), the actual emission point coordinates of each laser rangefinder in the world coordinate system are calculated. Then, based on the angle between the laser emission direction and the world coordinate system, the spatial propagation direction of the laser beam is determined, and the real-time acquired laser ranging values are used. Projecting the distance along this direction, we finally obtain the first... The precise physical coordinates of a laser point in three-dimensional space , and .
[0024] Step 42: Define the local coordinate system of the object surface Among them, the laser point in the upper left corner ( The projection point of ) is taken as the origin. , The axis extends to the right along the horizontal direction of the building facade itself; The axis extends downwards along the vertical direction of the building facade itself; The axis is along the normal vector direction of the building facade (which can be obtained by fitting the physical coordinates of 4 laser points); Specifically, the physical coordinates of the four laser points are projected onto the local coordinate system of the object surface. In the plane, the relative coordinates of each laser point on the object surface are obtained, and the projection error caused by the slight tilt of the building surface is corrected. The relative coordinates of each laser point on the object surface are as follows: First projection point The origin The relative coordinates are ; Second projection point relative coordinates ; Third projection point relative coordinates ; Fourth projection point relative coordinates .
[0025] Step 43: (Based on conventional perspective transformation) Solve for the homography transformation matrix. This matrix is used to calculate the corresponding pixel in the image pixel coordinate system for any point in the local coordinate system of the object surface. This allows for rapid conversion between the two coordinate systems, providing a foundation for subsequent image measurement and target localization. Specific expressions include: ; in, and Indicates the relative coordinates of the laser point on the object surface; and Indicates the center pixel coordinates of the laser point; Denotes the homography transformation matrix; where, , , , , , , and All are matrix elements; In this way, by using the known point pairs between the relative coordinates of the laser point on the object surface and the pixel coordinates of the laser point center, a system of linear equations can be constructed, which can then be solved. (4 pairs of known points are used to construct 8 linear equations and solve for 8 unknown elements.)
[0026] Step 44: Based on the homography transformation matrix, perform perspective correction on the architectural image by setting the corrected image size and inverse perspective transformation (using the OpenCV vision library). Specific expressions include: ; in, express The inverse matrix is used to reverse the transformation from image to object plane into an orthophoto mapping from object plane to image, thereby eliminating perspective distortion; and They represent and Corrected coordinates.
[0027] Preferably, the corrected image size refers to first calculating the maximum relative coordinates in the local coordinate system of the object surface, specifically including: Horizontal maximum relative coordinates That is, the horizontal distribution range covering all laser points, specifically expressed as: ; Vertical maximum relative coordinates That is, the vertical distribution range covering all laser points, specifically expressed as: ; Then, based on the required measurement accuracy (e.g., 0.1 mm / pixel), the maximum relative coordinates are converted into the number of pixels, specifically including: Horizontal pixels The specific expression is: ,in, This indicates the rounding operation; Vertical pixel count The specific expression is: ; This allows the corrected image size to match the distribution of laser points in the local coordinate system of the object surface, ensuring complete coverage of the object surface area and reasonable pixel accuracy.
[0028] Preferably, the inverse perspective transformation can be implemented using the warpPerspective function, specifically including: using the preprocessed architectural image as the input image; and... As the transformation matrix; * As the output size; use the bicubic interpolation algorithm as the interpolation algorithm; call the warpPerspective function to obtain the orthographic projection image (without perspective distortion).
[0029] Step 45: Calculate the conversion coefficient between pixels and actual distance. The specific expression includes: .
[0030] Preferably, step 45 specifically includes: Step 451: Calculate the average actual distance of the laser point in the horizontal direction. and average pixel distance The specific expressions include: ; ; Calculate the average actual distance of the laser point in the vertical direction and average pixel distance The specific expressions include: ; ; Step 452: Calculate the conversion coefficient between pixels and actual distance. The unit is mm / pixel, and the specific expressions include: ; Thus, given the pixel distances in each direction, it can be directly multiplied by... This method allows for the quick calculation of the actual distance, and vice versa.
[0031] Step 5: Input the orthophoto image into the pre-trained semantic segmentation model to obtain the building facade segmentation mask.
[0032] In one feasible implementation, the specific training method of the semantic segmentation model includes: preprocessing building images of different sizes and angles, labeling the building facade areas, and generating pixel-level mask labels as a training dataset; training the semantic segmentation model with building images as input and mask labels as output; and optimizing the model parameters through backpropagation to enable it to accurately segment building facade areas.
[0033] Step 6: Divide the building facade into a mask, extract the straight line segments of the facade edges, and calculate the actual dimensions of the building facade based on the conversion factor.
[0034] In one feasible implementation, the conversion in step 6 refers to multiplying the pixel distance of the measured straight line segment by a conversion coefficient.
[0035] In one feasible implementation, the method for extracting the straight line segments of the facade edge in step 6 is the least squares method; of course, in other implementations, the RANSAC algorithm can be used to replace the least squares method to make it suitable for edge detection in complex environments.
[0036] Secondly, based on the same inventive concept, this application also provides a building dimension measurement system, including a data receiving module, a data processing module and a result generation module; The data receiving module is used to receive laser ranging data, which serves as the physical coordinates of the laser point, and building images. The data processing module includes a preprocessing unit, a perspective correction unit, a semantic segmentation unit, and a size measurement unit. The preprocessing unit is used to preprocess the building image and extract the pixel coordinates of the laser points; The perspective correction unit calculates the relative coordinates of the laser point on the object surface based on the physical coordinates of the laser point and the center pixel coordinates of the laser point, solves the homography transformation matrix, performs perspective correction on the building image, obtains the orthographic projection image, and obtains the conversion coefficient between the pixel and the actual distance. The semantic segmentation unit is used to input the orthophoto image into the pre-trained semantic segmentation model to obtain the building facade segmentation mask; The dimension measurement unit segments the building facade using a mask, extracts straight line segments from the facade edges, and calculates the actual dimensions of the building facade based on a conversion coefficient. The result generation module is used to send the results of the size measurement unit to an external source.
[0037] Thirdly, based on the same inventive concept, this application also provides a building dimension measuring device, including a processor, a memory, and a bus. The memory stores instructions and data that can be read by the processor. The processor is used to call the instructions and data in the memory to execute the building dimension measuring method described above. The bus connects the various functional components for transmitting information.
[0038] In one feasible implementation, the size measuring device further includes a laser rangefinder, a monocular camera, and an electric drive platform.
[0039] By adopting the above technical solution, the present invention has the following beneficial effects: This invention provides a method, system, and device for measuring building dimensions. It achieves three-dimensional movement via an electrically driven platform, allowing adjustment of the laser point positioning position according to building dimensions, adapting to buildings of different specifications and overcoming the limitation of existing technologies that can only measure objects of specific sizes. Through pre-calibration and laser ranging reading correction, combined with the conversion coefficient between pixels and actual distance, the building dimension measurement error can be ≤0.5%. This solution automatically segments the building area using a semantic segmentation model, requiring no manual intervention. The measurement process is fully automated, increasing efficiency by more than 5 times compared to manual measurement, meeting the needs of batch building measurements. This solution does not require contact with the building surface, allowing measurements to be completed from a distance, avoiding the safety risks of high-altitude operations or close-range measurements, and preventing damage to the building surface. Attached Figure Description
[0040] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0041] Figure 1 A flowchart of a building dimension measurement method provided in an embodiment of the present invention; Figure 2 Examples of the main stages in step 3 are shown below; (a) is a Gaussian filtered image; (b) is an HSV color gamut converted image; (c) is a binarized mask image; and (d) is a laser dot region image. Figure 3 This is a schematic diagram illustrating the calculation process of the relative coordinates of the laser point on the object surface in step 4. Figure 4 This is a schematic diagram of projection points provided in an embodiment of the present invention; Figure 5 This is a semantic segmentation diagram provided for an embodiment of the present invention. Detailed Implementation
[0042] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0043] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0044] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0045] The present invention will be further explained below with reference to specific embodiments.
[0046] It should also be noted that the specific embodiments or implementation methods described below are a series of optimized settings listed by the present invention to further explain the specific content of the invention, and these settings can be combined or used in conjunction with each other.
[0047] Example 1: like Figure 1-5 As shown in the figure, this embodiment provides a method for measuring building dimensions, which includes the following steps: Step 1: Set up the size measurement device and perform preliminary calibration, which includes a laser rangefinder, a monocular camera, and an electric drive platform; the monocular camera is located at the center of the electric drive platform, and four laser rangefinders are located at the four corners of the electric drive platform; the laser emission direction is perpendicular to the electric drive platform and parallel to the optical axis of the monocular camera.
[0048] Furthermore, the preliminary calibration specifically includes: The monocular camera was calibrated using Zhang Zhengyou's flat plate calibration method, and its internal and external parameters (such as focal length, pixel size, and distortion coefficient) were acquired and stored. Move the electric drive platform to the standard calibration area, calibrate the initial physical coordinates of the four laser rangefinders using a standard-size calibration plate (a building with known length and width), and record the installation offset of each laser rangefinder relative to the center of the platform. The platform of the electric drive platform is moved a preset distance along the X, Y and Z directions respectively. The laser rangefinder readings are compared with the actual distances moved by the platform to establish a three-degree-of-freedom position correction model, including the current positioning coordinates of the platform and the angle between the laser emission direction and the world coordinate system, which is used for subsequent coordinate correction.
[0049] Furthermore, the electric drive platform includes a servo motor and / or a stepper motor and / or a linear module to enable three-dimensional movement and precise positioning of the platform; the electric drive platform also includes a spacing adjustment mechanism (such as a lead screw, a slide rail, etc.) to automatically adjust the horizontal and vertical spacing between the four laser rangefinders according to the dimensions of the building to be measured.
[0050] Step 2: Move the platform of the electric drive platform so that the laser points (spots) of each laser rangefinder are projected onto the corresponding corner points of the building facade to be measured. Collect the laser ranging data after the previous calibration as the physical coordinates of the laser points. At the same time, collect the building image through a monocular camera. The building image includes the laser points and the building facade.
[0051] Furthermore, the physical coordinates of the laser point belong to the world coordinate system and can be denoted as ( ). ), ( ), ( )and( ).
[0052] Step 3: After preprocessing the building image, extract the pixel coordinates of the laser points to provide a high-precision (±1 pixel) image reference for subsequent calculations.
[0053] Furthermore, step 3 specifically includes: Step 31: Obtain the candidate region mask for laser points through noise suppression, HSV color gamut conversion, mask extraction and mask morphology optimization.
[0054] Furthermore, step 31 specifically includes: Step 311: Apply a Gaussian convolution kernel of a preset size (e.g., 5x5) with the standard deviation of the Gaussian function. (Set to 1.2) The original image of the building image is smoothed to obtain a smooth image. This can effectively suppress Gaussian noise and salt-and-pepper noise by using the normal distribution characteristics and weighted averaging of adjacent pixels. Step 312: Select the original image as the guide image and perform guided filtering on the smoothed image (filter radius is 5, regularization parameter is 5). (Setting the value to 100) yields a Gaussian filtered image, such as Figure 2 As shown in Figure (a), this can eliminate high-frequency interference from building surface texture while preserving the grayscale difference between the laser point and the background, thereby ensuring that the edges of the laser point are clear and not blurry. Step 313: Convert the Gaussian-filtered image to the HSV color gamut to enhance the distinction between the laser points and the background, such as... Figure 2 As shown in Figure (b); set the V channel threshold range, for example... High-brightness areas are selected from the Gaussian-filtered image; In particular, the threshold range of the V channel can be dynamically corrected according to the mean brightness of the Gaussian filtered image ±10, so as to avoid missed detection in strong light or weak light environments. Step 314: Set the threshold range for the S channel, for example... Remove pure white background reflections (such as strong reflections on steel structure surfaces) from the Gaussian filtered image. Step 315: Perform a logical AND operation on the filtering results of the V and S channels to generate a binary mask containing only the candidate regions of laser points, thereby eliminating more than 95% of non-target pixels and significantly reducing the computational load of subsequent processing. Figure 2 As shown in Figure (c); Step 316: Perform morphological closing operation (3*3 rectangular structuring element) on the binarized mask to fill the (tiny) holes inside the laser points (caused by noise); then perform morphological opening operation (3*3 rectangular structuring element) to remove noise attached to the mask edges, and obtain a laser point candidate region mask (with complete outline and clean interior).
[0055] Step 32: Based on the laser point candidate region mask, after extracting the candidate regions, the laser point region image is determined through edge detection and contour feature filtering to avoid interference from workshop light reflections, building surface markers, etc. Figure 2 As shown in Figure (d) of the document.
[0056] Furthermore, step 32 specifically includes: Step 321: Extract the edge of the Gaussian-filtered image after the laser point candidate region masking to obtain the candidate region. Then, based on the preset dual thresholds (e.g., the low threshold is 50 and the high threshold is 150), extract the continuous edge contour of the laser point through Gaussian gradient calculation, non-maximum suppression and hysteresis thresholding to ensure that the edge is free of breakage and redundant edge. Step 322: (using the findContours function of OpenCV tool) After extracting all contours of the candidate region, set the filtering conditions based on the geometric features of the laser point (circle or approximately circle) to filter out the laser point region image.
[0057] Furthermore, the screening criteria include: Filtering criterion 1: Based on the actual size of the laser spot (the pixel area after imaging is usually between 50-200 pixels), set the area threshold range, for example... This is to eliminate excessively small noise contours and excessively large background interference areas; Filtering criterion 2: Based on roundness Calculation formula ,in, Represents the area of the outline. This represents the perimeter of the outline, and sets a roundness threshold range, for example... To eliminate irregular non-circular outlines (such as rectangular markers, striped reflections, etc.); Filtering condition 3: Calculate the ratio of the minimum bounding rectangle of the contour to the area of the contour, and filter out contours with a ratio ≤ preset threshold (e.g., 1.5) to further eliminate non-laser point interference.
[0058] Step 33: For the laser point area image, the center pixel coordinates are solved by fitting algorithm, and the final center pixel coordinates are obtained by multi-frame averaging optimization to improve the stability of the center pixel coordinates.
[0059] Furthermore, step 33 specifically includes: Step 331: Using the least squares method, fit a circle to the edge contour of the laser point and solve for the coordinates of the circle center. The specific calculation formula includes: ; in, Indicates the coordinates of the center of the circle; Indicates the radius of the circle; Using all pixels on the edge contour as samples, a conventional error function is constructed. By minimizing the error function through partial derivatives, the coordinates of the circle center and the radius of the circle are obtained. Step 332: Since the building image can be multiple frames (e.g., 5 frames) taken under the same conditions, and the above steps are performed separately to obtain multiple sets of center coordinates (e.g., 5 sets), the abnormal center coordinates (i.e., center coordinates deviating from the mean by more than 2 standard deviations) from the multiple sets of center coordinates from the multiple frames are removed using the Grubbs criterion. The arithmetic mean of the remaining center coordinates is then taken to obtain the four (precise) laser point center pixel coordinates. ( ), ( ), ( )and ( ).
[0060] Step 4: Based on the physical coordinates of the laser point and the center pixel coordinates of the laser point, calculate the relative coordinates of the laser point on the object surface, solve the homography transformation matrix, perform perspective correction on the building image, obtain the orthophoto image, and obtain the conversion coefficient between the pixel and the actual distance. This eliminates the errors caused by the perspective distortion of the monocular camera and the non-ideal plane of the building surface, establishes a high-precision mapping relationship between the pixel and the actual distance, and provides a benchmark for subsequent measurements.
[0061] Furthermore, step 4 specifically includes: Step 41: Based on the previous calibration data and laser ranging data, solve the physical coordinates of the laser point in the world coordinate system through spatial geometric calculations; Specifically, firstly, based on the current positioning coordinates of the electric drive platform ( , , ) and the installation offset of each laser rangefinder relative to the center of the platform ( , Combining the platform's attitude information (such as pitch, roll, and yaw angles), the actual emission point coordinates of each laser rangefinder in the world coordinate system are calculated. Then, based on the angle between the laser emission direction and the world coordinate system, the spatial propagation direction of the laser beam is determined, and the real-time acquired laser ranging values are used. Projecting the distance along this direction, we finally obtain the first... The precise physical coordinates of a laser point in three-dimensional space , and .
[0062] Step 42: Define the local coordinate system of the object surface. Among them, the laser point in the upper left corner ( The projection point of ) is taken as the origin. , The axis extends to the right along the horizontal direction of the building facade itself; The axis extends downwards along the vertical direction of the building facade itself; The axis is along the normal vector direction of the building facade (which can be obtained by fitting the physical coordinates of 4 laser points); Specifically, such as Figure 3-4 As shown, the physical coordinates of the four laser points are projected onto the local coordinate system of the object surface. In the plane, the relative coordinates of each laser point on the object surface are obtained, and the projection error caused by the slight tilt of the building surface is corrected. The relative coordinates of each laser point on the object surface are as follows: First projection point The origin The relative coordinates are ; Second projection point relative coordinates ; Third projection point relative coordinates ; Fourth projection point relative coordinates .
[0063] Step 43: (Based on conventional perspective transformation) Solve for the homography transformation matrix. This matrix is used to calculate the corresponding pixel in the image pixel coordinate system for any point in the local coordinate system of the object surface. This allows for rapid conversion between the two coordinate systems, providing a foundation for subsequent image measurement and target localization. Specific expressions include: ; in, and Indicates the relative coordinates of the laser point on the object surface; and Indicates the center pixel coordinates of the laser point; Represents the homography transformation matrix; in, , , , , , , and All are matrix elements; specifically, during rotation operations, through... , , and The submatrix is constructed, and its rotation components are extracted; during translation operations, the rotation components are extracted using... and Extract the translation component; during scaling operations, through... , , and The determinant of the resulting submatrix is used to calculate the scaling ratio; during the shearing operation, the scaling ratio is calculated using... and Calculate the shear component; during the projection distortion operation, through and Extract the projection distortion component; In this way, by using the known point pairs between the relative coordinates of the laser point on the object surface and the pixel coordinates of the laser point center, a system of linear equations can be constructed, which can then be solved. (4 pairs of known points are used to construct 8 linear equations and solve for 8 unknown elements.)
[0064] Step 44: Based on the homography transformation matrix, perform perspective correction on the architectural image by setting the corrected image size and inverse perspective transformation (using the OpenCV vision library). Specific expressions include: ; in, express The inverse matrix is used to reverse the transformation from image to object plane into an orthophoto mapping from object plane to image, thereby eliminating perspective distortion; and They represent and Corrected coordinates; The corrected image size refers to first calculating the maximum relative coordinates in the local coordinate system of the object surface, specifically including: Horizontal maximum relative coordinates That is, the horizontal distribution range covering all laser points, specifically expressed as: ; Vertical maximum relative coordinates That is, the vertical distribution range covering all laser points, specifically expressed as: ; Then, based on the required measurement accuracy (e.g., 0.1 mm / pixel), the maximum relative coordinates are converted into the number of pixels, specifically including: Horizontal pixels The specific expression is: ,in, This indicates the rounding operation; Vertical pixel count The specific expression is: ; In this way, the size of the corrected image can be matched with the distribution of laser points in the local coordinate system of the object surface, ensuring complete coverage of the object surface area and reasonable pixel accuracy; In particular, if * For images smaller than 500*500 pixels, the precision requirement can be reduced (e.g., adjust from 0.1mm / pixel to 0.2mm / pixel) and then recalculated to ensure that the effective information of the image is complete and no details are lost. The inverse perspective transformation can be implemented using the `warpPerspective` function, specifically including: using the preprocessed architectural image (i.e., the Gaussian filtered image obtained in step 312) as the input image; and... As the transformation matrix; * As the output size; use the bicubic interpolation algorithm as the interpolation algorithm; call the warpPerspective function to obtain the orthographic projection image (without perspective distortion); Step 45: Calculate the conversion coefficient between pixels and actual distance. The specific expression includes: .
[0065] Preferably, step 45 specifically includes: Step 451: Calculate the average actual distance of the laser point in the horizontal direction. and average pixel distance The specific expressions include: ; ; Calculate the average actual distance of the laser point in the vertical direction and average pixel distance The specific expressions include: ; ; Step 452: Calculate the conversion coefficient between pixels and actual distance. The unit is mm / pixel, and the specific expressions include: ; Thus, given the pixel distances in each direction, it can be directly multiplied by... This method allows for the quick calculation of the actual distance, and vice versa.
[0066] Step 5, as follows Figure 5 As shown, the orthophoto image (obtained in step 4) is input into the pre-trained semantic segmentation model to obtain the building facade segmentation mask.
[0067] Furthermore, the specific training method of the semantic segmentation model includes: preprocessing building images of different sizes and angles, labeling the building facade areas, and generating pixel-level mask labels as training datasets; training the semantic segmentation model (such as the deeplabv3 deep learning model, U-Net semantic segmentation model, and SegNet semantic segmentation model, etc.), with the building images as input and the mask labels as output; and optimizing the model parameters through backpropagation to enable it to accurately segment the building facade areas.
[0068] Step 6: Divide the building facade into a mask, extract the straight line segments of the facade edges, and calculate the actual dimensions of the building facade based on the conversion factor.
[0069] Furthermore, the conversion in step 6 refers to multiplying the pixel distance of the measured straight line segment by a conversion coefficient.
[0070] Furthermore, the method for extracting the straight line segments of the facade edge in step 6 is the least squares method; of course, in other embodiments, the RANSAC algorithm can be used instead of the least squares method to make it suitable for edge detection in complex environments.
[0071] Example 2: This embodiment provides a building dimension measurement system, including a data receiving module, a data processing module, and a result generation module; The data receiving module is used to receive laser ranging data, which serves as the physical coordinates of the laser point, and building images. The data processing module includes a preprocessing unit, a perspective correction unit, a semantic segmentation unit, and a size measurement unit. The preprocessing unit is used to preprocess the building image and extract the pixel coordinates of the laser points; The perspective correction unit calculates the relative coordinates of the laser point on the object surface based on the physical coordinates of the laser point and the center pixel coordinates of the laser point, solves the homography transformation matrix, performs perspective correction on the building image, obtains the orthographic projection image, and obtains the conversion coefficient between the pixel and the actual distance. The semantic segmentation unit is used to input the orthophoto image into the pre-trained semantic segmentation model to obtain the building facade segmentation mask; The dimension measurement unit segments the building facade using a mask, extracts straight line segments from the facade edges, and calculates the actual dimensions of the building facade based on a conversion coefficient. The result generation module is used to send the results of the size measurement unit to an external source.
[0072] Example 3: This embodiment provides a building dimension measuring device, including a processor, a memory, and a bus. The memory stores instructions and data that can be read by the processor. The processor is used to call the instructions and data in the memory to execute the building dimension measuring method described above. The bus connects the various functional components for transmitting information.
[0073] Furthermore, the size measuring device also includes a laser rangefinder, a monocular camera, and an electric drive platform.
[0074] In another embodiment, this solution can also be implemented using an integrated device, which may include corresponding modules that perform one or more steps in the various embodiments described above. A module may be one or more hardware modules specifically configured to perform the corresponding step, or implemented by a processor configured to perform the corresponding step, or stored in a computer-readable medium for implementation by a processor, or implemented through some combination thereof.
[0075] The processor executes the various methods and processes described above. For example, the method implementations in this scheme can be implemented as software programs tangibly contained in a machine-readable medium, such as memory. In some implementations, part or all of the software program can be loaded and / or installed via memory and / or a communication interface. When the software program is loaded into memory and executed by the processor, one or more steps of the methods described above can be performed. Alternatively, in other implementations, the processor can be configured to execute one of the methods described above by any other suitable means (e.g., by means of firmware).
[0076] This device can be implemented using a bus architecture. A bus architecture can include any number of interconnect buses and bridges, depending on the specific application of the hardware and overall design constraints. The bus connects various circuits, including one or more processors, memory, and / or hardware modules. The bus can also connect various other circuits such as peripherals, voltage regulators, power management circuitry, external antennas, etc.
[0077] Buses can be Industry Standard Architecture (ISA) buses, Peripheral Component Interconnect (PCI) buses, or Extended Industry Standard Component (EISA) buses, etc. Buses can be divided into address buses, data buses, control buses, etc.
[0078] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for measuring building dimensions, characterized in that, include: Step 1: Set up the size measurement device and perform preliminary calibration, which includes a laser rangefinder, a monocular camera, and an electric drive platform; the monocular camera is located at the center of the electric drive platform, and four laser rangefinders are located at the four corners of the electric drive platform; the laser emission direction is perpendicular to the electric drive platform and parallel to the optical axis of the monocular camera. The preliminary calibration specifically includes: The monocular camera was calibrated using Zhang Zhengyou's flat-panel calibration method, and its internal and external parameters were acquired and stored. Move the electric drive platform to the standard calibration area, calibrate the initial physical coordinates of the four laser rangefinders using a standard-size calibration plate, and record the installation offset of each laser rangefinder relative to the center of the platform. The platform of the electric drive platform is moved a preset distance along the X, Y, and Z directions, respectively. The laser rangefinder readings are compared with the actual distances moved by the platform to establish a three-degree-of-freedom position correction model, including the current positioning coordinates of the platform and the angle between the laser emission direction and the world coordinate system. Step 2: Move the platform of the electric drive platform so that the laser points of each laser rangefinder are projected onto the corresponding corner points of the building facade to be measured. Collect the laser ranging data after the previous calibration as the physical coordinates of the laser points, and at the same time, collect the building image through a monocular camera. Step 3: After preprocessing the building image, extract the pixel coordinates of the laser points; Step 4: Based on the physical coordinates of the laser point and the center pixel coordinates of the laser point, calculate the relative coordinates of the laser point on the object surface, solve the homography transformation matrix, perform perspective correction on the building image, obtain the orthographic projection image, and obtain the conversion coefficient between the pixel and the actual distance. Step 5: Input the orthophoto image into the pre-trained semantic segmentation model to obtain the building facade segmentation mask; Step 6: Divide the building facade into a mask, extract the straight line segments of the facade edges, and calculate the actual dimensions of the building facade based on the conversion factor.
2. The measurement method according to claim 1, characterized in that, Step 3 specifically includes: Step 31: Obtain the candidate region mask for laser points through noise suppression, HSV color gamut conversion, mask extraction and mask morphology optimization; Step 32: Based on the candidate region mask for laser points, after extracting the candidate regions, determine the laser point region image through edge detection and contour feature filtering; Step 33: For the laser point area image, the center pixel coordinates are solved by fitting algorithm, and the final center pixel coordinates are obtained by multi-frame averaging optimization.
3. The measurement method according to claim 2, characterized in that, Step 31 specifically includes: Step 311: Smooth the original image of the building image by using a Gaussian convolution kernel of a preset size to obtain a smoothed image; Step 312: Select the original image as the guide image, perform guided filtering on the smoothed image, and obtain a Gaussian filtered image; Step 313: Convert the Gaussian filtered image to the HSV color gamut, set the threshold range for the V channel, and filter out the high-brightness areas from the Gaussian filtered image; Step 314: Set the threshold range for the S channel to remove pure white background reflections from the Gaussian filtered image; Step 315: Perform a logical AND operation on the filtering results of the V channel and S channel to generate a binary mask that only contains the candidate regions of laser points; Step 316: Perform morphological closing operation on the binarized mask to fill the holes inside the laser points; then perform morphological opening operation to remove noise attached to the edge of the mask, and obtain the candidate region mask for the laser points.
4. The measurement method according to claim 3, characterized in that, Step 32 specifically includes: Step 321: Extract the edge of the Gaussian filtered image after the laser point candidate region masking to obtain the candidate region. Then, based on the preset double threshold, extract the continuous edge contour of the laser point through Gaussian gradient calculation, non-maximum suppression and hysteresis thresholding. Step 322: After extracting all contours of the candidate region, set filtering conditions based on the geometric features of the laser points to filter out the laser point region images.
5. The measurement method according to claim 4, characterized in that, The filtering criteria include: Filtering condition 1: Set the area threshold range based on the actual size of the laser point; Filtering criterion 2: Based on roundness Calculation formula ,in, Represents the area of the outline. Indicates the perimeter of the outline, and sets the roundness threshold range; Filtering condition 3: Calculate the ratio of the minimum bounding rectangle of the contour to the area of the contour, and filter out contours that are ≤ the preset ratio threshold.
6. The measurement method according to claim 2, characterized in that, Step 33 specifically includes: Step 331: Using the least squares method, fit a circle to the edge contour of the laser point and solve for the coordinates of the circle center. The specific calculation formula includes: ; in, Indicates the coordinates of the center of the circle; Indicates the radius of the circle; Using all pixels on the edge contour as samples, an error function is constructed. By minimizing the error function through partial derivatives, the coordinates of the circle center and the radius of the circle can be obtained. Step 332: The building images are multiple frames taken under the same shooting conditions. The above steps are performed on each frame to obtain multiple sets of center coordinates. Using the Grubbs criterion, abnormal center coordinates from the multiple sets of center coordinates from the multiple frames are removed. The arithmetic mean of the remaining center coordinates is taken to obtain the center pixel coordinates of the four laser points. ( ), ( ), ( )and ( ).
7. The measurement method according to claim 1, characterized in that, Step 4 specifically includes: Step 41: Based on the previous calibration data and laser ranging data, solve for the physical coordinates of the laser point in the world coordinate system through spatial geometric calculations. , and ; Step 42: Define the local coordinate system of the object surface. The origin is defined by the projection of the laser point in the upper left corner. , The axis runs horizontally to the right along the building facade; The axis runs vertically downwards along the building facade; The axis is along the direction of the normal vector of the building facade; Project the physical coordinates of the four laser points onto the local coordinate system of the object surface. Within the plane, the relative coordinates of the laser point on the object surface are obtained and corrected. The horizontal projection error caused by axis tilt is specifically expressed as follows: First projection point The origin The relative coordinates are ; Second projection point relative coordinates ; Third projection point relative coordinates ; Fourth projection point relative coordinates ; Step 43: Solve for the homography transformation matrix. The specific expression includes: ; in, and Indicates the relative coordinates of the laser point on the object surface; and Indicates the center pixel coordinates of the laser point; Represents the homography transformation matrix; , , , , , , and All are matrix elements; Step 44: Based on the homography transformation matrix, perform perspective correction on the architectural image by setting the corrected image size and inverse perspective transformation. The specific expressions include: ; in, express The inverse matrix; and They represent and Corrected coordinates; The corrected image size refers to first calculating the maximum relative coordinates in the local coordinate system of the object surface, specifically including: Horizontal maximum relative coordinates The specific expression is: ; Vertical maximum relative coordinates The specific expression is: ; Then, based on the required measurement accuracy, the maximum relative coordinates are converted into the number of pixels, specifically including: Horizontal pixels The specific expression is: ,in, This indicates the rounding operation; Vertical pixel count The specific expression is: ; Step 45: Calculate the conversion coefficient between pixels and actual distance. The specific expression includes: 。 8. A building dimension measurement system employing the measurement method described in any one of claims 1-7, characterized in that, It includes a data receiving module, a data processing module, and a result generation module; The data receiving module is used to receive laser ranging data, which serves as the physical coordinates of the laser point, and building images. The data processing module includes a preprocessing unit, a perspective correction unit, a semantic segmentation unit, and a size measurement unit. The preprocessing unit is used to preprocess the building image and extract the pixel coordinates of the laser points; The perspective correction unit calculates the relative coordinates of the laser point on the object surface based on the physical coordinates of the laser point and the center pixel coordinates of the laser point, solves the homography transformation matrix, performs perspective correction on the building image, obtains the orthographic projection image, and obtains the conversion coefficient between the pixel and the actual distance. The semantic segmentation unit is used to input the orthophoto image into the pre-trained semantic segmentation model to obtain the building facade segmentation mask; The dimension measurement unit segments the building facade using a mask, extracts straight line segments from the facade edges, and calculates the actual dimensions of the building facade based on a conversion coefficient. The result generation module is used to send the results of the size measurement unit to an external source.
9. A building dimension measuring device, characterized in that, It includes a processor, a memory, and a bus. The memory stores instructions and data read by the processor. The processor is used to call the instructions and data in the memory to execute the measurement method as described in any one of claims 1-7. The bus connects the functional components for transmitting information.
Citation Information
Patent Citations
Non-contact measurement method of logistics cargo volume based on binocular stereo vision and point laser ranging
CN106767399B
Three-dimensional building fine geometric reconstruction method integrating airborne and vehicle-mounted three-dimensional laser point clouds and streetscape images
CN111815776A
Safety anti-collision method and system for table top of laser cutting machine
CN120572169A