2

I've detected water bodies in satellite images (modis, sentinel, landsat) in special area polygons, by ndwi values and based on special thresholds. area polygons and image tiles are coordinate restricted, so there is only one main water body in image (as you can see in the picture below). i need to identify water body borders so i defined a binary mask that represents water body area (1s) and land area (0s). the problem is, there are some small water bodies (as noises) in the image. i want to get access to them and turn their values in binary mask array from 1 to 0, without effecting the main water body. i found some codes can count such like binary areas base on adjacency, but i dont have access to those areas to change the values!i need to access those areas seperately as an distinct objects (or something like this). ndwi

what should i do?

4

You can use gdal_sieve to remove small areas of noise. From the documentation:

gdal_sieve.py script removes raster polygons smaller than a provided threshold size (in pixels) and replaces them with the pixel value of the largest neighbour polygon. The result can be written back to the existing raster band, or copied into a new file.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.