Scanning data processing method, device, three-dimensional scanning system and storage medium
By building a preset bounding box and tree data structure, the three-dimensional scanned data is filtered, which solves the problem that excess point cloud data outside the workpiece cannot be accurately filtered, and improves the efficiency and accuracy of three-dimensional reconstruction.
Patent Information
- Application Number
- CN202411571604.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-11-06
AI Technical Summary
In the prior art, excess point cloud data outside the artifact cannot be accurately filtered, resulting in large amount of data, low computing efficiency and poor reconstruction accuracy for subsequent point cloud reconstruction.
By obtaining the preset workpiece model data of the target workpiece, a preset bounding box, a first tree data structure and a second tree data structure are constructed, the current frame scanning data is obtained in real time, and the scan data is filtered according to these structures, and the point cloud data is updated frame by frame.
Accurate filtering of excess point cloud data outside the workpiece is realized, reducing the amount of data required for subsequent three-dimensional reconstruction, and improving computing efficiency and reconstruction accuracy.
Smart Images

Figure CN119063632B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of three-dimensional scanning, and in particular to a scanning data processing method, device, three-dimensional scanning system and storage medium. Background Art
[0002] In the process of 3D scanning of workpieces, it is inevitable to collect point cloud data outside the workpiece, resulting in redundant point cloud data in the collected data. In order to reduce the amount of data for subsequent point cloud reconstruction, improve computing efficiency and reconstruction accuracy, it is necessary to filter out the redundant point cloud data outside the collected workpiece.
[0003] At present, the point cloud outside the area is often filtered by delimiting the scanning area. The method of delimiting the scanning area includes using an axisymmetric bounding box, a directional bounding box or a spherical bounding box. In this way, there is still a lot of space outside the workpiece that is included in the bounding box, which makes it impossible to accurately filter some redundant point cloud data.
[0004] With regard to the problem in related technologies that redundant point cloud data outside the workpiece cannot be accurately filtered, no effective solution has been proposed so far. Summary of the invention
[0005] In this embodiment, a scanning data processing method, device, three-dimensional scanning system and storage medium are provided to solve the problem in the related art that redundant point cloud data outside the workpiece cannot be accurately filtered.
[0006] In a first aspect, a scan data processing method is provided in this embodiment, including:
[0007] Acquire preset workpiece model data of a target workpiece, and a target bounding box pre-constructed based on the workpiece model data; the target bounding box includes a preset bounding box, a first tree data structure, and a second tree data structure; wherein the first tree data structure is a tree data structure for recursive partitioning of a three-dimensional space; and the second tree data structure is a tree data structure for nearest neighbor search;
[0008] Acquire the current frame scanning data of the target workpiece in real time;
[0009] According to the preset bounding box, the current frame scan data is filtered to obtain first point cloud data of the current frame;
[0010] Filtering the first point cloud data of the current frame according to the first tree data structure and the second tree data structure to obtain second point cloud data of the current frame;
[0011] The next frame scan data is acquired, and the next frame scan data is used as new current frame scan data.
[0012] In some of the embodiments, before obtaining the target bounding box pre-constructed based on the workpiece model data, the method further includes:
[0013] Extracting model point cloud data of the workpiece model data;
[0014] Calculating a preset bounding box corresponding to the workpiece model data according to the model point cloud data;
[0015] The first tree data structure and the second tree data structure are constructed respectively according to preset configuration information and the model point cloud data; the preset configuration information includes resolution configuration information.
[0016] In some embodiments, obtaining preset workpiece model data of a target workpiece and a target bounding box pre-constructed based on the workpiece model data includes:
[0017] Reading initial model data of the target workpiece;
[0018] Performing point cloud processing on the initial model data to obtain feature point cloud data;
[0019] Pre-scanning the target workpiece to obtain a pre-scan model;
[0020] Performing feature alignment on the feature point cloud data and the pre-scan model, and converting the initial model data into a pre-established unified coordinate system according to the alignment result to obtain workpiece model data;
[0021] The target bounding box of the target workpiece is constructed according to the workpiece model data.
[0022] In some embodiments, filtering the first point cloud data of the current frame according to the first tree data structure and the second tree data structure to obtain the second point cloud data of the current frame includes:
[0023] Taking each coordinate point in the first point cloud data as a first target coordinate point in turn, recursively traversing a first target hierarchical structure corresponding to the first target coordinate point in the first tree data structure, and judging whether the target point is in the first tree data structure according to the traversal result; the depth of the first target hierarchical structure is a preset first depth;
[0024] Identify the coordinate points in the first tree data structure as reserved coordinate points, and identify the coordinate points outside the first tree data structure as coordinate points to be detected;
[0025] For each of the coordinate points to be detected, recursively traverse the second target hierarchical structure corresponding to the coordinate point to be detected in the second tree data structure to filter each of the coordinate points to be detected, and identify the filtered coordinate points as reserved coordinate points; the depth of the second target hierarchical structure is a preset second depth;
[0026] The point cloud data composed of all the reserved coordinate points are identified as the second point cloud data of the current frame.
[0027] In some of the embodiments, for each of the coordinate points to be detected, recursively traversing the second target hierarchical structure corresponding to the coordinate point to be detected in the second tree data structure to filter each of the coordinate points to be detected, and identifying the filtered coordinate points as reserved coordinate points, includes:
[0028] For each of the coordinate points to be detected, recursively traverse the second target hierarchical structure corresponding to the coordinate point to be detected in the second tree data structure to search for the nearest point corresponding to the coordinate point to be detected;
[0029] Calculate the distance between each coordinate point to be detected and the corresponding nearest point respectively, and obtain the target distance corresponding to the coordinate point to be detected;
[0030] The to-be-detected coordinate points whose target distance is less than a preset distance threshold are identified as reserved coordinate points.
[0031] In some of the embodiments, after obtaining the second point cloud data of all frames, the method further includes:
[0032] Point cloud stitching is performed on the second point cloud data of all frames, and point cloud fusion is performed on the stitching results to obtain a three-dimensional reconstructed model of the target workpiece.
[0033] In a second aspect, a scanning data processing device is provided in this embodiment, comprising: a first acquisition module, a second acquisition module, a first filtering module, a second filtering module and an update acquisition module; wherein:
[0034] The first acquisition module is used to acquire preset workpiece model data of the target workpiece and a target bounding box pre-constructed based on the workpiece model data; the target bounding box includes a preset bounding box, a first tree data structure and a second tree data structure; wherein the first tree data structure is a tree data structure for recursive partitioning of a three-dimensional space; and the second tree data structure is a tree data structure for nearest neighbor search;
[0035] The second acquisition module is used to acquire the current frame scanning data of the target workpiece in real time;
[0036] The first filtering module is used to filter the current frame scan data according to the preset bounding box to obtain first point cloud data of the current frame;
[0037] The second filtering module is used to filter the first point cloud data of the current frame according to the first tree data structure and the second tree data structure to obtain the second point cloud data of the current frame;
[0038] The update acquisition module is used to acquire the next frame scan data when the next frame scan data exists, and use the next frame scan data as the new current frame scan data.
[0039] In a third aspect, a three-dimensional scanning system is provided in this embodiment, comprising: a scanning device and a processor; wherein the scanning device is communicatively connected with the processor;
[0040] The scanning device is used to perform three-dimensional scanning on the target workpiece;
[0041] The processor is used to execute the scanning data processing method described in the first aspect above.
[0042] In a fourth aspect, an electronic device is provided in this embodiment, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the scanning data processing method described in the first aspect when executing the computer program.
[0043] In a fifth aspect, a storage medium is provided in this embodiment, on which a computer program is stored, and when the program is executed by a processor, the scanning data processing method described in the first aspect is implemented.
[0044] Compared with the related art, the present embodiment provides a scanning data processing method, device, three-dimensional scanning system and storage medium. The scanning data processing method obtains preset workpiece model data of the target workpiece, and a target bounding box pre-constructed based on the workpiece model data; the target bounding box includes a preset bounding box, a first tree data structure and a second tree data structure; wherein the first tree data structure is a tree data structure for recursive division of a three-dimensional space; the second tree data structure is a tree data structure for nearest neighbor search; the current frame scanning data of the target workpiece is obtained in real time; according to the preset bounding box, the current frame scanning data is filtered to obtain the first point cloud data of the current frame; according to the first tree data structure and the second tree data structure, the first point cloud data of the current frame is filtered to obtain the second point cloud data of the current frame; the next frame scanning data is obtained, and the next frame scanning data is used as the new current frame scanning data. It can achieve the matching of the filtering range with the shape of the workpiece based on the filtering processing of the three-dimensional bounding box, the first tree data structure and the second tree data structure, thereby improving the accuracy of filtering the redundant point cloud data outside the workpiece.
[0045] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0047] Figure 1 is a hardware structure block diagram of a terminal of the scan data processing method of this embodiment;
[0048] Figure 2 is a flow chart of the scan data processing method of this embodiment;
[0049] Figure 3 is a flowchart of a method for constructing a target bounding box in some of the embodiments;
[0050] Figure 4 is a flow chart of a point cloud data filtering method in some embodiments;
[0051] Figure 5 is a flowchart of a data filtering method based on a minimum bounding box in some of the embodiments;
[0052] Figure 6 is a structural block diagram of the scanning data processing device of this embodiment;
[0053] Figure 7 Schematic diagram of the structure of the three-dimensional scanning system of this embodiment. DETAILED DESCRIPTION
[0054] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0055] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with general skills in the technical field to which this application belongs. The words "one", "a", "the", "these" and the like in this application do not indicate a quantitative limitation, and they may be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" may mean: A exists alone, A and B exist at the same time, and B exists alone. Generally, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0056] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. For example, running on a terminal, Figure 1 FIG. 1 is a hardware structure diagram of a terminal of the scan data processing method of this embodiment. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 and a memory 104 for storing data, wherein the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA. The above terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0057] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the scan data processing method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0058] The transmission device 106 is used to receive or send data via a network. The above network includes a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0059] In this embodiment, a scanning data processing method is provided. Figure 2 is a flow chart of the scan data processing method of this embodiment. Figure 2 As shown, the process includes the following steps:
[0060] Step S210, obtaining preset workpiece model data of the target workpiece and a target bounding box pre-constructed based on the workpiece model data; the target bounding box includes a preset bounding box, a first tree data structure and a second tree data structure; wherein the first tree data structure is a tree data structure for recursive division of a three-dimensional space; and the second tree data structure is a tree data structure for nearest neighbor search.
[0061] The workpiece model data can be three-dimensional data in a pre-established unified coordinate system obtained by transforming a computer-aided design (CAD) model or a mesh model of the target workpiece. The workpiece model data is used to describe a virtual model of the target workpiece, and can accurately simulate the geometric structure, shape, size and relative relationship between the target workpiece, and can be used as a standard three-dimensional spatial feature representation of the target workpiece. In this step, a target bounding box of the target workpiece is constructed based on the workpiece model data. The target bounding box can be specifically determined based on a preset bounding box, a first tree data structure and a second tree data structure.
[0062] The preset bounding box may specifically be an oriented bounding box (OBB for short). An oriented bounding box is a geometric body used to describe the boundary of an object, and is defined as the smallest cuboid that contains a geometric object and is in any direction relative to the coordinate axis. The first tree data structure may specifically be a tree data structure for recursive partitioning of a three-dimensional space. In particular, the first tree data structure may be an octree, or other tree data structures that are similar to an octree and can also realize recursive partitioning of a three-dimensional space. The second tree data structure may specifically be a tree data structure for nearest neighbor search. Exemplarily, the second tree data structure may be a KD tree (K-Dimensional Tree), or other tree data structures that are similar to a KD tree and can also realize nearest neighbor search.
[0063] Specifically, the centroid and three main axes of the workpiece model data can be determined according to the workpiece model data, and on this basis, the directional bounding box that can cover the workpiece model data can be determined to achieve the construction of the above-mentioned preset bounding box. Exemplarily, the maximum depth of the first tree data structure can be set according to the complexity of the workpiece and the required accuracy. The initial cube is determined as the root node of the first tree data structure according to the maximum size of the above-mentioned workpiece model data, and then spatial segmentation is performed based on the root node. Specifically, the elements (such as point cloud data) in the workpiece model data are allocated to cubes that can be contained and have no child nodes. If the maximum depth of the first tree data structure is not reached, the cube containing the elements is subdivided into eight equal parts, and all the elements contained in the cube are allocated to eight child cubes. If the number of elements allocated to the child cube is not zero and is the same as that of the parent cube, the child cube stops subdividing. When the above-mentioned maximum depth is reached, the subdivision is also stopped. Based on this, the first tree data structure can be constructed.
[0064] In addition, for the second tree data structure, first determine the segmentation dimension and segmentation point. Then, create a root node based on the workpiece model data and the selected first dimension. Divide the data into two left and right subsets according to the segmentation point, and use them as inputs of the left and right subtrees respectively. Recursively construct subtrees, wherein for each subset, select the next dimension as the segmentation basis, and find the median on the dimension as the segmentation point. Recursively create left and right child nodes, and assign data points in the workpiece model data to the corresponding subtrees. Repeat this process until the depth limit of the tree is reached or each leaf node contains only one data point. Based on this, the construction of the second tree data structure can be achieved. In this step, the preset bounding box, the first tree data structure, and the second tree data structure are combined to form an overall target bounding box for filtering the scan data.
[0065] Step S220, real-time acquisition of the current frame scanning data of the target workpiece. The current frame scanning data may be the point cloud data of the current frame collected by scanning the target workpiece with a device such as a three-dimensional scanner. Data filtering may be performed once each frame of point cloud data of the target workpiece is scanned.
[0066] Step S230: Filter the current frame scan data according to the preset bounding box to obtain the first point cloud data of the current frame. After obtaining the current frame scan data, first determine whether each coordinate point in the current frame scan data falls within the preset bounding box, filter the coordinate points that fall outside the preset bounding box, and retain the coordinate points that fall within the preset bounding box to obtain the first point cloud data of the current frame.
[0067] Step S240: filtering the first point cloud data of the current frame according to the first tree data structure and the second tree data structure to obtain the second point cloud data of the current frame.
[0068] The first point cloud data retained after filtering by the preset bounding box is further filtered through the first tree data structure and the second tree data structure, so that the point cloud data in the first point cloud data that falls within the preset bounding box but is actually outside the target workpiece is filtered out, so as to further filter out the redundant data of the current frame in a manner that better fits the shape of the target workpiece, and obtain the second point cloud data of the current frame. Specifically, the first point cloud data can be filtered based on the traversal of the first tree data structure and the second tree data structure to obtain the second point cloud data of the current frame.
[0069] Step S250, obtaining the next frame scanning data, and using the next frame scanning data as the new current frame scanning data.
[0070] After completing the filtering of the current frame scan data, continue to obtain the next frame scan data, and use the next frame scan data as the new current frame scan data. Referring to the above steps S230 to S240, the redundant data in the new current frame scan data is filtered based on the target bounding box to obtain the second point cloud data of the new current frame.
[0071] It is understandable that after filtering all the frame scan data, the second point cloud data of all frames can be obtained, and then the 3D reconstruction model of the target workpiece can be obtained based on the second point cloud data of all frames. Thus, accurate 3D reconstruction of the target workpiece can be achieved.
[0072] In the related art, the collected scan data of the target workpiece is often filtered using an axisymmetric bounding box, a directional bounding box or a spherical bounding box. In this way, since there is still a lot of space outside the workpiece contained by the bounding box, there is a problem that some redundant point clouds cannot be accurately filtered.
[0073] This embodiment, through the above steps S210 to S250, respectively constructs a preset bounding box, a first tree data structure and a second tree data structure according to the workpiece model data; then, the preset bounding box, the first tree data structure and the second tree data structure are combined to form a target bounding box. Among them, the introduction of the preset bounding box, the first tree data structure and the second tree data structure at the same time can improve the accuracy of filtering redundant point cloud data while improving the judgment efficiency. The second tree data structure introduced can control the range of the target bounding box based on the distance threshold. Compared with the existing bounding box, the target bounding box provided in this embodiment is more closely matched to the target workpiece in shape, and can be used as the minimum bounding box for the target workpiece to accurately filter the redundant point cloud data as much as possible. Furthermore, it can reduce the amount of data that needs to be processed for subsequent three-dimensional reconstruction, improve data processing efficiency, and improve the accuracy of three-dimensional reconstruction.
[0074] In the above steps S210 to S250, preset workpiece model data of the target workpiece and a target bounding box pre-constructed based on the workpiece model data are obtained; the target bounding box includes a preset bounding box, a first tree data structure and a second tree data structure; wherein the first tree data structure is a tree data structure for recursive partitioning of a three-dimensional space; the second tree data structure is a tree data structure for nearest neighbor search; the current frame scanning data of the target workpiece is obtained in real time; according to the preset bounding box, the current frame scanning data is filtered to obtain the first point cloud data of the current frame; according to the first tree data structure and the second tree data structure, the first point cloud data of the current frame is filtered to obtain the second point cloud data of the current frame; the next frame scanning data is obtained, and the next frame scanning data is used as the new current frame scanning data. It can achieve the matching of the filtering range with the shape of the workpiece based on the filtering processing of the three-dimensional bounding box, the first tree data structure and the second tree data structure, thereby improving the accuracy of filtering the redundant point cloud data outside the workpiece.
[0075] In one embodiment, before obtaining the target bounding box pre-constructed based on the workpiece model data, the scanning data processing method may further include:
[0076] Extract model point cloud data of the workpiece model data; calculate a preset bounding box corresponding to the workpiece model data according to the model point cloud data; construct a first tree data structure and a second tree data structure according to preset configuration information and the model point cloud data; the preset configuration information includes resolution configuration information.
[0077] The workpiece model data is three-dimensional model data. First, each point cloud data in the workpiece model data is extracted to obtain the model point cloud data. Then, the corresponding direction bounding box is constructed according to the model point cloud data. For example, the center of mass of the direction bounding box is calculated according to the positions of all points in the model point cloud data. According to the relative positions of the center of mass and each model point cloud data, a covariance matrix is constructed. The covariance matrix reflects the degree of discreteness and correlation of the point cloud in each direction. The three main axis directions of the direction bounding box are determined by characteristic decomposition of the covariance matrix. Then, in the main axis direction, the maximum and minimum values of the model point cloud data in these directions are calculated respectively, and the length of the direction bounding box in each main axis direction is determined. Based on this, the direction bounding box corresponding to the target workpiece can be constructed, that is, the above-mentioned preset bounding box.
[0078] In addition, when constructing the first tree data structure and the second tree data structure, corresponding configuration information can be set according to the requirements of the actual application scenario. The first tree data structure and the second tree data structure are constructed according to the preset configuration information. Specifically, the above preset configuration information may include resolution configuration information. The resolution configuration information can be set according to the requirements of the actual application scenario, for example, taking into account the requirements for scanning efficiency and the effect that can be achieved after point cloud filtering. The resolution configuration information can specifically be a resolution threshold. For example, the depth of each of the first tree data structure and the second tree data structure can be set according to the above preset configuration information.
[0079] Exemplarily, when constructing the first tree data structure, a cube that wraps the entire model point cloud data can be first determined as the initial root node of the first tree data structure. After that, the current node (cube) is recursively divided into eight child nodes (child cubes). According to the coordinates of each point in the model point cloud data, the points are divided into corresponding child cubes until the preset division termination condition is met. The first tree data structure can also be represented in memory using nodes and pointers. Each node represents a cube area, and the pointer points to its child node. In addition, before constructing the first tree data structure, relevant parameters can be set, for example, controlling the number of points in the child cube, limiting the maximum depth of the first tree data structure, and determining a suitable space division strategy (uniform division, feature-based division, etc.). The parameter setting of the first tree data structure can be determined based on the above-mentioned preset configuration information.
[0080] Exemplarily, at the beginning of constructing the second tree data structure, it is necessary to select a dimension as the splitting dimension of the current node. According to the splitting dimension, the points in the model point cloud data are sorted according to the value of the splitting dimension. The sorted median is selected as the value of the current node, and the model point cloud data is divided into two parts: a point set less than or equal to the median and a point set greater than the median. Then, the subtree is recursively constructed. Specifically, for the point set less than or equal to the median, the left subtree is recursively constructed, and the splitting dimension selected is the next sequential dimension (for example, if the current node is divided according to the x-axis, the root node of the left subtree can be divided according to the y-axis). For the point set greater than the median, the right subtree is recursively constructed, and the next sequential dimension is also selected as the splitting dimension. When the point set under a node is empty or the depth of the second tree data structure reaches a preset depth threshold, the node becomes a leaf node and is no longer divided.
[0081] This embodiment implements the construction of a preset bounding box, a first tree data structure and a second tree data structure respectively according to the workpiece model data, and forms a new minimum bounding box based on the combination of the three, thereby providing an accurate filtering range for subsequent point cloud filtering.
[0082] Additionally, in one embodiment, based on the above step S210, obtaining preset workpiece model data of the target workpiece and pre-constructing a target bounding box based on the workpiece model data may include:
[0083] Read the initial model data of the target workpiece; perform point cloud processing on the initial model data to obtain feature point cloud data; pre-scan the target workpiece to obtain a pre-scan model; perform feature alignment on the feature point cloud data and the pre-scan model, and convert the initial model data to a pre-established unified coordinate system based on the alignment result to obtain the workpiece model data; construct a target bounding box of the target workpiece based on the workpiece model data.
[0084] The above-mentioned initial model data can specifically be the CAD data or mesh model data of the read target workpiece. First, the initial model data is point clouded to obtain the corresponding feature point cloud data. Then, in order to transform the coordinate system of the initial model data, the target workpiece is pre-scanned to obtain the pre-scan model of the target workpiece.
[0085] Optionally, in some of the embodiments, the target workpiece can be pre-scanned based on a tracker in a tracking 3D scanning system to obtain a pre-scan model in the same coordinate system. Then, the feature point cloud data is subjected to feature alignment processing with the pre-scan model, such as three-point alignment or best fit alignment, to determine the conversion relationship (rotation and translation matrix RT) of the initial model data to the same coordinate system, and obtain an alignment result. Then, the initial model data is converted to a unified coordinate system according to the alignment result to obtain the workpiece model data.
[0086] Optionally, in some other embodiments, a scanner in a handheld 3D scanning system can be used to pre-scan the marker points set in the scene to construct a unified coordinate system, and then the target workpiece is pre-scanned to obtain a pre-scan model in the unified coordinate system. The pre-scan model is then feature-aligned with the feature point cloud data to obtain workpiece model data in the unified coordinate system.
[0087] This embodiment performs coordinate system conversion processing on the model data of the target workpiece to convert it into a pre-established unified coordinate system, so as to facilitate filtering of subsequent scan data of the target workpiece in the unified coordinate system, thereby improving the convenience and accuracy of data processing.
[0088] In addition, in one embodiment, based on the above step S240, filtering the first point cloud data of the current frame according to the first tree data structure and the second tree data structure to obtain the second point cloud data of the current frame may include:
[0089] Take each coordinate point in the first point cloud data as the first target coordinate point in turn, recursively traverse the first target hierarchical structure corresponding to the first target coordinate point in the first tree data structure, and judge whether the target point is in the first tree data structure according to the traversal result; the depth of the first target hierarchical structure is a preset first depth; identify the coordinate points in the first tree data structure as reserved coordinate points, and identify the coordinate points outside the first tree data structure as coordinate points to be detected; for each coordinate point to be detected, recursively traverse the second target hierarchical structure corresponding to the coordinate point to be detected in the second tree data structure to filter each coordinate point to be detected, and identify the filtered coordinate points as reserved coordinate points; the depth of the second target hierarchical structure is a preset second depth; identify the point cloud data composed of all the reserved coordinate points as the second point cloud data of the current frame.
[0090] In this embodiment, the first point cloud data of the current frame is filtered through the first tree data structure and the second tree data structure in turn. That is, the first point cloud data is first filtered according to the first tree data structure, and the coordinate points in the first tree data structure are directly identified as the reserved coordinate points, while the coordinate points outside the first tree data structure are identified as the coordinate points to be detected. For the coordinate points to be detected, the second tree data structure is continued to be filtered, and the coordinate points retained after filtering are also identified as the reserved coordinate points. Finally, all the reserved coordinate points are used as the second point cloud data of the current frame retained after filtering.
[0091] In the overall judgment and filtering process, the efficiency of the directional bounding box is higher than that of the first tree data structure, and the efficiency of the first tree data structure is higher than that of the second tree data structure. Therefore, this embodiment takes into account the accuracy and judgment efficiency of filtering redundant point cloud data, introduces a directional bounding box, a first tree data structure, and a second tree data structure to form a target bounding box, and in the judgment order, uses the directional bounding box to filter the coordinate points outside the directional bounding box, and uses the retained coordinate points as the first point cloud data to determine whether the first point cloud data falls into the first tree data structure. If so, the point is retained and identified as a retained coordinate point; otherwise, the coordinate point is further judged based on the second tree data structure. Therefore, this embodiment can take into account both judgment efficiency and data filtering accuracy through the setting of the above judgment order.
[0092] In particular, in the process of filtering based on the first tree data structure, recursive traversal is performed in the first tree data structure for each coordinate point in the first point cloud data. In order to further improve the traversal efficiency, the corresponding partial hierarchical structure that needs to be traversed can be determined in advance in the first tree data structure according to the position of the coordinate point currently being filtered and judged, as the corresponding first target hierarchical structure, and recursive traversal is performed in the first target hierarchical structure, rather than recursive traversal in the entire first tree data structure, so as to reduce the traversal time and improve the traversal efficiency. During the traversal process, if it is determined that the current first target coordinate point is in a node of the first tree data structure, the first target coordinate point is identified as a reserved coordinate point; at this time, the filtering judgment of the point is terminated, and the next coordinate point in the first point cloud data is read as the first target coordinate point, and the filtering judgment is performed in the first tree data structure. For the coordinate points located outside the first tree data structure, the second tree data structure is continued to be used for filtering judgment.
[0093] Based on this, this embodiment can achieve the efficiency of traversal in the first tree data structure, thereby improving the overall data processing efficiency.
[0094] In one embodiment, for each coordinate point to be detected, recursively traversing the second target hierarchical structure corresponding to the coordinate point to be detected in the second tree data structure to filter each coordinate point to be detected, and identifying the filtered coordinate point as a reserved coordinate point may include:
[0095] For each coordinate point to be detected, the second target hierarchy structure corresponding to the coordinate point to be detected in the second tree data structure is recursively traversed to search for the nearest point corresponding to the coordinate point to be detected; the distance between each coordinate point to be detected and the corresponding nearest point is calculated to obtain the target distance corresponding to the coordinate point to be detected; the coordinate point to be detected whose target distance is less than a preset distance threshold is identified as a retained coordinate point.
[0096] Accordingly, when recursively traversing the second tree data structure, the corresponding partial hierarchical structure can be determined from the second tree data structure as the second target hierarchical structure for recursive traversal according to the position of the coordinate point to be detected that needs to be filtered and judged, and recursive traversal of the entire second tree data structure can be avoided. In this way, the time overhead of traversing the second tree data structure for each coordinate point to be detected can be reduced, and the traversal efficiency can be improved.
[0097] In the recursive traversal process, the nearest point corresponding to the current coordinate point to be detected is searched from the second tree data structure. If the distance between the nearest point and the current coordinate point to be detected is less than the preset distance threshold, the current coordinate point to be detected is identified as a reserved coordinate point; otherwise, the current coordinate point to be detected is discarded. Finally, all the reserved coordinate points are used as the second point cloud data corresponding to the current frame.
[0098] This embodiment can improve the efficiency of the recursive traversal by optimizing the recursive traversal of the second tree data structure, thereby improving the overall data processing efficiency.
[0099] In addition, in one embodiment, after obtaining the second point cloud data of all frames, the scanning data processing method may further include:
[0100] The second point cloud data of all frames are stitched, and the stitching results are fused to obtain a three-dimensional reconstructed model of the target workpiece.
[0101] That is, after the above-mentioned filtering of the redundant point cloud data is completed, the second point cloud data retained by all frame scanning data is spliced between frames. Then, point cloud fusion is performed on the basis of point cloud splicing to obtain a three-dimensional reconstructed model of the target workpiece. The specific point cloud splicing process and point cloud fusion process can be implemented based on the splicing method and fusion method in the current three-dimensional scanning scene, and this embodiment does not specifically limit this.
[0102] Figure 3 is a flowchart of a method for constructing a target bounding box in some of the embodiments, such as Figure 3 As shown, the target bounding box construction method includes the following steps:
[0103] Step S301, obtaining workpiece model data; wherein the workpiece model data can be obtained based on a CAD model or a mesh model.
[0104] Step S302: extracting point cloud data from the workpiece model data to obtain model point cloud data.
[0105] Step S303, constructing a target bounding box according to the model point cloud data; wherein the target bounding box includes a directional bounding box, an octree, and a KD tree.
[0106] Figure 4 is a flow chart of a point cloud data filtering method in some embodiments, such as Figure 4 As shown, the steps of the point cloud data filtering method include:
[0107] Step S401 : filtering the current frame scanning data collected in real time according to the direction bounding box, and filtering out the coordinate points falling outside the direction bounding box.
[0108] Step S402: The coordinate point within the direction bounding box is judged again through the octree. If it is in the structure of the octree, it is identified as a reserved coordinate point.
[0109] Step S403, for the coordinate points outside the octree structure, the KD tree is used to filter again, the nearest point is searched in the KD tree, and the coordinate points whose distance to the nearest point is less than a preset distance threshold are identified as reserved coordinate points.
[0110] Step S404: taking all the retained coordinate points of the current frame as the point cloud data retained after filtering the current frame.
[0111] Figure 5 is a flowchart of a data filtering method based on a minimum bounding box in some of the embodiments, such as Figure 5 As shown, the data filtering method based on the minimum bounding box includes the following steps:
[0112] Step S501, obtaining the current coordinate point of the current frame scan data; wherein each coordinate point in the current frame scan data is sequentially used as the current coordinate point.
[0113] Step S502, determine whether the current coordinate point falls within the direction bounding box; if so, execute step S503; otherwise, execute step S505.
[0114] Step S503, traverse the octree according to the current coordinate point to determine whether the current coordinate point falls into the octree structure; if so, execute step S504; otherwise, execute step S506.
[0115] Step S504: Identify the current coordinate point as a reserved coordinate point.
[0116] Step S505, discard the current coordinate point.
[0117] Step S506, traverse the KD tree according to the current coordinate point to find the nearest point of the current coordinate point in the KD tree.
[0118] Step S507, determining whether the distance between the current coordinate point and the nearest point is greater than a preset distance threshold; if so, executing step S504; otherwise, executing step S505.
[0119] In this embodiment, a scanning data processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made are not repeated here. The terms "module", "unit", "subunit" and the like used below may be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation in hardware, or a combination of software and hardware, is also possible and conceivable.
[0120] Figure 6 is a structural block diagram of the scanning data processing device 60 of this embodiment. Figure 6 As shown, the scan data processing device 60 includes: a first acquisition module 61, a second acquisition module 62, a first filtering module 63, a second filtering module 64 and an update acquisition module 65; wherein:
[0121] The first acquisition module 61 is used to acquire preset workpiece model data of the target workpiece, and a target bounding box pre-constructed based on the workpiece model data; the target bounding box includes a preset bounding box, a first tree data structure and a second tree data structure; wherein the first tree data structure is a tree data structure for recursive division of a three-dimensional space; the second tree data structure is a tree data structure for nearest neighbor search; the second acquisition module 62 is used to acquire the current frame scanning data of the target workpiece in real time; the first filtering module 63 is used to filter the current frame scanning data according to the preset bounding box to obtain the first point cloud data of the current frame; the second filtering module 64 is used to filter the first point cloud data of the current frame according to the first tree data structure and the second tree data structure to obtain the second point cloud data of the current frame; the update acquisition module 65 is used to acquire the next frame scanning data if there is a next frame scanning data, and use the next frame scanning data as the new current frame scanning data.
[0122] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0123] In this embodiment, a three-dimensional scanning system is also provided. Figure 7 is a schematic diagram of the structure of the three-dimensional scanning system 70 of this embodiment, as shown in Figure 7 As shown, the three-dimensional scanning system 70 includes: a scanning device 72 and a processor 74; wherein the scanning device 72 is in communication connection with the processor 74;
[0124] The scanning device 72 is used to perform three-dimensional scanning on the target workpiece; the processor 74 is used to execute the scanning data processing method provided in the above embodiment.
[0125] In this embodiment, an electronic device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0126] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0127] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0128] S1, obtaining preset workpiece model data of the target workpiece and a target bounding box pre-constructed based on the workpiece model data; the target bounding box includes a preset bounding box, a first tree data structure and a second tree data structure; wherein the first tree data structure is a tree data structure for recursive partitioning of a three-dimensional space; and the second tree data structure is a tree data structure for nearest neighbor search;
[0129] S2, real-time acquisition of the current frame scanning data of the target workpiece;
[0130] S3, filtering the current frame scan data according to the preset bounding box to obtain the first point cloud data of the current frame;
[0131] S4, filtering the first point cloud data of the current frame according to the first tree data structure and the second tree data structure to obtain the second point cloud data of the current frame;
[0132] S5, obtaining the next frame scanning data, and using the next frame scanning data as the new current frame scanning data.
[0133] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and will not be repeated in this embodiment.
[0134] In addition, in combination with the scan data processing method provided in the above embodiments, a storage medium may be provided in this embodiment to implement the method. The storage medium stores a computer program; when the computer program is executed by a processor, any scan data processing method in the above embodiments is implemented.
[0135] It should be understood that the specific embodiments described herein are only used to explain the application, rather than to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of this application.
[0136] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0137] Obviously, the drawings are only some examples or embodiments of the present application. For ordinary technicians in the field, the present application can also be applied to other similar situations based on these drawings without creative work. In addition, it is understandable that although the work done in this development process may be complicated and lengthy, for ordinary technicians in the field, certain changes in design, manufacturing or production based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient content disclosed in this application.
[0138] The term "embodiment" in this application refers to a specific feature, structure or characteristic described in conjunction with the embodiment that can be included in at least one embodiment of the present application. The appearance of this phrase in various locations in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. It is clearly or implicitly understood by those of ordinary skill in the art that the embodiments described in this application can be combined with other embodiments without conflict.
[0139] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of patent protection. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the scope of protection of the present application. Therefore, the scope of protection of the present application shall be subject to the attached claims.
Claims
1. A scanning data processing method, characterized in that: include: Acquire preset workpiece model data of the target workpiece and a target bounding box pre-constructed based on the workpiece model data; The target bounding box includes a preset bounding box, a first tree data structure and a second tree data structure; wherein the first tree data structure is a tree data structure for recursive partitioning of a three-dimensional space; and the second tree data structure is a tree data structure for nearest neighbor search; Acquire the current frame scanning data of the target workpiece in real time; According to the preset bounding box, the current frame scan data is filtered to obtain first point cloud data of the current frame; Taking each coordinate point in the first point cloud data as a first target coordinate point in turn, recursively traversing a first target hierarchical structure corresponding to the first target coordinate point in the first tree data structure, and judging whether the first target coordinate point is in the first tree data structure according to the traversal result; the depth of the first target hierarchical structure is a preset first depth; Identify the coordinate points in the first tree data structure as reserved coordinate points, and identify the coordinate points outside the first tree data structure as coordinate points to be detected; For each of the coordinate points to be detected, recursively traverse the second target hierarchical structure corresponding to the coordinate point to be detected in the second tree data structure to filter each of the coordinate points to be detected, and identify the filtered coordinate points as reserved coordinate points; the depth of the second target hierarchical structure is a preset second depth; Identify the point cloud data composed of all the reserved coordinate points as the second point cloud data of the current frame; The next frame scan data is acquired, and the next frame scan data is used as new current frame scan data.
2. The scanning data processing method according to claim 1, characterized in that: Before obtaining the target bounding box pre-constructed based on the workpiece model data, the method further includes: Extracting model point cloud data of the workpiece model data; Calculating a preset bounding box corresponding to the workpiece model data according to the model point cloud data; The first tree data structure and the second tree data structure are constructed respectively according to preset configuration information and the model point cloud data; the preset configuration information includes resolution configuration information.
3. The scanning data processing method according to claim 1, characterized in that: Acquiring preset workpiece model data of a target workpiece and a target bounding box pre-constructed based on the workpiece model data, including: Reading initial model data of the target workpiece; Performing point cloud processing on the initial model data to obtain feature point cloud data; Pre-scanning the target workpiece to obtain a pre-scan model; Performing feature alignment on the feature point cloud data and the pre-scan model, and converting the initial model data into a pre-established unified coordinate system according to the alignment result to obtain workpiece model data; The target bounding box of the target workpiece is constructed according to the workpiece model data.
4. The scanning data processing method according to claim 1, characterized in that: For each of the coordinate points to be detected, recursively traverse the second target hierarchical structure corresponding to the coordinate point to be detected in the second tree data structure to filter each of the coordinate points to be detected, and identify the filtered coordinate points as reserved coordinate points, including: For each of the coordinate points to be detected, recursively traverse the second target hierarchical structure corresponding to the coordinate point to be detected in the second tree data structure to search for the nearest point corresponding to the coordinate point to be detected; Calculate the distance between each coordinate point to be detected and the corresponding nearest point respectively, and obtain the target distance corresponding to the coordinate point to be detected; The coordinate points to be detected whose target distance is less than a preset distance threshold are identified as reserved coordinate points.
5. The scanning data processing method according to any one of claims 1 to 4, characterized in that: After obtaining the second point cloud data of all frames, the method further includes: Point cloud stitching is performed on the second point cloud data of all frames, and point cloud fusion is performed on the stitching results to obtain a three-dimensional reconstructed model of the target workpiece.
6. A scanning data processing device, characterized in that: include: A first acquisition module, a second acquisition module, a first filtering module, a second filtering module and an update acquisition module; wherein: The first acquisition module is used to acquire preset workpiece model data of the target workpiece and a target bounding box pre-constructed based on the workpiece model data; the target bounding box includes a preset bounding box, a first tree data structure and a second tree data structure; wherein the first tree data structure is a tree data structure for recursive partitioning of a three-dimensional space; and the second tree data structure is a tree data structure for nearest neighbor search; The second acquisition module is used to acquire the current frame scanning data of the target workpiece in real time; The first filtering module is used to filter the current frame scan data according to the preset bounding box to obtain first point cloud data of the current frame; The second filtering module is used to take each coordinate point in the first point cloud data as a first target coordinate point in turn, recursively traverse the first target hierarchical structure corresponding to the first target coordinate point in the first tree data structure, and determine whether the first target coordinate point is in the first tree data structure according to the traversal result; the depth of the first target hierarchical structure is a preset first depth; identify the coordinate points in the first tree data structure as reserved coordinate points, and identify the coordinate points outside the first tree data structure as coordinate points to be detected; for each coordinate point to be detected, recursively traverse the second target hierarchical structure corresponding to the coordinate point to be detected in the second tree data structure to filter each of the coordinate points to be detected, and identify the filtered coordinate points as reserved coordinate points; the depth of the second target hierarchical structure is a preset second depth; identify the point cloud data composed of all the reserved coordinate points as the second point cloud data of the current frame; The update acquisition module is used to acquire the next frame scan data when the next frame scan data exists, and use the next frame scan data as the new current frame scan data.
7. A three-dimensional scanning system, characterized in that: include: A scanning device and a processor; wherein the scanning device is communicatively connected to the processor; The scanning device is used to perform three-dimensional scanning on the target workpiece; The processor is used to execute the scan data processing method according to any one of claims 1 to 5.
8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the scan data processing method according to any one of claims 1 to 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the scan data processing method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Laser point cloud data management method based on octree and three-dimensional R star tree integration
CN106095907A
Three-dimensional point cloud data reduction method and apparatus for complex ship hull plate
CN106951643A