DIPlib Documentation - ©1995-2008 Quantitative Imaging Group, Delft University of Technology.

Tophat

Morphological high-pass filter

SYNOPSIS

#include "dip_morphology.h"

dip_Error dip_Tophat ( in, out, se, boundary, filterParam, shape, edgeType, polarity )

DATA TYPES

integer, float

FUNCTION

The top-hat is the difference between a morphological operation and the original image, comparable to a high-pass filter. Which operation is used can be chosen through the dip_MphEdgeType and dip_MphTophatPolarity parameters.

The rectangular, elliptic and diamond structuring elements are "flat", i.e. these structuring elements have a constant value. For these structuring elements, filterParam determines the sizes of the structuring elements. When shape is set to DIP_FLT_SHAPE_PARABOLIC, filterParams specifies the curvature of the parabola. When shape is set to DIP_FLT_SHAPE_STRUCTURING_ELEMENT, se is used as structuring element. It can be either a binary or a grey-value image, but be careful: it is converted to the same data type as the input image, and might therefore be clipped or loose precision. It is required (in the current implementation) that the structuring element be odd in size. Its origin is the center.

If shape is not equal to DIP_FLT_SHAPE_STRUCTURING_ELEMENT, se is allowed to be set to zero. When shape is set to DIP_FLT_SHAPE_STRUCTURING_ELEMENT, filterParam is ignored, (and can be set to zero).

ARGUMENTS

Data typeNameDescription
dip_ImageinInput
dip_ImageoutOutput
dip_ImageseStructuring element
dip_BoundaryArrayboundaryBoundary conditions
dip_FloatArrayfilterParamFilter parameters
dip_FilterShapeshapeFilter shape
dip_MphEdgeTypeedgeTypeedgeType
dip_MphTophatPolaritypolaritypolarity

The enumerator dip_FilterShape contains the following constants:

NameDescription
DIP_FLT_SHAPE_DEFAULTdefault structuring element, same as DIP_FLT_SHAPE_RECTANGULAR
DIP_FLT_SHAPE_RECTANGULARrectangular structuring element
DIP_FLT_SHAPE_ELLIPTICelliptic structuring element
DIP_FLT_SHAPE_DIAMONDdiamond shaped structuring element
DIP_FLT_SHAPE_PARABOLICparabolic structuring element
DIP_FLT_SHAPE_STRUCTURING_ELEMENTuse se as structuring element

The enumerator dip_MphEdgeType contains the following constants:

NameDescription
DIP_MPH_TEXTUREResponse is limited to edges in texture
DIP_MPH_OBJECTResponse is limited to object edges
DIP_MPH_BOTHAll edges produce equal response

The enumerator dip_MphTophatPolarity contains the following constants:

NameDescription
DIP_MPH_TEXTUREResponse is limited to edges in texture
DIP_MPH_OBJECTResponse is limited to object edges
DIP_MPH_BOTHAll edges produce equal response

SEE ALSO

Lee, MorphologicalGradientMagnitude, MorphologicalRange, MultiScaleMorphologicalGradient, MorphologicalSmoothing, MorphologicalThreshold

DIPlib on-line documentation | Function reference | Global function index