Start » Filter Reference » OpenCV » Miscellaneous Image Transformations » cvFloodFill

cvFloodFill


Module: OpenCV

Fills a connected component with the given color.

Name Type Description
Input will be modified
ioSrc Image Input image.
Input value
inMask Image* Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask in multiple calls to the function to make sure the filled area does not overlap.
Input value
inSeed Location Starting point.
Input value
inNewVal Pixel New value of the repainted domain pixels.
Input value
inLoDiff Pixel Maximal lower brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component.
Input value
inUpDiff Pixel Maximal upper brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component.
Input value
inConnectivity RegionConnectivity Connectivity determines which neighbors of a pixel are considered.
Input value
inFloodFillFixedRange Bool If set, the difference between the current pixel and seed pixel is considered. Otherwise, the difference between neighbor pixels is considered.
Output value
outRect Region
Output value
outMask Image Output operation mask.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Input image must be 1- or 3-channel, UINT8 or REAL image in cvFloodFill.
DomainError Mask size must be larger by 2px in width and height than inSrc in cvFloodFill.

Complexity Level

This filter is available on Basic Complexity Level.