Keep target points on reference points location

22 views
Skip to first unread message

Alexandre Guyot

unread,
Apr 19, 2017, 8:23:22 AM4/19/17
to LAStools - efficient tools for LiDAR processing
Hello,

I have a reference point cloud containing XYZ info only and a target point cloud containing much more points as well as extended attributes.
I would like to extract points from the target point cloud only where reference points exist (or drop all target points not similar -in XYZ- to reference points).

Any idea on how to do that ?

Thanks,
Alex

Martin Isenburg

unread,
Apr 19, 2017, 9:42:57 AM4/19/17
to LAStools - efficient command line tools for LIDAR processing
Hello,

this would be an approach:

:: create an example reference subset as XYZ ascii


E:\LAStools\bin>las2las -i ..\data\fusa.laz ^
                                       -keep_every_nth 10000 ^
                                       -oparse xyz -o ref.txt

E:\LAStools\bin>more ref.txt
277991.78 6122360.79 50.03
277982.30 6122270.68 49.64
277972.77 6122393.66 49.87
277962.33 6122495.77 54.96
277955.44 6122296.62 54.46
277948.28 6122259.59 49.03
277936.29 6122478.52 51.44
277930.15 6122362.21 54.99
277924.65 6122256.20 48.24
277912.46 6122454.53 51.38
277905.68 6122397.89 47.48
277898.49 6122339.52 47.31
277888.81 6122367.76 46.98
277878.88 6122404.17 46.66
277868.81 6122494.01 45.40
277860.36 6122416.50 45.78
277852.78 6122321.82 45.38
277840.54 6122471.80 47.84
277831.74 6122422.66 44.86
277823.09 6122340.60 55.33
277816.90 6122282.04 44.83
277806.35 6122308.95 49.33
277791.13 6122495.16 47.49
277784.23 6122399.58 43.90
277775.58 6122367.76 43.67
277763.77 6122453.44 42.86
277759.40 6122312.09 44.15

:: go back to LAZ with the *right* point type


E:\LAStools\bin>txt2las -i ref.txt ^
                                      -set_point_type 1 ^
                                      -o ref.laz

:: first the reference points. then the attributed points. then
:: a merge them and lasduplicate is instructed to remove all
:: xyz_unique duplicates and record them. important is that
:: the attributed LAZ files has no xyz_unique duplicates as
:: they will be otherwise removed and reported as well. you
:: may want to first run only on the attributed LAZ file to make
:: sure all xyz_unique duplicates are gone.


E:\LAStools\bin>lasduplicate -i ref.laz ^
                                               -i ..\data\fusa.laz ^
                                               -merged ^
                                               -unique_xyz ^
                                               -record_removed ^
                                               -o fusa.laz

:: check that we got all the attributes for all 27 xyz unique points


E:\LAStools\bin>las2txt -i fusa_removed.laz ^
                                      -parse_all ^
                                      -stdout
5881.204058 277991.78 6122360.79 50.03 21 1 1 0 0 2 91 0 1
5881.443519 277982.30 6122270.68 49.64 81 1 1 0 0 2 83 0 1
5881.640919 277972.77 6122393.66 49.87 17 1 1 0 0 2 94 0 1
5881.838050 277962.33 6122495.77 54.96 19 1 1 0 0 6 103 58 1
5882.045759 277955.44 6122296.62 54.46 20 1 1 0 0 5 85 54 1
5882.240883 277948.28 6122259.59 49.03 93 1 1 0 0 2 82 0 1
5882.424661 277936.29 6122478.52 51.44 136 1 1 0 0 6 101 38 1
5882.618550 277930.15 6122362.21 54.99 10 1 3 0 0 5 91 68 1
5882.812654 277924.65 6122256.20 48.24 101 1 1 0 0 2 82 0 1
5882.996103 277912.46 6122454.53 51.38 70 1 1 0 0 6 99 39 1
5883.190867 277905.68 6122397.89 47.48 48 1 1 0 0 2 94 0 1
5883.385610 277898.49 6122339.52 47.31 71 1 1 0 0 2 89 0 1
5883.581626 277888.81 6122367.76 46.98 14 1 1 0 0 2 91 0 1
5883.777767 277878.88 6122404.17 46.66 65 1 1 0 0 2 94 0 1
5883.974704 277868.81 6122494.01 45.40 62 1 1 0 0 2 102 0 1
5884.214308 277860.36 6122416.50 45.78 60 1 1 0 0 2 95 0 1
5884.423566 277852.78 6122321.82 45.38 46 1 1 0 0 2 86 0 1
5884.621369 277840.54 6122471.80 47.84 86 1 1 0 0 6 100 30 1
5884.831294 277831.74 6122422.66 44.86 102 1 1 0 0 2 95 0 1
5885.040716 277823.09 6122340.60 55.33 74 1 1 0 0 6 88 100 1
5885.250547 277816.90 6122282.04 44.83 10 2 2 0 0 2 83 0 1
5885.461580 277806.35 6122308.95 49.33 59 1 1 0 0 6 85 40 1
5885.659953 277791.13 6122495.16 47.49 30 1 1 0 0 6 102 45 1
5885.869209 277784.23 6122399.58 43.90 45 1 1 0 0 2 93 0 1
5886.079383 277775.58 6122367.76 43.67 22 1 1 0 0 2 90 0 1
5886.276230 277763.77 6122453.44 42.86 38 1 1 0 0 2 97 0 1
5886.484784 277759.40 6122312.09 44.15 50 1 1 0 0 2 85 0 1

It'll be a bit more tricky to do this with extra bytes as you'll need to create a LAZ file from the ASCII XYZ reference file that has the same extra bytes as the file with the actual data.

Regards,

Martin @rapidlasso

Alexandre Guyot

unread,
Apr 20, 2017, 9:34:08 AM4/20/17
to LAStools - efficient tools for LiDAR processing
Hi Martin,

Thanks a lot !!
Just one thing. It looks like the "-set_point_type" is not recognized by txt2las (only las2las).
I've added a las2las command for making sure the ref file is in the same point type as my target file (point type 3) :

las2las -i ref.laz ^
    -set_point_type 3 ^
    -o ref_type3.laz

My file indeed has extrabytes that I would like to keep. All seems to go well with the lasduplicate (as long as the ref and target have the same xyz scale).
However, while the unique points are created with all extrabytes still available, the "_remove" version created automatically seems to be broken (several extra-dimensions are now empty).

Is there a way to control the extrabytes on the "_remove" laz file ?

Thanks,
Alex





Reply all
Reply to author
Forward
0 new messages