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 ?
I know I can do this in r.mapcalc going through all the neighboring
pixels, but is another way ?
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 ?
I know I can do this in r.mapcalc going through all the neighboring
pixels, but is another way ?
Moritz
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.
On 23/11/11 17:41, Marcello Gorini wrote:
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.
Thanks ! Yes, I came upon this solution myself in the meanwhile and I think it is the only one. Maybe something to script into a nice little frontend to r.neighbors where you give the map and the desired category and you receive a map of numbers of neighbours in return.
Moritz