Point cloud data storage method and related device
By dividing point cloud data into pyramid tiles and data tiles, efficient storage and simplification of massive point cloud data is achieved, and the problem of excessive storage space is solved, ensuring memory savings and data simplification effectiveness.
Patent Information
- Application Number
- CN202411005891.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-11-19
AI Technical Summary
The existing technology cannot effectively process massive point cloud data, resulting in excessive storage space occupied, and compression technology requires reading data into memory for processing, which cannot be used when the memory limit exceeds.
By dividing point cloud data into pyramid tiles and data tiles, determining the corresponding pyramid tiles based on the coordinates of point cloud data, and writing the data in the data tiles to the database when the preset number is reached, clearing the memory. Implement segmented storage and simplification of data.
It saves memory, facilitates database management, avoids the problem of excessive memory usage caused by excessive data tiles, and ensures effective simplification of point cloud data.
Smart Images

Figure CN118981548A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a point cloud data storage method and related devices. Background Art
[0002] Point cloud data collection is done by machines, and a small area can easily generate hundreds of GB of data. This amount of data must be sampled and compressed by the point cloud sparse algorithm before it can be displayed normally on the computer. However, existing point cloud compression technologies are all based on memory implementation, and the point cloud data must first be read into the computer memory and then compressed. If the amount of point cloud data far exceeds the size of the computer memory and cannot be read into the memory, these compression technologies will not work.
[0003] Therefore, there is an urgent need for a method to quickly and efficiently simplify massive point cloud data to save storage space. Summary of the invention
[0004] The main purpose of the present invention is to provide a point cloud data storage method, device, computer equipment and storage medium, which can solve the problem of excessive space occupation caused by excessive point cloud data volume in the prior art.
[0005] To achieve the above object, the present invention provides a point cloud data storage method in a first aspect, the method comprising:
[0006] Acquire a point cloud data set to be stored, wherein the point cloud data set contains at least one point cloud data, traverse the point cloud data set, and for the traversed target point cloud data, determine the pyramid tile corresponding to the target point cloud data based on the coordinates of the target point cloud data, acquire the data tile corresponding to the pyramid tile, store the target point cloud data in the data tile, and if the number of point cloud data currently stored in the data tile reaches a preset number, write the point cloud data stored in the data tile into a database, clear the point cloud data stored in the data tile, and traverse the next point cloud data until all the point cloud data in the point cloud data set are traversed;
[0007] The point cloud data stored in the database are placed into corresponding data tiles, and the data tiles are traversed in sequence according to the levels of the pyramid tiles corresponding to the data tiles. For the traversed target data tiles, the point cloud data in the target data tiles are simplified, the simplified point cloud data in the target data tiles are written into the database, and the simplified point cloud data in the target data tiles are cleared.
[0008] In combination with the first aspect, in a possible implementation manner, determining the pyramid tile corresponding to the target point cloud data based on the coordinates of the target point cloud data includes:
[0009] Acquire the coordinates of the target point cloud data, calculate the name of the pyramid tile according to the coordinates of the target point cloud data, a preset pyramid base point, a pyramid level, and a preset pyramid tile size, and obtain the target name;
[0010] If there is a pyramid tile with the same name as the target name, the pyramid tile with the same name is determined as the pyramid tile corresponding to the target point cloud data; if there is no pyramid tile with the same name as the target name, a new pyramid tile with the target name is created as the pyramid tile corresponding to the target point cloud data.
[0011] In combination with the first aspect, in a possible implementation, the name of the pyramid tile is calculated according to the coordinates of the target point cloud data, the preset pyramid base point, the pyramid level, and the preset pyramid tile size, and the calculation formula for obtaining the target name is as follows:
[0012] name=((pt-basePt) / length,level)
[0013] Among them, name represents the target name, pt represents the coordinates of the target point cloud data, basePt represents the preset pyramid base point, length represents the preset pyramid tile size, and level represents the level of the current pyramid tile.
[0014] In combination with the first aspect, in a possible implementation manner, the step of obtaining the data tile corresponding to the pyramid tile includes:
[0015] If the pyramid tile corresponding to the target point cloud data is determined by a pyramid tile with the same name as the target name, the corresponding data tile is obtained through the data tile index stored in the pyramid tile corresponding to the target point cloud data; the data tile index has a one-to-one correspondence with the data tile;
[0016] If the pyramid tile corresponding to the target point cloud data is a newly created pyramid tile with the target name, a new data tile is created, and the newly created data tile is determined as the data tile corresponding to the pyramid tile.
[0017] In combination with the first aspect, in a possible implementation, the step of creating a new data tile further includes:
[0018] The newly created data tile is placed in an array for storing data tiles, the subscript of the element storing the newly created data tile in the array is determined as the data tile index used to determine the data tile, and the data tile index is stored in the pyramid tile corresponding to the target point cloud data.
[0019] In combination with the first aspect, in a possible implementation manner, the method further includes:
[0020] Determine the parent tiles of the pyramid tiles corresponding to the point cloud data sets respectively;
[0021] The simplifying the point cloud data in the target data tile and writing the simplified point cloud data in the target data tile into a database comprises:
[0022] Outputting the simplified point cloud data in the target data tile corresponding to the bottom-level pyramid tile to the parent tile of the bottom-level pyramid tile, simplifying the point cloud data in the parent tile of the bottom-level pyramid tile, and obtaining the first point cloud data after further simplification;
[0023] Outputting the first point cloud data and the simplified point cloud data in the target data tile corresponding to the target upper pyramid tile to the parent tile of the target upper pyramid tile, simplifying the point cloud data in the parent tile of the target upper pyramid tile, and obtaining the second simplified point cloud data; wherein the target upper pyramid tile is the lowest level pyramid tile in the upper pyramid tile of the lowest level pyramid tile;
[0024] The target upper pyramid tile is set as the bottom-level pyramid tile, the second point cloud data is set as the first point cloud data, and the simplified point cloud data in the target data tile corresponding to the first point cloud data and the target upper pyramid tile is returned to the step of outputting the simplified point cloud data to the parent tile of the target upper pyramid tile until the parent tile of the target upper pyramid tile is the topmost parent tile;
[0025] Write the simplified point cloud data output by the top parent tile into the database.
[0026] In combination with the first aspect, in a possible implementation manner, the above-mentioned respectively determining the parent tiles of the pyramid tiles corresponding to the point cloud data sets includes:
[0027] According to the levels of the pyramid tiles, the pyramid tiles are traversed in sequence, and for the traversed target pyramid tile, the corresponding parent tile is calculated based on the pyramid tile size of the target pyramid tile, and the parent tile name is calculated according to the coordinates of the target point cloud data, the preset pyramid base point, the pyramid level and the parent tile size;
[0028] If there is a parent tile with the same name as the parent tile, the parent tile with the same name as the parent tile is determined as the parent tile of the target pyramid tile; if there is no parent tile with the same name as the parent tile, a new parent tile of the target pyramid tile is created.
[0029] To achieve the above object, the second aspect of the present invention provides a point cloud data storage device, the device comprising:
[0030] Data traversal module: used to obtain a point cloud data set to be stored, wherein the point cloud data set contains at least one point cloud data, traverse the point cloud data set, determine the pyramid tile corresponding to the target point cloud data based on the coordinates of the target point cloud data, obtain the data tile corresponding to the pyramid tile, store the target point cloud data in the data tile, if the number of point cloud data currently stored in the data tile reaches a preset number, write the point cloud data stored in the data tile into a database, clear the point cloud data stored in the data tile, and traverse the next point cloud data until all the point cloud data in the point cloud data set are traversed;
[0031] Data simplification module: used to put the point cloud data stored in the database into the corresponding data tile, traverse the data tiles in sequence according to the levels of the pyramid tiles corresponding to the data tiles, simplify the point cloud data in the traversed target data tile, write the simplified point cloud data in the target data tile into the database, and clear the simplified point cloud data in the target data tile.
[0032] To achieve the above object, the third aspect of the present invention provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor performs the following steps:
[0033] Acquire a point cloud data set to be stored, wherein the point cloud data set contains at least one point cloud data, traverse the point cloud data set, and for the traversed target point cloud data, determine the pyramid tile corresponding to the target point cloud data based on the coordinates of the target point cloud data, acquire the data tile corresponding to the pyramid tile, store the target point cloud data in the data tile, and if the number of point cloud data currently stored in the data tile reaches a preset number, write the point cloud data stored in the data tile into a database, clear the point cloud data stored in the data tile, and traverse the next point cloud data until all the point cloud data in the point cloud data set are traversed;
[0034] The point cloud data stored in the database are placed into corresponding data tiles, and the data tiles are traversed in sequence according to the levels of the pyramid tiles corresponding to the data tiles. For the traversed target data tiles, the point cloud data in the target data tiles are simplified, the simplified point cloud data in the target data tiles are written into the database, and the simplified point cloud data in the target data tiles are cleared.
[0035] To achieve the above object, a fourth aspect of the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps:
[0036] Acquire a point cloud data set to be stored, wherein the point cloud data set contains at least one point cloud data, traverse the point cloud data set, and for the traversed target point cloud data, determine the pyramid tile corresponding to the target point cloud data based on the coordinates of the target point cloud data, acquire the data tile corresponding to the pyramid tile, store the target point cloud data in the data tile, and if the number of point cloud data currently stored in the data tile reaches a preset number, write the point cloud data stored in the data tile into a database, clear the point cloud data stored in the data tile, and traverse the next point cloud data until all the point cloud data in the point cloud data set are traversed;
[0037] The point cloud data stored in the database are placed into corresponding data tiles, and the data tiles are traversed in sequence according to the levels of the pyramid tiles corresponding to the data tiles. For the traversed target data tiles, the point cloud data in the target data tiles are simplified, the simplified point cloud data in the target data tiles are written into the database, and the simplified point cloud data in the target data tiles are cleared.
[0038] The embodiments of the present invention have the following beneficial effects:
[0039] The present invention provides a point cloud data storage method. For traversed target point cloud data, a pyramid tile corresponding to the target point cloud data is determined based on the coordinates of the target point cloud data, a data tile corresponding to the pyramid tile is obtained, and the target point cloud data is stored in the data tile. If the number of point cloud data stored in the current data tile reaches a preset number, the point cloud data stored in the data tile is written into a database, and the point cloud data stored in the data tile is cleared. The next point cloud data is traversed until all point cloud data in a point cloud data set are traversed, the point cloud data stored in the database is put into the corresponding data tile, and the data tiles are traversed in sequence according to the levels of the pyramid tiles corresponding to the data tiles. For the traversed target data tile, the point cloud data in the target data tile is simplified, the simplified point cloud data in the target data tile is written into the database, and the simplified point cloud data in the target data tile is cleared. The present invention separates data tiles from pyramid tiles, which saves memory on the one hand and makes it more convenient to manage database data on the other hand. If the number of point cloud data stored in the current data tile reaches a preset number, the point cloud data stored in the data tile is written into the database. This can ensure that each data tile stores valid point cloud data on the basis of dividing the point cloud data, and no empty tiles are generated. Since the more data tiles are processed at the same time, the more memory will be occupied. In addition, if the amount of point cloud data processed is too large, it is easy to cause data simplification failure. Therefore, the present invention can ensure that memory is saved as much as possible and the effectiveness of simplification can be ensured by simplifying the point cloud data of a single data tile in turn. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] in:
[0042] Figure 1 A schematic diagram of a process of a point cloud data storage method according to an embodiment of the present invention;
[0043] Figure 2 A data flow diagram provided by an embodiment of the present invention in an embodiment of the present invention;
[0044] Figure 3 This is a structural block diagram of a point cloud data storage device in an embodiment of the present invention;
[0045] Figure 4 4 is a structural block diagram of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] An embodiment of the present invention provides a point cloud data storage method, which can be applied to any scenario of storing point cloud data. The method actually provides a point cloud data simplification technology, which can be executed by a terminal device. The point cloud data simplification technology mainly involves three modules: pyramid tiles (BaseTile), data tiles (TileData), and containers (TileManager).
[0048] The following will introduce the functions of the three modules in turn:
[0049] Pyramid tile: Pyramid is a structure. Refer to Table 1, which gives the variables and meanings contained in the pyramid tile.
[0050] Table 1
[0051]
[0052] Among the above five variables, _name can be used as a pyramid tile index, where x, y, and z represent the position sequence of the pyramid tiles, which can be understood as the serial number representing the pyramid tile relative to the reference point. Level represents the pyramid level, generally starting from level = 0 and increasing downward according to the octave book. Each pyramid tile corresponds to a data tile, and the corresponding data tile can be found through the data tile index _index in the pyramid tile. The pyramid tile index data tile uses the int type, and the data tile index can actually be the element subscript used to store the data tile in the array storing the data tile. From this, we can also know that the data tile is an array structure, and the pyramid tile and the data tile can be stored together in the container. Among them, the key for storing the pyramid tile can be composed of a string concatenated by _name. This index can greatly improve efficiency when building a pyramid. Another point to note is that both pyramid tiles and data tiles are stored as objects in the container, and finding these objects is done using subscripts or pointers. Generally, the pyramid records child nodes and parent nodes using object pointers. However, in order to make the entire process more efficient and safe, the present invention does not use smart pointers, thus avoiding the overhead of frequent construction and destruction of smart pointers. At the same time, the actual structure data is saved so that all memory can be released normally after the point cloud data storage is completed.
[0053] Data tiles: Refer to Table 2, which shows the variables and meanings contained in the data tiles.
[0054] Table 2
[0055]
[0056] The main function of the data tile is to exchange data with the database, so _uri is used to record the database link. Through _uri, the point cloud data contained in the current data tile can be found accurately and quickly. The database in the present invention can adopt a disk database, and the disk database can be a disk file, so _uri can be a string representing the file path name. If other databases are used, other formats of _uri need to be selected according to actual conditions. The point array _pts is a space used to temporarily store database data. The data tile will read the database data into _pts at an appropriate time for subsequent simplified processing. After processing, the processing results will be written back to the database space pointed to by uri, and then the memory occupied by _pts will be released. The data tile provides the ability to write the data in _pts to the database in an appended manner, the ability to clear the database space pointed to by uri, and the ability to read all the database data into _pts at once. _pts can be saved using the structure of the pcl point cloud library, mainly to facilitate the subsequent processing of the data in _pts using the pcl library. In practice, it can also be replaced according to the different libraries that process point cloud data.
[0057] Container: The container is a singleton class. Refer to Table 3, which gives the variables contained in the container and their meanings.
[0058] Table 3
[0059] std::map<std::string,BaseTile>_tiles Storing Pyramid Tiles std::vector <tiledata>_Data < / tiledata> Storing data tiles float_length Pyramid tile leaf node size int_Maxlevel Maximum level of the pyramid Vec3_basePt Pyramid base point
[0060] The container mainly stores parameters related to pyramid creation.
[0061] The above describes the terminal device for executing the method. The following describes the point cloud data storage method in the present invention in detail. Figure 1 and Figure 2 , Figure 1 A schematic diagram of a point cloud data storage method provided by an embodiment of the present invention. Figure 2 A data flow diagram provided by an embodiment of the present invention is based on Figure 1 and Figure 2 Introduce the present invention, such as Figure 1 and Figure 2 As shown, the specific steps of the method are as follows: step S101-step S102:
[0062] Step S101, obtain a point cloud data set to be stored, traverse the point cloud data set, determine the pyramid tile corresponding to the target point cloud data based on the coordinates of the target point cloud data, obtain the data tile corresponding to the pyramid tile, store the target point cloud data in the data tile, if the number of point cloud data currently stored in the data tile reaches a preset number, write the point cloud data stored in the data tile into the database, clear the point cloud data stored in the data tile, and traverse the next point cloud data until all the point cloud data in the point cloud data set are traversed.
[0063] Step S102, putting the point cloud data stored in the disk into the corresponding data tile, traversing the data tile in sequence according to the level of the pyramid tile corresponding to the data tile, simplifying the point cloud data in the traversed target data tile, writing the simplified point cloud data in the target data tile into the database, and clearing the simplified point cloud data in the target data tile.
[0064] A point cloud data set to be stored is obtained, wherein the point cloud data set includes at least one point cloud data, the point cloud data set is traversed, and for the traversed target point cloud data, a pyramid tile corresponding to the target point cloud data is determined based on the coordinates of the target point cloud data.
[0065] In a possible implementation, the pyramid tile corresponding to the target point cloud data may be determined through the following steps S201 to S202.
[0066] Step S201, obtaining the coordinates of the target point cloud data, and calculating the name of the pyramid tile according to the coordinates of the target point cloud data, a preset pyramid base point, a pyramid level, and a preset pyramid tile size to obtain a target name.
[0067] Step S202: If there is a pyramid tile with the same name as the target name, the pyramid tile with the same name is determined as the pyramid tile corresponding to the target point cloud data; if there is no pyramid tile with the same name as the target name, a new pyramid tile with the target name is created as the pyramid tile corresponding to the target point cloud data.
[0068] Get the coordinates of the target point cloud data, calculate the name of the pyramid tile according to the coordinates of the target point cloud data, the preset pyramid base point, the pyramid level and the preset pyramid tile size, and get the target name, which is the source of the _name of the pyramid tile BaseTile. The pyramid base point is a reference coordinate that can be preset, such as (0, 0, 0). The pyramid level and pyramid tile size can be preset as required.
[0069] The target name can be calculated as follows:
[0070] Vec4i_name=((pt-_basePt) / _length, level);
[0071] Among them, Vec4i_name represents the target name, pt represents the coordinates of the target point cloud data, _basePt represents the preset pyramid base point, _length represents the preset pyramid tile size, and level represents the level of the current pyramid tile.
[0072] Specifically, since the length, width, and height of the pyramid tile are the same, _length may refer to the length value of the pyramid tile.
[0073] Determine whether a pyramid tile with the same name as the target name is already stored in the container. If a pyramid tile with the same name as the target name exists, the pyramid tile with the same name is determined as the pyramid tile corresponding to the target point cloud data. If a pyramid tile with the same name as the target name does not exist, a newly created pyramid tile with the target name is inserted into the container, and the newly created pyramid tile with the target name is determined as the pyramid tile corresponding to the target point cloud data.
[0074] By first determining whether a pyramid tile with the same name as the target name is already stored in the container to decide whether to create a new pyramid tile, it is possible to effectively avoid creating two identical pyramid tiles, improve the effectiveness of subsequent data processing, and reduce the space occupied by the container.
[0075] Obtaining data tiles corresponding to pyramid tiles corresponding to target point cloud data, in one possible implementation, can be accomplished through steps S301-S302:
[0076] Step S301: If the pyramid tile corresponding to the target point cloud data is determined by a pyramid tile with the same name as the target name, the corresponding data tile is obtained through the data tile index stored in the pyramid tile corresponding to the target point cloud data.
[0077] Step S302: If the pyramid tile corresponding to the target point cloud data is a newly created pyramid tile with the target name, a new data tile is created, and the newly created data tile is determined as the data tile corresponding to the pyramid tile.
[0078] The pyramid tile at least includes a pyramid tile index and a data tile index. The pyramid tile index is generally the pyramid tile name, which is used to find the pyramid tile, and the data tile index is generally the element subscript used to store the data tile in the array storing the data tile, which is used to find the data tile, so the data tile index has a one-to-one correspondence with the data tile. Since each existing pyramid tile will have a corresponding data tile, if the pyramid tile corresponding to the target point cloud data is determined by the pyramid tile with the same name as the target name, it means that the pyramid tile corresponding to the target point cloud data is the original existing pyramid tile, then the pyramid tile corresponding to the target point cloud data already has the corresponding data tile, and the corresponding data tile can be obtained by the data tile index stored in the pyramid tile corresponding to the target point cloud data. If the pyramid tile corresponding to the target point cloud data is a newly created pyramid tile with the target name, the data tile of the pyramid tile corresponding to the new target point cloud data is created.
[0079] In one possible implementation, after a new data tile is created, the new data tile is placed in an array for storing data tiles, the subscript of the element storing the new data tile in the array is determined as the data tile index used to determine the data tile, and the data tile index is stored in the pyramid tile corresponding to the target point cloud data.
[0080] After the corresponding data tile is obtained, the target point cloud data is stored in the data tile. If the number of point cloud data stored in the current data tile reaches the preset number, the point cloud data stored in the data tile is written into the database, and the point cloud data stored in the data tile is cleared. The database can be a disk database. For an incoming point cloud data, it is first placed in the memory of the data tile. When the number of memory exceeds the preset number, such as 1000 (this value should be flexibly adjusted according to the size of the computer memory), the preset number of point cloud data in the data tile is written into the database, and the memory of the data tile is cleared, and then it continues to wait for new point cloud data to be entered.
[0081] The present invention temporarily stores the inserted point cloud data in the data tile memory, and submits it to the database once after storing a certain size, so that the efficiency of point division tile can be greatly improved, and all point cloud data cached by the data tile are stored in the database, and then the memory space is released. After this step, the point cloud data is divided through the pyramid leaf nodes, and the point cloud data divided in this way can ensure that each pyramid tile must contain valid data and no empty tiles will be generated.
[0082] When the currently traversed point cloud data is processed, the next point cloud data is traversed until all the point cloud data in the point cloud data set are traversed.
[0083] The above describes step S101, through which a pyramid leaf node can be constructed. The following describes step S102.
[0084] After traversing all the point cloud data in the point cloud data set, the point cloud data stored in the database is put back into the corresponding data tile again, and the data tiles are traversed in sequence according to the level of the pyramid tile corresponding to the data tile, generally from high level to low level. For the traversed target data tile, the point cloud data in the target data tile is simplified, and then the simplified point cloud data in the target data tile is written into the database, and the simplified point cloud data in the target data tile is cleared. In a possible implementation method, the pcl point cloud simplification method can be used to simplify the point cloud data in the target data tile.
[0085] The more data tiles are processed at the same time, the more memory will be occupied. In addition, if the amount of point cloud data processed is too large, data simplification may fail. Therefore, the present invention simplifies the point cloud data of a single data tile in turn, which can ensure that memory is saved as much as possible and the effectiveness of simplification is guaranteed.
[0086] In a possible implementation, after step S101, step S401 is further performed:
[0087] Step S401: determine the parent tiles of the pyramid tiles corresponding to the point cloud data set respectively.
[0088] After executing step S101, the pyramid tiles corresponding to each point cloud data in the point cloud data set can be obtained, and the parent tiles of all the obtained pyramid tiles are determined respectively.
[0089] In a possible implementation, the parent tile of the pyramid tile can be determined through steps S501 and S502:
[0090] Step S501: traverse the pyramid tiles in sequence according to the levels of the pyramid tiles, and for the traversed target pyramid tile, calculate the corresponding parent tile based on the pyramid tile size of the target pyramid tile, and calculate the parent tile name according to the coordinates of the target point cloud data, the preset pyramid base point, the pyramid level and the parent tile size.
[0091] Step S502: If there is a parent tile with the same name as the parent tile, determine the parent tile with the same name as the parent tile as the parent tile of the target pyramid tile; if there is no parent tile with the same name as the parent tile, create a new parent tile of the target pyramid tile.
[0092] According to the levels of the pyramid tiles, the pyramid tiles are traversed in sequence. In a possible implementation, the traversal may be performed from the top level to the bottom level of the pyramid tiles, or from the bottom level to the top level.
[0093] For the traversed target pyramid tile, the corresponding parent tile size is calculated based on the pyramid tile size of the target pyramid tile. In a possible implementation, the parent tile size can be calculated as follows:
[0094] length 父 =_length*pow(2,_Maxlevel-level 父 )calculate:
[0095] Among them, length 父 Indicates the tile size of the parent tile, _length indicates the pyramid tile size of the target pyramid tile, _Maxlevel indicates the maximum level of the pyramid, level 父 Indicates the level of the parent tile of the current target pyramid tile, where level 父 =level-1, level indicates the level of the current target pyramid tile. pow(2,_Maxlevel-level 父 ) means 2 (Maxlevel-level 父) Power.
[0096] For example, if the current target pyramid tile level is 10 and _Maxlevel is 10, then level 父 =10-1=9, the formula can be simplified to length 父 =_length*pow(2,_10-9)=_length*pow(2,_1)=_length*2.
[0097] The parent tile name is calculated according to the coordinates of the target point cloud data, the preset pyramid base point, the pyramid level, and the tile size of the parent tile. The specific formula can refer to the pyramid tile name calculation method. If there is a parent tile with the same name as the parent tile name, the parent tile with the same name as the parent tile name is determined as the parent tile of the target pyramid tile. If there is no parent tile with the same name as the parent tile name, a new parent tile of the target pyramid tile is created.
[0098] In a possible implementation, the point cloud data in the target data tile is simplified, and the simplified point cloud data in the target data tile is written into the database, as shown in steps S601 to S604:
[0099] Step S601: output the simplified point cloud data in the target data tile corresponding to the bottom-level pyramid tile to the parent tile of the bottom-level pyramid tile, simplify the point cloud data in the parent tile of the bottom-level pyramid tile, and obtain the first point cloud data after further simplification.
[0100] Step S602: Output the first point cloud data and the simplified point cloud data in the target data tile corresponding to the target upper pyramid tile to the parent tile of the target upper pyramid tile, simplify the point cloud data in the parent tile of the target upper pyramid tile, and obtain the second point cloud data that is simplified again.
[0101] The target upper pyramid tile is the lowest level pyramid tile in the upper pyramid tiles of the lowest level pyramid tile.
[0102] Step S603, setting the target upper pyramid tile as the bottommost pyramid tile, the second point cloud data as the first point cloud data, and returning to execute the step of outputting the first point cloud data and the simplified point cloud data in the target data tile corresponding to the target upper pyramid tile to the parent tile of the target upper pyramid tile until the parent tile of the target upper pyramid tile is the topmost parent tile.
[0103] Step S604: write the simplified point cloud data output by the topmost parent tile into the database.
[0104] Simplify in sequence from the bottom pyramid tile to the upper pyramid tile. Specifically, the simplified point cloud data in the target data tile corresponding to the bottom pyramid tile is output to the parent tile of the bottom pyramid tile, and the point cloud data in the parent tile of the bottom pyramid tile is simplified to obtain the first point cloud data after being simplified again. For example, the number of pyramid tiles is 5, and from the 5-1 layer pyramid tile is from the bottom pyramid to the top pyramid tile, the simplified point cloud data in the target data tile corresponding to the 5th layer pyramid tile is output to the parent tile of the 5th layer pyramid tile, and the point cloud data in the parent tile of the 5th layer pyramid tile is simplified to obtain the first point cloud data after being simplified again.
[0105] The first point cloud data and the simplified point cloud data in the target data tile corresponding to the target upper pyramid tile are output to the parent tile of the target upper pyramid tile, wherein the target upper pyramid tile is the lowest level pyramid tile in the upper pyramid tile of the lowest level pyramid tile. For example, the number of pyramid tiles is 5, and the 5-1 layer pyramid tile is from the lowest level pyramid tile to the upper level pyramid tile. The first point cloud data is the point cloud data corresponding to the 5th layer pyramid tile, and the upper layer of the 5th layer pyramid tile is the parent tile of the target upper pyramid tile. The pyramid tile includes a 4th layer pyramid tile, a 3rd layer pyramid tile, a 2nd layer pyramid tile, and a 1st layer pyramid tile, then the 4th layer pyramid tile is the bottommost pyramid tile in the upper layer pyramid tile, the target data tile is the 4th layer pyramid tile, the first point cloud data and the simplified point cloud data in the target data tile corresponding to the 4th layer pyramid tile are output to the parent tile of the 4th layer pyramid tile, the point cloud data in the parent tile of the 4th layer pyramid tile is simplified, and the second point cloud data after further simplification is obtained.
[0106] Let the target upper pyramid tile be the lowest level pyramid tile, the second point cloud data be the first point cloud data, and return to execute the step of outputting the first point cloud data and the simplified point cloud data in the target data tile corresponding to the target upper pyramid tile to the parent tile of the target upper pyramid tile until the parent tile of the target upper pyramid tile is the topmost parent tile.
[0107] For example, if the number of pyramid tiles is 5, and the 5-1th layer of pyramid tiles is from the bottom pyramid to the top pyramid tile, the simplified point cloud data in the target data tile corresponding to the 5th layer of pyramid tiles is output to the 4th layer of parent tiles, and the point cloud data in the 4th layer of parent tiles is simplified to obtain the simplified point cloud data again. Then, the simplified point cloud data in the 4th layer of parent tiles and the simplified point cloud data in the target data tile corresponding to the 4th layer of pyramid tiles are output to the 3rd layer of parent tiles. , simplify the point cloud data in the 3rd-level parent tile to obtain the simplified point cloud data again, and so on, until the simplified point cloud data in the 1st-level parent tile and the simplified point cloud data in the target data tile corresponding to the 1st-level pyramid tile are output to the 0th-level parent tile, simplify the point cloud data in the 0th-level parent tile to obtain the simplified point cloud data again, write the simplified point cloud data output by the 0th-level parent tile into the database, and complete the multiple simplifications of all point cloud data.
[0108] Among them, simplified tiles simplify the point cloud data carried in the tiles to reduce space occupancy.
[0109] In this way, the simplified output of the bottom layer can be used as the input of the upper layer, which can avoid excessive memory usage caused by too many tiles in the upper layer. At the same time, this processing is to ensure that memory is saved as much as possible. Another important reason is to avoid the failure of PCL simplification due to the inability to process tiles of too large a range.
[0110] In the present invention, the simplified results of pyramid tiles and data tiles can be used as the output results of the container and can be output to other 3D rendering engines, and the output results can be any data format that can be directly provided to other 3D rendering engines, such as osgb, fbx, 3dtiles, etc.
[0111] Based on the above method, the present invention separates the data tile and the pyramid tile, which saves memory on the one hand and is more convenient for the management of database data on the other hand. If the number of point cloud data stored in the current data tile reaches a preset number, the point cloud data stored in the data tile is written into the database. This can ensure that each data tile stores valid point cloud data on the basis of dividing the point cloud data, and no empty tiles are generated. Since the more data tiles are processed at the same time, the more memory will be occupied. In addition, if the amount of point cloud data processed is too large, it is easy to cause data simplification failure. Therefore, the present invention can ensure that memory is saved as much as possible and the effectiveness of simplification can be ensured by simplifying the point cloud data of a single data tile in turn.
[0112] In order to better implement the above method, the embodiment of the present invention provides a point cloud data storage device, which can perform similar functions of the above method. Figure 3 , Figure 3 A structural block diagram of a point cloud data storage device provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the device 30 comprises:
[0113] Data traversal module 301: used to obtain a point cloud data set to be stored, wherein the point cloud data set contains at least one point cloud data, traverse the point cloud data set, and for the traversed target point cloud data, determine the pyramid tile corresponding to the target point cloud data based on the coordinates of the target point cloud data, obtain the data tile corresponding to the pyramid tile, store the target point cloud data in the data tile, if the number of point cloud data currently stored in the data tile reaches a preset number, write the point cloud data stored in the data tile into the database, clear the point cloud data stored in the data tile, and traverse the next point cloud data until all the point cloud data in the point cloud data set are traversed.
[0114] Data simplification module 302: used to put the point cloud data stored in the database into corresponding data tiles, traverse the data tiles in sequence according to the levels of the pyramid tiles corresponding to the data tiles, simplify the point cloud data in the traversed target data tiles, write the simplified point cloud data in the target data tiles into the database, and clear the simplified point cloud data in the target data tiles.
[0115] In a possible design, the data traversal module 301 is specifically used to: obtain the coordinates of the target point cloud data, calculate the name of the pyramid tile according to the coordinates of the target point cloud data, a preset pyramid base point, a pyramid level and a preset pyramid tile size, and obtain the target name; if there is a pyramid tile with the same name as the target name, then the pyramid tile with the same name is determined as the pyramid tile corresponding to the target point cloud data; if there is no pyramid tile with the same name as the target name, then a newly created pyramid tile with the target name is the pyramid tile corresponding to the target point cloud data.
[0116] In a possible design, the data traversal module 301 calculates the name of the pyramid tile according to the coordinates of the target point cloud data, the preset pyramid base point, the pyramid level, and the preset pyramid tile size, and obtains the calculation formula of the target name as follows:
[0117] name=((pt-basePt) / length,level)
[0118] Among them, name represents the target name, pt represents the coordinates of the target point cloud data, basePt represents the preset pyramid base point, length represents the preset pyramid tile size, and level represents the level of the current pyramid tile.
[0119] In a possible design, the data traversal module 301 is specifically used for: if the pyramid tile corresponding to the target point cloud data is determined by a pyramid tile with the same name as the target name, then the corresponding data tile is obtained through the data tile index stored in the pyramid tile corresponding to the target point cloud data; the data tile index has a one-to-one correspondence with the data tile; if the pyramid tile corresponding to the target point cloud data is a newly created pyramid tile with the target name, then a new data tile is created, and the newly created data tile is determined as the data tile corresponding to the pyramid tile.
[0120] In one possible design, the data traversal module 301 is specifically used to: place the newly created data tile into an array for storing data tiles, determine the subscript of the element storing the newly created data tile in the array as the data tile index used to determine the data tile, and store the data tile index in the pyramid tile corresponding to the target point cloud data.
[0121] The data reduction module 302 is specifically configured to respectively determine the parent tiles of the pyramid tiles corresponding to the point cloud data set.
[0122] The data simplification module 302 is specifically used to output the simplified point cloud data in the target data tile corresponding to the bottom-level pyramid tile to the parent tile of the bottom-level pyramid tile, simplify the point cloud data in the parent tile of the bottom-level pyramid tile, and obtain the first point cloud data after being simplified again; output the first point cloud data and the simplified point cloud data in the target data tile corresponding to the target upper-level pyramid tile to the parent tile of the target upper-level pyramid tile, simplify the point cloud data in the parent tile of the target upper-level pyramid tile, and obtain the second point cloud data after being simplified again; Among them, the target upper pyramid tile is the lowest level pyramid tile in the upper pyramid tile of the lowest level pyramid tile; the target upper pyramid tile is set as the lowest level pyramid tile, the second point cloud data is set as the first point cloud data, and the step of returning to execute the simplified point cloud data in the target data tile corresponding to the first point cloud data and the target upper pyramid tile is output to the parent tile of the target upper pyramid tile until the parent tile of the target upper pyramid tile is the uppermost parent tile; the simplified point cloud data output by the uppermost parent tile is written into the database.
[0123] In a possible design, the data simplification module 302 is specifically used to: traverse the pyramid tiles in sequence according to the levels of the pyramid tiles, calculate the corresponding parent tile for the traversed target pyramid tile based on the pyramid tile size of the target pyramid tile, and calculate the parent tile name according to the coordinates of the target point cloud data, the preset pyramid base point, the pyramid level and the parent tile size; if there is a parent tile with the same name as the parent tile name, determine the parent tile with the same name as the parent tile name as the parent tile of the target pyramid tile; if there is no parent tile with the same name as the parent tile name, create a new parent tile of the target pyramid tile.
[0124] Based on the above device, it can be ensured that the memory is saved as much as possible.
[0125] Figure 4 FIG. 1 shows an internal structure diagram of a computer device in an embodiment. The computer device may be a terminal or a server. Figure 4As shown, the computer device includes a processor, a memory and a network interface connected via a system bus. The memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program. When the computer program is executed by the processor, the processor can implement all the steps of the above method. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor can implement all the steps of the above method. Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0126] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes each step of the aforementioned method.
[0127] In one embodiment, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the processor executes each step of the aforementioned method.
[0128] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0129] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0130] 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 the present application. 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 protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A point cloud data storage method, characterized in that: The method comprises: Obtain a point cloud data set to be stored, wherein the point cloud data set contains at least one point cloud data, traverse the point cloud data set, and for the traversed target point cloud data, determine the pyramid tile corresponding to the target point cloud data based on the coordinates of the target point cloud data, obtain the data tile corresponding to the pyramid tile, store the target point cloud data in the data tile, if the number of point cloud data currently stored in the data tile reaches a preset number, write the point cloud data stored in the data tile into a database, clear the point cloud data stored in the data tile, and traverse the next point cloud data until all the point cloud data in the point cloud data set are traversed; The point cloud data stored in the database are placed into corresponding data tiles, and the data tiles are traversed in sequence according to the levels of the pyramid tiles corresponding to the data tiles. For the traversed target data tiles, the point cloud data in the target data tiles are simplified, the simplified point cloud data in the target data tiles are written into the database, and the simplified point cloud data in the target data tiles are cleared.
2. The method according to claim 1, characterized in that The step of determining the pyramid tile corresponding to the target point cloud data based on the coordinates of the target point cloud data comprises: Acquire the coordinates of the target point cloud data, calculate the name of the pyramid tile according to the coordinates of the target point cloud data, a preset pyramid base point, a pyramid level, and a preset pyramid tile size, and obtain the target name; If there is a pyramid tile with the same name as the target name, the pyramid tile with the same name is determined as the pyramid tile corresponding to the target point cloud data; if there is no pyramid tile with the same name as the target name, a new pyramid tile with the target name is created as the pyramid tile corresponding to the target point cloud data.
3. The method according to claim 2, characterized in that The calculation formula for calculating the name of the pyramid tile according to the coordinates of the target point cloud data, the preset pyramid base point, the pyramid level and the preset pyramid tile size to obtain the target name is as follows: name=((pt-basePt) / length,level) Among them, name represents the target name, pt represents the coordinates of the target point cloud data, basePt represents the preset pyramid base point, length represents the preset pyramid tile size, and level represents the level of the current pyramid tile.
4. The method according to claim 1, characterized in that: The obtaining of the data tile corresponding to the pyramid tile comprises: If the pyramid tile corresponding to the target point cloud data is determined by a pyramid tile with the same name as the target name, the corresponding data tile is obtained through the data tile index stored in the pyramid tile corresponding to the target point cloud data; the data tile index has a one-to-one correspondence with the data tile; If the pyramid tile corresponding to the target point cloud data is a newly created pyramid tile with the target name, a new data tile is created, and the newly created data tile is determined as the data tile corresponding to the pyramid tile.
5. The method according to claim 4, characterized in that The newly created data tile also includes: The newly created data tile is placed in an array for storing data tiles, the subscript of the element storing the newly created data tile in the array is determined as the data tile index used to determine the data tile, and the data tile index is stored in the pyramid tile corresponding to the target point cloud data.
6. The method according to claim 1, characterized in that The method further comprises: Determine the parent tiles of the pyramid tiles corresponding to the point cloud data sets respectively; The simplifying the point cloud data in the target data tile and writing the simplified point cloud data in the target data tile into a database comprises: Outputting the simplified point cloud data in the target data tile corresponding to the bottom-level pyramid tile to the parent tile of the bottom-level pyramid tile, simplifying the point cloud data in the parent tile of the bottom-level pyramid tile, and obtaining the first point cloud data after further simplification; Outputting the first point cloud data and the simplified point cloud data in the target data tile corresponding to the target upper pyramid tile to the parent tile of the target upper pyramid tile, simplifying the point cloud data in the parent tile of the target upper pyramid tile, and obtaining the second simplified point cloud data; wherein the target upper pyramid tile is the lowest level pyramid tile in the upper pyramid tile of the lowest level pyramid tile; The target upper pyramid tile is set as the bottom-level pyramid tile, the second point cloud data is set as the first point cloud data, and the simplified point cloud data in the target data tile corresponding to the first point cloud data and the target upper pyramid tile is returned to the step of outputting the simplified point cloud data to the parent tile of the target upper pyramid tile until the parent tile of the target upper pyramid tile is the topmost parent tile; Write the simplified point cloud data output by the top parent tile into the database.
7. The method according to claim 6, characterized in that The step of respectively determining the parent tiles of the pyramid tiles corresponding to the point cloud data sets comprises: According to the levels of the pyramid tiles, the pyramid tiles are traversed in sequence, and for the traversed target pyramid tile, the corresponding parent tile is calculated based on the pyramid tile size of the target pyramid tile, and the parent tile name is calculated according to the coordinates of the target point cloud data, the preset pyramid base point, the pyramid level and the parent tile size; If there is a parent tile with the same name as the parent tile, the parent tile with the same name as the parent tile is determined as the parent tile of the target pyramid tile; if there is no parent tile with the same name as the parent tile, a new parent tile of the target pyramid tile is created.
8. A point cloud data storage device, characterized in that: The device comprises: Data traversal module: used to obtain a point cloud data set to be stored, wherein the point cloud data set contains at least one point cloud data, traverse the point cloud data set, determine the pyramid tile corresponding to the target point cloud data based on the coordinates of the target point cloud data, obtain the data tile corresponding to the pyramid tile, store the target point cloud data in the data tile, if the number of point cloud data currently stored in the data tile reaches a preset number, write the point cloud data stored in the data tile into a database, clear the point cloud data stored in the data tile, and traverse the next point cloud data until all the point cloud data in the point cloud data set are traversed; Data simplification module: used to put the point cloud data stored in the database into the corresponding data tile, traverse the data tiles in sequence according to the levels of the pyramid tiles corresponding to the data tiles, simplify the point cloud data in the traversed target data tile, write the simplified point cloud data in the target data tile into the database, and clear the simplified point cloud data in the target data tile.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 7.
10. A computer device comprising a memory and a processor, characterized in that: The memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 7.
