TLIB documentation
 

tlBlobs Class Reference

List of all members.


Detailed Description

Blobs extraction, labeling, and filtering class.

A basic task in image processing, known as "connected components extraction", consists in managing and sorting blobs defined by a series of filters. The tlBlobs object is a collection of tlMask objects that does just that. Given a binary image, it segments, extracts and labels sets of connected pixels into tlMask objects, that can then be sorted with respect to different criterions. This is extremely useful for object extraction.

Public Member Functions

 tlBlobs ()
 tlBlobs (tlImage *image, int minArea=0)
 tlBlobs (tlImage *image, tlRect *rect, int minArea=0)
virtual ~tlBlobs ()
int getCount ()
tlMaskgetBlob (int index)
int getBlob (int index, tlMask *mask)
tlMaskgetBlobCopy (int index)
int reset ()
int clear ()
int extract (tlImage *image, int minArea=0)
int extract (tlImage *image, tlRect *rect, int minArea=0)
int filterArea (int minArea, int maxArea)
int filterMinArea (int minArea)
int filterMaxArea (int maxArea)
int sortByArea ()
int add (tlMask *mask)
int insert (int index, tlMask *mask)
int remove (int index)
int swap (int index1, int index2)


Constructor & Destructor Documentation

tlBlobs::tlBlobs (  ) 

Constructor, creates an empty tlBlobs object. Call extract(tlImage *image, int minArea) to perform the extraction.

Note:
See error management for details.

tlBlobs::tlBlobs ( tlImage image,
int  minArea = 0 
)

Constructor, creates a tlBlobs object from an initial binary image.

Parameters:
image binary image for blob extraction.
minArea minimal area a blob must have to be considered; smaller blobs are ignored.
Note:
See error management for details.

tlBlobs::tlBlobs ( tlImage image,
tlRect rect,
int  minArea = 0 
)

Constructor, creates a tlBlobs object from a portion of a binary image.

Parameters:
image binary image for blob extraction.
rect portion of the image to process.
minArea minimal area a blob must have to be considered; smaller blobs are ignored.
Note:
See error management for details.

tlBlobs::~tlBlobs (  )  [virtual]

Destructor.

Note:
See error management for details.

Todo:
fix blobs destructor crash


Member Function Documentation

int tlBlobs::getCount (  )  [inline]

Get the number of blobs currently in the list.

Returns:
the blob count.

tlMask * tlBlobs::getBlob ( int  index  ) 

Get the blob at a given index in the chain (if it exists).

Parameters:
index point index
Returns:
A pointer to the existing tlMask * success, NULL otherwise. See error management for details.
Remarks:
the pointer returned points to the actual mask in the chained list. Thus, it should NOT be deleted. Use getBlobCopy() to get a copy of the blob.

int tlBlobs::getBlob ( int  index,
tlMask mask 
)

Fill an existing blob with data from the blob at a given index in the chain (if it exists).

Parameters:
index point index
mask mask to fill
Returns:
0 on success, -1 otherwise.
See error management for details.
See also:
getBlob (int index) getBlobCopy (int index)

tlMask * tlBlobs::getBlobCopy ( int  index  ) 

Get a copy of the blob at a given index in the chain (if it exists).

Parameters:
index point index
Returns:
A pointer to a copy of the existing tlMask on success, NULL otherwise. See error management for details.
Remarks:
the pointer returned points to a new mask. Thus, it should be deleted after use. Use getBlobCopy() to get a pointer to the actual blob.

int tlBlobs::reset (  ) 

Reset the blob list (remove all blobs).
Same as clear().

Returns:
0 on success, -1 otherwise.
See error management for details.

int tlBlobs::clear (  ) 

Reset the blob list (remove all blobs).
Same as reset().

Returns:
0 on success, -1 otherwise.
See error management for details.

int tlBlobs::extract ( tlImage image,
int  minArea = 0 
)

Perform a blob extraction on the given image. This routine ignores all blobs whose area is smaller than minArea.

Parameters:
image binary image to perform extraction from
minArea minimal blob area [pix]
Returns:
The number of blobs found on success.
On error, -1 is returned and tl_errno is set.
See TL_ERROR for details.

int tlBlobs::extract ( tlImage image,
tlRect rect,
int  minArea = 0 
)

Perform a blob extraction on a portion of the given image. This routine ignores all blobs whose area is smaller than minArea.

Parameters:
image binary image to perform extraction from
minArea minimal blob area [pix]
rect portion of the image to process
Returns:
The number of blobs found on success, -1 otherwise.
See error management for details.

int tlBlobs::filterArea ( int  minArea,
int  maxArea 
)

Filters the blobs according to their apparent area and deletes blob which do not satisfy the criterias

Parameters:
minArea minimal blob area [pix]
maxArea maximal blob area [pix]
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlBlobs::filterMinArea ( int  minArea  ) 

Filters the blobs according to their apparent area and deletes blob which do not satisfy the criterias

Parameters:
minArea minimal blob area [pix]
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlBlobs::filterMaxArea ( int  maxArea  ) 

Filters the blobs according to their apparent area and deletes blob which do not satisfy the criterias

Parameters:
maxArea maximal blob area [pix]
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlBlobs::sortByArea (  ) 

Sort the blobs by area so that the biggest blob is at index 0.

Returns:
0 on success, -1 otherwise.
See error management for details.

int tlBlobs::add ( tlMask mask  ) 

Insert a blob at the end of the list.

Parameters:
mask the blob to add
Returns:
The index of the point if insertion on success, -1 otherwise.
See error management for details.

int tlBlobs::insert ( int  index,
tlMask mask 
)

Insert a blob at a specific index in the chained list.

Parameters:
index the index to insert to blob at
mask the blob to insert
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlBlobs::remove ( int  index  ) 

Remove a blob at a specific index from the chained list.

Parameters:
index the index of the blob to remove
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlBlobs::swap ( int  index1,
int  index2 
)

Swap two blobs within the list.

Parameters:
index1 the first blob
index2 the second blob
Returns:
0 on success, -1 otherwise.
See error management for details.


The documentation for this class was generated from the following files:

TLIB documentation - generated on 7 May 2008
Please address any questions to seb@tuyphon.com
(C) 2001-2008 - S. Grange
(C) 2001-2007 - VRAI Group, EPFL
All Rights Reserved.