2

I am working on some LiDAR dataset. I am used to importing the LiDAR data from .las files. I generally use liblas library in Python to import the same.

Recently, I found the dataset in .mat format which is actually a structure in MATLAB. What I am able to see in that file is only a single cell which contains all the x,y,z,intensity fields as attributes.

So, to be clear, my query is how to convert this .mat file to .las file so that I can directly read the attributes using liblas?

1 Answer 1

0

One option is to convert your .mat file into a text file (.txt), and then, convert it to .las outside MATLAB.

A file with .mat extension can be read with function load. See Supported File Formats for MATLAB.

M = load(filename.mat)

To convert it, try dlmwrite(filename,M), which "writes numeric data in array M to an ASCII format file, filename, using the default delimiter (,) to separate array elements."

dlmwrite(filename.txt,M)

Then, use some point cloud processing software to convert from .txt to .las. For example, see:

Finding outliers with wrong Z values in LIDAR data.

2
  • 1
    Yeah, actually instead I directly read the .txt file, copied the Z attributes and then reshaped it into Numpy array. Would try Fusion if needed. :)
    – SimplyOm
    Commented Nov 10, 2017 at 18:24
  • PDAL has matlab support at 1.6.0, but it doesn’t read free-structured data. Commented Nov 11, 2017 at 3:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.