Typedefs | Enumerations | Functions
core/vil/algo/vil_blob.h File Reference

Finds connected regions in a boolean image. More...

#include <vcl_vector.h>
#include <vcl_utility.h>
#include <vil/vil_image_view.h>
#include <vil/vil_chord.h>

Go to the source code of this file.

Typedefs

typedef vcl_vector< vil_chordvil_blob_region
 A region is a vector of chords that came from a connected blob.
typedef vcl_vector< vcl_pair
< unsigned, unsigned > > 
vil_blob_pixel_list
 A pixel list is a vector of <i,j> pixel positions.

Enumerations

enum  vil_blob_connectivity { vil_blob_4_conn, vil_blob_8_conn }
 Specify 4- or 8- neighbour connectivity. More...

Functions

void vil_blob_labels (const vil_image_view< bool > &src_binary, vil_blob_connectivity conn, vil_image_view< unsigned > &dest_label)
 Produce a label image that enumerates all disjoint blobs in a binary image.
void vil_blob_labels_to_edge_labels (const vil_image_view< unsigned > &src_label, vil_blob_connectivity conn, vil_image_view< unsigned > &dest_label)
 Set all non-blob-edge pixels in a blob label image to zero.
void vil_blob_labels_to_regions (const vil_image_view< unsigned > &src_label, vcl_vector< vil_blob_region > &dest_regions)
 Convert a label image into a list of chorded regions.
void vil_blob_labels_to_pixel_lists (const vil_image_view< unsigned > &src_label, vcl_vector< vil_blob_pixel_list > &dest_pixel_lists)
 Convert a label image into a list of pixel lists.

Detailed Description

Finds connected regions in a boolean image.

Author:
Ian Scott Thes functions can be combined to get blobs as images, chorded regions, edge pixels lists, etc. For example to get an edge pixel list of im_binary
 vil_blob_labels(im_binary, vil_blob_4_conn, im_labels);
 vil_blob_labels_to_edge_labels(im_binary, vil_blob_4_conn, im_labels);
 vil_blob_labels_to_pixel_lists(im_edges, pixel_lists);
To get the area of a blob efficiently
 vil_blob_labels(im_binary, vil_blob_4_conn, im_labels);
 vil_blob_labels_to_regions(im_edges, regions);
 unsigned area_of_first_blob = vil_area(regions[0]);

Definition in file vil_blob.h.


Typedef Documentation

typedef vcl_vector<vcl_pair<unsigned, unsigned> > vil_blob_pixel_list

A pixel list is a vector of <i,j> pixel positions.

Definition at line 57 of file vil_blob.h.

typedef vcl_vector<vil_chord> vil_blob_region

A region is a vector of chords that came from a connected blob.

Definition at line 48 of file vil_blob.h.


Enumeration Type Documentation

Specify 4- or 8- neighbour connectivity.

Enumerator:
vil_blob_4_conn 
vil_blob_8_conn 

Definition at line 27 of file vil_blob.h.


Function Documentation

void vil_blob_labels ( const vil_image_view< bool > &  src_binary,
vil_blob_connectivity  conn,
vil_image_view< unsigned > &  dest_label 
)

Produce a label image that enumerates all disjoint blobs in a binary image.

Definition at line 81 of file vil_blob.cxx.

void vil_blob_labels_to_edge_labels ( const vil_image_view< unsigned > &  src_label,
vil_blob_connectivity  conn,
vil_image_view< unsigned > &  dest_label 
)

Set all non-blob-edge pixels in a blob label image to zero.

A 4-conn edge is a 4-conn area itself, and not just those pixels which have dissimilar 4-conn neighbours.

Definition at line 197 of file vil_blob.cxx.

void vil_blob_labels_to_pixel_lists ( const vil_image_view< unsigned > &  src_label,
vcl_vector< vil_blob_pixel_list > &  dest_pixel_lists 
)

Convert a label image into a list of pixel lists.

A blob label value of n will be returned in dest_pixels_lists[n-1].

Convert a label image into a list of pixel lists.

A blob label value of n will be returned in dest_pixels_lists[n-1]. Note that pixel lists are not ordered.

Definition at line 275 of file vil_blob.cxx.

void vil_blob_labels_to_regions ( const vil_image_view< unsigned > &  src_label,
vcl_vector< vil_blob_region > &  dest_regions 
)

Convert a label image into a list of chorded regions.

A blob label value of n will be returned in dest_regions[n-1].

Definition at line 247 of file vil_blob.cxx.