I have a raster dataset and have used gdal_sieve to eliminate clumps of pixels made up of below a certain number of pixels. How do I eliminate large clumps of pixels above a certain number of pixels?
Asked
Active
Viewed 499 times
1 Answers
1
gdal_sieve.py does not support removing objects above a threshold size. However it seems that your desired output can be achieved by sieving objects below your threshold and then calculating the difference between the input and sieved images:
gdal_sieve.py -st <<threshold>> input.tif sieved.tif
gdal_calc.py -A input.tif -B sieved.tif --calc="A ^ B" --outfile=output.tif

user6072577
- 339
- 5
- 11
-
That's what I wound up doing. Was hoping for a one-step solution but this'll do. – Blazinator Apr 17 '19 at 18:34