Learn R Programming

Rvision (version 0.4.2)

filter2D: Image Convolution with Kernel

Description

filter2D applies an arbitrary linear filter to an image.

Usage

filter2D(image, kernel, in_place = FALSE)

Arguments

image

An Image object.

kernel

A matrix representing the convolution kernel.

in_place

A logical indicating whether the change should be applied to the image itself (TRUE, faster but destructive) or to a copy of it (FALSE, the default, slower but non destructive).

Value

An Image object if in_place=FALSE. Otherwise, it returns nothing and modifies image in place.

See Also

Image, split, merge

Examples

Run this code
# NOT RUN {
balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
k_edge_detection <- matrix(c(-1, -1, -1, -1, 8, -1, -1, -1, -1), nrow = 3)
balloon_edge <- filter2D(balloon, k_edge_detection)
plot(balloon_edge)

# }

Run the code above in your browser using DataLab