Functions
vil_flood_fill.h File Reference

Fills a connected region with a given value. More...

#include <vector>
#include <utility>
#include <vil/vil_image_view.h>
#include <vil/vil_chord.h>

Go to the source code of this file.

Functions

template<class T >
void vil_flood_fill_row (vil_image_view< T > &image, unsigned i, unsigned j, T v, T new_v, unsigned &ilo, unsigned &ihi)
 Search along i direction either side for limits of pixels matching v. More...
 
template<class T >
void vil_flood_fill4 (vil_image_view< T > &image, unsigned seed_i, unsigned seed_j, T v, T new_v)
 Flood fill on a 4-connected region. More...
 
template<class T >
void vil_flood_fill4 (vil_image_view< T > &image, unsigned seed_i, unsigned seed_j, T v, T new_v, std::vector< vil_chord > &region)
 Flood fill on a 4-connected region, and record region. More...
 
template<class T >
void vil_flood_fill8 (vil_image_view< T > &image, unsigned seed_i, unsigned seed_j, T v, T new_v)
 Flood fill on a 8-connected region. More...
 
template<class T >
void vil_flood_fill8 (vil_image_view< T > &image, unsigned seed_i, unsigned seed_j, T v, T new_v, std::vector< vil_chord > &region)
 Flood fill on a 8-connected region, and record region. More...
 

Detailed Description

Fills a connected region with a given value.

Author
Tim Cootes

Definition in file vil_flood_fill.h.

Function Documentation

◆ vil_flood_fill4() [1/2]

template<class T >
void vil_flood_fill4 ( vil_image_view< T > &  image,
unsigned  seed_i,
unsigned  seed_j,
v,
new_v 
)

Flood fill on a 4-connected region.

Find every point in 4-connected region with values image(i,j)==v containing (seed_i,seed_j), and change their values to new_v

Note, currently uses inefficient (x,y) access to image. Could be improved using fast pointer access to work along the rows.

Definition at line 44 of file vil_flood_fill.h.

◆ vil_flood_fill4() [2/2]

template<class T >
void vil_flood_fill4 ( vil_image_view< T > &  image,
unsigned  seed_i,
unsigned  seed_j,
v,
new_v,
std::vector< vil_chord > &  region 
)

Flood fill on a 4-connected region, and record region.

Find every point in 4-connected region with values image(i,j)==v containing (seed_i,seed_j), and change their values to new_v

On exit region is filled with a set of image chords which cover the region.

Note, currently uses inefficient (x,y) access to image. Could be improved using fast pointer access to work along the rows.

Definition at line 97 of file vil_flood_fill.h.

◆ vil_flood_fill8() [1/2]

template<class T >
void vil_flood_fill8 ( vil_image_view< T > &  image,
unsigned  seed_i,
unsigned  seed_j,
v,
new_v 
)

Flood fill on a 8-connected region.

Find every point in 8-connected region with values image(i,j)==v containing (seed_i,seed_j), and change their values to new_v

Note, currently uses inefficient (x,y) access to image. Could be improved using fast pointer access to work along the rows.

Definition at line 152 of file vil_flood_fill.h.

◆ vil_flood_fill8() [2/2]

template<class T >
void vil_flood_fill8 ( vil_image_view< T > &  image,
unsigned  seed_i,
unsigned  seed_j,
v,
new_v,
std::vector< vil_chord > &  region 
)

Flood fill on a 8-connected region, and record region.

Find every point in 8-connected region with values image(i,j)==v containing (seed_i,seed_j), and change their values to new_v

On exit region is filled with a set of image chords which cover the region.

Note, currently uses inefficient (x,y) access to image. Could be improved using fast pointer access to work along the rows.

Definition at line 208 of file vil_flood_fill.h.

◆ vil_flood_fill_row()

template<class T >
void vil_flood_fill_row ( vil_image_view< T > &  image,
unsigned  i,
unsigned  j,
v,
new_v,
unsigned &  ilo,
unsigned &  ihi 
)
inline

Search along i direction either side for limits of pixels matching v.

Fills in all such pixels with new_v. Returns limits in ilo and ihi

Definition at line 20 of file vil_flood_fill.h.