Skip to Main Content
Learning OpenCV
book

Learning OpenCV

by Gary Bradski, Adrian Kaehler
September 2008
Beginner to intermediate content levelBeginner to intermediate
580 pages
20h 7m
English
O'Reilly Media, Inc.
Content preview from Learning OpenCV

Flood Fill

Flood fill [Heckbert00; Shaw04; Vandevenne04] is an extremely useful function that is often used to mark or isolate portions of an image for further processing or analysis. Flood fill can also be used to derive, from an input image, masks that can be used for subsequent routines to speed or restrict processing to only those pixels indicated by the mask. The function cvFloodFill() itself takes an optional mask that can be further used to control where filling is done (e.g., when doing multiple fills of the same image).

In OpenCV, flood fill is a more general version of the sort of fill functionality which you probably already associate with typical computer painting programs. For both, a seed point is selected from an image and then all similar neighboring points are colored with a uniform color. The difference here is that the neighboring pixels need not all be identical in color.[55] The result of a flood fill operation will always be a single contiguous region. The cvFloodFill() function will color a neighboring pixel if it is within a specified range (lo Diff to up Diff) of either the current pixel or if (depending on the settings of flags) the neighboring pixel is within a specified range of the original seedPoint value. Flood filling can also be constrained by an optional mask argument. The prototype for the flood fill routine is:

Results of the morphological gradient operator: bright perimeter edges are identified

Figure 5-15. Results of the morphological ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning OpenCV 3

Learning OpenCV 3

Adrian Kaehler, Gary Bradski
Learning OpenCV, 2nd Edition

Learning OpenCV, 2nd Edition

Adrian Kaehler, Gary Bradski
Practical OpenCV

Practical OpenCV

Samarth Brahmbhatt
Machine Learning for OpenCV

Machine Learning for OpenCV

Michael Beyeler, Michael Beyeler (USD)

Publisher Resources

ISBN: 9780596516130Supplemental ContentErrata Page