[GRASS-user] Fwd: How to obtain selected adjacent pixel values?
Nikos Alexandris
nik at nikosalexandris.net
Sun Jun 30 06:31:41 PDT 2013
(cc-ing @MarkusMetz)
Yasser Said Lopez de Olmos Reyes wrote:
> > How could I obtain the differences between central pixel values and
> > cardinal directions pixel values related with a central pixel?
> > Or in a different manner, how to do this in grass gis?
> > RASTER_OUT= round(abs((RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_UP) +
> > (RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_DOWN) + (RASTER_IN -
> > RASTER_IN_PUSHED_ONE_COLUMN_LEFT) + (RASTER_IN -
> > RASTER_IN_PUSHED_ONE_COLUMN_RIGHT))
Nikos Alexandris wrote:
> This boils down to calculating
> (RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_UP) +
> (RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_DOWN) +
> (RASTER_IN - RASTER_IN_PUSHED_ONE_COLUMN_LEFT) +
> (RASTER_IN - RASTER_IN_PUSHED_ONE_COLUMN_RIGHT)
>
> 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]
>
> I am not exactly sure about the implementation though.
@Yasser, if you implement this and think it is something that can be justified
as generically useful, why not ask @MarkusMetz if it is easy to include in
"r.neighbors" as yet another method?
Best, Nikos
More information about the grass-user
mailing list