Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
1dffd4cd
Commit
1dffd4cd
authored
Jan 21, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed poly_image to allow the user to decide if intensity normalization
should be used.
parent
9207d11e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
18 deletions
+70
-18
poly_image.h
dlib/image_keypoint/poly_image.h
+51
-16
poly_image_abstract.h
dlib/image_keypoint/poly_image_abstract.h
+19
-2
No files found.
dlib/image_keypoint/poly_image.h
View file @
1dffd4cd
...
...
@@ -43,6 +43,7 @@ namespace dlib
void
clear
(
)
{
normalize
=
true
;
poly_coef
.
clear
();
order
=
3
;
window_size
=
13
;
...
...
@@ -89,10 +90,21 @@ namespace dlib
filters
=
build_separable_poly_filters
(
order
,
window_size
);
}
bool
uses_normalization
(
)
const
{
return
normalize
;
}
void
set_normalization
(
bool
normalization
)
{
normalize
=
normalization
;
}
void
copy_configuration
(
const
poly_image
&
item
)
{
normalize
=
item
.
normalize
;
if
(
order
!=
item
.
order
||
window_size
!=
item
.
window_size
)
{
...
...
@@ -116,27 +128,40 @@ namespace dlib
des
.
set_size
(
get_num_dimensions
());
array2d
<
float
>
coef0
;
rectangle
rect
=
filter_image
(
img
,
coef0
,
filters
[
0
]);
num_rows
=
rect
.
height
();
num_cols
=
rect
.
width
();
for
(
unsigned
long
i
=
1
;
i
<
filters
.
size
();
++
i
)
if
(
normalize
)
{
filter_image
(
img
,
poly_coef
[
i
-
1
],
filters
[
i
]);
array2d
<
float
>
coef0
;
rectangle
rect
=
filter_image
(
img
,
coef0
,
filters
[
0
]);
num_rows
=
rect
.
height
();
num_cols
=
rect
.
width
();
// intensity normalize everything
for
(
long
r
=
0
;
r
<
coef0
.
nr
();
++
r
)
for
(
unsigned
long
i
=
1
;
i
<
filters
.
size
();
++
i
)
{
for
(
long
c
=
0
;
c
<
coef0
.
nc
();
++
c
)
filter_image
(
img
,
poly_coef
[
i
-
1
],
filters
[
i
]);
// intensity normalize everything
for
(
long
r
=
0
;
r
<
coef0
.
nr
();
++
r
)
{
if
(
coef0
[
r
][
c
]
>=
1
)
poly_coef
[
i
-
1
][
r
][
c
]
/=
coef0
[
r
][
c
];
else
poly_coef
[
i
-
1
][
r
][
c
]
=
0
;
for
(
long
c
=
0
;
c
<
coef0
.
nc
();
++
c
)
{
if
(
coef0
[
r
][
c
]
>=
1
)
poly_coef
[
i
-
1
][
r
][
c
]
/=
coef0
[
r
][
c
];
else
poly_coef
[
i
-
1
][
r
][
c
]
=
0
;
}
}
}
}
else
{
rectangle
rect
;
for
(
unsigned
long
i
=
0
;
i
<
filters
.
size
();
++
i
)
{
rect
=
filter_image
(
img
,
poly_coef
[
i
],
filters
[
i
]);
}
num_rows
=
rect
.
height
();
num_cols
=
rect
.
width
();
}
}
void
unload
()
...
...
@@ -158,8 +183,15 @@ namespace dlib
long
get_num_dimensions
(
)
const
{
// -1 because we discard the constant term of the polynomial.
return
filters
.
size
()
-
1
;
if
(
normalize
)
{
// -1 because we discard the constant term of the polynomial.
return
filters
.
size
()
-
1
;
}
else
{
return
filters
.
size
();
}
}
inline
const
descriptor_type
&
operator
()
(
...
...
@@ -238,6 +270,7 @@ namespace dlib
serialize
(
item
.
border_size
,
out
);
serialize
(
item
.
num_rows
,
out
);
serialize
(
item
.
num_cols
,
out
);
serialize
(
item
.
normalize
,
out
);
serialize
(
item
.
filters
,
out
);
}
...
...
@@ -254,6 +287,7 @@ namespace dlib
deserialize
(
item
.
border_size
,
in
);
deserialize
(
item
.
num_rows
,
in
);
deserialize
(
item
.
num_cols
,
in
);
deserialize
(
item
.
normalize
,
in
);
deserialize
(
item
.
filters
,
in
);
}
...
...
@@ -285,6 +319,7 @@ namespace dlib
long
num_rows
;
long
num_cols
;
bool
normalize
;
mutable
descriptor_type
des
;
};
...
...
dlib/image_keypoint/poly_image_abstract.h
View file @
1dffd4cd
...
...
@@ -23,7 +23,7 @@ namespace dlib
This object is a tool for extracting local feature descriptors from an image.
In particular, it fits polynomials to local pixel patches and allows you to
query the coefficients of these polynomials. Additionally, the coefficients
ar
e intensity normalized by dividing them by the constant term of the fitted
may b
e intensity normalized by dividing them by the constant term of the fitted
polynomial and then the constant term is discarded.
Finally, the user can specify a downsampling rate. If the template argument
...
...
@@ -105,6 +105,22 @@ namespace dlib
This is the width and height of the window in pixels.
!*/
bool
uses_normalization
(
)
const
;
/*!
ensures
- returns true if the polynomial coefficients are intensity normalized
and false otherwise.
!*/
void
set_normalization
(
bool
normalization
);
/*!
ensures
- uses_normalization() == normalization
!*/
void
copy_configuration
(
const
poly_image
&
item
);
...
...
@@ -184,7 +200,8 @@ namespace dlib
- returns the number of dimensions in the feature vectors generated by
this object.
- In this case, this will be the number of coefficients in an order
get_order() polynomial, except for the constant term of the polynomial.
get_order() polynomial, except for the constant term of the polynomial
if uses_normalization() == true.
!*/
inline
const
descriptor_type
&
operator
()
(
...
...
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