PCAP to .MAT (want to use PCAP in Examples)

13 visualizzazioni (ultimi 30 giorni)
Abdullah Rasul
Abdullah Rasul il 11 Feb 2019
Risposto: Paola Donis Noriega il 29 Ott 2025 alle 14:11
i am currently using velodyne VLP16 and most of the work is done in PCAP file.
i have tried some matlab examples with PCAP file and they are really good but there are some examples that uses .mat file instead of pcap.
can any one help me in using PCAP in those examples or how can i convert PCAP to .mat or even how can i get .mat file using velodyne VLP16.
thanks,
  5 Commenti
Akshay Gupta
Akshay Gupta il 13 Apr 2022
Hello, can we save above mentioned converted MATLAB file into pcap file again?
As I have transfromed the point from pcap file frame by frame and save it in matrix/ or matlab file.
But I need to convert it to pcap file again.
Please suggest the solution for this.
Thanks
Abdullah Rasul
Abdullah Rasul il 14 Apr 2022
Matlab does not allow much processing with PCAP files. It usually converts them to .mat files for the processing.
In my opinion, convert your points to the point cloud file as explained here: https://www.mathworks.com/help/vision/ref/pointcloud.html#d123e118474
This way you can use the point cloud for processing as well and this point cloud format is compatible with most of the hardware/software
Thanks.

Accedi per commentare.

Risposte (1)

Paola Donis Noriega
Paola Donis Noriega il 29 Ott 2025 alle 14:11
Hi Abdullah,
You can read point clouds from a PCAP file and store them as an array of pointCloud objects. Then, you can save this array to a MAT file. For example:
% Create a reader object for the PCAP file.
veloReader = velodyneFileReader('lidarData_ConstructionRoad.pcap','HDL32E');
% Preallocate an array to hold each point cloud frame.
numFrames = veloReader.NumberOfFrames;
ptCloudArr = repmat(pointCloud(zeros(0, 3)),numFrames,1);
for i = 1:numFrames
% Read each frame and store it in the array.
ptCloudArr(i) = readFrame(veloReader,i);
end
% Save the array of point clouds to a MAT file.
save("velodyneData.mat","ptCloudArr")
Note: MATLAB does not support writing point clouds to PCAP files. To export point clouds, you can use the pcwrite function to save each point cloud to a PLY or PCD file.

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by