#include <sdet_texture_classifier.h>
Public Member Functions | |
sdet_texture_classifier (sdet_texture_classifier_params const ¶ms) | |
constructor from parameter block. | |
bool | compute_filter_bank (vil_image_view< float > const &img) |
compute filter responses for a given texture category training image. | |
unsigned | max_filter_radius () const |
the max image border width eaten up by filter kernels. | |
brip_filter_bank & | filter_responses () |
retrieve the filter responses. | |
bool | compute_training_data (vcl_string const &category) |
append to training data (current filter responses). | |
bool | compute_training_data (vcl_string const &category, vgl_polygon< double > const &texture_region) |
randomly select training samples from within the specified region. | |
bool | compute_training_data (vcl_string const &category, vcl_vector< vgl_polygon< double > >const &texture_regions) |
randomly select training samples from within the specified regions. | |
bool | compute_training_data (vcl_string const &category, vcl_string const &poly_path="") |
randomly select training samples from within a region loaded from file. | |
bool | compute_textons (vcl_string const &category) |
compute textons with k_means for the specified texture category. | |
bool | compute_textons (vcl_vector< vcl_string > const &image_paths, vcl_string const &category, vcl_vector< vcl_string > const &poly_paths=vcl_vector< vcl_string >()) |
compute textons from set of images (and polygons). | |
void | compute_category_histograms () |
The texton histograms derived from the training data. | |
bool | save_dictionary (vcl_string const &path) const |
save texton dictionary, binary (includes classifier params at top of file). | |
bool | load_dictionary (vcl_string const &path) |
load dictionary, binary. | |
void | set_category_colors (vcl_map< vcl_string, vnl_vector_fixed< float, 3 > > const &color_map) |
set category colors. | |
vil_image_view< float > | classify_image_blocks (vcl_string const &img_path) |
image of category probabilities expressed as colors. | |
void | print_dictionary () const |
print. | |
void | print_distances () const |
void | print_color_map () const |
void | print_category_histograms () const |
void | print_interclass_probs () const |
void | print_texton_weights () const |
bool | SanityCheck () |
Checks that parameters are within acceptable bounds. | |
void | ref () |
void | unref () |
int | get_references () const |
bool | is_referenced () const |
Public Attributes | |
unsigned | n_scales_ |
the number of scales used for the anisotropic filters. | |
float | scale_interval_ |
the scale range for the anisotropic filters. | |
float | angle_interval_ |
the angle interval for anisotropic filters. | |
float | lambda0_ |
the major radius of the anisotropic Gaussian filter. | |
float | lambda1_ |
the minor radius of the anisotropic Gaussian filter. | |
float | laplace_radius_ |
the radius of the isotropic Laplace filter. | |
float | gauss_radius_ |
the radius of the isotropic Gaussian intensity spot filter. | |
float | cutoff_per_ |
the residual value of the Gaussian tail considered negligible. | |
bool | signed_response_ |
should the filter response be signed vs. absolute value. | |
bool | mag_ |
should the filter response be absolute value vs. signed or clipped. | |
bool | fast_ |
should the fast algorithm be used to compute the filters. | |
unsigned | k_ |
the value of k for the k-means algorithm. | |
unsigned | n_samples_ |
the number of samples to be randomly selected from the training images. | |
unsigned | block_size_ |
the square block size for test images. | |
float | weight_offset_ |
a factor that controls the weighting of textons that appear in more than one class. | |
Protected Member Functions | |
sdet_texture_classifier () | |
vil_image_view< float > | scale_image (vil_image_resource_sptr const &resc) |
vcl_vector< vnl_vector< double > > | random_centers (vcl_vector< vnl_vector< double > > const &training_data, unsigned k) const |
void | compute_distances () |
void | compute_interclass_probs () |
void | compute_texton_weights () |
void | init_color_map () |
void | compute_texton_index () |
unsigned | nearest_texton_index (vnl_vector< double > const &query) |
void | update_hist (vnl_vector< double > const &f, float weight, vcl_vector< float > &hist) |
update the texton histogram with a filter vector. | |
vcl_map< vcl_string, float > | texture_probabilities (vcl_vector< float > const &hist) |
compute the vector of texture probabilities. | |
void | category_color_mix (vcl_map< vcl_string, float > &probs, vnl_vector_fixed< float, 3 > &color_mix) |
color representing the mix of texture probabilites. | |
void | category_quality_color_mix (vcl_map< vcl_string, float > &probs, vnl_vector_fixed< float, 3 > &color_mix) |
color representing the mix of texture probabilites with atomspheric quality (should be removed to another class). | |
void | InitParams (unsigned n_scales, float scale_interval, float angle_interval, float lambda0, float lambda1, float laplace_radius, float gauss_radius, float cutoff_per, bool signed_response, bool mag, bool fast, unsigned k, unsigned n_samples, unsigned block_size, float weight_offset) |
Protected Attributes | |
brip_filter_bank | filter_responses_ |
vil_image_view< float > | laplace_ |
vil_image_view< float > | gauss_ |
vil_image_view< float > | frac_counts_ |
vcl_map< vcl_string, vcl_vector< vnl_vector< double > > > | training_data_ |
vcl_map< vcl_string, vcl_vector< vnl_vector< double > > > | texton_dictionary_ |
vcl_map< vcl_string, vcl_map < vcl_string, double > > | dist_ |
bool | distances_valid_ |
vcl_map< vcl_string, vcl_map < vcl_string, double > > | inter_prob_ |
bool | inter_prob_valid_ |
vcl_map< vcl_string, vnl_vector_fixed< float, 3 > > | color_map_ |
bool | color_map_valid_ |
vcl_vector< sdet_neighbor > | texton_index_ |
bool | texton_index_valid_ |
vcl_map< vcl_string, vcl_vector< float > > | category_histograms_ |
vcl_vector< float > | texton_weights_ |
bool | texton_weights_valid_ |
Friends | |
vcl_ostream & | operator<< (vcl_ostream &os, const sdet_texture_classifier_params &imp) |
Definition at line 85 of file sdet_texture_classifier.h.
sdet_texture_classifier::sdet_texture_classifier | ( | sdet_texture_classifier_params const & | params | ) |
constructor from parameter block.
Definition at line 113 of file sdet_texture_classifier.cxx.
sdet_texture_classifier::sdet_texture_classifier | ( | ) | [protected] |
void sdet_texture_classifier::category_color_mix | ( | vcl_map< vcl_string, float > & | probs, |
vnl_vector_fixed< float, 3 > & | color_mix | ||
) | [protected] |
color representing the mix of texture probabilites.
Definition at line 824 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::category_quality_color_mix | ( | vcl_map< vcl_string, float > & | probs, |
vnl_vector_fixed< float, 3 > & | color_mix | ||
) | [protected] |
color representing the mix of texture probabilites with atomspheric quality (should be removed to another class).
vil_image_view< float > sdet_texture_classifier::classify_image_blocks | ( | vcl_string const & | img_path | ) |
image of category probabilities expressed as colors.
Definition at line 851 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::compute_category_histograms | ( | ) |
The texton histograms derived from the training data.
Definition at line 760 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::compute_distances | ( | ) | [protected] |
Definition at line 542 of file sdet_texture_classifier.cxx.
bool sdet_texture_classifier::compute_filter_bank | ( | vil_image_view< float > const & | img | ) |
compute filter responses for a given texture category training image.
Definition at line 127 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::compute_interclass_probs | ( | ) | [protected] |
Definition at line 581 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::compute_texton_index | ( | ) | [protected] |
Definition at line 732 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::compute_texton_weights | ( | ) | [protected] |
Definition at line 625 of file sdet_texture_classifier.cxx.
bool sdet_texture_classifier::compute_textons | ( | vcl_string const & | category | ) |
compute textons with k_means for the specified texture category.
Definition at line 383 of file sdet_texture_classifier.cxx.
bool sdet_texture_classifier::compute_textons | ( | vcl_vector< vcl_string > const & | image_paths, |
vcl_string const & | category, | ||
vcl_vector< vcl_string > const & | poly_paths = vcl_vector<vcl_string>() |
||
) |
compute textons from set of images (and polygons).
If polygon_paths is empty or some element contains a null string the entire image(s) is(are) used This method is the main driver function to carry out training
Definition at line 403 of file sdet_texture_classifier.cxx.
bool sdet_texture_classifier::compute_training_data | ( | vcl_string const & | category | ) |
append to training data (current filter responses).
randomly select training samples from full training image for category
Definition at line 179 of file sdet_texture_classifier.cxx.
bool sdet_texture_classifier::compute_training_data | ( | vcl_string const & | category, |
vgl_polygon< double > const & | texture_region | ||
) |
randomly select training samples from within the specified region.
Definition at line 234 of file sdet_texture_classifier.cxx.
bool sdet_texture_classifier::compute_training_data | ( | vcl_string const & | category, |
vcl_vector< vgl_polygon< double > >const & | texture_regions | ||
) |
randomly select training samples from within the specified regions.
Definition at line 294 of file sdet_texture_classifier.cxx.
bool sdet_texture_classifier::compute_training_data | ( | vcl_string const & | category, |
vcl_string const & | poly_path = "" |
||
) |
randomly select training samples from within a region loaded from file.
Definition at line 361 of file sdet_texture_classifier.cxx.
brip_filter_bank& sdet_texture_classifier::filter_responses | ( | ) | [inline] |
retrieve the filter responses.
Definition at line 99 of file sdet_texture_classifier.h.
void sdet_texture_classifier::init_color_map | ( | ) | [protected] |
Definition at line 79 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier_params::InitParams | ( | unsigned | n_scales, |
float | scale_interval, | ||
float | angle_interval, | ||
float | lambda0, | ||
float | lambda1, | ||
float | laplace_radius, | ||
float | gauss_radius, | ||
float | cutoff_per, | ||
bool | signed_response, | ||
bool | mag, | ||
bool | fast, | ||
unsigned | k, | ||
unsigned | n_samples, | ||
unsigned | block_size, | ||
float | weight_offset | ||
) | [protected, inherited] |
Definition at line 65 of file sdet_texture_classifier_params.cxx.
bool sdet_texture_classifier::load_dictionary | ( | vcl_string const & | path | ) |
load dictionary, binary.
Definition at line 500 of file sdet_texture_classifier.cxx.
unsigned sdet_texture_classifier::max_filter_radius | ( | ) | const |
the max image border width eaten up by filter kernels.
Definition at line 931 of file sdet_texture_classifier.cxx.
unsigned sdet_texture_classifier::nearest_texton_index | ( | vnl_vector< double > const & | query | ) | [protected] |
Definition at line 745 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::print_category_histograms | ( | ) | const |
Definition at line 680 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::print_color_map | ( | ) | const |
Definition at line 100 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::print_dictionary | ( | ) | const |
print.
Definition at line 524 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::print_distances | ( | ) | const |
Definition at line 662 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::print_interclass_probs | ( | ) | const |
Definition at line 704 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::print_texton_weights | ( | ) | const |
Definition at line 719 of file sdet_texture_classifier.cxx.
vcl_vector< vnl_vector< double > > sdet_texture_classifier::random_centers | ( | vcl_vector< vnl_vector< double > > const & | training_data, |
unsigned | k | ||
) | const [protected] |
Definition at line 166 of file sdet_texture_classifier.cxx.
bool sdet_texture_classifier_params::SanityCheck | ( | ) | [inherited] |
Checks that parameters are within acceptable bounds.
Definition at line 93 of file sdet_texture_classifier_params.cxx.
bool sdet_texture_classifier::save_dictionary | ( | vcl_string const & | path | ) | const |
save texton dictionary, binary (includes classifier params at top of file).
Definition at line 483 of file sdet_texture_classifier.cxx.
vil_image_view< float > sdet_texture_classifier::scale_image | ( | vil_image_resource_sptr const & | resc | ) | [protected] |
Definition at line 60 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::set_category_colors | ( | vcl_map< vcl_string, vnl_vector_fixed< float, 3 > > const & | color_map | ) | [inline] |
set category colors.
Definition at line 136 of file sdet_texture_classifier.h.
vcl_map< vcl_string, float > sdet_texture_classifier::texture_probabilities | ( | vcl_vector< float > const & | hist | ) | [protected] |
compute the vector of texture probabilities.
Definition at line 800 of file sdet_texture_classifier.cxx.
void sdet_texture_classifier::update_hist | ( | vnl_vector< double > const & | f, |
float | weight, | ||
vcl_vector< float > & | hist | ||
) | [protected] |
update the texton histogram with a filter vector.
Definition at line 793 of file sdet_texture_classifier.cxx.
vcl_ostream& operator<< | ( | vcl_ostream & | os, |
const sdet_texture_classifier_params & | imp | ||
) | [friend, inherited] |
Definition at line 118 of file sdet_texture_classifier_params.cxx.
float sdet_texture_classifier_params::angle_interval_ [inherited] |
the angle interval for anisotropic filters.
Definition at line 66 of file sdet_texture_classifier_params.h.
unsigned sdet_texture_classifier_params::block_size_ [inherited] |
the square block size for test images.
Definition at line 88 of file sdet_texture_classifier_params.h.
vcl_map<vcl_string, vcl_vector<float> > sdet_texture_classifier::category_histograms_ [protected] |
Definition at line 198 of file sdet_texture_classifier.h.
vcl_map< vcl_string, vnl_vector_fixed<float, 3> > sdet_texture_classifier::color_map_ [protected] |
Definition at line 194 of file sdet_texture_classifier.h.
bool sdet_texture_classifier::color_map_valid_ [protected] |
Definition at line 195 of file sdet_texture_classifier.h.
float sdet_texture_classifier_params::cutoff_per_ [inherited] |
the residual value of the Gaussian tail considered negligible.
Definition at line 76 of file sdet_texture_classifier_params.h.
vcl_map< vcl_string, vcl_map< vcl_string, double> > sdet_texture_classifier::dist_ [protected] |
Definition at line 188 of file sdet_texture_classifier.h.
bool sdet_texture_classifier::distances_valid_ [protected] |
Definition at line 189 of file sdet_texture_classifier.h.
bool sdet_texture_classifier_params::fast_ [inherited] |
should the fast algorithm be used to compute the filters.
Definition at line 82 of file sdet_texture_classifier_params.h.
Definition at line 179 of file sdet_texture_classifier.h.
vil_image_view<float> sdet_texture_classifier::frac_counts_ [protected] |
Definition at line 182 of file sdet_texture_classifier.h.
vil_image_view<float> sdet_texture_classifier::gauss_ [protected] |
Definition at line 181 of file sdet_texture_classifier.h.
float sdet_texture_classifier_params::gauss_radius_ [inherited] |
the radius of the isotropic Gaussian intensity spot filter.
Definition at line 74 of file sdet_texture_classifier_params.h.
vcl_map< vcl_string, vcl_map< vcl_string, double> > sdet_texture_classifier::inter_prob_ [protected] |
Definition at line 191 of file sdet_texture_classifier.h.
bool sdet_texture_classifier::inter_prob_valid_ [protected] |
Definition at line 192 of file sdet_texture_classifier.h.
unsigned sdet_texture_classifier_params::k_ [inherited] |
the value of k for the k-means algorithm.
Definition at line 84 of file sdet_texture_classifier_params.h.
float sdet_texture_classifier_params::lambda0_ [inherited] |
the major radius of the anisotropic Gaussian filter.
Definition at line 68 of file sdet_texture_classifier_params.h.
float sdet_texture_classifier_params::lambda1_ [inherited] |
the minor radius of the anisotropic Gaussian filter.
Definition at line 70 of file sdet_texture_classifier_params.h.
vil_image_view<float> sdet_texture_classifier::laplace_ [protected] |
Definition at line 180 of file sdet_texture_classifier.h.
float sdet_texture_classifier_params::laplace_radius_ [inherited] |
the radius of the isotropic Laplace filter.
Definition at line 72 of file sdet_texture_classifier_params.h.
bool sdet_texture_classifier_params::mag_ [inherited] |
should the filter response be absolute value vs. signed or clipped.
Definition at line 80 of file sdet_texture_classifier_params.h.
unsigned sdet_texture_classifier_params::n_samples_ [inherited] |
the number of samples to be randomly selected from the training images.
Definition at line 86 of file sdet_texture_classifier_params.h.
unsigned sdet_texture_classifier_params::n_scales_ [inherited] |
the number of scales used for the anisotropic filters.
Definition at line 62 of file sdet_texture_classifier_params.h.
float sdet_texture_classifier_params::scale_interval_ [inherited] |
the scale range for the anisotropic filters.
Definition at line 64 of file sdet_texture_classifier_params.h.
bool sdet_texture_classifier_params::signed_response_ [inherited] |
should the filter response be signed vs. absolute value.
Definition at line 78 of file sdet_texture_classifier_params.h.
vcl_map< vcl_string, vcl_vector<vnl_vector<double> > > sdet_texture_classifier::texton_dictionary_ [protected] |
Definition at line 186 of file sdet_texture_classifier.h.
vcl_vector<sdet_neighbor> sdet_texture_classifier::texton_index_ [protected] |
Definition at line 196 of file sdet_texture_classifier.h.
bool sdet_texture_classifier::texton_index_valid_ [protected] |
Definition at line 197 of file sdet_texture_classifier.h.
vcl_vector<float> sdet_texture_classifier::texton_weights_ [protected] |
Definition at line 199 of file sdet_texture_classifier.h.
bool sdet_texture_classifier::texton_weights_valid_ [protected] |
Definition at line 200 of file sdet_texture_classifier.h.
vcl_map< vcl_string, vcl_vector<vnl_vector<double> > > sdet_texture_classifier::training_data_ [protected] |
Definition at line 184 of file sdet_texture_classifier.h.
float sdet_texture_classifier_params::weight_offset_ [inherited] |
a factor that controls the weighting of textons that appear in more than one class.
Definition at line 90 of file sdet_texture_classifier_params.h.