Applies a user supplied kernel to the image according to the given morphology method.
인수
morphologyMethod
Which morphology method to use one of the \Imagick::MORPHOLOGY_* constants.
iterations
The number of iteration to apply the morphology function. A value of -1 means loop until no change found. How this is applied may depend on the morphology method. Typically this is a value of 1.
<?php // As a result you will see that 'Open' smoothed the outline, by rounding off any sharp points, and remove any parts that is smaller than the shape used. It will also disconnect or 'open' any thin bridges. $canvas = $this->getCharacterOutline(); $kernel = \ImagickKernel::fromBuiltIn(\Imagick::KERNEL_DISK, "6"); $canvas->morphology(\Imagick::MORPHOLOGY_OPEN, 1, $kernel); header("Content-Type: image/png"); echo $canvas->getImageBlob();
?>
Example #13 Open intensity Imagick::morphology()
<?php // As a result you will see that 'Open' smoothed the outline, by rounding off any sharp points, and remove any parts that is smaller than the shape used. It will also disconnect or 'open' any thin bridges.
<?php //The basic use of the 'Close' method is to reduce or remove any 'holes' or 'gaps' about the size of the kernel 'Structure Element'. That is 'close' parts of the background that are about that size. $canvas = $this->getCharacterOutline(); $kernel = \ImagickKernel::fromBuiltIn(\Imagick::KERNEL_DISK, "6"); $canvas->morphology(\Imagick::MORPHOLOGY_CLOSE, 1, $kernel); header("Content-Type: image/png"); echo $canvas->getImageBlob();
?>
Example #15 Close Intensity Imagick::morphology()
<?php //The basic use of the 'Close' method is to reduce or remove any 'holes' or 'gaps' about the size of the kernel 'Structure Element'. That is 'close' parts of the background that are about that size. $canvas = $this->getCharacter(); $kernel = \ImagickKernel::fromBuiltIn(\Imagick::KERNEL_DISK, "6"); $canvas->morphology(\Imagick::MORPHOLOGY_CLOSE_INTENSITY, 1, $kernel); header("Content-Type: image/png"); echo $canvas->getImageBlob();
Example #19 The 'TopHat' method, or more specifically 'White Top Hat', returns the pixels that were removed by a Opening of the shape, that is the pixels that were removed to round off the points, and the connecting bridged between shapes. Imagick::morphology()
Example #20 The 'BottomHat' method, also known as 'Black TopHat' is the pixels that a Closing of the shape adds to the image. That is the the pixels that were used to fill in the 'holes', 'gaps', and 'bridges'. Imagick::morphology()
// The thicken morphology doesn't handle small gaps. We close them // with the close morphology. $canvas->morphology(\Imagick::MORPHOLOGY_CLOSE, 1, $diamondKernel); $canvas->morphology(\Imagick::MORPHOLOGY_THICKEN, -1, $convexKernel); $canvas->morphology(\Imagick::MORPHOLOGY_CLOSE, 1, $diamondKernel);