diff --git a/dlib/image_processing/setup_hashed_features.h b/dlib/image_processing/setup_hashed_features.h index 1dabc05d5..157cf3c15 100644 --- a/dlib/image_processing/setup_hashed_features.h +++ b/dlib/image_processing/setup_hashed_features.h @@ -24,6 +24,36 @@ namespace dlib ): error(a) {} }; +// ---------------------------------------------------------------------------------------- + + template < + typename image_scanner + > + void use_uniform_feature_weights ( + image_scanner& scanner + ) + { + typename image_scanner::feature_extractor_type fe; + fe.copy_configuration(scanner.get_feature_extractor()); + fe.use_uniform_feature_weights(); + scanner.copy_configuration(fe); + } + +// ---------------------------------------------------------------------------------------- + + template < + typename image_scanner + > + void use_relative_feature_weights ( + image_scanner& scanner + ) + { + typename image_scanner::feature_extractor_type fe; + fe.copy_configuration(scanner.get_feature_extractor()); + fe.use_relative_feature_weights(); + scanner.copy_configuration(fe); + } + // ---------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------- // stuff for scan_image_pyramid @@ -66,6 +96,7 @@ namespace dlib projection_hash phash = create_random_projection_hash(samps, bits); feature_image hfe; + hfe.copy_configuration(scanner.get_feature_extractor()); hfe.set_hash(phash); hfe.copy_configuration(fe); scanner.copy_configuration(hfe); @@ -143,6 +174,7 @@ namespace dlib projection_hash phash = create_random_projection_hash(samps, bits); feature_image hfe; + hfe.copy_configuration(scanner.get_feature_extractor()); hfe.set_hash(phash); hfe.copy_configuration(fe); scanner.copy_configuration(hfe); diff --git a/dlib/image_processing/setup_hashed_features_abstract.h b/dlib/image_processing/setup_hashed_features_abstract.h index 7b05d4b88..0a8e42919 100644 --- a/dlib/image_processing/setup_hashed_features_abstract.h +++ b/dlib/image_processing/setup_hashed_features_abstract.h @@ -22,6 +22,42 @@ namespace dlib !*/ }; +// ---------------------------------------------------------------------------------------- + + template < + typename image_scanner + > + void use_uniform_feature_weights ( + image_scanner& scanner + ); + /*! + requires + - image_scanner should be either scan_image_pyramid or scan_image_boxes and + should use the hashed_feature_image as its local feature extractor. + ensures + - #scanner.get_feature_extractor().uses_uniform_feature_weights() == true + (i.e. Make the scanner's feature extractor use the uniform feature weighting + scheme) + !*/ + +// ---------------------------------------------------------------------------------------- + + template < + typename image_scanner + > + void use_relative_feature_weights ( + image_scanner& scanner + ); + /*! + requires + - image_scanner should be either scan_image_pyramid or scan_image_boxes and + should use the hashed_feature_image as its local feature extractor. + ensures + - #scanner.get_feature_extractor().uses_uniform_feature_weights() == false + (i.e. Make the scanner's feature extractor use the relative feature weighting + scheme) + !*/ + // ---------------------------------------------------------------------------------------- template <