BW = imextendedmin(I,h)
BW = imextendedmin(I,h,conn)
BW = imextendedmin(I,h) computes the extended-minima transform, which is the regional minima of the H-minima transform. h is a nonnegative scalar.
Regional minima are connected components of pixels with a constant intensity value, and whose external boundary pixels all have a higher value.
By default, imextendedmin uses 8-connected neighborhoods for 2-D images, and 26-connected neighborhoods for 3-D images. For higher dimensions, imextendedmin uses conndef(numel(size(I)),'maximal').
BW = imextendedmin(I,h,conn) computes the extended-minima transform, where conn specifies the connectivity. conn can have any of the following scalar values.
Connectivity can be defined in a more general way for any dimension by using for conn a 3-by-3-by-...-by-3 matrix of 0's and 1's. The 1-valued elements define neighborhood locations relative to the center element of conn. Note that conn must be symmetric about its center element.
imextendedmin supports the generation of efficient, production-quality C/C++ code from MATLAB. When generating code, the optional third input argument, conn, must be a compile-time constant. Generated code for this function uses a precompiled platform-specific shared library. To see a complete list of toolbox functions that support code generation, see List of Supported Functions with Usage Notes.
I can be of any nonsparse numeric class and any dimension. BW has the same size as I and is always logical.
 Soille, P., Morphological Image Analysis: Principles and Applications, Springer-Verlag, 1999, pp. 170-171.