Public Types | Public Member Functions | Private Member Functions | Private Attributes | Related Functions | List of all members
vil_region_finder< pix_type, predicate_type > Class Template Reference

Extract regions from an image using a flood-fill. More...

#include <vil_region_finder.h>

Public Types

typedef vil_image_view< pix_type > image_view
 

Public Member Functions

 vil_region_finder (image_view const &image, vil_region_finder_connectivity conn=vil_region_finder_4_conn)
 Prepare to extract regions from image. More...
 
void same_int_region (unsigned i, unsigned j, std::vector< unsigned > &ri, std::vector< unsigned > &rj)
 Extract the region containing (i,j). More...
 
void same_int_region (unsigned i, unsigned j, pix_type p, std::vector< unsigned > &ri, std::vector< unsigned > &rj)
 Extract the region containing (i,j). More...
 
image_view const & image () const
 The image from which the regions are being extracted. More...
 
vil_image_view< bool > const & boolean_region_image () const
 boolean mask on the region. More...
 

Private Member Functions

void init (vil_region_finder_connectivity)
 Marks all pixels as unprocessed, and sets the neighbour deltas based on the requested connectivity. More...
 

Private Attributes

image_view const image_
 The image. More...
 
vil_image_view< bool > processed_
 The marks. More...
 
unsigned num_nbrs_
 The size of the nbr_delta_ array. More...
 
int const (* nbr_delta_ )[2]
 The deltas to the neighbours. More...
 
predicate_type predi_
 predicate. More...
 

Related Functions

(Note that these are not member functions.)

enum  vil_region_finder_connectivity
 Type of connectivity to use in finding the regions. More...
 

Detailed Description

template<class pix_type, class predicate_type = std::equal_to<pix_type>>
class vil_region_finder< pix_type, predicate_type >

Extract regions from an image using a flood-fill.

This class encapsulates a simple flood fill algorithm to extract a four or eight connected regions from an image. It uses an auxiliary bool image to mark pixels as processed. This mark is not reset between calls to the region extraction routine, so each region can be extracted only once.

Definition at line 36 of file vil_region_finder.h.

Member Typedef Documentation

◆ image_view

template<class pix_type , class predicate_type = std::equal_to<pix_type>>
typedef vil_image_view<pix_type> vil_region_finder< pix_type, predicate_type >::image_view

Definition at line 40 of file vil_region_finder.h.

Constructor & Destructor Documentation

◆ vil_region_finder()

template<class pix_type , class predicate_type >
vil_region_finder< pix_type, predicate_type >::vil_region_finder ( image_view const &  image,
vil_region_finder_connectivity  conn = vil_region_finder_4_conn 
)

Prepare to extract regions from image.

Definition at line 15 of file vil_region_finder.hxx.

Member Function Documentation

◆ boolean_region_image()

template<class pix_type , class predicate_type >
vil_image_view< bool > const & vil_region_finder< pix_type, predicate_type >::boolean_region_image ( ) const

boolean mask on the region.

Definition at line 133 of file vil_region_finder.hxx.

◆ image()

template<class pix_type , class predicate_type >
vil_region_finder< pix_type, predicate_type >::image_view const & vil_region_finder< pix_type, predicate_type >::image ( ) const

The image from which the regions are being extracted.

Definition at line 125 of file vil_region_finder.hxx.

◆ init()

template<class pix_type , class predicate_type >
void vil_region_finder< pix_type, predicate_type >::init ( vil_region_finder_connectivity  conn)
private

Marks all pixels as unprocessed, and sets the neighbour deltas based on the requested connectivity.

Definition at line 30 of file vil_region_finder.hxx.

◆ same_int_region() [1/2]

template<class pix_type , class predicate_type >
void vil_region_finder< pix_type, predicate_type >::same_int_region ( unsigned  i,
unsigned  j,
std::vector< unsigned > &  ri,
std::vector< unsigned > &  rj 
)

Extract the region containing (i,j).

This will return the coordinates of all the pixels in the region around (i,j) where the predicate claims true compared with the intensity of pixel (i,j).

This is a simple flood fill algorithm.

Definition at line 57 of file vil_region_finder.hxx.

◆ same_int_region() [2/2]

template<class pix_type , class predicate_type >
void vil_region_finder< pix_type, predicate_type >::same_int_region ( unsigned  i,
unsigned  j,
pix_type  p,
std::vector< unsigned > &  ri,
std::vector< unsigned > &  rj 
)

Extract the region containing (i,j).

This will return the coordinates of all the pixels in the region around (i,j) where the predicate claims true compared with the intensity p

This is a simple flood fill algorithm.

Definition at line 75 of file vil_region_finder.hxx.

Friends And Related Function Documentation

◆ vil_region_finder_connectivity

template<class pix_type , class predicate_type = std::equal_to<pix_type>>
enum vil_region_finder_connectivity
related

Type of connectivity to use in finding the regions.

Definition at line 21 of file vil_region_finder.h.

Member Data Documentation

◆ image_

template<class pix_type , class predicate_type = std::equal_to<pix_type>>
image_view const vil_region_finder< pix_type, predicate_type >::image_
private

The image.

Definition at line 88 of file vil_region_finder.h.

◆ nbr_delta_

template<class pix_type , class predicate_type = std::equal_to<pix_type>>
int const(* vil_region_finder< pix_type, predicate_type >::nbr_delta_)[2]
private

The deltas to the neighbours.

Definition at line 97 of file vil_region_finder.h.

◆ num_nbrs_

template<class pix_type , class predicate_type = std::equal_to<pix_type>>
unsigned vil_region_finder< pix_type, predicate_type >::num_nbrs_
private

The size of the nbr_delta_ array.

Definition at line 94 of file vil_region_finder.h.

◆ predi_

template<class pix_type , class predicate_type = std::equal_to<pix_type>>
predicate_type vil_region_finder< pix_type, predicate_type >::predi_
private

predicate.

Definition at line 100 of file vil_region_finder.h.

◆ processed_

template<class pix_type , class predicate_type = std::equal_to<pix_type>>
vil_image_view<bool> vil_region_finder< pix_type, predicate_type >::processed_
private

The marks.

Definition at line 91 of file vil_region_finder.h.


The documentation for this class was generated from the following files: