Commit 4b29dec6 authored by Davis King's avatar Davis King

Added use_relative_feature_weights() and use_uniform_feature_weights()

functions to make it easy to configure image scanners that use the hashed_feature_image.
parent 615b3cf6
......@@ -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<feature_extractor, projection_hash> 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<feature_extractor, projection_hash> hfe;
hfe.copy_configuration(scanner.get_feature_extractor());
hfe.set_hash(phash);
hfe.copy_configuration(fe);
scanner.copy_configuration(hfe);
......
......@@ -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 <
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment