[GRASS-user] how to count number of occurrences of a specific category value in the neighborhood of a given pixel

Marcello Gorini gorini at gmail.com
Wed Nov 23 11:41:16 EST 2011


Moritz:

Hello,
>
> Does anyone see an easy way to count the number of times a specific
> category value occurs in a given neighborhood of a central pixel ?
>
>
As always, there is surely a better way in GRASS (probably one single
command), but you could binarize your map (1 for your desired category and
zero for everything else) and then use r.neighbors method=sum
size=desired_neighborhood.

The result would be the desired count.

Cheers,
Marcello.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20111123/b7417f8e/attachment.html


More information about the grass-user mailing list