Learn R Programming

gridSVG (version 1.5-0)

feConvolveMatrix: Apply a matrix convolution filter effect.

Description

A convolution combines pixels in the input image with neighbouring pixels to produce a resulting image. A wide variety of imaging operations can be achieved through convolutions, including blurring, edge detection, sharpening, embossing and beveling.

Usage

feConvolveMatrix(input = NA, order = 3, kernelMatrix = matrix(), divisor = 1, bias = 0, targetX = 1, targetY = 1, edgeMode = c("duplicate", "wrap", "none"), kernelUnitLength = NA, preserveAlpha = FALSE, ...)

Arguments

input
Identifies an input for this filter primtive. See filterInputs.
order
A numeric vector of length 1 or 2. Indicates the number of cells in each dimension for kernelMatrix. The values provided must be integers greater than zero. The first number (orderX), indicates the number of columns in the matrix. The second number (orderY), indicates the number of rows in the matrix. If this is a vector of length one then the number of rows is assumed to be same as the number of columns specified.
kernelMatrix
The kernel matrix for the convolution. The number of entries must correspond with the values given by order.
divisor
After applying the kernelMatrix to the input image to yield a number, that number is divided by divisor to yield the final destination colour value. A divisor that is the sum of all the matrix values tends to have an evening effect on the overall colour intensity of the result. It is an error to specify a divisor of zero. The default value is the sum of all values in kernelMatrix, with the exception that if the sum is zero, then the divisor is set to 1.
bias
After applying the kernelMatrix to the input image to yield a number and applying the divisor, the bias attribute is added to each component. One application of bias is when it is desirable to have 0.5 gray value be the zero response of the filter. The bias property shifts the range of the filter. This allows representation of values that would otherwise be clamped to 0 or 1.
targetX
Determines the positioning in X of the convolution matrix relative to a given target pixel in the input image. The leftmost column of the matrix is column number zero. The value must be such that: $0
targetY
Determines the positioning in Y of the convolution matrix relative to a given target pixel in the input image. The topmost row of the matrix is row number zero. The value must be such that: $0
edgeMode
Determines how to extend the input image as necessary with colour values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image.

  • "duplicate" indicates that the input image is extended along each of its borders as necessary by duplicating the colour values at the given edge of the input image.

  • "wrap" indicates that the input image is extended by taking the colour values from the opposite edge of the image.
  • "none" indicates that the input image is extended with pixel values of zero for R, G, B and A.
  • kernelUnitLength
    The first number is the dx value. The second number is the dy value. If the dy value is not specified, it defaults to the same value as dx. Indicates the intended distance in current filter units (i.e., units as determined by the value of the filter effect container's primitiveUnits) between successive columns and rows, respectively, in the kernelMatrix. By specifying value(s) for kernelUnitLength, the kernel becomes defined in a scalable, abstract coordinate system. If kernelUnitLength is not specified, the default value is one pixel in the offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable.
    preserveAlpha
    A value of FALSE indicates that the convolution will apply to all channels, including the alpha channel.

    A value of TRUE indicates that the convolution will only apply to the colour channels. In this case, the filter will temporarily unpremultiply the colour component values, apply the kernel, and then re-premultiply at the end.

    ...
    Further arguments to be passed onto fe.

    Value

    An fe.convolve.matrix object.

    Details

    For more information about this primitive, consult the reference to the SVG specification.

    References

    http://www.w3.org/TR/SVG/filters.html#feConvolveMatrixElement

    See Also

    filterEffect, fe.