Skip to content
Luca edited this page Mar 7, 2014 · 9 revisions

Variables and types used in the descriptions:

  • binary_image: CV_8UC1
  • mask_image: CV_8UC1
  • NUMCORES: int
  • res: CBlobResult
  • b1,b2: CBlob*

Usage:

Blob detection
CBlobResult res(binary_image,mask_image,NUMCORES);
Blob filtering
New call

With the commit of Feb 22nd we added a new interface which makes use of enum types instead of preprocessor #defines, in order to provide better readability of the code.

CBlobResult dst;
res.Filter(dst,FilterAction::action,blobOperator,FilterCondition::condition,lowVal,highVal);

where FilterAction and FilterCondition are 2 enums

enum FilterAction {FLT_INCLUDE=1,FLT_EXCLUDE};
enum FilterCondition {FLT_EQUAL=3,FLT_NOTEQUAL,FLT_GREATER,FLT_LESS,FLT_GREATEROREQUAL,FLT_LESSOREQUAL,FLT_INSIDE,FLT_OUTSIDE};
Old call
CBlobResult dst;
res.Filter(dst,def1,blobOperator,def2,lowVal,highVal);

where def1 and def2 are pre-processor defined values (e.g. B_EXCLUDE or B_EQUAL). They will be removed in the future, but for now are here just for compatibility. Using the enum interface is advisable.

Blob overlap
int numPixels = b1->overlappingPixels(b2);
Blob density

Density function, which checks the area of the blob against the area of its convex hull, giving an idea of how much dense the blob is.

double numPixels = b1->density(AreaMode mod);

where mod = {AreaMode::GREEN, AreaMode::PIXELWISE};

GREEN -> Green formula (faster but not exact)

PIXELWISE -> Counts pixels (exact)

Blob area

Area computation function.

double numPixels = b1->density(AreaMode mod);

see density function for AreaMode details.

Clone this wiki locally