How to change a PCAP file into the PCD file?

17 views (last 30 days)
I am trying to change my raw lidar file of .pcap to .pcp file to be used for detection and tracking of vehicle. Can anyone help me how I can change in into .pcd format. Also I have to select a portion of frames from the whole dataset. Can anyone give a hint or how should I start.
Ps- I am working with Velodyne vlp-16 and using Veloview to view my generated file.
  2 Comments
Youssef Attia
Youssef Attia on 12 Nov 2023
wanted to know if you finished your project. I'm also currently working on the same project, but i can't seem to understand what to do
Shashank Rajput
Shashank Rajput on 13 Nov 2023
Yes I finished, what's the thing you can't understand. If you can explain me clearly maybe I can help.

Sign in to comment.

Answers (1)

Shashank Rajput
Shashank Rajput on 7 Mar 2022
Hey,
I myself have found the answer to my question. I am attaching my code where I have taken frames(25049-28765) from the total data set and converted that into the pcd files.
outputFolder = fullfile('C:\Users\Shashank Rajput\OneDrive - IIT Kanpur\Documents\Research\lidar data\Lidar');
%Saving the PCD files of the data
pcdfolder = fullfile(outputFolder, 'Velodyne VLP-16\Trial Data\', 'Detections', 'PCD_03')
%Reading the lidar file
veloReader = velodyneFileReader('C:\Users\Shashank Rajput\OneDrive - IIT Kanpur\Documents\Research\lidar data\Lidar\2022-02-24-18-23-31_Velodyne-VLP-16-Data.pcap','VLP16');
%Limits of the Lidar
xlimits = [-60 60];
ylimits = [-80 80];
zlimits = [-20 20];
player = pcplayer(xlimits,ylimits,zlimits);
%Label the Axes
xlabel(player.Axes,'X (m)');
ylabel(player.Axes,'Y (m)');
zlabel(player.Axes,'Z (m)');
frame=25049;
%Display
while(hasFrame(veloReader) && player.isOpen() && (frame<=28765))
ptCloud = readFrame(veloReader,frame);
ptCloud = pointCloud(reshape(ptCloud.Location, [],3), 'Intensity',single(reshape(ptCloud.Intensity, [],1)));
name = sprintf('frame%04d.pcd',frame);
pcwrite(ptCloud, fullfile(pcdfolder,name));
frame=frame+1;
end
  2 Comments
Sarang Jokhio
Sarang Jokhio on 1 Apr 2022
Hi Shashank,
I assume that you saved file in pcd format to open it in Lidar Labeler app?
I also used similar method to convert raw lidar scans into point clouds and then into pcd files.
However, when use dir function, the resulting order of the files is not correct. Did you also face same issue?
If not, could you please check it with dir and let me know if you have files in correct order?
Thank you :)
Shashank Rajput
Shashank Rajput on 5 Apr 2022
Sorry for the late reply.No I didn't used the dir function. It's better to write it using the sprintf function only in order to get the correct order.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!