Re: pylidar question

154 views
Skip to first unread message

John David Armston

unread,
Jul 3, 2017, 1:15:02 AM7/3/17
to William Woodgate, pyl...@googlegroups.com
Hi Will, yes it does.

A longer response is below - I'm cc'ing the pylidar mailing list on this too as we need to use it more. I'll send you an invite to join. 

The output you want is relatively simple processing task (or at least should be). You can currently do it one of two ways:
1. Using command line tools (these are similar to SPDLib). These use processing code we call "spatial processing mode".
2. Using custom written scripts (see http://pylidar.org/en/latest/processorexamples.html for examples). These use processing code we call "non-spatial processing mode".
For either you'll need to have the RIEGL RiScan libraries locally. See (http://pylidar.org/en/latest/lidarformats/riegl.html)


An example using the spatial processing mode command line tools (1) with a REIGL VZ400 scan is below. It requires three steps (similar to SPDLib):

1. Convert from RXP to SPDV4 (the scale/offset defaults are those typical for ALS so we have to specify at the command line here). SPD files are useful, particularly for waveform processing and if you need to derive/store additional pulse and point attributes before creating image or profile products.
pylidar_translate -i 160629_095427.rxp -o 160629_095427.spd -f SPDV4 --scaling POINT X UINT32 1000 -1000 --scaling POINT Y UINT32 1000 -1000 --scaling POINT Z UINT32 1000 -1000 --scaling PULSE X_ORIGIN UINT32 1000 -1000 --scaling PULSE Y_ORIGIN UINT32 1000 -1000 --scaling PULSE Z_ORIGIN UINT32 1000 -1000 --internalrotation

2. Add a spherical spatial index at 0.1 deg (or whatever you want). The only spatial index available is a simple 2D grid, but TLS has a regular distribution of shots in zenith/azimuth so this is fine, but it is not suited to processing TLS data in Cartesian coordinates. It is suited to processing ALS data in Cartesian coordinates though, especially if you want to avoid tiling your data. A different type of spatial index is needed to handle TLS data more efficiently, but we have not progressed that (despite attempting to). 
pylidar_index -i 160629_095427.spd -o 160629_095427_sph.spd --indextype SPHERICAL -r 0.1

3. Produce the min range image at the 2D grid spatial index resolution:
pylidar_rasterize -i 160629_095427_sph.spd -o 160629_095427_sph_range.img -a RANGE -f numpy.ma.min


An example using the non-spatial processing mode to create a minimum range image is attached. This does a single pass though the data and progressively updates the output image array using code written in "numba". This is an efficient and fast way to create regular output grids of simple point and pulse attributes/metrics, without first converting your data to SPD and creating a spatial index. For the TLS minimum range image, it's the better solution if you can write the script (or have someone write it for you...). I wrote the pylidar_canopy vertical profile code using this processing framework, simply because it was easier for me. Helper functions available to users to make non-spatial processing easier to implement have been added by Sam and Neil: see the examples at http://pylidar.org/en/latest/processorexamples.html for a little more info. But while efficient it does not yet have all the functionality of spatial processing mode. It's also not always easier for some - you need to use numba for it to be feasible (it's not so bad...). And how to calculate some metrics (e.g. quantiles) and fit models for individual (or overlapping) grid cells is sometimes not so simple on-the-fly. In this case you need to either:
- find/implement an algorithm that can do what you need in one pass of the data, 
- tile the data first and step through each tile reading the whole tile into memory before calculation (what spatial processing mode handles automatically), or 
- write everything you need out to temporary image stacks and then use image processing software such as RIOS in a second processing step. 

Additional helper functions and command line tools (e.g. for tiling) may appear for non-spatial processing mode in future.
We need to improve the documentation too!

cheers,
John.


On Wed, Jun 28, 2017 at 12:13 AM, William Woodgate <w.woo...@gmail.com> wrote:
Hi John,

Quick question - I'm interested in generating a range image from my top of tower Riegl scan, basically I'm after a range image with the rows and cols being zenith and azimuth, respectively. Does pylidar offer this functionality? Or should I just hack away with my own tools?

Cheers,
Will



--
John Armston
Assistant Research Professor
Global Ecosystem Dynamics Investigation (GEDI)
Department of Geographical Sciences
University of Maryland, College Park MD 20742

pylidar_tls_minrange.py
Reply all
Reply to author
Forward
0 new messages