[R] 2D convolution

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jun 4 23:11:11 CEST 2001


On Mon, 4 Jun 2001, Kjetil Kjernsmo wrote:

> Dear all,
>
> I have an image that I need to filter, and so I'm looking for a method to
> convolve it with a matrix. If I understood the docs for convolve
> correctly, it only works in 1D (and I have tried to convolve, it didn't
> look good).
>
> So, I wondered if anybody have implemented 2D convolution in R, or have
> any good advices to share (beyond having a look at mvfft), before I go
> hacking?

How about don't?  That is, do it at C/Fortran level.  2D convolution tends
to be expensive and edge effects can be much trickier.  When we had to do
it in earnest (2D optical astronomy from CCD arrays, pre-R) fortunately
the objects of interest were in the centre of the image, so edge effects
were small, and we wrote Fortran routines to do it in place (also based on
Singleton's code).

Note that mvfft does not do 2D transforms: it's fft that does so (as I
read the docs).

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list