Wall masonry mortar joint thickness detection method

By combining two-dimensional color images and three-dimensional point cloud data, the problems of automation and accuracy in grout joint thickness detection in existing technologies have been solved, achieving efficient and stable grout joint thickness measurement.

CN122048781APending Publication Date: 2026-05-15ZHONG JIAO SAN GONG JU DI LIU GONG CHENG (HE BEI) YOU XIAN GONG SI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511882607.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-15
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

In the current technology for detecting the thickness of mortar joints in wall masonry, relying solely on two-dimensional images cannot obtain depth information, while directly processing three-dimensional point clouds makes it difficult to automatically and accurately identify and locate the geometric features of the mortar joints, thus making it impossible to achieve non-contact and automated thickness measurement.

Method used

By combining two-dimensional color images and three-dimensional point cloud data, and establishing coordinate mapping relationships, semantic segmentation of grout joints and analysis of point cloud normal features are performed to identify and fit the upper and lower edges of the grout joints and calculate the thickness value.

Benefits of technology

It achieves automated and accurate mortar joint thickness detection, improves the stability and accuracy of detection, reduces reliance on single features, adapts to different brick types and construction processes, and reduces systematic errors.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The invention provides a wall masonry mortar joint thickness detection method, and belongs to the technical field of building quality nondestructive testing. The method aims at solving the problem that the non-contact thickness detection precision and the automation degree are insufficient. The method comprises the following steps: firstly, synchronously acquiring a two-dimensional color image and three-dimensional point cloud data of a wall body, and establishing coordinate mapping; performing mortar joint semantic segmentation on the image to obtain an initial mask, and mapping the initial mask to a three-dimensional point cloud to focus a candidate area; recognizing and fitting a first space curve and a second space curve where the upper edge and the lower edge of the mortar joint are located based on the normal and spatial distribution characteristics of the point cloud of the region; finally, calculating points are selected on the first space curve, corresponding points are determined on the second space curve, and the three-dimensional Euclidean distance between each point pair is calculated and counted, so that the mortar joint thickness value is obtained. The method is mainly used for carrying out rapid and non-contact automatic measurement on the masonry mortar joint thickness in a building construction site or quality evaluation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of non-destructive testing technology for building quality, and specifically relates to a method for detecting the thickness of mortar joints in masonry walls. Background Technology

[0002] In the construction industry, wall masonry is one of the core processes, and its quality directly affects the structural safety and durability of buildings. The mortar joints, serving as the adhesive and filling layer between bricks, have a crucial thickness uniformity and compliance that is a key indicator of masonry quality. Currently, the industry generally relies on traditional contact measurement methods for inspecting mortar joint thickness and is actively exploring non-contact inspection technologies based on vision and 3D data. However, these existing technological approaches all face a series of unresolved technical challenges in practical applications, limiting the accuracy, efficiency, and automation level of the inspection.

[0003] Traditional contact-based inspection methods, such as manual measurement using straightedges, feeler gauges, or calipers, while intuitive, have significant limitations. These methods are essentially point-based sampling inspections, failing to fully reflect the true distribution of mortar joint thickness across the entire wall surface, resulting in insufficient representativeness. More importantly, the measurement process relies entirely on the experience and subjective judgment of the inspectors, easily leading to reading discrepancies between different operators. This results in poor data repeatability and comparability, making it difficult to meet the requirements of digital and quantitative quality management. Furthermore, for mortar joints in high, concealed, or structurally complex areas, traditional tools have poor physical accessibility, creating numerous blind spots and failing to achieve comprehensive coverage.

[0004] To overcome the shortcomings of traditional methods, non-contact detection technologies based on image recognition and 3D point clouds have become a research hotspot. However, these advanced technologies have encountered severe technical bottlenecks in their transition from the laboratory to engineering sites. The core challenge of methods based on 2D image recognition lies in the difficulty of reliably obtaining the 3D thickness of mortar joints from 2D information. While image processing techniques can effectively identify the pixel regions of mortar joints in planar images, monocular images lack depth information and cannot directly derive the true physical thickness. Although depth can be estimated through stereo vision or multi-view reconstruction, this process requires extremely high image matching accuracy, lighting consistency, and texture features. Under the complex lighting conditions, wall surface stains, and shadow interference at construction sites, the stability of image feature extraction and matching decreases significantly, and the accuracy of the reconstructed 3D model often fails to meet the requirements for millimeter-level thickness measurement. Therefore, relying solely on image data is insufficient to achieve stable and high-precision thickness detection.

[0005] On the other hand, high-precision point cloud data obtained directly from 3D laser scanning can theoretically provide rich 3D geometric information. However, how to automatically and accurately identify the specific geometric feature of "grout lines" from massive, disordered point clouds and extract their upper and lower edges to calculate thickness is another key challenge. In point cloud data, the surface of bricks and the surface of grout lines are spatially adjacent, and their boundary is not a clear "line" in 3D space, but a transitional region. Existing point cloud segmentation algorithms are not robust enough to deal with uneven brick surfaces, varying grout line depths, and noise and density in the point cloud itself. Algorithms often rely on preset thresholds or models, making it difficult to adapt to the huge morphological differences brought about by different brick types and different masonry techniques. In addition, the selection of mathematical models (such as straight lines or curves) for the grout line edge curves fitted from the point cloud lacks universal guidelines. Inappropriate models can lead to systematic fitting errors, directly affecting the accuracy of subsequent thickness calculation results.

[0006] Furthermore, after calculating the spatial positions of the upper and lower edges of the mortar joint, defining and calculating the geometric quantity of "thickness" is not straightforward. Thickness is not simply the Euclidean distance between two points; it should reflect the minimum dimension of the mortar material in the direction perpendicular to the masonry surface. Due to construction errors, the surfaces of the upper and lower bricks may not be perfectly parallel, and the mortar joint itself may be inclined. Therefore, how to correctly find the corresponding physical matching point on the lower edge of the complex geometric relationship for each point on the upper edge in three-dimensional space, and calculate the distance between them that truly reflects the local thickness of the mortar joint, is an unresolved geometric correspondence problem. Simple projection or nearest-point matching rules can produce calculation results with unclear physical meaning or even errors when the geometry is irregular.

[0007] In summary, existing technologies, whether traditional or emerging non-contact methods, all possess inherent technical limitations in achieving efficient, accurate, and automated detection of mortar joint thickness in masonry walls. These limitations stem from the gap between two-dimensional information and three-dimensional measurement, the difficulty in extracting massive amounts of disordered data and specific semantic features, and the challenges of accurately defining and calculating physical quantities within complex three-dimensional geometric relationships. Overcoming these difficulties requires a new method capable of deeply integrating multi-source data, intelligently analyzing geometric features, and rigorously defining measurement logic. Summary of the Invention

[0008] One object of the present invention is to solve at least the above-mentioned problems and / or defects, and to provide at least the advantages described below.

[0009] One objective of this invention is to address the problem in existing wall mortar joint thickness detection methods that rely solely on two-dimensional images to obtain depth information, while directly processing three-dimensional point clouds makes it difficult to automatically and accurately identify and locate the geometric features of the mortar joints, thus preventing non-contact and automated thickness measurement.

[0010] One objective of this invention is to solve the problem that in complex 3D point clouds, due to the roughness of the brick surface, the varied morphology of the mortar joints, and the noise interference of the point cloud, it is difficult to stably and accurately distinguish the point cloud on the brick surface from the point cloud on the mortar joint surface based on simple geometric features (such as a single normal threshold), and thus it is impossible to reliably extract the edge points of the mortar joints.

[0011] One objective of this invention is to address the problem that when fitting discrete grout joint edge points into a spatial curve, the lack of prior knowledge about the edge morphology means that using a single geometric model (such as a straight line) for fitting may introduce large errors, while manually selecting a model lacks efficiency and consistency.

[0012] One objective of this invention is to address the problem that after calculating the upper and lower spatial edge curves of the mortar joint, the complex spatial pose relationship between the curves due to construction errors means that simply projecting the curves in the global direction or finding the nearest point in space to determine the corresponding point lacks physical meaning and cannot accurately reflect the true local thickness.

[0013] One objective of this invention is to address the problem that when using the projection intersection method to determine corresponding points, the effectiveness is heavily dependent on the selection of the projection direction. However, if a fixed direction (such as the wall normal) is selected for projection, the projection lines may become misaligned, resulting in ineffective intersection or significant errors when the wall is uneven or the mortar joints are slanted.

[0014] One objective of this invention is to address the problem that initial point cloud classification results based on normal angles may contain a large number of noise points and misclassified points (such as uneven areas on a brick surface being misclassified as mortar joints, and smooth mortar joint points being misclassified as brick surfaces). These isolated misclassified points can seriously interfere with the accuracy of subsequent boundary point identification.

[0015] One objective of this invention is to address the problems in the process of multi-model optimal fitting, where, when faced with a set of boundary points containing noise and outliers, the scoring function may select an overly complex model due to overfitting noise, and calculating all candidate models leads to inefficiency, as well as the lack of fallback processing for invalid fitting results.

[0016] One objective of this invention is to address the problem that when constructing a local projection plane for each upper edge point, directly using the instantaneous tangent direction of that point is extremely sensitive to data noise, has large directional jitter, and completely depends on the global wall main plane direction, which may contain errors, resulting in an unstable and unreliable projection plane.

[0017] One objective of this invention is to address the problems that when searching for the optimal projection plane, using a single evaluation metric (such as Hausdorff distance) may fail to fully reflect the projection quality due to the limitations of the metric itself (such as sensitivity to outliers), and that the lack of specificity in the generation of candidate plane sets leads to low search efficiency.

[0018] One objective of this invention is to address the problem that in the final decision-making process of selecting the optimal projection plane based on multiple indicators, there may be conflicts between different indicators, and the key indicator of "straightness" is vaguely defined, leading to unclear final decision-making logic and the possibility of falling into suboptimal selection.

[0019] One object of the present invention is to provide a method for detecting the thickness of mortar joints in wall masonry, comprising the following steps: Data acquisition steps: Simultaneously acquire two-dimensional color images and three-dimensional point cloud data of the target wall area, and establish the coordinate mapping relationship between the two; Initial localization step of the grout seam region: Perform grout seam semantic segmentation on the two-dimensional color image to obtain the initial mask of the grout seam pixel region; Three-dimensional target region focusing step: According to the coordinate mapping relationship, the initial mask is mapped to the three-dimensional point cloud data to obtain a candidate three-dimensional region containing the mortar joint and the surface of its adjacent bricks; Edge precision extraction step: Based on the normal features and spatial distribution features of the point cloud in the candidate three-dimensional region, the first spatial curve where the upper edge of the mortar joint is located and the second spatial curve where the lower edge is located are identified and fitted respectively. The first spatial curve and the second spatial curve are respectively generated by fitting the three-dimensional point cloud at the junction of the brick and the mortar joint in the candidate three-dimensional region. Thickness calculation steps: Select multiple first calculation points on the first spatial curve, and determine a corresponding second calculation point on the second spatial curve that is closest in normal distance or intersecting in projection for each first calculation point. Calculate the three-dimensional Euclidean distance between each pair of calculation points, and use the statistical value of these distances as the thickness value of the mortar joint.

[0020] Preferably, in the method for detecting the thickness of mortar joints in wall construction, the precise edge extraction step includes: Point cloud normal estimation and initial classification sub-step: Calculate the normal vector of each 3D point in the candidate 3D region, and divide the point cloud in the candidate 3D region into a first category point cloud and a second category point cloud according to the clustering results of the normal vector direction. The angle between the normal vector direction of the first category point cloud and the normal vector direction of the main plane of the wall is less than a first threshold, and the angle between the normal vector direction of the second category point cloud and the normal vector direction of the main plane of the wall is greater than or equal to the first threshold. Brick surface subdivision and extraction sub-steps: In the first category of point cloud, based on the distribution of the spatial coordinates of the three-dimensional points in the vertical direction, separate the upper brick candidate point cloud located at the top and the lower brick candidate point cloud located at the bottom. Boundary point identification sub-step: For the upper brick candidate point cloud, the boundary points are identified as those three-dimensional points that simultaneously contain three-dimensional points belonging to both the upper brick candidate point cloud and the second category point cloud within a preset spatial neighborhood radius; For the lower brick candidate point cloud, the boundary points are identified as those three-dimensional points that simultaneously contain both three-dimensional points belonging to both the lower brick candidate point cloud and the second category point cloud within the preset spatial neighborhood radius. The spatial curve fitting sub-step is as follows: all boundary points identified as belonging to the candidate point cloud of the upper brick are fitted into the first spatial curve; all boundary points identified as belonging to the candidate point cloud of the lower brick are fitted into the second spatial curve.

[0021] Preferably, in the method for detecting the thickness of mortar joints in wall construction, the spatial curve fitting sub-step specifically includes: Model selection and fitting sub-steps: For the set of boundary points to be fitted, perform the following operations: The boundary point set is fitted with a variety of pre-defined candidate geometric models, and the goodness-of-fit index and model complexity cost for each model are calculated. Based on the goodness-of-fit index and the model complexity cost, the optimal model is selected from the multiple candidate geometric models, wherein the optimal model is the model that makes a comprehensive scoring function optimal, and the comprehensive scoring function is a weighted combination of the goodness-of-fit index and the model complexity cost. The optimal model is used to perform a final fitting on the set of boundary points to obtain either the first spatial curve or the second spatial curve.

[0022] Preferably, in the method for detecting the thickness of mortar joints in wall masonry, the thickness calculation step specifically includes: Local Corresponding Point Determination Sub-step: For any first calculation point on the first space curve, perform the following operations: Determine the direction of the first tangent line of the first space curve at the first calculation point; A first calculation plane is constructed, which is jointly determined by the first tangent direction and the direction perpendicular to the main plane of the wall; The second spatial curve is projected vertically onto the first calculation plane to obtain a second projection curve. On the first calculation plane, find the nearest point from the projection point of the first calculation point to the second projection curve. The preimage point of this nearest point on the second spatial curve is the second calculation point corresponding to the first calculation point. Thickness calculation and statistics sub-step: Calculate the three-dimensional Euclidean distance between all the first calculation points and their respective second calculation points, and use the statistical value of all the distance values ​​as the thickness value of the mortar joint.

[0023] Preferably, in the method for detecting the thickness of mortar joints in wall masonry, when the thickness calculation step uses the projection intersection method to determine the corresponding point, the following sub-steps are performed: Candidate projection plane set construction sub-step: Construct a set of candidate projection planes, wherein the normal vector of each candidate projection plane is determined based on statistical analysis of the overall orientation of the first space curve and the second space curve within a preset analysis segment; Optimal projection plane selection sub-step: For each candidate projection plane, project the first space curve and the second space curve perpendicularly onto the plane to obtain two two-dimensional projection lines; calculate the average Hausdorff distance between the two-dimensional projection lines; select the candidate projection plane with the smallest average Hausdorff distance as the optimal projection plane; Corresponding point analysis sub-step: On the optimal projection plane, for the first projection point on the first spatial curve projection line, find its nearest point on the second spatial curve projection line. The preimage point of this nearest point on the second spatial curve is the second calculation point corresponding to the first projection point.

[0024] Preferably, in the method for detecting the thickness of mortar joints in wall masonry, after the point cloud normal estimation and initial classification sub-step, a classification result verification and correction sub-step is further included, which includes: For each 3D point in the first category of point cloud, check the proportion of points in its spatial neighborhood that belong to the first category of point cloud; If the proportion is lower than a preset neighborhood consistency threshold, the 3D point is removed from the first category point cloud and reclassified into the second category point cloud. For each 3D point in the second category point cloud, check the proportion of points in its spatial neighborhood that belong to the second category point cloud; If the proportion is lower than the neighborhood consistency threshold, the 3D point is removed from the second category point cloud and reclassified into the first category point cloud.

[0025] Preferably, in the method for detecting the thickness of mortar joints in wall masonry, the model selection and fitting sub-step further includes the following steps: Pre-screening and simplification steps: Before fitting the boundary point set, the boundary point set is first thinned and simplified, and the simplified point set is used to perform subsequent candidate model fitting and scoring. Adaptive threshold step: The weight coefficients in the comprehensive scoring function are dynamically adjusted according to the dispersion or noise level of the boundary point set. When the dispersion or noise level is higher than a preset standard, the weight of the model complexity cost in the scoring function is increased. Model validity verification steps: For the selected optimal model, check whether the distribution of its fitting residuals conforms to the preset random error distribution characteristics; if it does not conform, the model is determined to be invalid, and the preset default geometric model is used to fit the set of boundary points.

[0026] Preferably, in the method for detecting the thickness of mortar joints in wall construction, the sub-step for determining local corresponding points in the thickness calculation step is performed in the following manner: On the first spatial curve, a continuous curve segment containing the current first calculation point to be processed is extracted as a local curve segment, with the first calculation point to be processed as the center. Principal component analysis is performed on all three-dimensional points constituting the local curve segment, and the direction of the first principal component is determined as the main extension direction of the local curve segment. Calculate the average spatial position of all three-dimensional points on the local curve segment, and determine the direction vector from the origin to the average point as the average position direction of the local curve segment; The plane spanned by the main extension direction and the average position direction is used as the local projection plane for finding the corresponding second calculation point; The second spatial curve is projected vertically onto the local projection plane to obtain a two-dimensional projection line; On the local projection plane, find the nearest point from the projection point of the first calculation point to the two-dimensional projection line. The preimage point of this nearest point on the second space curve is the second calculation point corresponding to the first calculation point.

[0027] Preferably, in the method for detecting the thickness of mortar joints in wall masonry, The specific steps for constructing the candidate projection plane set are as follows: based on the tangent directions of the first and second spatial curves at each sampling point in the analysis segment, statistical analysis is performed to obtain the main trend direction; around the main trend direction, rotation sampling is performed in three-dimensional space at preset angular intervals to generate a set of normal vectors; a candidate projection plane is determined by each normal vector and the spatial centroid of the analysis segment. The optimal projection plane selection sub-step is performed as follows: For each candidate projection plane, the projection lines of the first space curve and the second space curve on it are calculated respectively; the root mean square value of the normal distance between the two projection lines at multiple preset equidistant points is calculated; the candidate projection plane with the smallest root mean square value is selected as the first candidate plane; at the same time, the overlap index between the two projection lines is calculated; the candidate projection plane with the highest overlap index is selected as the second candidate plane; the straightness of the projection line shape under the first candidate plane and the second candidate plane is compared comprehensively, and the plane with higher straightness is selected as the optimal projection plane.

[0028] Preferably, in the method for detecting the thickness of mortar joints in wall masonry, The comprehensive comparison of the straightness of the projected lines under the first and second candidate planes is achieved in the following way: Straightness quantification sub-step: For each projection line under the candidate plane, discretize it into an ordered series of points, calculate the straightness component of the angle formed by every three consecutive adjacent points in the series of points, and take the average of the straightness components of all consecutive three-point groups to obtain the straightness quantification value of the projection line. The higher the straightness quantification value, the straighter the projection line. Furthermore, the final selection of the optimal projection plane is performed in the following manner: If the first candidate plane coincides with the second candidate plane, then it is directly determined as the optimal projection plane; If the first candidate plane and the second candidate plane are different, then the first comprehensive evaluation value corresponding to the first candidate plane and the second comprehensive evaluation value corresponding to the second candidate plane are calculated respectively. The comprehensive evaluation value of a candidate plane is obtained by synthesizing the inverse index of the normalized root mean square distance value, the normalized overlap index value, and the flatness quantification value corresponding to the plane according to a preset weight ratio. By comparing the first comprehensive evaluation value with the second comprehensive evaluation value, the candidate plane with the higher comprehensive evaluation value is determined as the optimal projection plane.

[0029] The present invention has at least the following beneficial effects: This invention provides a non-contact method for detecting the thickness of wall mortar joints by combining the semantic recognition capabilities of two-dimensional color images with the geometric precision of three-dimensional point cloud data. This method utilizes images for rapid initial localization of the mortar joint area, effectively reducing the processing range of the three-dimensional point cloud and avoiding the computational burden of complex segmentation of massive panoramic point cloud data. Simultaneously, the three-dimensional point cloud provides a precise spatial coordinate basis for the final thickness calculation, thus achieving automated and high-precision thickness detection overall.

[0030] This invention establishes a structured point cloud processing workflow by first performing a coarse classification of the point cloud based on the angle between the normal and the main plane of the wall, then further subdividing the upper and lower brick surfaces according to the spatial distribution in the vertical direction, and finally accurately identifying boundary points based on spatial neighborhood relationships. This method improves the robustness of distinguishing between brick and mortar surfaces in complex point cloud scenes, making edge point extraction independent of single, easily disturbed features, and providing a more reliable data foundation for generating spatial curves that reflect real physical edges.

[0031] This invention enables the fitting process of space curves to have a certain degree of adaptability by pre-setting multiple candidate geometric models and establishing an automatic selection mechanism based on goodness of fit and model complexity. This method reduces the reliance on manual experience in model selection and can make trade-offs between different models such as straight lines and curves. Therefore, when faced with grout joint edges of different shapes, it is expected to obtain fitting results that better match the local geometry and reduce systematic errors introduced by improper model selection.

[0032] This invention provides a point correspondence method with clear geometric meaning by constructing a projection plane for each calculation point on a first spatial curve, jointly determined by the local tangent direction of that point and the global wall normal, and then finding the corresponding point on the second spatial curve on this plane. Compared to a simple three-dimensional nearest neighbor search, this method is closer to simulating the thickness concept of mortar joints on a local vertical section, making the distance between each pair of points more directional and physically reasonable.

[0033] This invention enhances the adaptability of the projection intersection method by constructing a data-driven set of candidate projection planes and using Hausdorff distance as an evaluation metric to automatically select the optimal projection plane. This method reduces the dependence on fixed, preset projection directions, enabling the algorithm to autonomously find a projection angle that visually aligns the upper and lower edge projection lines even when the wall surface is not perfectly flat or the mortar joints are tilted. This improves the success rate and stability of this step.

[0034] This invention introduces a classification result verification and correction step based on spatial neighborhood consistency, enabling effective post-processing of isolated noise points and local misclassifications that may exist in the initial classification. This mechanism utilizes prior knowledge that the point cloud of a real brick surface or mortar joint should have continuity and consistency in local areas, thereby filtering out or correcting erroneous classification points that do not conform to the spatial distribution pattern, thus improving the "purity" of the point cloud data used for boundary recognition.

[0035] This invention optimizes the multi-model optimal fitting process by adding data simplification, adaptive weight adjustment, and model validity verification steps to the model selection process. Data simplification improves computational efficiency; dynamically adjusting the scoring weights based on the data noise level helps suppress overfitting; and the final validity verification provides a safety guarantee for the entire fitting process, enabling the use of a default model when the automatic selection fails, thereby enhancing the overall robustness and practicality of this sub-step.

[0036] This invention determines the projection plane by employing principal component analysis and average position direction based on local curve segments, replacing the direct reliance on the tangent direction at a single point and the global wall normal. This method utilizes the statistical characteristics of a local data segment, and the derived principal extension direction and average position direction have a better smoothing and resistance effect on noise at individual points and errors in the global reference, thereby making the constructed local projection plane more stable and reducing the matching fluctuations of corresponding points caused by directional jitter.

[0037] This invention optimizes the search process for the optimal projection plane by employing a multi-index step-by-step screening strategy (root mean square distance, overlap) combined with a targeted candidate plane set generated based on local curve orientation statistics. Multi-index consideration allows for a more comprehensive evaluation of projection quality, avoiding the limitations of a single index; while data-driven candidate set generation focuses the search on more likely directions, improving search efficiency. The comprehensive comparison of straightness as the final criterion further considers the rationality of the projection line shape.

[0038] This invention establishes a clear and quantitative final decision rule by explicitly defining a quantitative calculation method for flatness and combining it with normalized root mean square distance and overlap indexes according to preset weights. This solves the problem of decision ambiguity when multiple indicators may conflict, transforming the selection of the optimal projection plane from a step that may rely on subjective judgment into a repeatable and interpretable deterministic calculation, thereby improving the objectivity and consistency of the algorithm's decision-making.

[0039] Other advantages, objectives and features of the present invention will become apparent in part from the following description, and in part from those skilled in the art through study and practice of the invention. Detailed Implementation

[0040] The present invention will now be described in further detail so that those skilled in the art can implement it based on the description.

[0041] This invention provides a method for detecting the thickness of mortar joints in wall construction, comprising the following steps: a data acquisition step: synchronously acquiring two-dimensional color images and three-dimensional point cloud data of the target wall area, and establishing a coordinate mapping relationship between the two; a mortar joint area initial positioning step: performing mortar joint semantic segmentation on the two-dimensional color image to obtain an initial mask for the mortar joint pixel area; a three-dimensional target area focusing step: mapping the initial mask onto the three-dimensional point cloud data according to the coordinate mapping relationship to obtain a candidate three-dimensional area containing the mortar joint and the surface of its adjacent bricks; an edge precision extraction step: based on the normal features and spatial distribution features of the point cloud in the candidate three-dimensional area, identifying and fitting a first spatial curve where the upper edge of the mortar joint is located and a second spatial curve where the lower edge is located, wherein the first spatial curve and the second spatial curve are respectively generated by fitting the three-dimensional point cloud at the junction of the bricks and the mortar joint in the candidate three-dimensional area; a thickness calculation step: selecting multiple first calculation points on the first spatial curve, and determining a corresponding second calculation point on the second spatial curve that is closest in normal distance or intersecting in projection for each first calculation point, calculating the three-dimensional Euclidean distance between each pair of calculation points, and using the statistical values ​​of these distances as the thickness value of the mortar joint.

[0042] The method for detecting the thickness of mortar joints in wall masonry according to the present invention mainly includes the following steps: First, data is acquired synchronously. A detection device integrating a color camera and a 3D laser scanner is used to scan the target wall area. The color camera acquires high-resolution 2D color images, while the 3D laser scanner acquires high-density 3D point cloud data within the same field of view. Through factory calibration and on-site joint calibration, a precise mapping relationship is established between the 2D image pixel coordinate system and the 3D point cloud spatial coordinate system. This step ensures the spatiotemporal alignment of 2D information and 3D geometry, laying the foundation for subsequent data fusion processing.

[0043] The synchronous acquisition of the two-dimensional color image and the three-dimensional point cloud data is achieved through a calibrated RGB-D camera (such as the Intel RealSense series) or laser scanner and a synchronously triggered external color camera. The coordinate mapping relationship is obtained by combining Zhang Zhengyou calibration method with hand-eye calibration, and the mapping error should be controlled within ±2 pixels.

[0044] Next, initial localization of the mortar joint area is performed based on the image. The acquired 2D color image is input into a pre-trained deep learning semantic segmentation model. This model can identify bricks and mortar joint areas in the image and output a binarized initial mask image, where white pixels represent the predicted mortar joint locations. Due to variations in lighting, shadows, and surface stains at the construction site, the mask boundaries obtained in this step may have slight inaccuracies or breaks, but its core function is to provide a reliable and approximate region of interest guide for subsequent 3D processing, avoiding blind calculation of the entire point cloud.

[0045] The mortar joint semantic segmentation model employs a U-Net-based convolutional neural network, with training data derived from construction site image datasets featuring varying lighting, brick types, and mortar joint materials. The model output is a binary mask, which can be post-processed using a Conditional Random Field (CRF) to optimize boundaries. If the initial mask obtained from semantic segmentation contains breaks or large areas of misidentification, the system will initiate a mask repair mechanism: first, morphological closing operations are performed on the mask to connect broken areas; second, if the mask area is less than a preset minimum (e.g., less than 1% of the image area), it is determined that there are no valid mortar joints in that area, subsequent processing is terminated, and a prompt message is output.

[0046] Next, spatial focusing of the 3D target region is performed. Based on the coordinate mapping relationship established in the previous step, the initial 2D mask is projected onto the 3D point cloud. Specifically, for each white pixel in the mask, a ray corresponding to it in 3D space is found according to the mapping relationship, and the 3D point cloud data within a certain spatial range near the ray is extracted. All the extracted 3D points together constitute a "candidate 3D region". This region not only includes the point cloud of the mortar joint itself, but also necessarily a portion of the point cloud of the upper and lower brick surfaces adjacent to the mortar joint. The key value of this step is that it narrows the processing scope from a massive full-field point cloud to a local 3D space directly related to the target with a significantly reduced data volume, greatly improving the efficiency of subsequent processing.

[0047] Subsequently, precise edge extraction and spatial curve fitting are performed. This is the core of thickness calculation. Within the obtained candidate 3D region, the algorithm first calculates the normal vector at each 3D point. Then, it analyzes the normal vector characteristics and the spatial distribution of the points to identify the set of 3D points at the junction of the brick surface and the mortar joint. Specifically, the algorithm attempts to distinguish two types of points: one type has a normal direction close to the direction of the wall surface, mainly belonging to the exposed surface of the brick; the other type has a significantly different normal direction, possibly belonging to the side of the mortar joint or the edge of the brick. By further analyzing the spatial aggregation of these points, the set of points belonging to the lower edge region of the upper brick and the set of points belonging to the upper edge region of the lower brick can be separated. Appropriate mathematical methods are then used to fit spatial curves to these two sets of points, such as using the least squares method to fit them into a straight line or smooth curve in 3D space, thus obtaining the first spatial curve representing the upper edge of the mortar joint and the second spatial curve representing the lower edge. Assuming the main plane of the wall is the reference plane, the upper brick surface is above the reference plane, the lower brick surface is below the reference plane, and the mortar joint region is located between the two. The boundary point identification process can be understood as follows: in the point cloud of the lower surface of the upper brick, find those 'transition points' that contain both brick points and mortar joint points in their spherical neighborhood. The set of these points constitutes the discrete representation of the upper edge. Similarly, the discrete point set of the lower edge can be obtained.

[0048] If the number of boundary points identified is too small (e.g., less than 10 points), or the curvature of the fitted spatial curve is abnormal (e.g., the radius of curvature is less than half the length of the brick), the system will determine that the extraction of the mortar joint edge has failed and will try to expand the candidate 3D region or enable an alternative edge extraction algorithm (e.g., local edge tracking based on gradient descent).

[0049] Finally, thickness calculation is performed. On the first spatial curve, multiple points are selected at regular intervals along the curve as first calculation points. For each first calculation point, a corresponding second calculation point needs to be found on the second spatial curve. This "correspondence" follows specific geometric rules, aiming to find the point that accurately reflects the minimum dimension of the mortar joint filling. One feasible method is to construct a specific projection plane through the first calculation point, project the second spatial curve perpendicularly onto this plane to form a two-dimensional projection line, and then find the point on the projection line closest to the projected position of the first calculation point. The position of this point on the original second spatial curve is the second calculation point. After determining all point pairs, the true three-dimensional spatial straight-line distance between each pair of first and second calculation points, i.e., the three-dimensional Euclidean distance, is calculated sequentially. Finally, the average or median of all these calculated distance values ​​is taken as the statistical value of the thickness of the measured mortar joint area. The construction process of the local projection plane can be understood through the following spatial relationship: Taking the current upper edge calculation point P as the center, take a curve segment before and after point P. The main extension direction of this curve segment in space (obtained through principal component analysis) indicates the local orientation of the grout joint edge. Among all planes passing through point P and containing this direction vector, the plane that simultaneously contains the direction vector from the origin to the centroid of this curve segment is selected as the projection plane. This plane essentially attempts to simulate a 'virtual cutting plane' passing through point P and perpendicular to the local edge orientation.

[0050] Existing technologies mainly fall into two categories. The first category is detection methods purely based on two-dimensional image processing. These methods typically identify mortar joints in images through edge detection or machine learning and attempt to estimate the thickness by comparing the pixel width with the known brick dimensions. Their fundamental flaw is that two-dimensional images completely lose depth information, and any estimation is based on the ideal assumption of a "flat wall and a directly facing camera." In actual construction sites, factors such as camera angle, local wall irregularities, and perspective distortion can severely interfere with the estimation results, making accuracy impossible to guarantee, and they cannot handle situations where the mortar joints themselves vary in depth. The second category is schemes directly based on three-dimensional point cloud analysis. These methods attempt to obtain the mortar joint thickness from the overall point cloud of the scanned wall by identifying the planes of adjacent bricks and calculating their distances. However, their main challenge lies in the difficulty of automated segmentation and recognition. The wall point cloud data is large, the brick surfaces may have damage or texture, and the mortar joints may be partially filled or contaminated. These factors make it extremely difficult to automatically, accurately, and robustly segment the point cloud into parts such as "brick plane A," "mortar joint area," and "brick plane B." Existing algorithms often have high requirements for scene and point cloud quality, and are prone to failure in complex real-world scenes, resulting in the inability to reliably extract the corresponding surface used to calculate thickness.

[0051] Compared with the existing technologies described above, the method provided by this invention has clear differences and beneficial effects. This method does not rely solely on two-dimensional or three-dimensional data, but creatively integrates and complements the advantages of both sequentially. It utilizes two-dimensional image processing technology to quickly and semantically locate "where the mortar joint might be," and then uses three-dimensional point cloud technology to perform precise geometric analysis and calculation within the located area, solving the problem of "how thick the mortar joint is." This "coarse-to-fine" strategy avoids the fundamental deficiency of pure image methods lacking depth information, and overcomes the automation challenges and huge computational overhead faced by pure point cloud methods in full-scene segmentation. By guiding three-dimensional focusing with two-dimensional data, this method transforms a complex global three-dimensional problem into a controllable local three-dimensional problem, improving the feasibility and efficiency of overall processing, and providing a new technical path for realizing non-contact mortar joint thickness detection in practical engineering sites.

[0052] In a preferred embodiment, the wall masonry mortar joint thickness detection method includes the following precise edge extraction step: Point cloud normal estimation and initial classification sub-step: calculating the normal vector of each three-dimensional point within the candidate three-dimensional region, and dividing the point cloud within the candidate three-dimensional region into a first category point cloud and a second category point cloud based on the clustering results of the normal vector directions, wherein the angle between the normal vector direction of the first category point cloud and the normal vector direction of the main plane of the wall is less than a first threshold, and the angle between the normal vector direction of the second category point cloud and the normal vector direction of the main plane of the wall is greater than or equal to the first threshold; Brick surface subdivision and extraction sub-step: in the first category point cloud, based on the distribution of the spatial coordinates of the three-dimensional points in the vertical direction, separating the upper brick candidate point cloud located above. The process involves several steps: First, identifying the boundary points of the upper brick candidate point cloud. This includes identifying the boundary points of the lower brick candidate point cloud as those 3D points that simultaneously belong to both the upper brick candidate point cloud and the second category point cloud within a preset spatial neighborhood radius. Second, identifying the boundary points of the lower brick candidate point cloud as those 3D points that simultaneously belong to both the lower brick candidate point cloud and the second category point cloud within the preset spatial neighborhood radius. Finally, a spatial curve fitting step involves fitting all identified boundary points belonging to the upper brick candidate point cloud into the first spatial curve and all identified boundary points belonging to the lower brick candidate point cloud into the second spatial curve.

[0053] First, point cloud normal estimation and initial classification are performed. Within the obtained candidate 3D region, the algorithm calculates the normal vector of each 3D point. The calculation of the normal vector is typically based on a locally tangent plane fitted to the point and its neighbors. Simultaneously, the principal plane of the entire wall is fitted using the point cloud data, and its normal direction is obtained. Next, the angle between the normal vector of each point and the normal direction of the wall's principal plane is calculated one by one. A first threshold θ is set, typically ranging from 10° to 20°, preferably 15°. This threshold can be determined experimentally: in the point cloud of a typical wall sample, the distribution of the angle between the normal vector of the brick surface points and the normal direction of the wall's principal plane is statistically analyzed, and the 95th quantile of the distribution curve is selected as θ. Points with an angle less than this threshold are classified as the first category of point cloud; these points are considered to have surface directions approximately parallel to the wall surface, mainly corresponding to the exposed surfaces of the bricks. Points with an included angle greater than or equal to the threshold are classified as the second category of point cloud. These points correspond to areas where the surface orientation differs significantly from the wall surface, including the sides and bottom of the mortar joints, as well as possible edges or broken areas of the bricks.

[0054] Next, the brick surface is subdivided and extracted. In the obtained first-category point cloud, statistical analysis is performed based on the vertical coordinate values ​​of the 3D points. Since the candidate region includes the mortar joints and their adjacent upper and lower bricks, the vertical coordinate distribution will exhibit two clustered levels. By analyzing the histogram of the vertical coordinate distribution or using a clustering algorithm, the first-category point cloud can be separated into two subsets: the point cloud located at the top is labeled as the upper brick candidate point cloud, and the point cloud located at the bottom is labeled as the lower brick candidate point cloud. This step completes the initial differentiation of the brick surface.

[0055] Subsequently, boundary point identification is performed. For the candidate point cloud of the upper brick, the algorithm traverses each point. A preset spatial neighborhood radius is set around this point, for example, twice the average point spacing of the point cloud. All points within this spherical neighborhood are checked. If a point belonging to both the upper brick candidate point cloud and the second category point cloud exists within this neighborhood, then the current point is considered to be located at the boundary between the brick surface and the mortar joint or other non-brick areas, and it is marked as a boundary point of the upper brick. Similarly, the same operation is performed on the candidate point cloud of the lower brick to identify the boundary points of the lower brick. Through this criterion based on the degree of spatial neighborhood mixing, the actual boundary position between the brick and the mortar joint can be captured relatively accurately.

[0056] Finally, spatial curve fitting is performed. All identified upper brick boundary points are collected together, and a curve fitting algorithm, such as a 3D linear or polynomial curve fitting based on the least squares principle, is used to generate a smooth 3D spatial curve, the first spatial curve, representing the upper edge of the mortar joint. The same operation is performed on the lower brick boundary points to obtain a second spatial curve representing the lower edge of the mortar joint.

[0057] The candidate geometric models include: three-dimensional straight lines, quadratic curves, circular arcs, and cubic B-spline curves. The goodness-of-fit metric is the root mean square error (RMSE), and the model complexity cost is represented by the normalized number of model parameters. The comprehensive scoring function is designed as follows: S = w 1⋅RMSE+ w 2⋅ComplexityCost, where the weighting coefficients are... w 1 and w 2. Adaptively adjust based on the degree of dispersion of the point set.

[0058] Existing technologies detect edges directly based on local geometrical abrupt changes in point clouds (such as height jumps or normal vector abrupt changes) or region segmentation. However, height jump methods are ineffective for flat joints; normal vector abrupt changes are susceptible to brick surface roughness and scanning noise, making it difficult to set a stable threshold; and region segmentation methods tend to fail when joints are narrow or point cloud quality is poor, resulting in unreliable boundary extraction. In contrast, this method employs a hierarchical reasoning process of "global normal classification, spatial location subdivision, and local neighborhood verification." It does not rely on a single sensitive threshold but identifies boundaries by analyzing the coexistence relationships of points with different semantic categories within the point's neighborhood. This makes it more robust to uneven brick surfaces and point cloud noise, focusing more on capturing the physical essence of the "brick-joint boundary," thereby improving the stability and accuracy of edge extraction.

[0059] In a preferred embodiment, the spatial curve fitting sub-step in the wall masonry mortar joint thickness detection method specifically comprises: a model selection and fitting sub-step: for the set of boundary points to be fitted, the following operations are performed: the set of boundary points is fitted with a variety of preset candidate geometric models, and the goodness-of-fit index and model complexity cost corresponding to each model are calculated; based on the goodness-of-fit index and the model complexity cost, the optimal model is selected from the variety of candidate geometric models, wherein the optimal model is the model that makes a comprehensive scoring function optimal, and the comprehensive scoring function is a weighted combination of the goodness-of-fit index and the model complexity cost; the optimal model is used to finally fit the set of boundary points to obtain the first spatial curve or the second spatial curve.

[0060] The space curve fitting sub-step adaptively selects the most suitable geometric model from the identified set of discrete boundary points and generates a space curve that accurately represents the edge of the mortar joint. This process, known as the model selection and fitting sub-step, consists of three consecutive operational steps.

[0061] First, multi-model fitting and scoring are performed. For the set of boundary points to be fitted, such as the set of boundary points for bricks, the algorithm pre-defines a set containing multiple candidate geometric models. This set typically includes simple models such as straight lines in 3D space, as well as more complex models such as quadratic curves, circular arcs, or polynomial curves of a specific order. The algorithm sequentially uses each model in the set to fit the current set of boundary points. For each fit, the algorithm calculates two key metrics: one is the goodness-of-fit metric, which quantifies the model's ability to interpret the data points, such as calculating the average sum of squared distances from all data points to the fitted curve; a smaller value generally indicates a better fit. The other is the model complexity cost, which measures the complexity of the model itself; for example, linear models have fewer parameters and lower complexity, while high-order polynomial models have more parameters and higher complexity.

[0062] Next, the algorithm selects the optimal model. After obtaining the goodness-of-fit index and model complexity cost of all candidate models, the algorithm makes a decision based on a comprehensive scoring function. This comprehensive scoring function is a weighted combination of the two indices, designed to encourage the selection of models that fit the data well without being overly complex. A common approach is to add the goodness-of-fit index and model complexity cost with a certain weight, and the model with the lowest total score is considered optimal. By iterating through and comparing the comprehensive scores of all candidate models, the algorithm automatically determines the optimal fitting model corresponding to the current set of boundary points.

[0063] Finally, the final curve is generated. The algorithm uses the optimal model selected in the previous step to perform a final, accurate parameter fitting on the original set of boundary points. The fitting process outputs the complete parameters of the model, such as the direction vector and points passed through by a straight line, or the coefficient matrix of a quadratic curve. These parameters completely define a continuous curve in three-dimensional space, which is the final first-space curve or second-space curve.

[0064] Current technology involves directly using a single, pre-defined geometric model when fitting spatial curves. A common approach is to treat the mortar joint edges as straight lines by default and directly fit a three-dimensional straight line using the least squares method. Another approach is to pre-specify the curve model to use for fitting specific scenarios (such as curved walls) based on the engineer's experience.

[0065] However, these existing methods have significant limitations when applied to actual wall mortar joint inspection. First, while using a default straight-line model is computationally simple, it lacks adaptability. Actual mortar joint edges may exhibit slight curvature or irregular shapes due to masonry techniques, brick deformation, or wall settlement. Forcing a straight-line fit introduces systematic fitting errors, causing the generated edge curve to deviate from its true position, directly affecting the accuracy of subsequent thickness calculations. Second, methods relying on pre-specified model types based on human experience lack universality and automation capabilities. Different walls and different sections may be suitable for different models; manual pre-judgment is both time-consuming and difficult to guarantee accuracy, failing to meet the needs of automated batch inspection.

[0066] Compared to existing technologies, this method offers a significantly different technical approach. Its core difference lies in the introduction of an automated model selection mechanism, rather than relying on fixed presets or manual intervention. This method pre-sets a candidate set containing models of varying complexity and establishes a quantitative evaluation system based on fitting performance and model complexity. This allows the algorithm to automatically and data-drivenally select the most suitable geometric model based on the specific distribution characteristics of the boundary point data. This method enhances adaptability to different mortar joint edge morphologies and reduces fixed biases caused by inappropriate model selection.

[0067] In a preferred embodiment, the thickness calculation step in the wall masonry mortar joint thickness detection method specifically includes: a local corresponding point determination sub-step: for any first calculation point on the first spatial curve, perform the following operations: determine the first tangent direction of the first spatial curve at the first calculation point; construct a first calculation plane, which is jointly determined by the first tangent direction and the direction perpendicular to the main plane of the wall; project the second spatial curve vertically onto the first calculation plane to obtain a second projection curve; on the first calculation plane, find the nearest point from the projection point of the first calculation point on it to the second projection curve, and the preimage point of this nearest point on the second spatial curve is the second calculation point corresponding to the first calculation point; a thickness calculation and statistics sub-step: calculate the three-dimensional Euclidean distance between all the first calculation points and their respective corresponding second calculation points, and use the statistical value of all the distance values ​​obtained as the thickness value of the mortar joint.

[0068] The thickness calculation step involves finding a matching point on the corresponding lower edge curve for each point on the upper edge curve of the mortar joint that accurately reflects the mortar joint thickness at that point. This process is defined as a local corresponding point determination sub-step and a thickness calculation and statistics sub-step.

[0069] First, the local corresponding point determination is performed. For each pre-selected first calculation point on the first spatial curve, the algorithm performs the following operations in sequence: Step 1: Calculate the tangent direction of the first spatial curve at the first calculation point. This is usually done by calculating the direction of a small segment of the curve near the point, or by differentiating the curve equation. Step 2: Obtain the normal direction of the wall's main plane. This direction is the global reference direction obtained earlier by fitting the point cloud of the candidate 3D region. Step 3: Construct a plane using these two direction vectors, called the first calculation plane. This plane contains the tangent direction of the first calculation point, and its normal direction, together with the normal direction of the wall's main plane, determines the spatial orientation of the plane. Step 4: Project the second spatial curve representing the lower edge of the mortar joint along a direction perpendicular to the first calculation plane. The projection result forms a new 2D curve on this plane, called the second projection curve. Step 5: Project the first calculation point perpendicularly onto the same plane to obtain a projection point. Then, on the second projection curve on this plane, find the point closest to this projection point; this closest point is called the target projection point. The sixth step is to find the three-dimensional space point corresponding to the target projection point on the original second space curve. This point is the second calculation point paired with the current first calculation point.

[0070] Specifically, a first calculation plane is constructed, whose spatial pose is determined by two directions: the tangent direction T of the first spatial curve at the first calculation point, and the normal direction N of the pre-fitted principal plane of the wall. wall This plane can be considered as being composed of T and N. wall The plane formed by the contraction has a normal vector of T × N. wall (Cross product). The geometric significance of this construction is that the plane includes the local tangent direction of the edge while maintaining its relationship with the overall posture of the wall, forming an approximation of a local vertical section.

[0071] Secondly, thickness calculation and statistics are performed. After finding the corresponding second calculation points for each of the first calculation points using the above method, the algorithm calculates the straight-line distance between each pair of points, i.e., the three-dimensional Euclidean distance. Finally, all the calculated distance values ​​are statistically processed, such as calculating their arithmetic mean or median. The statistical result is then recognized as the thickness detection value of that mortar joint.

[0072] In existing technologies, common methods for determining the relationship between corresponding points on two spatial curves are to directly calculate the nearest point in space or to project along a fixed direction. For example, one method is to find the nearest point in three-dimensional space on the lower edge curve for each point on the upper edge curve. Another method is to choose a fixed projection direction, such as a direction perpendicular to the wall, project both curves onto the same plane, and then find the correspondence on the projection plane.

[0073] However, these methods have limitations in solving the specific problem of calculating mortar joint thickness. Directly calculating the nearest point in three-dimensional space ignores the physical meaning. Due to deviations in masonry construction, the surfaces of upper and lower bricks may not be perfectly parallel, causing the mortar joint to be inclined in space. In this case, the nearest point in three-dimensional space may not be located in the direction reflecting the actual fill thickness, leading to calculation results that deviate from the actual mortar joint dimensions. The method using fixed-direction projection, on the other hand, relies entirely on the accuracy of the projection direction. If the wall itself is not perpendicular or the scan is tilted, the preset projection direction will deviate, causing the two curves to misalign after projection, thus resulting in inaccurate matching point pairs.

[0074] Compared to existing technologies, this method proposes a different solution. Its core difference lies in dynamically constructing a local reference plane for each first calculation point. This plane is determined by the local tangent direction of that point and the overall wall normal. Essentially, this method attempts to define a local "thickness measurement coordinate system" for each measurement point. It constrains the search for corresponding points from three-dimensional space or a fixed projection plane to a specific plane related to the local geometric features of that point. This plane considers both the local orientation of the edge and maintains its association with the overall orientation of the wall, making the nearest point found on this plane more likely to be located in a direction reflecting the true filling state of the mortar joint at that point. Therefore, this method aims to provide a more physically plausible corresponding point matching method than simple spatial nearest neighbor or fixed projection.

[0075] In a preferred embodiment, in the wall masonry mortar joint thickness detection method, when the thickness calculation step uses the projection intersection method to determine the corresponding point, the following sub-steps are executed: Candidate projection plane set construction sub-step: Construct a set of candidate projection planes, wherein the normal vector of each candidate projection plane is determined based on statistical analysis of the overall direction of the first spatial curve and the second spatial curve within a preset analysis segment; Optimal projection plane selection sub-step: For each candidate projection plane, the first spatial curve and the second spatial curve are perpendicularly projected onto the plane to obtain two two-dimensional projection lines; the average Hausdorff distance between the two-dimensional projection lines is calculated; the candidate projection plane with the smallest average Hausdorff distance is selected as the optimal projection plane; Corresponding point analysis sub-step: On the optimal projection plane, for the first projection point on the projection line of the first spatial curve, find its nearest point on the projection line of the second spatial curve. The preimage point of this nearest point on the second spatial curve is the second calculation point corresponding to the first projection point.

[0076] In the thickness calculation step, when determining corresponding points using the projection intersection method, the reliability of the matching is ensured by automatically finding an optimal projection direction. This process consists of three consecutive sub-steps.

[0077] First, the algorithm constructs a set of candidate projection planes. It extracts a pre-defined analysis segment from the first and second spatial curves of the grout joint. The curve points within this segment are analyzed to obtain statistical characteristics of their overall orientation, such as calculating the principal direction of the tangent at all sampling points. Based on this principal trend direction, a series of uniformly distributed direction vectors are generated in three-dimensional space around it at pre-defined fixed angular intervals. These vectors are then rotated and sampled at pre-defined fixed angular intervals Δα, typically 5° to 15°, preferably 10°, to ensure coverage of the main projection direction with reasonable computational overhead. Each such direction vector, combined with the coordinates of the spatial centroid of the analysis segment, uniquely determines a spatial plane. All such generated planes constitute the set of candidate projection planes. This method aims to ensure that the candidate planes cover a reasonable search range around the main orientation of the curve.

[0078] Next, the optimal projection plane selection is performed. The algorithm iterates through each candidate projection plane. For the current candidate plane, the first and second spatial curves are projected perpendicularly onto the plane, resulting in two two-dimensional projection lines. Then, the average Hausdorff distance between these two projection lines is calculated. The Hausdorff distance is a measure of the maximum mismatch between two curves; it is calculated by taking the maximum or average of the shortest distances from all points on the two curves to the other curve. After calculating the average Hausdorff distance for all candidate planes, the algorithm selects the candidate plane that minimizes this distance and marks it as the optimal projection plane.

[0079] Finally, point resolution is performed. On the determined optimal projection plane, the projection lines of the first and second spatial curves are considered to be well aligned. Next, for the first projection point on the projection line of the first spatial curve, the algorithm finds its nearest point on the projection line of the second spatial curve on the same plane. The 3D point corresponding to this nearest point on the original second spatial curve is then determined as the second calculation point corresponding to the first projection point.

[0080] In existing technologies, when using the projection intersection method, the projection direction is usually preset or determined empirically. A common approach is to directly use the direction perpendicular to the fitted main plane of the wall as the projection direction. Another approach is to use the direction of gravity or a fixed axis direction in the device coordinate system for projection, depending on the device's placement posture.

[0081] However, these methods have limitations in practical applications for wall mortar joint detection. First, directly using the wall's principal plane normal projection makes its accuracy entirely dependent on the precision of the principal plane fitting. If the wall is uneven or the scanning range is limited, the fitted principal plane direction may be deviated, leading to misalignment of the upper and lower edge curves after projection, resulting in ineffective intersection or inaccurate intersection points. Second, using a fixed-direction projection device completely ignores the wall's true orientation in space. When the device is not positioned correctly or the wall is tilted, the projection results will be severely distorted and cannot be used for accurate thickness calculations.

[0082] Compared to existing technologies, the method described above employs a data-driven and optimized strategy to find the projection direction. Its core difference lies in that it does not use a fixed, potentially inaccurate projection direction. Instead, it constructs a set of candidate directions around the geometric features of the curve and automatically selects the direction that maximizes the alignment of the two edge curves after projection using an objective geometric metric. This method reduces the absolute dependence on the accuracy of the initial wall plane fitting or the equipment placement orientation. By searching for and selecting the optimal projection plane, this method aims to improve the adaptability and robustness of the projection intersection method for walls with different spatial orientations and under conditions of construction deviation, thereby increasing the success rate and accuracy of corresponding point matching.

[0083] In a preferred embodiment, the method for detecting the thickness of mortar joints in wall masonry further includes a classification result verification and correction sub-step after the point cloud normal estimation and initial classification sub-step. The classification result verification and correction sub-step includes: for each three-dimensional point in the first category point cloud, checking the proportion of points belonging to the first category point cloud in its spatial neighborhood; if the proportion is lower than a preset neighborhood consistency threshold, removing the three-dimensional point from the first category point cloud and reclassifying it to the second category point cloud; for each three-dimensional point in the second category point cloud, checking the proportion of points belonging to the second category point cloud in its spatial neighborhood; if the proportion is lower than the neighborhood consistency threshold, removing the three-dimensional point from the second category point cloud and reclassifying it to the first category point cloud.

[0084] The operation process of the classification result verification and correction sub-step is as follows: First, the algorithm processes the first-class point cloud obtained through point cloud normal estimation and initial classification. It iterates through each 3D point in the point cloud, and for the current point, queries its spatial neighborhood of a specified radius (pre-defined). Then, it counts the number of points belonging to the first-class point cloud within this spherical neighborhood and calculates its proportion of the total number of points in the neighborhood. If the calculated proportion is lower than a pre-set neighborhood consistency threshold δ, where δ typically ranges from 50% to 70%, preferably 60%, this threshold is used to exclude isolated noise points. Its value can be dynamically adjusted according to the point cloud density; the higher the density, the higher δ can be. Therefore, the algorithm determines that the point is not sufficiently continuous with its surrounding "same-class" points and may be a misclassified isolated point or noise point. Consequently, the algorithm removes the point from the first-class point cloud and reclassifies it into the second-class point cloud.

[0085] Secondly, the algorithm performs a fully symmetrical verification operation on the second category point cloud. It iterates through each 3D point in the second category point cloud, checking the proportion of points belonging to the second category point cloud within its preset spatial neighborhood. If this proportion is lower than the same neighborhood consistency threshold, the point is determined to be isolated in the second category, possibly belonging to the brick surface but initially misclassified due to anomalies in normal vectors. Therefore, the algorithm removes the point from the second category point cloud and reclassifies it to the first category point cloud.

[0086] This sub-step, as a post-processing step, aims to utilize the prior knowledge that "real and effective surface regions should have spatial continuity" to locally smooth and correct the coarse classification results based on the normal angle in the previous step.

[0087] In existing technologies, common practices for processing point clouds after feature-based classification include directly using the classification results or performing simple connected component-based filtering to remove isolated small point clusters that are significantly far from the main clusters. For example, one approach is to perform Euclidean clustering on the classified point cloud to remove clusters with too few points as noise. Another approach is to set a stricter confidence threshold during classification, but this may result in the loss of valid data.

[0088] However, these methods have limitations when dealing with specific scenarios involving wall point cloud classification. Connected component-based filtering primarily targets spatially isolated noise clumps, but it cannot effectively handle "boundary points" or "internal outliers" that are connected to the main point cloud region but are misclassified. For example, a local depression or convexity on the brick surface may have a point cloud normal with a large angle to the principal plane, making it easy to be misclassified as a second-class point in the initial classification. However, since these points are spatially connected to the main point cloud of the brick, they will not be filtered out as isolated clumps. Simply increasing the classification confidence threshold is a global tightening strategy. While it can reduce misclassification, it also excludes many points that are actually correct but whose features are not very distinct (such as points at seams), resulting in data loss.

[0089] Compared to existing technologies, the method described above offers a more refined and targeted correction strategy. Its core difference lies in its non-reliance on the absolute spatial connectivity of the point cloud; instead, it assesses and corrects each point by evaluating the "class consistency" within its local neighborhood. This method can identify and correct misclassified points that are connected to the main point cloud but have inconsistent classes, while retaining isolated points that are correctly classified. It specifically targets the "scattered" classification errors that normal classification methods are prone to produce in areas of uneven brick surfaces or blurred mortar joint features, aiming to improve the local purity and consistency of the classified point cloud in subsequent boundary recognition steps—an effective enhancement of the initial classification results.

[0090] In a preferred embodiment, the method for detecting the thickness of mortar joints in wall masonry further includes the following steps in the model selection and fitting sub-step: a pre-screening and simplification step: before fitting the boundary point set, the boundary point set is first thinned and simplified, and the simplified point set is used to perform subsequent candidate model fitting and scoring; an adaptive threshold step: the weight coefficients in the comprehensive scoring function are dynamically adjusted according to the dispersion or noise level of the boundary point set, wherein when the dispersion or noise level is higher than a preset standard, the weight of the model complexity cost in the scoring function is increased; a model validity verification step: for the selected optimal model, the distribution of its fitting residuals is checked to see if it conforms to the preset random error distribution characteristics; if it does not conform, the model is determined to be invalid, and the preset default geometric model is used to fit the boundary point set.

[0091] The optimization of the model selection and fitting sub-steps includes three additional steps: a pre-screening and simplification step, an adaptive thresholding step, and a model validity verification step. These three steps work together to process the boundary point set and the model selection process.

[0092] First, a pre-screening and simplification step is performed. Before performing multi-model fitting on the boundary point set, the algorithm first thins and simplifies the point set. For example, using the Douglas-Puk algorithm, some redundant points are removed while maintaining the overall shape and outline. The simplified point set is then used to replace the original point set for subsequent candidate model fitting and scoring calculations. This step aims to reduce the amount of data and improve the speed of subsequent fitting calculations.

[0093] Secondly, an adaptive thresholding step is introduced when selecting the optimal model. The weighting coefficients of the algorithm are not fixed when calculating the comprehensive scoring function. The algorithm first evaluates the dispersion or noise level of the boundary point set, for example, by calculating the average distance from the point set to a simple reference curve it fits as an estimate of the noise level. When the evaluated dispersion or noise level exceeds a preset standard, the algorithm automatically increases the weight of the model complexity cost in the scoring function. This means that when faced with noisy data, the algorithm will tend to choose a simpler model to prevent overfitting.

[0094] Finally, the model validity verification step is performed. After selecting an optimal model through comprehensive scoring, the algorithm does not immediately use it as the final result. It checks the distribution of the fitting residuals of the optimal model to the original set of boundary points. The fitting residuals refer to the distance from each data point to the fitted curve. The algorithm analyzes whether the distribution of these residuals conforms to the preset random error distribution characteristics, such as whether the residuals are roughly randomly distributed around zero, and whether there are obvious systematic biases or a large number of extreme outliers. If the residual distribution characteristics do not meet expectations, it is determined that the optimal model may not have captured the true structure of the data and may be invalid. In this case, the algorithm will abandon this selection and instead use a preset default geometric model, such as a three-dimensional straight line, to perform the final fitting of the original set of boundary points.

[0095] Model selection methods that directly employ multi-model comparison processes or adopt the model with the smallest fitting error as the result place high demands on the quality of the input data and the stability of the algorithm parameters. First, when faced with boundary point sets containing numerous outliers or uneven noise, directly fitting all models to the original data is computationally inefficient, and noise directly impacts the goodness-of-fit evaluation of all models. Second, fixed scoring function weights perform poorly with data of varying noise levels. In cases of high noise, complex models may still be selected to fit the noise, leading to unreasonable curve distortion. Finally, when data quality is extremely poor or special circumstances cause automatic selection to fail, these methods lack a reliable backup mechanism, potentially outputting a completely invalid fitting result and causing subsequent processes to crash.

[0096] This method constructs a more robust model selection system by introducing preprocessing, adaptive, and posterior validation mechanisms. It improves efficiency through data simplification, suppresses overfitting tendencies under noise through adaptive weighting, and provides a safety net through final validity validation. This approach aims to make the automatic model selection process more reliable and robust when dealing with the imperfections of real-world data, enhancing the engineering practicality of the entire fitting subsystem.

[0097] In a preferred embodiment, in the wall masonry mortar joint thickness detection method, the local corresponding point determination sub-step in the thickness calculation step is performed as follows: On the first spatial curve, taking the current first calculation point to be processed as the center, a continuous curve segment including the point is extracted as a local curve segment; principal component analysis is performed on all three-dimensional points constituting the local curve segment, and the direction of the first principal component is determined as the main extension direction of the local curve segment; the average value of the spatial positions of all three-dimensional points on the local curve segment is calculated, and the direction vector from the origin to the average value point is determined as the average position direction of the local curve segment; the plane spanned by the main extension direction and the average position direction is used as the local projection plane for finding the corresponding second calculation point; the second spatial curve is vertically projected onto the local projection plane to obtain a two-dimensional projection line; on the local projection plane, the nearest point from the projection point of the first calculation point to the two-dimensional projection line is found, and the preimage point of the nearest point on the second spatial curve is the second calculation point corresponding to the first calculation point.

[0098] An improved method for calculating mortar joint thickness aims to determine a more robust corresponding matching point for each point on the upper edge curve of the mortar joint. This method is achieved by optimizing the construction process of the local projection plane.

[0099] First, the algorithm centers on the current upper edge point to be processed and extracts continuous curve segments of a certain length before and after it along the spatial curve, forming a local 3D point set. Next, principal component analysis is performed on this local point set. The direction of the first principal component obtained through this statistical analysis represents the main extension trend of this curve segment in space and is called the main extension direction. Simultaneously, the average value of all 3D coordinates of this local point set is calculated to obtain the average position point. The vector from the origin to this point is the average position direction, indicating the overall position of this curve segment in space.

[0100] Then, the algorithm uses the two vectors calculated above—the main extension direction and the average position direction—to jointly define a plane, which is the local projection plane used for matching the current point. This plane is entirely determined by the statistical characteristics of the local data itself. Subsequent steps are consistent with the basic method: the lower edge space curve is vertically projected onto this local plane to obtain a two-dimensional projection line; then, on this plane, the projection point of the current upper edge point is found, and the point closest to this projection point is found on the two-dimensional projection line; finally, this closest point is back-projected back onto the original lower edge space curve, and this point is determined as the matching point corresponding to the current upper edge point.

[0101] When constructing a local projection plane, two methods can be used: one is based on the instantaneous tangent direction of the spatial curve at the current measurement point, which is obtained by differentiating the curve equation or by local fitting; the other is based on the global principal plane normal direction of the wall obtained by fitting the overall point cloud of the wall. The projection plane is determined by these two directions together.

[0102] However, this method has limitations in practical applications. The calculation of the instantaneous tangent direction is highly sensitive to noise in the curve data and local fitting errors, which may cause undue jitter in the tangent direction between adjacent points, resulting in an unstable constructed projection plane. Simultaneously, the global principal plane normal direction is a single, overall reference. If the wall itself is uneven, or the point cloud region used for fitting the principal plane is limited or contains interference such as door and window openings, the fitted principal plane direction will be biased. This systematic error will be directly propagated to the construction of each local projection plane. Furthermore, when the local curve direction happens to be close to the principal normal direction of the wall, the instantaneous tangent direction may be nearly parallel to this global direction, making it impossible to uniquely determine a plane and causing the algorithm to fail at this point.

[0103] This method abandons the reliance on instantaneous geometric quantities at single points and global reference vectors, instead employing a method based on statistical analysis of local data blocks to obtain the two directions required to define the plane. The main extension direction is obtained through principal component analysis of the local point set, reflecting the overall, statistically significant trend of the curve segment. It smooths out noise at individual points and is more stable than the instantaneous tangent direction. The average position direction also originates from local data, characterizing the spatial position of the curve segment and no longer relying on the potentially erroneous global wall attitude. This method transforms the construction basis of the projection plane from "unstable local points + potentially erroneous global quantities" to "robust local statistical characteristics + adaptive local position information," aiming to improve the stability of the projection plane construction and its adaptability to complex geometric shapes, thereby potentially improving the reliability of corresponding point matching under non-ideal conditions.

[0104] In a preferred embodiment, the method for detecting the thickness of mortar joints in wall masonry, specifically the step of constructing a candidate projection plane set, involves: statistically analyzing the tangent directions of the first and second spatial curves at each sampling point within the analysis segment to obtain the main trend direction; rotating and sampling in three-dimensional space around the main trend direction at preset angular intervals to generate a set of normal vectors; determining a candidate projection plane by each normal vector and the spatial centroid of the analysis segment; and performing the optimal projection plane selection step as follows: for each candidate projection plane, calculating the projection lines of the first and second spatial curves on them; calculating the root mean square value of the normal distance between the two projection lines at multiple preset equidistant points; selecting the candidate projection plane with the smallest root mean square value as the first candidate plane; simultaneously calculating the overlap index between the two projection lines; selecting the candidate projection plane with the highest overlap index as the second candidate plane; and comprehensively comparing the straightness of the projection lines under the first and second candidate planes, selecting the plane with higher straightness as the optimal projection plane.

[0105] The method for finding the optimal projection plane in this embodiment improves the quality and efficiency of projection plane selection through more comprehensive evaluation indicators and a data-driven approach.

[0106] First, the algorithm constructs a set of candidate projection planes without blindly sampling in space. Specifically, it analyzes the tangent directions at sampling points along the upper and lower edges of the grout seam within a pre-defined analysis segment. Statistical analysis is performed on these tangent directions, such as calculating their average or principal directions, to obtain the main trend direction of the curve's overall direction within that segment. Then, using this principal trend direction as the central axis, the algorithm rotates and samples in three-dimensional space at pre-defined angular intervals, generating a set of uniformly distributed normal vectors. Each normal vector, combined with the coordinates of the centroid of the analysis segment, determines a candidate projection plane. This method generates a set of candidate planes that closely revolve around the main geometric features of the curve, making it more targeted.

[0107] Secondly, in selecting the optimal projection plane, the algorithm employs a multi-index step-by-step screening strategy. For each candidate projection plane, the algorithm projects the upper and lower edge spatial curves perpendicularly onto the plane, resulting in two two-dimensional projection lines. The evaluation process consists of two steps: First, the algorithm calculates the normal distance between the two projection lines at multiple preset equidistant points and calculates the root mean square (RMS) value of these distances. The candidate plane that minimizes this RMS value is selected and marked as the first candidate plane. Second, the algorithm calculates the overlap index between the two projection lines, which quantifies the degree of coincidence between the two lines in length and position. The candidate plane that maximizes this overlap index is selected and marked as the second candidate plane. These two planes are selected from two different perspectives: "average alignment accuracy" and "overall overlap."

[0108] Finally, the algorithm makes a final decision on the first and second candidate planes. The decision is based on comparing the straightness of the projected lines obtained on these two candidate planes. Projected lines with higher straightness are considered to have a more reasonable shape, and their corresponding projected planes are more likely to reflect the true cross-sectional direction of the mortar joint. Therefore, the algorithm determines the candidate plane with higher straightness as the final optimal projection plane for subsequent corresponding point analysis.

[0109] The method for selecting the optimal projection plane is to construct a set of candidate planes, then calculate a single quantification index for each plane, such as the Hausdorff distance between the two projection lines, and directly select the plane that optimizes the index as the result.

[0110] However, this method has certain limitations. First, if the generation of candidate planes lacks guidance, such as uniform sampling on a hemisphere, although the coverage is comprehensive, the efficiency is low, and many directions may be clearly unreasonable. Second, relying on a single evaluation metric for decision-making may not be comprehensive enough. Hausdorff distance mainly focuses on the maximum deviation between two curves and is very sensitive to local outliers. A plane that aligns the main part of the curve well, but has a small bulge due to noise at one point, may be rejected because the Hausdorff distance is slightly larger due to that bulge; while another plane that makes the overall alignment of the curve slightly worse but has no bulges may be selected. This selection may not be the most physically intuitive. A single metric cannot simultaneously take into account the average accuracy of alignment, overall overlap, and the morphological rationality of the projection line itself.

[0111] This method introduces a data-driven candidate set generation approach and a multi-indicator step-by-step screening decision-making mechanism. By generating the candidate set based on the curve's own trajectory statistics, the efficiency and targeting of the search are improved. Through step-by-step initial screening using root mean square distance and overlap indicators, high-performing candidates can be selected from different dimensions. Finally, straightness is introduced as the final criterion to ensure that the selected plane not only aligns the curves but also produces projection lines with reasonable shapes. This multi-stage, multi-indicator screening process aims to overcome the potential bias of a single indicator, ensuring that the final selected projection plane achieves a good balance in multiple aspects, thereby improving the overall rationality and reliability of the selection.

[0112] In a preferred embodiment, in the method for detecting the thickness of mortar joints in wall masonry, the comprehensive comparison of the straightness of the projection lines under the first candidate plane and the second candidate plane is achieved in the following way: A straightness quantification sub-step: For each projection line under a candidate plane, it is discretized into an ordered series of points. The straightness component of the angle formed by every three consecutive adjacent points in the series is calculated, and the average straightness component of all three consecutive point groups is taken to obtain the straightness quantification value of the projection line. The higher the straightness quantification value, the straighter the projection line. Furthermore, the final selection of the optimal projection plane is performed in the following way: if the first... If the first candidate plane coincides with the second candidate plane, it is directly determined as the optimal projection plane; if the first candidate plane and the second candidate plane are different, the first comprehensive evaluation value corresponding to the first candidate plane and the second comprehensive evaluation value corresponding to the second candidate plane are calculated respectively; wherein, the comprehensive evaluation value of a candidate plane is obtained by synthesizing the inverse index of the normalized root mean square distance value, the normalized overlap index value, and the flatness quantification value corresponding to the plane according to a preset weight ratio; comparing the first comprehensive evaluation value and the second comprehensive evaluation value, the candidate plane with the higher comprehensive evaluation value is determined as the optimal projection plane.

[0113] This method solves the problem of decision ambiguity after multi-indicator screening.

[0114] First, the algorithm explicitly defines a quantitative calculation method for the "straightness of the projected line shape" used for the final decision. For a two-dimensional projected line under a candidate plane, the algorithm discretizes it into a series of ordered points. For every three consecutive adjacent points in the point series, a straightness component of the angle formed by these three points is calculated. One feasible calculation method is to calculate the cosine of this angle; the absolute value reflects the degree of collinearity of the three points. The closer the absolute value is to 1, the closer it is to a straight line, i.e., the higher the local straightness. The algorithm calculates the straightness component for all such consecutive three-point groups in the projection line point series, and then takes the average of all components to obtain a single quantitative value representing the overall straightness of the projection line. The higher this value, the straighter the projection line.

[0115] Secondly, the algorithm establishes a clear final decision-making logic. This logic handles two cases: First, if the first candidate plane and the second candidate plane obtained in the initial step-by-step screening are the same plane, then this plane is directly determined as the optimal projection plane, without further calculation. Second, if the first candidate plane and the second candidate plane are different, then a comprehensive evaluation value is needed for comparison.

[0116] For each candidate plane to be compared (either the first or second candidate plane), the algorithm calculates its corresponding comprehensive evaluation value. This value integrates three normalized indicators: the first is the inverse indicator of the normalized root mean square distance (i.e., the smaller the distance, the larger the indicator value); the second is the normalized overlap indicator; and the third is the normalized value of the projected line straightness obtained from the previous calculation. The algorithm combines these three indicator values ​​into a single value, namely the comprehensive evaluation value of the plane, according to a pre-defined set of weights. The weight ratios reflect the degree of importance given to different indicators, and their sum is 1.

[0117] Finally, the algorithm compares the comprehensive evaluation values ​​of the first and second candidate planes and determines the candidate plane with the higher comprehensive evaluation value as the final optimal projection plane.

[0118] When different candidates are selected based on various metrics, the final decision often relies on a simple or subjective rule. For example, the winner based on a specific metric (such as flatness) might be directly designated as the final result, or the algorithm designer might make a subjective choice based on their experience. In this approach, "flatness" itself may lack a clear quantitative definition, and the decision rule may be rather vague.

[0119] The main problem with this approach lies in the lack of clarity in the decision-making process and the potential for suboptimal choices. Directly specifying a single indicator as the final criterion, while ignoring information reflected by other indicators, may result in selecting a plane that excels in one aspect but has serious deficiencies in others. If "flatness" is merely a vague, qualitative comparative concept, then decision-making will become difficult when the projected lines of two candidate planes appear visually similar in flatness, and the results may lack repeatability. The entire decision-making process lacks an objective, quantitative framework that comprehensively considers all relevant factors.

[0120] This method decomposes a potentially ambiguous decision-making process into three explicit steps: First, it provides a calculable quantitative definition for the crucial but ambiguous concept of "straightness"; second, it designs a comprehensive evaluation value calculation model that normalizes and weights multiple key indicators (alignment accuracy, overlap, and straightness) from different screening stages; finally, it performs an objective comparison based on this comprehensive evaluation value. This method transforms the final selection from a step that might rely on intuitive judgment into a deterministic process based on preset rules and numerical calculations. It aims to balance the contributions of different indicators, reduce the subjectivity and arbitrariness of decision-making, and ensure that the final optimal projection plane is the result of a comprehensive trade-off of multiple performance factors, thereby improving the rationality and consistency of the selection result.

[0121] To verify the effectiveness and accuracy of this method, comparative experiments were conducted on standard masonry walls. The method of this invention was compared with traditional manual measurement (feeler gauge) and pure point cloud segmentation methods. The results are as follows: the average deviation between the measurement results of the method of this invention and the manual measurement values ​​is ±0.3 mm; the failure rate of the pure point cloud segmentation method in the blurred area of ​​the mortar joint is approximately 25%; the average processing time for a single mortar joint of this invention is 1.2 seconds, meeting the requirements for rapid on-site inspection. Experiments show that this invention is superior to existing non-contact inspection methods in terms of accuracy, robustness, and efficiency.

[0122] Although embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and embodiments. It can be applied to various fields suitable for the present invention. Other modifications can be readily implemented by those skilled in the art. Therefore, the present invention is not limited to the specific details without departing from the general concept defined by the claims and their equivalents.

Claims

1. A method for detecting the thickness of mortar joints in masonry walls, characterized in that, Includes the following steps: Data acquisition steps: Simultaneously acquire two-dimensional color images and three-dimensional point cloud data of the target wall area, and establish the coordinate mapping relationship between the two; Initial localization step of the grout seam region: Perform grout seam semantic segmentation on the two-dimensional color image to obtain the initial mask of the grout seam pixel region; Three-dimensional target region focusing step: According to the coordinate mapping relationship, the initial mask is mapped to the three-dimensional point cloud data to obtain a candidate three-dimensional region containing the mortar joint and the surface of its adjacent bricks; Edge precision extraction step: Based on the normal features and spatial distribution features of the point cloud in the candidate three-dimensional region, the first spatial curve where the upper edge of the mortar joint is located and the second spatial curve where the lower edge is located are identified and fitted respectively. The first spatial curve and the second spatial curve are respectively generated by fitting the three-dimensional point cloud at the junction of the brick and the mortar joint in the candidate three-dimensional region. Thickness calculation steps: Select multiple first calculation points on the first spatial curve, and determine a corresponding second calculation point on the second spatial curve that is closest in normal distance or intersecting in projection for each first calculation point. Calculate the three-dimensional Euclidean distance between each pair of calculation points, and use the statistical value of these distances as the thickness value of the mortar joint.

2. The method for detecting the thickness of mortar joints in wall masonry according to claim 1, characterized in that, The precise edge extraction step includes: Point cloud normal estimation and initial classification sub-step: Calculate the normal vector of each 3D point in the candidate 3D region, and divide the point cloud in the candidate 3D region into a first category point cloud and a second category point cloud according to the clustering results of the normal vector direction. The angle between the normal vector direction of the first category point cloud and the normal vector direction of the main plane of the wall is less than a first threshold, and the angle between the normal vector direction of the second category point cloud and the normal vector direction of the main plane of the wall is greater than or equal to the first threshold. Brick surface subdivision and extraction sub-steps: In the first category of point cloud, based on the distribution of the spatial coordinates of the three-dimensional points in the vertical direction, separate the upper brick candidate point cloud located at the top and the lower brick candidate point cloud located at the bottom. Boundary point identification sub-step: For the upper brick candidate point cloud, the boundary points are identified as those three-dimensional points that simultaneously contain three-dimensional points belonging to both the upper brick candidate point cloud and the second category point cloud within a preset spatial neighborhood radius; For the lower brick candidate point cloud, the boundary points are identified as those three-dimensional points that simultaneously contain both three-dimensional points belonging to both the lower brick candidate point cloud and the second category point cloud within the preset spatial neighborhood radius. The spatial curve fitting sub-step is as follows: all boundary points identified as belonging to the candidate point cloud of the upper brick are fitted into the first spatial curve; all boundary points identified as belonging to the candidate point cloud of the lower brick are fitted into the second spatial curve.

3. The method for detecting the thickness of mortar joints in wall masonry according to claim 2, characterized in that, The specific steps of the space curve fitting sub-step are as follows: Model selection and fitting sub-steps: For the set of boundary points to be fitted, perform the following operations: The boundary point set is fitted with a variety of pre-defined candidate geometric models, and the goodness-of-fit index and model complexity cost for each model are calculated. Based on the goodness-of-fit index and the model complexity cost, the optimal model is selected from the multiple candidate geometric models, wherein the optimal model is the model that makes a comprehensive scoring function optimal, and the comprehensive scoring function is a weighted combination of the goodness-of-fit index and the model complexity cost. The optimal model is used to perform a final fitting on the set of boundary points to obtain either the first spatial curve or the second spatial curve.

4. The method for detecting the thickness of mortar joints in wall masonry according to claim 1, characterized in that, The thickness calculation steps are as follows: Local Corresponding Point Determination Sub-step: For any first calculation point on the first space curve, perform the following operations: Determine the direction of the first tangent line of the first space curve at the first calculation point; A first calculation plane is constructed, which is jointly determined by the first tangent direction and the direction perpendicular to the main plane of the wall; The second spatial curve is projected vertically onto the first calculation plane to obtain a second projection curve. On the first calculation plane, find the nearest point from the projection point of the first calculation point to the second projection curve. The preimage point of this nearest point on the second spatial curve is the second calculation point corresponding to the first calculation point. Thickness calculation and statistics sub-step: Calculate the three-dimensional Euclidean distance between all the first calculation points and their respective second calculation points, and use the statistical value of all the distance values ​​as the thickness value of the mortar joint.

5. The method for detecting the thickness of mortar joints in wall masonry according to claim 1, characterized in that, When the thickness calculation step uses the projection intersection method to determine the corresponding point, the following sub-steps are executed: Candidate projection plane set construction sub-step: Construct a set of candidate projection planes, wherein the normal vector of each candidate projection plane is determined based on statistical analysis of the overall orientation of the first space curve and the second space curve within a preset analysis segment; Optimal projection plane selection sub-step: For each candidate projection plane, project the first space curve and the second space curve perpendicularly onto the plane to obtain two two-dimensional projection lines; calculate the average Hausdorff distance between the two-dimensional projection lines; select the candidate projection plane with the smallest average Hausdorff distance as the optimal projection plane; Corresponding point analysis sub-step: On the optimal projection plane, for the first projection point on the first spatial curve projection line, find its nearest point on the second spatial curve projection line. The preimage point of this nearest point on the second spatial curve is the second calculation point corresponding to the first projection point.

6. The method for detecting the thickness of mortar joints in wall masonry according to claim 2, characterized in that, Following the point cloud normal estimation and initial classification sub-step, a classification result verification and correction sub-step is also included, which includes: For each 3D point in the first category of point cloud, check the proportion of points in its spatial neighborhood that belong to the first category of point cloud; If the proportion is lower than a preset neighborhood consistency threshold, the 3D point is removed from the first category point cloud and reclassified into the second category point cloud. For each 3D point in the second category point cloud, check the proportion of points in its spatial neighborhood that belong to the second category point cloud; If the proportion is lower than the neighborhood consistency threshold, the 3D point is removed from the second category point cloud and reclassified into the first category point cloud.

7. The method for detecting the thickness of mortar joints in wall masonry according to claim 3, characterized in that, The model selection and fitting sub-step also includes the following steps: Pre-screening and simplification steps: Before fitting the boundary point set, the boundary point set is first thinned and simplified, and the simplified point set is used to perform subsequent candidate model fitting and scoring. Adaptive threshold step: The weight coefficients in the comprehensive scoring function are dynamically adjusted according to the dispersion or noise level of the boundary point set. When the dispersion or noise level is higher than a preset standard, the weight of the model complexity cost in the scoring function is increased. Model validity verification steps: For the selected optimal model, check whether the distribution of its fitting residuals conforms to the preset random error distribution characteristics; if it does not conform, the model is determined to be invalid, and the preset default geometric model is used to fit the set of boundary points.

8. The method for detecting the thickness of mortar joints in wall masonry according to claim 4, characterized in that, The local corresponding point determination sub-step in the thickness calculation step is performed in the following manner: On the first spatial curve, a continuous curve segment containing the current first calculation point to be processed is extracted as a local curve segment, with the first calculation point to be processed as the center. Principal component analysis is performed on all three-dimensional points constituting the local curve segment, and the direction of the first principal component is determined as the main extension direction of the local curve segment. Calculate the average spatial position of all three-dimensional points on the local curve segment, and determine the direction vector from the origin to the average point as the average position direction of the local curve segment; The plane spanned by the main extension direction and the average position direction is used as the local projection plane for finding the corresponding second calculation point; The second spatial curve is projected vertically onto the local projection plane to obtain a two-dimensional projection line; On the local projection plane, find the nearest point from the projection point of the first calculation point to the two-dimensional projection line. The preimage point of this nearest point on the second space curve is the second calculation point corresponding to the first calculation point.

9. The method for detecting the thickness of mortar joints in wall masonry according to claim 5, characterized in that, The specific sub-step for constructing the candidate projection plane set is as follows: based on the tangent directions of the first spatial curve and the second spatial curve at each sampling point within the analysis segment, statistical analysis is performed to obtain the main trend direction; Around the main trend direction, rotational sampling is performed in three-dimensional space at preset angular intervals to generate a set of normal vectors; a candidate projection plane is determined by each normal vector and the spatial centroid of the analysis segment. The optimal projection plane selection sub-step is performed as follows: For each candidate projection plane, the projection lines of the first space curve and the second space curve on it are calculated respectively; the root mean square value of the normal distance between the two projection lines at multiple preset equidistant points is calculated; the candidate projection plane with the smallest root mean square value is selected as the first candidate plane; at the same time, the overlap index between the two projection lines is calculated. The candidate projection plane with the highest overlap index is selected as the second candidate plane; the straightness of the projection lines under the first candidate plane and the second candidate plane is compared, and the plane with higher straightness is selected as the optimal projection plane.

10. The method for detecting the thickness of mortar joints in wall masonry according to claim 9, characterized in that, The comprehensive comparison of the straightness of the projected lines under the first and second candidate planes is achieved in the following way: Straightness quantification sub-step: For each projection line under the candidate plane, discretize it into an ordered series of points, calculate the straightness component of the angle formed by every three consecutive adjacent points in the series of points, and take the average of the straightness components of all consecutive three-point groups to obtain the straightness quantification value of the projection line. The higher the straightness quantification value, the straighter the projection line. Furthermore, the final selection of the optimal projection plane is performed in the following manner: If the first candidate plane coincides with the second candidate plane, then it is directly determined as the optimal projection plane; If the first candidate plane and the second candidate plane are different, then the first comprehensive evaluation value corresponding to the first candidate plane and the second comprehensive evaluation value corresponding to the second candidate plane are calculated respectively. The comprehensive evaluation value of a candidate plane is obtained by synthesizing the inverse index of the normalized root mean square distance value, the normalized overlap index value, and the flatness quantification value corresponding to the plane according to a preset weight ratio. By comparing the first comprehensive evaluation value with the second comprehensive evaluation value, the candidate plane with the higher comprehensive evaluation value is determined as the optimal projection plane.