mirror of https://github.com/davisking/dlib.git
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.
This commit is contained in:
parent
615b3cf6a0
commit
4b29dec604
|
@ -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 <
|
||||
|
|
Loading…
Reference in New Issue