class BorderDetection extends Neighborhood implements FilterInterface

BorderDetection based on Laplace-Operator. Three different variants are offered:.

  First          Second            Third
 0,  1, 0       1,  1, 1,       -1,  2, -1,
 1, -4, 1  and  1, -8, 1,  and   2, -4,  2,
 0,  1, 0       1,  1, 1        -1,  2, -1

.

Consider to apply this filter on a grayscaled image.

Constants

VARIANT_ONE

First variant of the detection matrix.

VARIANT_TWO

Second variant of the detection matrix.

VARIANT_THREE

Third variant of the detection matrix.

Properties

protected Matrix $matrix from Neighborhood

Methods

__construct(int $variant = self::VARIANT_ONE)

Initialize this filter.

apply(ImageInterface $image)

Applies scheduled transformation to an ImageInterface instance.

Details

at line 59
__construct(int $variant = self::VARIANT_ONE)

Initialize this filter.

Parameters

int $variant One of the BorderDetection::VARIANT_... constants.

Exceptions

InvalidArgumentException throws an InvalidArgumentException if $variant is not valid

in Neighborhood at line 59
ImageInterface apply(ImageInterface $image)

Applies scheduled transformation to an ImageInterface instance.

Parameters

ImageInterface $image

Return Value

ImageInterface returns the processed ImageInterface instance

See also

FilterInterface::apply