Commit 5b3859a1 authored by Davis King's avatar Davis King

Added the binned_vector_feature_image.

parent 7fd5d6bf
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "image_keypoint/fine_hog_image.h" #include "image_keypoint/fine_hog_image.h"
#include "image_keypoint/hashed_feature_image.h" #include "image_keypoint/hashed_feature_image.h"
#include "image_keypoint/nearest_neighbor_feature_image.h" #include "image_keypoint/nearest_neighbor_feature_image.h"
#include "image_keypoint/binned_vector_feature_image.h"
#endif // DLIB_IMAGE_KEYPOINt_H_ #endif // DLIB_IMAGE_KEYPOINt_H_
This diff is collapsed.
This diff is collapsed.
...@@ -33,10 +33,11 @@ namespace dlib ...@@ -33,10 +33,11 @@ namespace dlib
template < template <
typename image_array, typename image_array,
typename pyramid, typename pyramid,
typename feature_extractor typename feature_extractor,
template <typename feature_extractor, typename hash> class feature_image
> >
void setup_hashed_features ( void setup_hashed_features (
scan_image_pyramid<pyramid, hashed_feature_image<feature_extractor, projection_hash> >& scanner, scan_image_pyramid<pyramid, feature_image<feature_extractor, projection_hash> >& scanner,
const image_array& images, const image_array& images,
const feature_extractor& fe, const feature_extractor& fe,
int bits, int bits,
...@@ -64,7 +65,7 @@ namespace dlib ...@@ -64,7 +65,7 @@ namespace dlib
projection_hash phash = create_random_projection_hash(samps, bits); projection_hash phash = create_random_projection_hash(samps, bits);
hashed_feature_image<feature_extractor, projection_hash> hfe; feature_image<feature_extractor, projection_hash> hfe;
hfe.set_hash(phash); hfe.set_hash(phash);
hfe.copy_configuration(fe); hfe.copy_configuration(fe);
scanner.copy_configuration(hfe); scanner.copy_configuration(hfe);
...@@ -75,10 +76,11 @@ namespace dlib ...@@ -75,10 +76,11 @@ namespace dlib
template < template <
typename image_array, typename image_array,
typename pyramid, typename pyramid,
typename feature_extractor typename feature_extractor,
template <typename feature_extractor, typename hash> class feature_image
> >
void setup_hashed_features ( void setup_hashed_features (
scan_image_pyramid<pyramid, hashed_feature_image<feature_extractor, projection_hash> >& scanner, scan_image_pyramid<pyramid, feature_image<feature_extractor, projection_hash> >& scanner,
const image_array& images, const image_array& images,
int bits, int bits,
unsigned long num_samples = 200000 unsigned long num_samples = 200000
...@@ -108,10 +110,11 @@ namespace dlib ...@@ -108,10 +110,11 @@ namespace dlib
template < template <
typename image_array, typename image_array,
typename feature_extractor, typename feature_extractor,
template <typename feature_extractor, typename hash> class feature_image,
typename box_generator typename box_generator
> >
void setup_hashed_features ( void setup_hashed_features (
scan_image_boxes<hashed_feature_image<feature_extractor, projection_hash>,box_generator >& scanner, scan_image_boxes<feature_image<feature_extractor, projection_hash>,box_generator >& scanner,
const image_array& images, const image_array& images,
const feature_extractor& fe, const feature_extractor& fe,
int bits, int bits,
...@@ -139,7 +142,7 @@ namespace dlib ...@@ -139,7 +142,7 @@ namespace dlib
projection_hash phash = create_random_projection_hash(samps, bits); projection_hash phash = create_random_projection_hash(samps, bits);
hashed_feature_image<feature_extractor, projection_hash> hfe; feature_image<feature_extractor, projection_hash> hfe;
hfe.set_hash(phash); hfe.set_hash(phash);
hfe.copy_configuration(fe); hfe.copy_configuration(fe);
scanner.copy_configuration(hfe); scanner.copy_configuration(hfe);
...@@ -150,10 +153,11 @@ namespace dlib ...@@ -150,10 +153,11 @@ namespace dlib
template < template <
typename image_array, typename image_array,
typename feature_extractor, typename feature_extractor,
template <typename feature_extractor, typename hash> class feature_image,
typename box_generator typename box_generator
> >
void setup_hashed_features ( void setup_hashed_features (
scan_image_boxes<hashed_feature_image<feature_extractor, projection_hash>,box_generator>& scanner, scan_image_boxes<feature_image<feature_extractor, projection_hash>,box_generator>& scanner,
const image_array& images, const image_array& images,
int bits, int bits,
unsigned long num_samples = 200000 unsigned long num_samples = 200000
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "scan_image_boxes_abstract.h" #include "scan_image_boxes_abstract.h"
#include "../lsh/projection_hash_abstract.h" #include "../lsh/projection_hash_abstract.h"
#include "../image_keypoint/hashed_feature_image_abstract.h" #include "../image_keypoint/hashed_feature_image_abstract.h"
#include "../image_keypoint/binned_vector_feature_image_abstract.h"
namespace dlib namespace dlib
{ {
...@@ -27,9 +28,10 @@ namespace dlib ...@@ -27,9 +28,10 @@ namespace dlib
typename image_array, typename image_array,
typename pyramid, typename pyramid,
typename feature_extractor typename feature_extractor
template <typename feature_extractor, typename hash> class feature_image
> >
void setup_hashed_features ( void setup_hashed_features (
scan_image_pyramid<pyramid, hashed_feature_image<feature_extractor, projection_hash> >& scanner, scan_image_pyramid<pyramid, feature_image<feature_extractor, projection_hash> >& scanner,
const image_array& images, const image_array& images,
const feature_extractor& fe, const feature_extractor& fe,
int bits, int bits,
...@@ -42,6 +44,8 @@ namespace dlib ...@@ -42,6 +44,8 @@ namespace dlib
- images.size() > 0 - images.size() > 0
- it must be valid to pass images[0] into scanner.load(). - it must be valid to pass images[0] into scanner.load().
(also, image_array must be an implementation of dlib/array/array_kernel_abstract.h) (also, image_array must be an implementation of dlib/array/array_kernel_abstract.h)
- feature_image == must be either hashed_feature_image, binned_vector_feature_image,
or a type with a compatible interface.
ensures ensures
- Creates a projection_hash suitable for hashing the feature vectors produced by - Creates a projection_hash suitable for hashing the feature vectors produced by
fe and then configures scanner to use this hash function. fe and then configures scanner to use this hash function.
...@@ -62,9 +66,10 @@ namespace dlib ...@@ -62,9 +66,10 @@ namespace dlib
typename image_array, typename image_array,
typename pyramid, typename pyramid,
typename feature_extractor typename feature_extractor
template <typename feature_extractor, typename hash> class feature_image
> >
void setup_hashed_features ( void setup_hashed_features (
scan_image_pyramid<pyramid, hashed_feature_image<feature_extractor, projection_hash> >& scanner, scan_image_pyramid<pyramid, feature_image<feature_extractor, projection_hash> >& scanner,
const image_array& images, const image_array& images,
int bits, int bits,
unsigned long num_samples = 200000 unsigned long num_samples = 200000
...@@ -76,6 +81,8 @@ namespace dlib ...@@ -76,6 +81,8 @@ namespace dlib
- images.size() > 0 - images.size() > 0
- it must be valid to pass images[0] into scanner.load(). - it must be valid to pass images[0] into scanner.load().
(also, image_array must be an implementation of dlib/array/array_kernel_abstract.h) (also, image_array must be an implementation of dlib/array/array_kernel_abstract.h)
- feature_image == must be either hashed_feature_image, binned_vector_feature_image,
or a type with a compatible interface.
ensures ensures
- performs: setup_hashed_features(scanner, images, feature_extractor(), bits, num_samples) - performs: setup_hashed_features(scanner, images, feature_extractor(), bits, num_samples)
throws throws
...@@ -93,10 +100,11 @@ namespace dlib ...@@ -93,10 +100,11 @@ namespace dlib
template < template <
typename image_array, typename image_array,
typename feature_extractor, typename feature_extractor,
template <typename feature_extractor, typename hash> class feature_image
typename box_generator typename box_generator
> >
void setup_hashed_features ( void setup_hashed_features (
scan_image_boxes<hashed_feature_image<feature_extractor, projection_hash>,box_generator>& scanner, scan_image_boxes<feature_image<feature_extractor, projection_hash>,box_generator>& scanner,
const image_array& images, const image_array& images,
const feature_extractor& fe, const feature_extractor& fe,
int bits, int bits,
...@@ -109,6 +117,8 @@ namespace dlib ...@@ -109,6 +117,8 @@ namespace dlib
- images.size() > 0 - images.size() > 0
- it must be valid to pass images[0] into scanner.load(). - it must be valid to pass images[0] into scanner.load().
(also, image_array must be an implementation of dlib/array/array_kernel_abstract.h) (also, image_array must be an implementation of dlib/array/array_kernel_abstract.h)
- feature_image == must be either hashed_feature_image, binned_vector_feature_image,
or a type with a compatible interface.
ensures ensures
- Creates a projection_hash suitable for hashing the feature vectors produced by - Creates a projection_hash suitable for hashing the feature vectors produced by
fe and then configures scanner to use this hash function. fe and then configures scanner to use this hash function.
...@@ -128,10 +138,11 @@ namespace dlib ...@@ -128,10 +138,11 @@ namespace dlib
template < template <
typename image_array, typename image_array,
typename feature_extractor, typename feature_extractor,
template <typename feature_extractor, typename hash> class feature_image
typename box_generator typename box_generator
> >
void setup_hashed_features ( void setup_hashed_features (
scan_image_boxes<hashed_feature_image<feature_extractor, projection_hash>,box_generator>& scanner, scan_image_boxes<feature_image<feature_extractor, projection_hash>,box_generator>& scanner,
const image_array& images, const image_array& images,
int bits, int bits,
unsigned long num_samples = 200000 unsigned long num_samples = 200000
...@@ -143,6 +154,8 @@ namespace dlib ...@@ -143,6 +154,8 @@ namespace dlib
- images.size() > 0 - images.size() > 0
- it must be valid to pass images[0] into scanner.load(). - it must be valid to pass images[0] into scanner.load().
(also, image_array must be an implementation of dlib/array/array_kernel_abstract.h) (also, image_array must be an implementation of dlib/array/array_kernel_abstract.h)
- feature_image == must be either hashed_feature_image, binned_vector_feature_image,
or a type with a compatible interface.
ensures ensures
- performs: setup_hashed_features(scanner, images, feature_extractor(), bits, num_samples) - performs: setup_hashed_features(scanner, images, feature_extractor(), bits, num_samples)
throws throws
......
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