Thin point density to uniformity (or max number at least)

270 views
Skip to first unread message

Eben Broadbent

unread,
Aug 22, 2018, 2:47:16 AM8/22/18
to LAStools - efficient tools for LiDAR processing
Basically, just a grid or thin filter that random selects up to X number of points and returns those. Does this exist?

Martin Isenburg

unread,
Aug 22, 2018, 5:09:18 AM8/22/18
to LAStools - efficient command line tools for LIDAR processing
Hello Eben,

There are several simple filters in the open source LASlib that are best used via the las2las module. One such option is '-thin_with_grid 0.5' which keeps the first return falling into each grid cell of size 0.5 by 0.5 units. Another option is '-keep_random_fraction 0.1' which keeps a randomly selected 10% of the points.


For more elaborate thinning options see lasthin and its README file.


Martin @rapidlasso

On Wed, Aug 22, 2018, 08:47 Eben Broadbent <ebe...@gmail.com> wrote:
Basically, just a grid or thin filter that random selects up to X number of points and returns those. Does this exist?

Tobias K Kohoutek

unread,
Aug 22, 2018, 9:55:53 AM8/22/18
to LAStools - efficient tools for LiDAR processing
Hello Eben,

you need to define carefully if you mean by points all echos or pulses with their echos. 

As Martin pointed out already, all simple filters are based on echos, so you'll end up with some echos of each pulse, but won't filter the complete pulse out of the point cloud. To filter the complete pulse out of the point cloud isn't that easy as we discussed here in the forum in several posts. We had to write our own program a while ago to complete this task, because it will effect points (echos) in the adjacent cell of your grid.

Cheers,
Tobias

Eben Broadbent

unread,
Sep 3, 2018, 7:43:32 AM9/3/18
to LAStools - efficient tools for LiDAR processing
Just all points, like in a las file. Say I want 500 pts m2. Reduce areas that are 2000 and don’t change areas that are 400.

Martin Isenburg

unread,
Sep 3, 2018, 8:15:50 AM9/3/18
to LAStools - efficient command line tools for LIDAR processing
Hello,

let's assume you want either 400 points per square meters or 625 point per square meters (because the square root of 500 is not so pretty). Moreover probably want them evenly distributed. Not most of those 400 points falling into a 10 cm by 10 cm square within the one square meter whereas the remaining areas of the square meter are sparse. So rather than asking for 400 or 625 points per square meter we will now ask for 1 points per x cm by x cm cell so that the total is 400 or 625 when the cell is fully covered with points.

sqrt(400) = 20
sqrt(625) = 25

So instead of 400 (or 625) points within one square meter we more specifically want 20 by 20 (or 25 by 25 points) points to cover the square meter evenly. A square meter of 100 cm by 100 cm is covered by 20 by 20 cells of 5 cm by 5 cm each (or by  25 by 25 cells of 4 cm by 4 cm each). So we want one point per 5 cm by 5 cm cell (or per 4 cm by 4 cm cell). Which one? Maybe the most '-central' one if your input points are truly random. Or maybe the most '-random' one of your input points already live on a grid structure. Or maybe the most '-lowest' or the '-highest' if you have some other particular objective for which points are to be preferred.

lasthin -i dense.laz ^
           -step 0.05 ^
           -central ^
           -o dense400.laz

lasthin -i dense.laz ^
           -step 0.04 ^
           -random ^
           -o dense625.laz

For larger point sets you will need a tiled workflow. No buffer is needed as long as the tile size is compatible with the step size in the sense that tile size divided by step size has a remainder of zero.
On Mon, Sep 3, 2018 at 1:43 PM Eben Broadbent <ebe...@gmail.com> wrote:
Just all points, like in a las file. Say I want 500 pts m2. Reduce areas that are 2000 and don’t change areas that are 400.

Eben Broadbent

unread,
Sep 15, 2018, 12:00:16 PM9/15/18
to LAStools - efficient tools for LiDAR processing
Thinking more. While this approach works if points are horizontally evenly spatially distributed, it poses a problem for areas with vertical features of dense points (such as building edges, or tree plantations), having large open low density areas between them. In this case you could image an entire 30 m vertical tree trunk would be reduced to 1 point, and all the other horizontal space would be already very low density. Not good. Rather, there should be an option to select a spatial scale (say 1-5 meters), and say how many random points you want kept (say, 500). This would keep the tree trunks and voids as they are, just reduce density to an acceptable amount. I don't think there is a way to do this in LAS Tools right now, however this possible in R LiDR.

Martin Isenburg

unread,
Sep 15, 2018, 12:19:35 PM9/15/18
to LAStools - efficient command line tools for LIDAR processing
Hello,

Keeping only 500 random points per horizontal area (aka per two dimensional area) would given higher point numbers on the ground on an open field or parking lot and lower point numbers on the ground if the horizontal area also has a vertical component with many samples. What you want is to reduce volumes (not areas) with higher density when considering all three dimensions. I think what you are after is lasduplicate with the '-nearby 0.02' option.

http://rapidlasso.com/lasduplicate
http://lastools.org/download/lasduplicate_README.txt

Fortunately the 64 bit version has just come out in case your point clouds are very very big.

running the 32 bit module

>> lasduplicate -i tile.laz -nearby 0.02 -o tile_thinned.laz

making the 32 bit module run the 64 bit module

>> lasduplicate -i tile.laz -nearby 0.02 -o tile_thinned.laz -cpu64

directly running the 64 bit module

>> lasduplicate64 -i tile.laz -nearby 0.02 -o tile_thinned.laz

making the 32 bit module run the 64 bit module on many cores

>> lasduplicate -i *.laz -nearby 0.02 -odir thinned -olaz -cpu64 -cores 4

The only way to run the 64 bit modules in parallel is the last option. This is also the way the GUI can call the new 64 bit modules.
Another way would be to first slice the LAZ files in vertical slices with lassplit, then run lasthin on each slice, and then put the slices back together:

http://rapidlasso.com/lassplit
http://lastools.org/download/lassplit_README.txt
http://rapidlasso.com/lasthin
http://lastools.org/download/lasthin_README.txt

>> lassplit -i tile.laz -by_z_interval 0.25 -odir temp1 -olaz
>> lasthin -i temp1/*.laz -step 0.05 -central -odir temp2 -olaz -cores 4
>> lasmerge -i temp2/*.laz -o tile_thinned.laz

Regards,

Martin @rapidlasso

On Wed, Sep 5, 2018 at 3:24 PM, Eben Broadbent <ebe...@gmail.com> wrote:
Thinking more. While this approach works if points are horizontally evenly spatially distributed, it poses a problem for areas with vertical features of dense points (such as building edges, or tree plantations), having large open low density areas between them. In this case you could image an entire 30 m vertical tree trunk would be reduced to 1 point, and all the other horizontal space would be already very low density. Not good. Rather, there should be an option to select a spatial scale (say 1-5 meters), and say how many random points you want kept (say, 500). This would keep the tree trunks and voids as they are, just reduce density to an acceptable amount. I don't think there is a way to do this in LAS Tools right now, however this possible in R LiDR.

--
Reply all
Reply to author
Forward
0 new messages