-
-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find corrupted point for track_sensor #393
Comments
Hi. Was this ever included in any version of |
Feature never implemented. Can you share a file with an error ? |
Sure. You can download the file from here. The "retile" file is is a part of the bigger ALS file read as a
|
I see
Label the incorrect ones las = filter_firstlast(las)
t = las@data[, .N, by = gpstime]
err = t[N > 2]
las@data$err = las$gpstime %in% err$gpstime Plot the incorrect ones plot(las, color = "err") Show one of the inccorect ones tt = err$gpstime
las@data[gpstime == tt[1]]
#> X Y Z gpstime Intensity ReturnNumber NumberOfReturns ScanDirectionFlag EdgeOfFlightline Classification Synthetic_flag Keypoint_flag
#> 1: 578410.5 6677400 255.02 114610821 4 1 2 0 0 1 FALSE FALSE
#> 2: 578412.2 6677401 243.03 114610821 10 2 2 0 0 1 FALSE FALSE
#> 3: 578411.0 6677400 251.70 114610821 127 1 1 0 0 1 FALSE FALSE
#> Withheld_flag ScanAngleRank UserData PointSourceID err
#> 1: FALSE -8 1 1 TRUE
#> 2: FALSE -8 1 1 TRUE
#> 3: FALSE -8 1 1 TRUE Plot those 3 points sub = las[las$gpstime == tt[1]]
plot(sub, size = 4) The 3 points are perfectly aligned. I'd say they are coming from the same pulse but numbering is incorrect. This pulse is a 3 returns pulse and points should have 1 2 3 in return number and 3 3 3 in number of return. You have probably 80000+ point of this kind. You dataset is incorrectly populated and the function is working as expected. |
Hi. Thanks for taking your time and looking throught the data. This piece of code is very helpful: las = filter_firstlast(las)
t = las@data[, .N, by = gpstime]
err = t[N > 2]
las@data$err = las$gpstime %in% err$gpstime Now I was thinking if it would be possible to solve this type of error by re-ranking the I have made some lines for this but is really slow as it goes one by one of the detected wrong pulses in tt = err$gpstime
for (i in 1:length(tt)){
n = which(las$gpstime == tt[i]) # Which position have the points in the cloud
sub = las[las$gpstime == tt[i]] # subset the cloud
rn = as.integer(rank(-sub$Z)) # New return numbers according to Z values
las$ReturnNumber[n] = rn # Substitute old RN for the new ones
}
sensor <- track_sensor(las, Roussel2020(), multi_pulse = T) The resulting sensor position is promising but I have only tried to run it for a "retile" file because it takes a long time if the number of wrong pulses is high, like in my case. |
The fastest way is library(lidR)
library(data.table)
las <- readLAS("retile_578250_6677250.las", filter = "-drop_class 7")
setorder(las@data, gpstime, UserData, Z)
las@data[, `:=`(ReturnNumber = 1:.N, NumberOfReturns = .N), by = .(gpstime, UserData)]
las = las_update(las) Notice that you missed to processed by user data because you have a multi pulse emission device. This is also why las = filter_firstlast(las)
t = las@data[, .N, by = .(gpstime, UserData)]
setorder(t, N)
err = t[N > 2]
err
#> Empty data.table (0 rows and 3 cols): gpstime,UserData,N |
Of course. With a tiny are you have very few points to resolve the interpolation problem. But the improvement is not very big actually
If the shapefile is made of lines I guess it is not associated with timestamps. We need a time information to match the point with the position of the sensor. You can sample the lines into discrete points but if the points are not associated with corresponding gpstime it won't work. |
Following numerous issues opened by @lucas-johnson (#392, #391, #388, #336, #327), add a function:
diagnose_invalid_pulse()
.This could return a table with the index of the point + the points + a comment explaining why a pulse is invalid.
The text was updated successfully, but these errors were encountered: