O'Reilly logo

OpenCV Essentials by Jesus Salido Tercero, Julio Alberto Patón Incertis, Ismael Serrano Gracia, Gloria Bueno García, Noelia Vállez Enano, Mª del Milagro Fernández Carrobles, Oscar Deniz Suarez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Flood fill

The flood fill operation fills the connected components with a given color. Starting from a seed point, the neighboring pixels are colored with a uniform color. The neighboring pixels can be within a specified range of the current pixel. The flood fill function is int floodFill(InputOutputArray image, Point seedPoint, Scalar newVal, Rect* rect=0, Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),int flags=4). The parameters loDiff and upDiff represent the range to check for every neighboring pixel (note that 3-channel difference thresholds can be specified). The parameter newVal is the color to apply to the pixels that are in range. The lower part of the parameter flags contains the pixel's connectivity value to use (4 or 8). The upper ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required