Skip to content
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

C++ median smoothing filter #1731

Merged
merged 3 commits into from
Dec 8, 2023
Merged

Conversation

pierotofy
Copy link
Member

@pierotofy pierotofy commented Dec 7, 2023

This PR moves the median smoothing filter to C++ via FastRasterFilter (https://github.com/OpenDroneMap/FastRasterFilter), which is now both faster and more algorithmically correct, since we properly apply the median filter using a sliding window with padding (compared to the current implementation, which does not implement padding).

image

@pierotofy
Copy link
Member Author

On brighton beach for a small raster this is ~25% faster, I fully expect this to be much faster for larger rasters and orders of magnitude faster for corridor type datasets, which have large chunks of empty space (we now detect empty tiles and skip the filtering for those areas).

@pierotofy
Copy link
Member Author

pierotofy commented Dec 7, 2023

Oh yeah.

time ./fastrasterfilter "/datasets/large/mesh_dsm.tif" --output "/datasets/large/median.tif" --window-size 512 --radius 5 --co TILED=YES --co BIGTIFF=IF_SAFER --co COMPRESS=DEFLATE
Input: /datasets/large/mesh_dsm.tif
Size: 45999x96885
Blocks: 17100
Smoothing...1000...2000...3000...4000...5000...6000...7000...8000...9000...10000...11000...12000...13000...14000...15000...16000...17000...17100... done
Wrote /datasets/large/median.tif

real	5m47.263s

On a scrappy core i5 laptop (4 cores).

@pierotofy pierotofy merged commit 32d9330 into OpenDroneMap:master Dec 8, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant