[postgis-users] Better way of removing pixelation with postgis raster

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Wed Jul 18 13:21:03 PDT 2012

> I think you could easily implement a filter function to remove the 1 pixel type of
> island as a custom function of ST_MapAlgebraFctNgb(). See
> http://www.postgis.org/documentation/manual-
> svn/RT_ST_MapAlgebraFctNgb.html The size of the window should be 3x3 in this
> case. Return the pixel value if at least one neighbour has a value, null otherwise.
> I am 99% sure ST_MapAlgebraFctNgb would be faster on big rasters than
> vectorizing/union/rasterizing...
> However I have no idea how to implement such a filter to remove bigger islands
> (or speckles?) spanning on many pixels. Maybe with a little of research...

Actually your first class of pixels to remove have to be 4 pixels. No importance if they are aligned on one row or column? To remove speckles 2x2 you would have a window of 4x4 instead. But this would not remove the 


types of arrangement and the 


type of arrangement.


More information about the postgis-users mailing list