Friday, August 12, 2011

cvFloodFill: one example

In the OpenCv, the definition of cvFloodFill is:

void cvFloodFill( CvArr* img, CvPoint seed, double newVal,
double lo=0, double up=0, CvConnectedComp* comp=0,
int flags=4, CvArr* mask=0 );
#define CV_FLOODFILL_FIXED_RANGE (1 << 16)
#define CV_FLOODFILL_MASK_ONLY (1 << 17)

The trick is how to define the flags. One example is:
int flags = connectivity + (new_mask_val << 8 ) + CV_FLOODFILL_FIXED_MASK_ONLY;

where connectivity can be 4 or 8, new_mask_val is the gray value to be assigned to the mask, e.g., 255.

No comments: