Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
89311dd4
Commit
89311dd4
authored
May 28, 2015
by
Kurnianggoro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding the resize feature
parent
43e71214
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
12 deletions
+21
-12
tracker.hpp
modules/tracking/include/opencv2/tracking/tracker.hpp
+3
-10
trackerKCF.cpp
modules/tracking/src/trackerKCF.cpp
+18
-2
No files found.
modules/tracking/include/opencv2/tracking/tracker.hpp
View file @
89311dd4
...
...
@@ -1189,16 +1189,7 @@ class CV_EXPORTS_W TrackerTLD : public Tracker
BOILERPLATE_CODE
(
"TLD"
,
TrackerTLD
);
};
/** @brief KCF is a novel tracking framework that explicitly decomposes the long-term tracking task into
tracking, learning and detection.
The tracker follows the object from frame to frame. The detector localizes all appearances that
have been observed so far and corrects the tracker if necessary. The learning estimates detector’s
errors and updates it to avoid these errors in the future. The implementation is based on @cite TLD .
The Median Flow algorithm (see cv::TrackerMedianFlow) was chosen as a tracking component in this
implementation, following authors. Tracker is supposed to be able to handle rapid motions, partial
occlusions, object absence etc.
/** @brief KCF is a novel tracking framework that utilize properties of circulant matrix to enhance the processing speed.
*/
class
CV_EXPORTS_W
TrackerKCF
:
public
Tracker
{
...
...
@@ -1213,6 +1204,8 @@ class CV_EXPORTS_W TrackerKCF : public Tracker
double
lambda
;
// regularization
double
interp_factor
;
// linear interpolation factor for adaptation
double
output_sigma_factor
;
// spatial bandwidth (proportional to target)
bool
resize
;
// activate the resize feature to improves the processing speed
};
/** @brief Constructor
...
...
modules/tracking/src/trackerKCF.cpp
View file @
89311dd4
...
...
@@ -109,6 +109,8 @@ namespace cv{
Mat
z
,
new_z
;
Mat
response
;
// detection result
bool
resizeImage
;
// resize the image whenever needed and the patch size is large
int
frame
;
};
...
...
@@ -122,6 +124,7 @@ namespace cv{
params
(
parameters
)
{
isInit
=
false
;
resizeImage
=
false
;
}
void
TrackerKCFImpl
::
read
(
const
cv
::
FileNode
&
fn
){
...
...
@@ -148,6 +151,15 @@ namespace cv{
output_sigma
=
sqrt
(
roi
.
width
*
roi
.
height
)
*
params
.
output_sigma_factor
;
output_sigma
=-
0.5
/
(
output_sigma
*
output_sigma
);
//resize the ROI whenever needed
if
(
params
.
resize
&&
roi
.
width
*
roi
.
height
>
80
*
80
){
resizeImage
=
true
;
roi
.
x
/=
2.0
;
roi
.
y
/=
2.0
;
roi
.
width
/=
2.0
;
roi
.
height
/=
2.0
;
}
// add padding to the roi
roi
.
x
-=
roi
.
width
/
2
;
roi
.
y
-=
roi
.
height
/
2
+
1
;
...
...
@@ -191,6 +203,9 @@ namespace cv{
cvtColor
(
image
,
img
,
CV_BGR2GRAY
);
}
else
img
=
image
;
// resize the image whenever needed
if
(
resizeImage
)
resize
(
img
,
img
,
Size
(
img
.
cols
/
2
,
img
.
rows
/
2
));
// extract and pre-process the patch
getSubWindow
(
img
,
roi
,
x
);
...
...
@@ -202,8 +217,8 @@ namespace cv{
roi
.
x
+=
(
maxLoc
.
x
-
roi
.
width
/
2
+
1
);
roi
.
y
+=
(
maxLoc
.
y
-
roi
.
height
/
2
+
1
);
// update the bounding box
boundingBox
.
x
=
roi
.
x
+
boundingBox
.
width
/
2
;
boundingBox
.
y
=
roi
.
y
+
boundingBox
.
height
/
2
;
boundingBox
.
x
=
(
resizeImage
?
roi
.
x
*
2
:
roi
.
x
)
+
boundingBox
.
width
/
2
;
boundingBox
.
y
=
(
resizeImage
?
roi
.
y
*
2
:
roi
.
y
)
+
boundingBox
.
height
/
2
;
}
// extract the patch for learning purpose
...
...
@@ -459,6 +474,7 @@ namespace cv{
lambda
=
0.01
;
interp_factor
=
0.075
;
output_sigma_factor
=
1.0
/
16.0
;
resize
=
true
;
}
void
TrackerKCF
::
Params
::
read
(
const
cv
::
FileNode
&
fn
){
...
...
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