Book Image

OpenCV 3.0 Computer Vision with Java

By : Daniel Lelis Baggio
Book Image

OpenCV 3.0 Computer Vision with Java

By: Daniel Lelis Baggio

Overview of this book

Table of Contents (15 chapters)
OpenCV 3.0 Computer Vision with Java
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Preface
Index

Flood filling


Another very important algorithm for segmentation is flood fill, also known as region growing. Most of you who have already worked with popular computer graphic programs, such as Microsoft Paint or GIMP will have probably used the bucket fill or paint bucket tool, which fills an area with a color. Although it might look like a very simple algorithm at first sight, it has a very interesting implementation and has several parameters that can make it work well to segment images.

The idea behind the algorithm is to check for connected components, which are the areas with similar color or brightness, starting from a given point—the so-called seed point—and then examining this particular point's neighbors. These can include either 4 (north, south, east, and west) or 8 neighbors (north, north-east, east, south-east, south, south-west, west, and north-west) that check for a condition and then recursively, call the same procedure on each of the neighbors in case they have passed that...