How to Change .pcd file Resolution

조회 수: 13 (최근 30일)
kevin harianto
kevin harianto 2022년 3월 30일
답변: Milan Bansal 2023년 11월 15일
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