Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

convolve.im

Convolution of Pixel Images


Description

Computes the convolution of two pixel images.

Usage

convolve.im(X, Y=X, ..., reflectX=FALSE, reflectY=FALSE)

Arguments

X

A pixel image (object of class "im".

Y

Optional. Another pixel image.

...

Ignored.

reflectX,reflectY

Logical values specifying whether the images X and Y (respectively) should be reflected in the origin before computing the convolution.

Details

The convolution of two pixel images X and Y in the plane is the function C(v) defined for each vector v as

C(v) = integral of X(u) * Y(v-u) du

where the integral is over all spatial locations u, and where X(u) and Y(u) denote the pixel values of X and Y respectively at location u.

This command computes a discretised approximation to the convolution, using the Fast Fourier Transform. The return value is another pixel image (object of class "im") whose greyscale values are values of the convolution.

If reflectX = TRUE then the pixel image X is reflected in the origin (see reflect) before the convolution is computed, so that convolve.im(X,Y,reflectX=TRUE) is mathematically equivalent to convolve.im(reflect(X), Y). (These two commands are not exactly equivalent, because the reflection is performed in the Fourier domain in the first command, and reflection is performed in the spatial domain in the second command).

Similarly if reflectY = TRUE then the pixel image Y is reflected in the origin before the convolution is computed, so that convolve.im(X,Y,reflectY=TRUE) is mathematically equivalent to convolve.im(X, reflect(Y)).

Value

A pixel image (an object of class "im") representing the convolution of X and Y.

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also

Examples

X <- as.im(letterR)
  Y <- as.im(square(1))
  plot(convolve.im(X, Y))
  plot(convolve.im(X, Y, reflectX=TRUE))
  plot(convolve.im(X))

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.