[GRASS-user] counting cells equal center cell on window
Glynn Clements
glynn at gclements.plus.com
Sat Dec 6 03:11:28 EST 2008
Milton Cezar Ribeiro wrote:
> I have a raster map with categorical values.
> I have many occurrence of alone-pixels, where all neighbours
> are different from a central pixels. So I need to change all pixels
> that differ from alll its neighbours for the "mode" value.
>
> I know that "r.neighbours ..method=mode" return the mode value.
> Now I need to identify only those pixels that differ from neighbours.
> I think one way is count all occurrence the value of central pixel
> on a windows (like 3x3, 5x5), and attrib it on a bynary map, where
> "ones" is for those positons where central pixels have frequency 1,
> and "zeros" for those potisions where central pixels have frequency >1.
Maybe you want method=interspersion:
interspersion
The percentage of cells containing values which differ from the
values assigned to the center cell in the neighborhood, plus 1. In
the above example, the interspersion is:
5/8 * 100 + 1 = 63.5
The result is rounded to the nearest integer (in this case 64).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list