Public Types | Public Member Functions | Private Member Functions | Private Attributes | Related Functions
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>

List of all members.

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.
void same_int_region (unsigned i, unsigned j, vcl_vector< unsigned > &ri, vcl_vector< unsigned > &rj)
 Extract the region containing (i,j).
void same_int_region (unsigned i, unsigned j, pix_type p, vcl_vector< unsigned > &ri, vcl_vector< unsigned > &rj)
 Extract the region containing (i,j).
image_view const & image () const
 The image from which the regions are being extracted.
vil_image_view< bool > const & boolean_region_image () const
 boolean mask on the region.

Private Member Functions

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

Private Attributes

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

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 = vcl_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 33 of file vil_region_finder.h.


Member Typedef Documentation

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

Definition at line 37 of file vil_region_finder.h.


Constructor & Destructor Documentation

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 12 of file vil_region_finder.txx.


Member Function Documentation

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 130 of file vil_region_finder.txx.

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 122 of file vil_region_finder.txx.

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 27 of file vil_region_finder.txx.

template<class pix_type , class predicate_type >
void vil_region_finder< pix_type, predicate_type >::same_int_region ( unsigned  i,
unsigned  j,
vcl_vector< unsigned > &  ri,
vcl_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 54 of file vil_region_finder.txx.

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,
vcl_vector< unsigned > &  ri,
vcl_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 72 of file vil_region_finder.txx.


Friends And Related Function Documentation

template<class pix_type , class predicate_type = vcl_equal_to<pix_type>>
enum vil_region_finder_connectivity [related]

Type of connectivity to use in finding the regions.

Definition at line 18 of file vil_region_finder.h.


Member Data Documentation

template<class pix_type , class predicate_type = vcl_equal_to<pix_type>>
image_view const vil_region_finder< pix_type, predicate_type >::image_ [private]

The image.

Definition at line 85 of file vil_region_finder.h.

template<class pix_type , class predicate_type = vcl_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 94 of file vil_region_finder.h.

template<class pix_type , class predicate_type = vcl_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 91 of file vil_region_finder.h.

template<class pix_type , class predicate_type = vcl_equal_to<pix_type>>
predicate_type vil_region_finder< pix_type, predicate_type >::predi_ [private]

predicate.

Definition at line 97 of file vil_region_finder.h.

template<class pix_type , class predicate_type = vcl_equal_to<pix_type>>
vil_image_view<bool> vil_region_finder< pix_type, predicate_type >::processed_ [private]

The marks.

Definition at line 88 of file vil_region_finder.h.


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