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
6700c46e
Commit
6700c46e
authored
Jan 12, 2014
by
Davis King
Browse files
Added an overload of extract_fhog_features() that returns a single column
vector represented using a matrix.
parent
972e3253
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
4 deletions
+59
-4
dlib/image_transforms/fhog.h
dlib/image_transforms/fhog.h
+23
-0
dlib/image_transforms/fhog_abstract.h
dlib/image_transforms/fhog_abstract.h
+36
-4
No files found.
dlib/image_transforms/fhog.h
View file @
6700c46e
...
...
@@ -655,6 +655,29 @@ namespace dlib
return
impl_fhog
::
impl_extract_fhog_features
(
img
,
hog
,
cell_size
,
filter_rows_padding
,
filter_cols_padding
);
}
// ----------------------------------------------------------------------------------------
template
<
typename
image_type
>
matrix
<
double
,
0
,
1
>
extract_fhog_features
(
const
image_type
&
img
,
int
cell_size
=
8
,
int
filter_rows_padding
=
1
,
int
filter_cols_padding
=
1
)
{
dlib
::
array
<
array2d
<
double
>
>
hog
;
extract_fhog_features
(
img
,
hog
,
cell_size
,
filter_rows_padding
,
filter_cols_padding
);
matrix
<
double
,
0
,
1
>
temp
(
hog
.
size
()
*
hog
[
0
].
size
());
for
(
unsigned
long
i
=
0
;
i
<
hog
.
size
();
++
i
)
{
const
long
size
=
hog
[
i
].
size
();
set_rowm
(
temp
,
range
(
i
*
size
,
(
i
+
1
)
*
size
-
1
))
=
reshape_to_column_vector
(
mat
(
hog
[
i
]));
}
return
temp
;
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
dlib/image_transforms/fhog_abstract.h
View file @
6700c46e
...
...
@@ -29,9 +29,9 @@ namespace dlib
- cell_size > 0
- filter_rows_padding > 0
- filter_cols_padding > 0
-
in_
image_type == is an implementation of array2d/array2d_kernel_abstract.h
- image_type == is an implementation of array2d/array2d_kernel_abstract.h
- img contains some kind of pixel type.
(i.e. pixel_traits<typename
in_
image_type::type> is defined)
(i.e. pixel_traits<typename image_type::type> is defined)
- T should be float or double
ensures
- This function implements the HOG feature extraction method described in
...
...
@@ -89,9 +89,9 @@ namespace dlib
- cell_size > 0
- filter_rows_padding > 0
- filter_cols_padding > 0
-
in_
image_type == is an implementation of array2d/array2d_kernel_abstract.h
- image_type == is an implementation of array2d/array2d_kernel_abstract.h
- img contains some kind of pixel type.
(i.e. pixel_traits<typename
in_
image_type::type> is defined)
(i.e. pixel_traits<typename image_type::type> is defined)
- T should be float or double
ensures
- This function is identical to the above extract_fhog_features() routine
...
...
@@ -105,6 +105,38 @@ namespace dlib
- #hog.size() == 31
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
image_type
>
matrix
<
double
,
0
,
1
>
extract_fhog_features
(
const
image_type
&
img
,
int
cell_size
=
8
,
int
filter_rows_padding
=
1
,
int
filter_cols_padding
=
1
);
/*!
requires
- cell_size > 0
- filter_rows_padding > 0
- filter_cols_padding > 0
- image_type == is an implementation of array2d/array2d_kernel_abstract.h
- img contains some kind of pixel type.
(i.e. pixel_traits<typename image_type::type> is defined)
ensures
- This function calls the above extract_fhog_features() routine and simply
packages the entire output into a dlib::matrix. The matrix is constructed
using the planar version of extract_fhog_features() and then each output
plane is converted into a column vector and subsequently all 31 column
vectors are concatenated together and returned.
- Each plane is converted into a column vector using reshape_to_column_vector(),
and is therefore represented in row major order inside the returned vector.
- If H is the array<array2d<double>> object output by the planar
extract_fhog_features() then the returned vector is composed by concatenating
H[0], then H[1], then H[2], and so on in ascending index order.
!*/
// ----------------------------------------------------------------------------------------
inline
point
image_to_fhog
(
...
...
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