[GRASS-user] Fwd: How to obtain selected adjacent pixel values?
Nikos Alexandris
nik at nikosalexandris.net
Mon Jul 1 03:49:14 PDT 2013
[..]
Nikos A:
> >> Please check the manual of r.mapcalc. There is "THE NEIGHBORHOOD
> >> MODIFIER" which I think can be used to obtain what is asked.
> >> So, for each of the off-current pixel, the modifiers would be like
> >> RASTER_IN_PUSHED_ONE_ROW_UP: map[-1,0]
> >> RASTER_IN_PUSHED_ONE_ROW_DOWN: map[1,0]
> >> RASTER_IN_PUSHED_ONE_COLUMN_LEFT: map[0,-1]
> >> RASTER_IN_PUSHED_ONE_COLUMN_RIGHT: map[0,1]
Markus Metz wrote:
> r.mapcalc \
> "RASTER_OUT=round(abs((RASTER_IN - RASTER_IN[0,-1]) + \
> (RASTER_IN - RASTER_IN[0,1]) + \
> (RASTER_IN - RASTER_IN[-1,0]) + \
> (RASTER_IN - RASTER_IN[1,0])))"
> Note that this is the same like
> round(abs(4 * RASTER_IN - \
> (RASTER_IN[0,-1] + \
> RASTER_IN[0,1] + \
> RASTER_IN[-1,0] + \
> RASTER_IN[1,0])))
[..]
Maybe we can add this example in the manual?
Nikos
More information about the grass-user
mailing list