[GRASS-user] Do filters available in GRASS takes care of cell padding?

Uttam Kumar uttamsinha09 at gmail.com
Sat Dec 5 13:58:28 PST 2015


Thank you very much. It is much easy to understand the kernel function
options now.

Thanks once again.

On Fri, Dec 4, 2015 at 1:44 PM, Glynn Clements <glynn at gclements.plus.com>
wrote:

>
> Uttam Kumar wrote:
>
> > 4.) Which one of the above GRASS commands would be best suited to perform
> > window operation (high pass filtering) along with cell padding?
>
> One caveat to my previous reply:
>
> Ignoring nulls often doesn't work so well for kernels with a zero sum
> (e.g your high-pass filter). You can't use r.neighbors method=average
> with weights which sum to zero (as that results in division by zero),
> and method=sum introduces a bias if some weights are ignored (at the
> edges, you'll have a single cell with a weight of 24 and fewer than 24
> cells with a weight of -1, meaning that a constant map would produce a
> positive value near the edges).
>
> I would suggest using two passes, e.g.
>
>         r.neighbors size=5 method=average input=band5 output=band5_average
>         r.mapcalc 'band5_highpassfilter = band5 - band5_average'
>         g.remove raster=band5_average
>
> This returns the value of the centre cell minus the average of the
> surrounding non-null cells. The average value is still meaningful if
> the filter window overlaps null cells or the edges.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20151205/d9eb5d82/attachment.html>


More information about the grass-user mailing list