Borrar filtros
Borrar filtros

How to Change .pcd file Resolution

5 visualizaciones (últimos 30 días)
kevin harianto
kevin harianto el 30 de Mzo. de 2022
Respondida: Milan Bansal el 15 de Nov. de 2023
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 comentario
Himanshu
Himanshu el 22 de Sept. de 2023
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.

Iniciar sesión para comentar.

Respuestas (1)

Milan Bansal
Milan Bansal el 15 de Nov. de 2023
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!

Categorías

Más información sobre Preprocessing en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by