Ticket #122 (closed defect: fixed)

Opened 11 months ago

Last modified 11 months ago

las2las does not eliminate requested classifications

Reported by: mloskot Owned by: mloskot
Priority: major Milestone: 1.2.1
Component: Utilities Version: 1.2
Keywords: classification Cc: hobu
LAS Format Version: Not Applicable

Description (last modified by mloskot) (diff)

Classification filtering in las2las behaves randomly and does not work properly (using LAS file from Samples):

las2las -i grass_lake_64320.las --class 20 -o out.las --verbose

cumulative CPU time thru start. = 0.006000
first pass reading 64320 points ...
x 728239.800 729116.460 876.660
y 4676349.000 4677130.350 781.350
z 291.760 325.730 33.970
intensity 192 255 63
edge_of_flight_line 0 0 0
scan_direction_flag 0 0 0
number_of_returns_of_given_pulse 0 7 7
return_number 0 7 7
classification 95 185 90
scan_angle_rank 0 0 0
user_data 0 0 0
gps_time 0.00000000 0.00000000 0.00000000
second pass reading 64320 and writing 64320 points ...

---------------------------------------------------------
  Point Inspection Summary
---------------------------------------------------------
  Header Point Count: 64320
  Actual Point Count: 64320

  Minimum and Maximum Attributes (min,max)
---------------------------------------------------------
  Min X,Y,Z:            728239.800000,4676349.000000,291.760000
  Max X,Y,Z:            729116.460000,4677130.350000,325.730000
  Bounding Box:         728239.80,4676349.00,729116.46,4677130.35
  Time:                 0.000000,0.000000
  Return Number:        0,7
  Return Count:         0,7
  Flightline Edge:      0,0
  Intensity:            192,255
  Scan Direction Flag:  0,0
  Scan Angle Rank:      0,0
  Classification:       95,255
  Minimum Color:         0 0 0
  Maximum Color:         0 0 0

  Number of Points by Return
---------------------------------------------------------
        (0) 15097       (1) 7524        (2) 7618        (3) 7710        (4) 8246
 Total Points: 46195

  Number of Returns by Pulse
---------------------------------------------------------
        (1) 0   (2) 0   (3) 0   (4) 0   (5) 0   (6) 0   (7) 64320
 Total Pulses: 64320

  Point Classifications
---------------------------------------------------------
            2016 Created, never classified (0)
            1941 Unclassified (1)
            2128 Ground (2)
            2099 Low Vegetation (3)
            1958 Medium Vegetation (4)
            1936 High Vegetation (5)
            1888 Building (6)
            1714 Low Point (noise) (7)
            1781 Model Key-point (mass point) (8)
            1662 Water (9)
            1586 Reserved for ASPRS Definition (10)
            1561 Reserved for ASPRS Definition (11)
            1631 Overlap Points (12)
            1657 Reserved for ASPRS Definition (13)
            1684 Reserved for ASPRS Definition (14)
            1743 Reserved for ASPRS Definition (15)
            1752 Reserved for ASPRS Definition (16)
            1741 Reserved for ASPRS Definition (17)
            1882 Reserved for ASPRS Definition (18)
            1919 Reserved for ASPRS Definition (19)
            1954 Reserved for ASPRS Definition (20)
            1800 Reserved for ASPRS Definition (21)
            2010 Reserved for ASPRS Definition (22)
            2024 Reserved for ASPRS Definition (23)
            1998 Reserved for ASPRS Definition (24)
            2039 Reserved for ASPRS Definition (25)
            2096 Reserved for ASPRS Definition (26)
            2105 Reserved for ASPRS Definition (27)
            2184 Reserved for ASPRS Definition (28)
            2507 Reserved for ASPRS Definition (29)
            4468 Reserved for ASPRS Definition (30)
            2856 Reserved for ASPRS Definition (31)

  Point Classification Histogram
---------------------------------------------------------
 +-> flagged as synthetic: 37821
 +-> flagged as keypoints: 33053
 +-> flagged as withheld:  64281
cumulative CPU time thru done. = 0.277000

There likely is a bug related to --eliminate_class.

Change History

Changed 11 months ago by mloskot

I've tested this issue against current SVN trunk (r1159) and the problem leaks there too.

Changed 11 months ago by mloskot

  • owner changed from hobu to mloskot
  • status changed from new to assigned

Changed 11 months ago by mloskot

  • status changed from assigned to closed
  • resolution set to fixed
  • description modified (diff)

The bug has been fixed in trunk (r1162 and r1164)

las2las -i grass_lake_small.las --class 30 -o out.las
eliminated classification: 199126
  Reparing Bounding Box...

lasinfo out30.las | grep "Point Records"
  Number of Point Records    5991674

Changed 11 months ago by mloskot

I have to confess this is a fix made in rush, however in order to avoid similar bugs in future, it would be best to define utility functions for operations that are made more than once:

bool compare_classification(uint8_t cls, uint8_t expected)
{
   // 31 is max index in classification lookup table
   clsidx = (cls & 31);
   assert(clsidx <= 31); 
   return (clsidx == expected);
}

and use it as follows

cls = LASPoint_GetClassification(p); 
bool issame = compare_classification(cls, elim_class);

Changed 11 months ago by hobu

  • cc hobu added
  • status changed from closed to reopened
  • resolution fixed deleted

Reopening so that LASPoint::operator== gets updated too.

Changed 11 months ago by hobu

  • status changed from reopened to closed
  • resolution set to fixed

Added a comment about LASPointer::operator== in r1168, but == doesn't compare any members other than the x, y, and z.

Changed 11 months ago by hobu

  • milestone changed from 1.3 to 1.2.1

backported to 1.2 branch in r1165

Note: See TracTickets for help on using tickets.