Detects connected components in an image. More...
#include <ConnectedComponentAnalyzer.h>
Classes | |
struct | IntensitySimilarity |
a similarity criterion based on intensity differences More... | |
struct | MaskVadility |
validity function for range image segmentation More... | |
Public Member Functions | |
ConnectedComponentAnalyzer () | |
unsigned | getImageHeight () |
unsigned | getImageWidth () |
unsigned * | getLastLabelImage () |
std::vector< ConnectedComponent > | segment (unsigned char *binImage, unsigned width, unsigned height, unsigned minSegmentSize=1, float minOccupiedArea=0.0, unsigned expandSegmentSize=0) |
std::vector< ConnectedComponent > | segment (const float *floatImage, unsigned width, unsigned height, float maxDistance, unsigned minSegmentSize=1, float minOccupiedArea=0.0, unsigned expandSegmentSize=0) |
std::vector< ConnectedComponent > | segment (const float *floatImage, const unsigned char *mask, unsigned width, unsigned height, float maxDistance, unsigned minSegmentSize=1, float minOccupiedArea=0.0, unsigned expandSegmentSize=0, int maxr=1) |
std::vector< ConnectedComponent > | segmentByLimit (cv::Mat *pi_img, double pi_limit) |
~ConnectedComponentAnalyzer () | |
Static Public Member Functions | |
static void | isolateLargestSegment (unsigned char *binImage, unsigned width, unsigned height) |
Private Member Functions | |
std::vector< ConnectedComponent > | extractComponents (unsigned max_label, unsigned minSegmentSize, float minOccupiedArea, unsigned expandSegmentSize) |
Private Attributes | |
unsigned | m_Height |
unsigned * | m_LabelImage |
unsigned | m_Width |
Detects connected components in an image.
Definition at line 25 of file ConnectedComponentAnalyzer.h.
Does nothing.
Does nothing.
std::vector<ConnectedComponent> ConnectedComponentAnalyzer::extractComponents | ( | unsigned | max_label, |
unsigned | minSegmentSize, | ||
float | minOccupiedArea, | ||
unsigned | expandSegmentSize | ||
) | [private] |
Extract connected components from a label image. Shared code between the different segment() implementations
labelImage | label image |
width | image width |
height | image height |
max_label | maximum label id |
minSegmentSize | minimal segment size (pixels) |
expandSegmentSize | expand the segments with the given size |
unsigned ConnectedComponentAnalyzer::getImageHeight | ( | ) | [inline] |
Definition at line 88 of file ConnectedComponentAnalyzer.h.
unsigned ConnectedComponentAnalyzer::getImageWidth | ( | ) | [inline] |
Definition at line 87 of file ConnectedComponentAnalyzer.h.
unsigned* ConnectedComponentAnalyzer::getLastLabelImage | ( | ) | [inline] |
Get the label image and dimensions of the last segmentation run.
Definition at line 86 of file ConnectedComponentAnalyzer.h.
static void ConnectedComponentAnalyzer::isolateLargestSegment | ( | unsigned char * | binImage, |
unsigned | width, | ||
unsigned | height | ||
) | [static] |
Clear all mask segments except the largest one
std::vector< ConnectedComponent > ConnectedComponentAnalyzer::segment | ( | unsigned char * | binImage, |
unsigned | width, | ||
unsigned | height, | ||
unsigned | minSegmentSize = 1 , |
||
float | minOccupiedArea = 0.0 , |
||
unsigned | expandSegmentSize = 0 |
||
) |
This method extracts segments of an already binarized image and returns a list of the segments containing bounding box, cog, size, etc.
binImage | binarized image |
width | width of the image |
height | height of the image |
minSegmentSize | minimal segment size (pixels) |
expandSegmentSize | expand the segments with the given size |
std::vector< ConnectedComponent > ConnectedComponentAnalyzer::segment | ( | const float * | floatImage, |
unsigned | width, | ||
unsigned | height, | ||
float | maxDistance, | ||
unsigned | minSegmentSize = 1 , |
||
float | minOccupiedArea = 0.0 , |
||
unsigned | expandSegmentSize = 0 |
||
) |
This method extracts segments of a range image using single linkage similarity checks between components and component candidates.
rangeImage | range image |
width | width of the image |
height | height of the image |
maxDistance | the similarity threshold (pixels with intensity difference <= maxDistance belong to the same object) |
minSegmentSize | minimal segment size (pixels) |
expandSegmentSize | expand the segments with the given size |
std::vector< ConnectedComponent > ConnectedComponentAnalyzer::segment | ( | const float * | floatImage, |
const unsigned char * | mask, | ||
unsigned | width, | ||
unsigned | height, | ||
float | maxDistance, | ||
unsigned | minSegmentSize = 1 , |
||
float | minOccupiedArea = 0.0 , |
||
unsigned | expandSegmentSize = 0 , |
||
int | maxr = 1 |
||
) |
std::vector< ConnectedComponent > ConnectedComponentAnalyzer::segmentByLimit | ( | cv::Mat * | pi_img, |
double | pi_limit | ||
) |
This method first detects pixels in a gray level image that have a value greater equal pi_limit. Then it extracts these segments and returns a list of the segments containing bounding box, center of gravity (cog), size
pi_img | The pointer to a cv::Mat Gray level image. |
pi_limit | A pixel is considered to be part of a component if its value is equal or larger than pi_limit. |
unsigned ConnectedComponentAnalyzer::m_Height [private] |
Definition at line 149 of file ConnectedComponentAnalyzer.h.
unsigned* ConnectedComponentAnalyzer::m_LabelImage [private] |
Definition at line 148 of file ConnectedComponentAnalyzer.h.
unsigned ConnectedComponentAnalyzer::m_Width [private] |
Definition at line 149 of file ConnectedComponentAnalyzer.h.