Function iaareaclose

Synopse

Area closing

  • y = iaareaclose(f, a, Bc=iasecross())
    • y: Image
    • f: Image
    • a: Double non negative integer.
    • Bc: Structuring Element ( connectivity).
1. from numpy import *
2. from iasecross import iasecross
3. 
4. def iaareaclose(f, a, Bc=iasecross()):
5.     from ianeg import ianeg
6.     from iaareaopen import iaareaopen
7. 
8.     y = ianeg( iaareaopen( ianeg(f),a,Bc))
9.     return y

Description

iaareaclose removes any pore (i.e., background 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.

Examples

Example 1

1. from ia870 import iaareaclose
2. 
3. a=mmreadgray('form-1.tif')
4. t1 = time.time()
5. b=iaareaclose(a,400)
6. print time.time() - t1, 'seconds'
7. adshow(a)
8. adshow(b)
3.11433887482 seconds

Example 2

1. a=mmreadgray('n2538.tif')
2. t1 = time.time()
3. b=iaareaclose(a,400)
4. print time.time() - t1, 'seconds'
5. adshow(a)
6. adshow(b)
0.661030054092 seconds

Equation

Limitations

The structuring elements allowed are the elementary cross (4-connected) and the elementary box (8-connected).