How to Change .pcd file Resolution

12 次查看(过去 30 天)
I would Like to insert a varied amount of 0s depending on the .pcd file resolution in order to meet a certain condition. this means that a .pcd file with resolution [16, 1200, 5] can be converted/compatible with an algorithm that requires a .pcd input of [64, 1856, 5] resolution in terms of the channel image. How would I go about accomplishing this?
  1 个评论
Himanshu
Himanshu 2023-9-22
Hey,
I understand that you are trying to add zeroes to the .pcd files’ 3D matrix based on their resolution.
Follow the steps to add zeroes to .pcd files:
  • Use the pcdread function or any other appropriate method to read the original .pcd file into MATLAB. This will give you a 3D matrix representing the point cloud data.
  • Calculate the desired resolution for the channel image. In your case, you want to convert from [16, 1200, 5] to [64, 1856, 5]. Note the differences in the number of points along each dimension.
  • Initialize a new matrix with the desired resolution using the zeros' function. For example, you can create an empty matrix of size [64, 1856, 5].
  • Copy the original data from the loaded .pcd file into the corresponding positions in the new matrix. The dimensions that have a difference in resolution will have additional zeros.
  • Use the pcdwrite function or any other appropriate method to save the modified matrix as a .pcd file.
Refer to the pcdread and pcdwrite functions’ documentation, to learn more about these functions.

请先登录,再进行评论。

回答(1 个)

Milan Bansal
Milan Bansal 2023-11-15
Hi kevin harianto
It is my understanding that you want to convert the resolution of an organized point cloud which is initially in the format [16 1200 5] into a new resolution with the format [64 1856 5] to make it compatible with the algorithm.
This can be accomplished by converting the existing point cloud into unorganized point cloud using "removeInvalidPoints" function. The unorganized point can then be converted into the organized point cloud of desired format i.e. [64 1856 5] using "pcorganize" function. Set the lidar parameters in "pcorganize" as "lidarParameters('HDL64E', 1856)". Please refer to the below code snippet that illustrates the workflow.
% read the point cloud
pc = pcread("filename.pcd");
% convert to unorganized point cloud
pcUnorganized = removeInvalidPoints(pc);
% convert to organized point cloud
newPc = pcorganize(pcunorg,lidarParameters('HDL64E', 1856));
Please refer to the below documentation
  • To learn more about "removeInvalidPoints" function.
  • To learn more about "pcorganize" function.
Hope it helps!

类别

Help CenterFile Exchange 中查找有关 Preprocessing 的更多信息

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by