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. | |
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... |
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.
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.
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.
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.
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.
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.
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.
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.
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.
image_view const vil_region_finder< pix_type, predicate_type >::image_ [private] |
The image.
Definition at line 85 of file vil_region_finder.h.
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.
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.
predicate_type vil_region_finder< pix_type, predicate_type >::predi_ [private] |
predicate.
Definition at line 97 of file vil_region_finder.h.
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.