[Top] [Up] [Prev] [Next] [Up] [Basic Concepts] [Demonstrations] [Functions] SDC Morphology Toolbox V1.1 15Jan02

mmareaopen - Area opening.


Synopsis
y = mmareaopen( f, a, Bc )
Input
f: Gray-scale (uint8 or uint16) or binary image (logical uint8).
a: non negative integer.
Bc: Structuring element. ( connectivity). Default: Elementary cross (mmsecross).
Output
y: Gray-scale (uint8 or uint16) or binary image (logical uint8).
Description
mmareaopen removes any grain (i.e., connected component) with area less than a of a binary image f. The connectivity is given by the structuring element Bc. This operator is generalized to gray-scale images by applying the binary operator successively on slices of f taken from higher threshold levels to lower threshold levels.
Limitation
The structuring elements allowed are the elementary cross (4-connected) and the elementary box (8-connected).
Examples

Numerical examples:

f=mmbinary(uint8([...
 1 1 0 0 0 0 1;...
 1 0 1 1 1 0 1;...
 0 0 0 0 1 0 0]));
y=mmareaopen(f,4,mmsecross)

y =
     0     0     0     0     0     0     0
     0     0     1     1     1     0     0
     0     0     0     0     1     0     0
f=uint8([...
   10    11    0     0    0    0   20;...
   10     0    5     8    9    0   15;...
   10     0    0     0   10    0    0]);
y=mmareaopen(f,4,mmsecross)

y =
    10    10     0     0     0     0     0
    10     0     5     5     5     0     0
    10     0     0     0     5     0     0

Binary image

a=mmreadgray('form-1.tif');
b=mmareaopen(a,500);
mmshow(a);
mmshow(b);
image
(a)
image
(b)

Gray-scale image

a=mmreadgray('bloodcells.tif');
b=mmareaopen(a,500);
mmshow(a);
mmshow(b);
image
(a)
image
(b)
Equation

equation

Algorithm
function y = mmareaopen_equ(f, a, Bc)
if nargin == 2
  Bc = mmsecross;
end
if mmis(f,'binary')
  fr = mmlabel(f,Bc);      % binary area open, use area measurement
  g = mmblob(fr,'area');
  y = mmthreshad(g,a);
else
  y=zeros(size(f));
  for k=1:mmmaxlevel(f)  % gray-scale area open, use thresholding decomposition
    fk = mmthreshad(f,k);
    fo = mmareaopen(fk,a,Bc);
    if mmcmp(fo,'==',0)
      break;
    end
    y = y + double(fo);
  end
end
See Also
mmareaclose - Area closing
mmfreedom - Control automatic data type conversion.
mmlabel - Label a binary image.
mmsebox - Create a box structuring element.
mmsecross - Cross structuring element.

[Top] [Up] [Prev] [Next] [Up] [Basic Concepts] [Demonstrations] [Functions] Valid XHTML 1.0!
Copyright (c) 1998-2002 by SDC Information Systems