Method
VipsImagemorph
Declaration [src]
int
vips_morph (
VipsImage* in,
VipsImage** out,
VipsImage* mask,
VipsOperationMorphology morph,
...
)
Description [src]
Performs a morphological operation on in
using mask
as a
structuring element.
The image should have 0 (black) for no object and 255 (non-zero) for an object. Note that this is the reverse of the usual convention for these operations, but more convenient when combined with the boolean operators. The output image is the same size as the input image: edge pxels are made by expanding the input image as necessary.
Mask coefficients can be either 0 (for object) or 255 (for background) or 128 (for do not care). The origin of the mask is at location (m.xsize / 2, m.ysize / 2), integer division. All algorithms have been based on the book “Fundamentals of Digital Image Processing” by A. Jain, pp 384-388, Prentice-Hall, 1989.
For VIPS_OPERATION_MORPHOLOGY_ERODE
,
the whole mask must match for the output pixel to be
set, that is, the result is the logical AND of the selected input pixels.
For VIPS_OPERATION_MORPHOLOGY_DILATE
,
the output pixel is set if any part of the mask
matches, that is, the result is the logical OR of the selected input pixels.
See the boolean operations vips_andimage()
, vips_orimage()
and vips_eorimage()
for analogues of the usual set difference and set union operations.
Operations are performed using the processor’s vector unit,
if possible. Disable this with --vips-novector
or VIPS_NOVECTOR
or
vips_vector_set_enabled()
.
This method is not directly available to language bindings.
Parameters
out
-
Type:
VipsImage
Output image.
The argument will be set by the function. The caller of the method takes ownership of the returned data, and is responsible for freeing it. mask
-
Type:
VipsImage
Morphology with this mask.
The data is owned by the caller of the method. morph
-
Type:
VipsOperationMorphology
Operation to perform.
...
-
Type:
NULL
-terminated list of optional named arguments.