Morph img

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search

Purpose

Perform erosion, dilation or threshold on a univariate image.

Synopsis

imout = morph_img(im,action,window,threshold)

Description

This function operates on a univariate image (im) and can perform any one of the morphing actions defined by the action input).

Note: using 'erode' or 'dilate' with a threshold other than the default is equivalent to doing a "celluar" erosion or dilation where the rules are "softer" for eroding or dilating.

Inputs

  • im = univariate image.
  • action = morphing action:
    • threshold : converts grayscale image to binary image where a pixel is set to a value of 1 if the original value is greater than the input (threshold) value.
    • erode : performs an erosion action on a binary image. Pixels which have any neighboring "off" pxiels will be turned off theselves. Optional input (threshold) defines the fraction of neighboring pixels which must be "on" to keep a given pixel "on" (default = 1 = all neighboring pixels must be "on")
    • dilate : performs a dilation action on a binary image. Pixels which have any neighboring "on" pixels will be turned on themselves. Optional input (threshold) defines the fraction of neighboring "on" pixels which must be exceeded to turn a given pixel "on" (default = 0 = at least one neighboring pixel must be "on")
    • open : automatically performs 'erode' followed by 'dilate'.
    • close : automatically performs 'dilate' followed by 'erode'.
    • apply : performs a simple application of the given mask to the image (binary or non). This action allows simple convolution of an image with a mask for various effects.

Optional Inputs

  • window = one of three window specifications:
    • a positive scalar indicating the size of square window to use (default = 3).
    • a negative scalar indicating the radius of a circular window mask to use (e.g. -5 = 5 pixel radius circle).
    • a specific 2D convolution mask to use. The mask will be automatically padded and centered for use on the image.
  • threshold = when non-empty, this input defines the level above which a pixel will be "on" after the given erosion or dilation action (see details above for function of threshold with the given action.) Default is defined by the method.

Outputs

  • imout = image resulting from given action.


See Also

rhist_img