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 () |
tlMask * | getBlob (int index) |
int | getBlob (int index, tlMask *mask) |
tlMask * | getBlobCopy (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) |
tlBlobs::tlBlobs | ( | ) |
Constructor, creates an empty tlBlobs object. Call extract(tlImage *image, int minArea) to perform the extraction.
tlBlobs::tlBlobs | ( | tlImage * | image, | |
int | minArea = 0 | |||
) |
Constructor, creates a tlBlobs object from an initial binary image.
image | binary image for blob extraction. | |
minArea | minimal area a blob must have to be considered; smaller blobs are ignored. |
Constructor, creates a tlBlobs object from a portion of a binary image.
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. |
tlBlobs::~tlBlobs | ( | ) | [virtual] |
int tlBlobs::getCount | ( | ) | [inline] |
Get the number of blobs currently in the list.
tlMask * tlBlobs::getBlob | ( | int | index | ) |
Get the blob at a given index in the chain (if it exists).
index | point index |
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).
index | point index | |
mask | mask to fill |
tlMask * tlBlobs::getBlobCopy | ( | int | index | ) |
Get a copy of the blob at a given index in the chain (if it exists).
index | point index |
int tlBlobs::reset | ( | ) |
Reset the blob list (remove all blobs).
Same as clear().
int tlBlobs::clear | ( | ) |
Reset the blob list (remove all blobs).
Same as reset().
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.
image | binary image to perform extraction from | |
minArea | minimal blob area [pix] |
Perform a blob extraction on a portion of the given image. This routine ignores all blobs whose area is smaller than minArea.
image | binary image to perform extraction from | |
minArea | minimal blob area [pix] | |
rect | portion of the image to process |
int tlBlobs::filterArea | ( | int | minArea, | |
int | maxArea | |||
) |
Filters the blobs according to their apparent area and deletes blob which do not satisfy the criterias
minArea | minimal blob area [pix] | |
maxArea | maximal blob area [pix] |
int tlBlobs::filterMinArea | ( | int | minArea | ) |
Filters the blobs according to their apparent area and deletes blob which do not satisfy the criterias
minArea | minimal blob area [pix] |
int tlBlobs::filterMaxArea | ( | int | maxArea | ) |
Filters the blobs according to their apparent area and deletes blob which do not satisfy the criterias
maxArea | maximal blob area [pix] |
int tlBlobs::sortByArea | ( | ) |
Sort the blobs by area so that the biggest blob is at index 0.
int tlBlobs::add | ( | tlMask * | mask | ) |
Insert a blob at the end of the list.
mask | the blob to add |
int tlBlobs::insert | ( | int | index, | |
tlMask * | mask | |||
) |
Insert a blob at a specific index in the chained list.
index | the index to insert to blob at | |
mask | the blob to insert |
int tlBlobs::remove | ( | int | index | ) |
Remove a blob at a specific index from the chained list.
index | the index of the blob to remove |
int tlBlobs::swap | ( | int | index1, | |
int | index2 | |||
) |
Swap two blobs within the list.
index1 | the first blob | |
index2 | the second blob |