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?

Andre Silva
  • 10,259
  • 12
  • 54
  • 106
SimplyOm
  • 23
  • 4

1 Answers1

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.

Andre Silva
  • 10,259
  • 12
  • 54
  • 106
  • 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 Nov 10 '17 at 18:24
  • PDAL has matlab support at 1.6.0, but it doesn’t read free-structured data. – Howard Butler Nov 11 '17 at 03:22