Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
5e7d14f4
Commit
5e7d14f4
authored
Sep 08, 2011
by
Davis King
Browse files
simplified this object a little bit.
parent
02566cc9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
30 deletions
+19
-30
dlib/image_keypoint/hashed_feature_image.h
dlib/image_keypoint/hashed_feature_image.h
+8
-6
dlib/image_keypoint/hashed_feature_image_abstract.h
dlib/image_keypoint/hashed_feature_image_abstract.h
+11
-24
No files found.
dlib/image_keypoint/hashed_feature_image.h
View file @
5e7d14f4
...
...
@@ -58,8 +58,6 @@ namespace dlib
const
image_type
&
img
);
bool
has_image_statistics
(
)
const
;
void
copy_configuration
(
const
feature_extractor
&
item
...
...
@@ -132,6 +130,8 @@ namespace dlib
private:
inline
bool
has_image_statistics
(
)
const
;
feature_extractor
fe
;
typename
feature_extractor
::
descriptor_type
inv_stddev
;
...
...
@@ -431,11 +431,9 @@ namespace dlib
{
// make sure requires clause is not broken
DLIB_ASSERT
(
0
<=
row
&&
row
<
nr
()
&&
0
<=
col
&&
col
<
nc
()
&&
has_image_statistics
()
==
true
,
0
<=
col
&&
col
<
nc
(),
"
\t
descriptor_type hashed_feature_image::operator(row,col)"
<<
"
\n\t
Invalid inputs were given to this function"
<<
"
\n\t
has_image_statistics(): "
<<
has_image_statistics
()
<<
"
\n\t
row: "
<<
row
<<
"
\n\t
col: "
<<
col
<<
"
\n\t
nr(): "
<<
nr
()
...
...
@@ -444,7 +442,11 @@ namespace dlib
);
hash_feats
.
resize
(
scales
.
size
());
if
(
has_image_statistics
())
scaled_feats
=
pointwise_multiply
(
fe
(
row
,
col
),
inv_stddev
);
else
scaled_feats
=
fe
(
row
,
col
);
for
(
long
i
=
0
;
i
<
scales
.
size
();
++
i
)
{
quantized_feats
=
matrix_cast
<
int32
>
(
scales
(
i
)
*
scaled_feats
);
...
...
dlib/image_keypoint/hashed_feature_image_abstract.h
View file @
5e7d14f4
...
...
@@ -24,7 +24,6 @@ namespace dlib
INITIAL VALUE
- size() == 0
- get_num_dimensions() == 1000
- has_image_statistics() == false
- get_scales() == logspace(-1,1,3)
WHAT THIS OBJECT REPRESENTS
...
...
@@ -77,10 +76,10 @@ namespace dlib
ensures
- When a feature vector from BASE_FE is hashed, it is hashed into exactly
get_scales().size() hash bins. Each hash is computed as follows:
-
f
irst normalize the feature vector
-
t
hen multiply it by an element of get_scales()
-
t
hen convert the resulting vector to a vector of dlib::int32
-
f
inally, hash the integer vector into a hash bin.
-
F
irst normalize the feature vector
.
-
T
hen multiply it by an element of get_scales()
.
-
T
hen convert the resulting vector to a vector of dlib::int32
.
-
F
inally, hash the integer vector into a hash bin.
- The size of the numbers in get_scales() determines how "big" the hash bins are.
A very small scale value would result in all input vectors being hashed into the
same bin, while larger scale values would result in only similar vectors
...
...
@@ -97,22 +96,12 @@ namespace dlib
);
/*!
requires
- image_type == is an implementation of array2d/array2d_kernel_abstract.h
- pixel_traits<typename image_type::type>::has_alpha == false
- image_type == any type that can be supplied to feature_extractor::load()
ensures
- if (img is large enough to have at least two local features in it) then
- #has_image_statistics() == true
- This function will accumulate image statistics across multiple calls.
Therefore, it can be beneficial to pass in many images.
!*/
bool
has_image_statistics
(
)
const
;
/*!
ensures
- Part of the hashing step is to normalize the features produced by
BASE_FE. This function returns true if we have accumulated the necessary
information to perform this normalization and false otherwise.
- Part of the hashing step is to normalize the features produced by BASE_FE.
This function will accumulate image statistics used to perform this normalization.
Note that it will accumulate across multiple calls. Therefore, it can be
beneficial to pass in many images.
!*/
void
copy_configuration
(
...
...
@@ -145,8 +134,7 @@ namespace dlib
);
/*!
requires
- image_type == is an implementation of array2d/array2d_kernel_abstract.h
- pixel_traits<typename image_type::type>::has_alpha == false
- image_type == any type that can be supplied to feature_extractor::load()
ensures
- performs BASE_FE.load(img)
i.e. does feature extraction. The features can be accessed using
...
...
@@ -198,11 +186,10 @@ namespace dlib
)
const
;
/*!
requires
- has_image_statistics() == true
- 0 <= row < nr()
- 0 <= col < nc()
ensures
- hashes BASE_FE(row,col) and returns resulting indicator vector.
- hashes BASE_FE(row,col) and returns
the
resulting indicator vector.
- Returns a vector V such that:
- V.size() == get_scales().size()
- for all valid i: 0 <= V[i].first < get_num_dimensions()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment