I'm trying to identify snags using LiDAR stored in las format. The Wing 2015 algorithm used in segment_snags requires the values be in the range from 0 to 255. Is it possible to edit and scale intensity values (not by adding a new attribute)? Alternatively, is it possible to edit the segment_snags tool in lidR?

1 Answer 1


If your intensities are recorded on 16 bits you can use the data.table syntax

las@data[, Intensity := as.integer(Intensity/(2^16-1)*255L)]

If your intensities are somehow arbitrary recorded

las@data[, Intensity := as.integer(Intensity/max(Intensity)*255L)]

With a more regular R syntax

las$Intensity = as.integer(las$Intensity/max(las$Intensity)*255L)

I don't remember how Wing's algo work but first read the original paper to ensure that rescaling like that has a meaning for the method.

Alternatively, is it possible to edit the segment_snags tool in lidR?

This might be the object of a feature request.

  • After testing, rescaling does indeed work. However, some snags that fall within the right intensity range do not end up being classified as snags. My guess is that the BBPR thresholds have to be manipulated but this would be a result of the nature of the lidar itself and not the algorithm or its implementation.
    – Ray J
    Jul 10, 2020 at 15:53
  • It should be noted that arbitrary scaled intensities are non-conformant to the las specification and anyone that supplies such data should be kicked. Incidentally don't expect much from intensity. practically it is a very poor metric. The author only claimed 56% detection rate. Mar 31 at 0:14

Your Answer

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

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