Skip to content

Commit

Permalink
Fixes #278
Browse files Browse the repository at this point in the history
This fixes an issue with RGB interpolation using the NN and IDW lidar interpolators (#278).
  • Loading branch information
jblindsay committed Sep 13, 2022
1 parent 030183c commit 739c685
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,9 @@ impl WhiteboxTool for LidarIdwInterpolation {
p.x,
p.y,
((255u32 << 24)
| ((clr.blue as u32) << 16)
| ((clr.green as u32) << 8)
| (clr.red as u32))
| (((clr.blue / 256) as u32) << 16)
| (((clr.green / 256) as u32) << 8)
| ((clr.red / 256) as u32))
as f64,
);
}
Expand Down
12 changes: 8 additions & 4 deletions whitebox-tools-app/src/tools/lidar_analysis/lidar_nn_gridding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,9 +782,9 @@ impl WhiteboxTool for LidarNearestNeighbourGridding {
p.x,
p.y,
((255u32 << 24)
| ((clr.blue as u32) << 16)
| ((clr.green as u32) << 8)
| (clr.red as u32))
| (((clr.blue / 256) as u32) << 16)
| (((clr.green / 256) as u32) << 8)
| ((clr.red / 256) as u32))
as f64,
);
}
Expand Down Expand Up @@ -860,7 +860,11 @@ impl WhiteboxTool for LidarNearestNeighbourGridding {
configs.resolution_y = grid_res;
configs.nodata = nodata;
configs.data_type = DataType::F32;
configs.photometric_interp = PhotometricInterpretation::Continuous;
if interp_parameter != "rgb" {
configs.photometric_interp = PhotometricInterpretation::Continuous;
} else {
configs.photometric_interp = PhotometricInterpretation::RGB;
}
configs.palette = palette.clone();

let mut output = Raster::initialize_using_config(&output_file, &configs);
Expand Down

0 comments on commit 739c685

Please sign in to comment.