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
6e9ee89e
Commit
6e9ee89e
authored
Apr 09, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
fe168596
eb25bf44
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
24 deletions
+113
-24
correlation_tracker.h
dlib/image_processing/correlation_tracker.h
+51
-16
correlation_tracker_abstract.h
dlib/image_processing/correlation_tracker_abstract.h
+55
-1
CMakeLists.txt
dlib/test/CMakeLists.txt
+1
-1
correlation_tracker.cpp
dlib/test/correlation_tracker.cpp
+6
-6
No files found.
dlib/image_processing/correlation_tracker.h
View file @
6e9ee89e
...
...
@@ -19,8 +19,20 @@ namespace dlib
{
public
:
correlation_tracker
(
explicit
correlation_tracker
(
unsigned
long
filter_size
=
6
,
unsigned
long
num_scale_levels
=
5
,
unsigned
long
scale_window_size
=
23
,
double
regularizer_space
=
0
.
001
,
double
nu_space
=
0
.
025
,
double
regularizer_scale
=
0
.
001
,
double
nu_scale
=
0
.
025
,
double
scale_pyramid_alpha
=
1
.
020
)
:
filter_size
(
1
<<
filter_size
),
num_scale_levels
(
1
<<
num_scale_levels
),
scale_window_size
(
scale_window_size
),
regularizer_space
(
regularizer_space
),
nu_space
(
nu_space
),
regularizer_scale
(
regularizer_scale
),
nu_scale
(
nu_scale
),
scale_pyramid_alpha
(
scale_pyramid_alpha
)
{
// Create the cosine mask used for space filtering.
mask
=
make_cosine_mask
();
...
...
@@ -78,23 +90,23 @@ namespace dlib
unsigned
long
get_filter_size
(
)
const
{
return
128
/
2
;
}
// must be power of 2
)
const
{
return
filter_size
;
}
unsigned
long
get_num_scale_levels
(
)
const
{
return
32
;
}
// must be power of 2
)
const
{
return
num_scale_levels
;
}
unsigned
long
get_scale_window_size
(
)
const
{
return
23
;
}
)
const
{
return
scale_window_size
;
}
double
get_regularizer_space
(
)
const
{
return
0
.
001
;
}
)
const
{
return
regularizer_space
;
}
inline
double
get_nu_space
(
)
const
{
return
0
.
025
;}
)
const
{
return
nu_space
;}
double
get_regularizer_scale
(
)
const
{
return
0
.
001
;
}
)
const
{
return
regularizer_scale
;
}
double
get_nu_scale
(
)
const
{
return
0
.
025
;}
)
const
{
return
nu_scale
;}
drectangle
get_position
(
)
const
...
...
@@ -103,13 +115,11 @@ namespace dlib
}
double
get_scale_pyramid_alpha
(
)
const
{
return
1
.
020
;
}
)
const
{
return
scale_pyramid_alpha
;
}
template
<
typename
image_type
>
double
update
(
double
update
_noscale
(
const
image_type
&
img
,
const
drectangle
&
guess
)
...
...
@@ -147,9 +157,8 @@ namespace dlib
}
const
double
psr
=
(
G
(
p
.
y
(),
p
.
x
()).
real
()
-
rs
.
mean
())
/
rs
.
stddev
();
// update the position of the object
position
=
translate_rect
(
guess
,
tform
(
pp
)
-
center
(
guess
));
position
=
translate_rect
(
guess
,
tform
(
pp
)
-
center
(
guess
));
// now update the position filters
make_target_location_image
(
pp
,
G
);
...
...
@@ -160,7 +169,16 @@ namespace dlib
B
+=
get_nu_space
()
*
(
squared
(
real
(
F
[
i
]))
+
squared
(
imag
(
F
[
i
])));
}
return
psr
;
}
template
<
typename
image_type
>
double
update
(
const
image_type
&
img
,
const
drectangle
&
guess
)
{
double
psr
=
update_noscale
(
img
,
guess
);
// Now predict the scale change
make_scale_space
(
img
,
Fs
);
...
...
@@ -192,7 +210,15 @@ namespace dlib
}
template
<
typename
image_type
>
double
update
(
double
update_noscale
(
const
image_type
&
img
)
{
return
update_noscale
(
img
,
get_position
());
}
template
<
typename
image_type
>
double
update
(
const
image_type
&
img
)
{
...
...
@@ -361,6 +387,15 @@ namespace dlib
// here just so we can void reallocating them over and over.
matrix
<
std
::
complex
<
double
>
>
G
;
matrix
<
std
::
complex
<
double
>
,
0
,
1
>
Gs
;
unsigned
long
filter_size
;
unsigned
long
num_scale_levels
;
unsigned
long
scale_window_size
;
double
regularizer_space
;
double
nu_space
;
double
regularizer_scale
;
double
nu_scale
;
double
scale_pyramid_alpha
;
};
}
...
...
dlib/image_processing/correlation_tracker_abstract.h
View file @
6e9ee89e
...
...
@@ -25,10 +25,23 @@ namespace dlib
public
:
correlation_tracker
(
explicit
correlation_tracker
(
unsigned
long
filter_size
=
6
,
unsigned
long
num_scale_levels
=
5
,
unsigned
long
scale_window_size
=
23
,
double
regularizer_space
=
0
.
001
,
double
nu_space
=
0
.
025
,
double
regularizer_scale
=
0
.
001
,
double
nu_scale
=
0
.
025
,
double
scale_pyramid_alpha
=
1
.
020
);
/*!
requires
- p.is_empty() == false
ensures
- Initializes correlation_tracker. Higher value of filter_size and
num_scale_levels increases tracking precision but requires more CPU
for processing. Recommended values for filter_size = 5-7,
default = 6, for num_scale_levels = 4-6, default = 5
- #get_position().is_empty() == true
!*/
...
...
@@ -58,6 +71,32 @@ namespace dlib
- returns the predicted position of the object under track.
!*/
template
<
typename
image_type
>
double
update_noscale
(
const
image_type
&
img
,
const
drectangle
&
guess
);
/*!
requires
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
- get_position().is_empty() == false
(i.e. you must have started tracking by calling start_track())
ensures
- When searching for the object in img, we search in the area around the
provided guess. This function only tracks object position without trying
to track the scale
- #get_position() == the new predicted location of the object in img. This
location will be a copy of guess that has been translated and NOT scaled
appropriately based on the content of img so that it, hopefully, bounds
the object in img.
- Returns the peak to side-lobe ratio. This is a number that measures how
confident the tracker is that the object is inside #get_position().
Larger values indicate higher confidence.
!*/
template
<
typename
image_type
>
...
...
@@ -83,6 +122,21 @@ namespace dlib
Larger values indicate higher confidence.
!*/
template
<
typename
image_type
>
double
update_noscale
(
const
image_type
&
img
);
/*!
requires
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
- get_position().is_empty() == false
(i.e. you must have started tracking by calling start_track())
ensures
- performs: return update_noscale(img, get_position())
!*/
template
<
typename
image_type
>
...
...
dlib/test/CMakeLists.txt
View file @
6e9ee89e
...
...
@@ -39,7 +39,7 @@ set (tests
conditioning_class_c.cpp
conditioning_class.cpp
config_reader.cpp
cor
el
lation_tracker.cpp
cor
re
lation_tracker.cpp
crc32.cpp
create_iris_datafile.cpp
data_io.cpp
...
...
dlib/test/cor
el
lation_tracker.cpp
→
dlib/test/cor
re
lation_tracker.cpp
View file @
6e9ee89e
...
...
@@ -14,17 +14,17 @@ namespace
using
namespace
test
;
using
namespace
dlib
;
using
namespace
std
;
dlib
::
logger
dlog
(
"test.cor
el
lation_tracker"
);
dlib
::
logger
dlog
(
"test.cor
re
lation_tracker"
);
class
cor
el
lation_tracker_tester
:
public
tester
class
cor
re
lation_tracker_tester
:
public
tester
{
public
:
cor
el
lation_tracker_tester
(
cor
re
lation_tracker_tester
(
)
:
tester
(
"test_cor
el
lation_tracker"
,
// the command line argument name for this test
"Run tests on the cor
el
lation_tracker functions."
,
// the command line argument description
"test_cor
re
lation_tracker"
,
// the command line argument name for this test
"Run tests on the cor
re
lation_tracker functions."
,
// the command line argument description
0
// the number of command line arguments for this test
)
{
...
...
@@ -946,7 +946,7 @@ namespace
};
cor
el
lation_tracker_tester
a
;
cor
re
lation_tracker_tester
a
;
// ----------------------------------------------------------------------------------------
...
...
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