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
8016ed28
Commit
8016ed28
authored
Feb 09, 2017
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tracking: fix overlap calculation
parent
2c33cb45
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
39 deletions
+17
-39
test_trackers.cpp
modules/tracking/test/test_trackers.cpp
+17
-39
No files found.
modules/tracking/test/test_trackers.cpp
View file @
8016ed28
...
...
@@ -83,8 +83,8 @@ class TrackerTest
{
public
:
TrackerTest
(
Ptr
<
Tracker
>
_tracker
,
string
_video
,
float
_
overlap
Threshold
,
float
_
distance
Threshold
,
int
_shift
=
NoTransform
,
int
_segmentIdx
=
1
,
int
_numSegments
=
10
);
TrackerTest
(
Ptr
<
Tracker
>
_tracker
,
string
_video
,
float
_
distance
Threshold
,
float
_
overlap
Threshold
,
int
_shift
=
NoTransform
,
int
_segmentIdx
=
1
,
int
_numSegments
=
10
);
virtual
~
TrackerTest
();
virtual
void
run
();
...
...
@@ -117,12 +117,12 @@ class TrackerTest
};
TrackerTest
::
TrackerTest
(
Ptr
<
Tracker
>
_tracker
,
string
_video
,
float
_
overlap
Threshold
,
float
_
distance
Threshold
,
int
_shift
,
int
_segmentIdx
,
int
_numSegments
)
:
TrackerTest
::
TrackerTest
(
Ptr
<
Tracker
>
_tracker
,
string
_video
,
float
_
distance
Threshold
,
float
_
overlap
Threshold
,
int
_shift
,
int
_segmentIdx
,
int
_numSegments
)
:
tracker
(
_tracker
),
video
(
_video
),
overlapThreshold
(
_
distance
Threshold
),
distanceThreshold
(
_
overlap
Threshold
),
overlapThreshold
(
_
overlap
Threshold
),
distanceThreshold
(
_
distance
Threshold
),
segmentIdx
(
_segmentIdx
),
shift
(
_shift
),
numSegments
(
_numSegments
)
...
...
@@ -156,30 +156,8 @@ float TrackerTest::calcDistance( Rect a, Rect b )
float
TrackerTest
::
calcOverlap
(
Rect
a
,
Rect
b
)
{
float
aArea
=
(
float
)(
a
.
width
*
a
.
height
);
float
bArea
=
(
float
)(
b
.
width
*
b
.
height
);
if
(
aArea
<
bArea
)
{
a
.
x
-=
(
b
.
width
-
a
.
width
)
/
2
;
a
.
y
-=
(
b
.
height
-
a
.
height
)
/
2
;
a
.
width
=
b
.
width
;
a
.
height
=
b
.
height
;
}
else
{
b
.
x
-=
(
a
.
width
-
b
.
width
)
/
2
;
b
.
y
-=
(
a
.
height
-
b
.
height
)
/
2
;
b
.
width
=
a
.
width
;
b
.
height
=
a
.
height
;
}
Rect
rectIntersection
=
a
&
b
;
Rect
rectUnion
=
a
|
b
;
float
iArea
=
(
float
)(
rectIntersection
.
width
*
rectIntersection
.
height
);
float
uArea
=
(
float
)(
rectUnion
.
width
*
rectUnion
.
height
);
float
overlap
=
iArea
/
uArea
;
return
overlap
;
float
rectIntersectionArea
=
(
float
)(
a
&
b
).
area
();
return
rectIntersectionArea
/
(
a
.
area
()
+
b
.
area
()
-
rectIntersectionArea
);
}
Rect
TrackerTest
::
applyShift
(
Rect
bb
)
...
...
@@ -461,19 +439,19 @@ PARAM_TEST_CASE(DistanceAndOverlap, string)
TEST_P
(
DistanceAndOverlap
,
MedianFlow
)
{
TrackerTest
test
(
Tracker
::
create
(
"MEDIANFLOW"
),
dataset
,
35
,
.5
5
f
,
NoTransform
,
1
,
1
);
TrackerTest
test
(
Tracker
::
create
(
"MEDIANFLOW"
),
dataset
,
35
,
.5
f
,
NoTransform
,
1
,
1
);
test
.
run
();
}
TEST_P
(
DistanceAndOverlap
,
MIL
)
{
TrackerTest
test
(
Tracker
::
create
(
"MIL"
),
dataset
,
30
,
0
.65
f
,
NoTransform
);
TrackerTest
test
(
Tracker
::
create
(
"MIL"
),
dataset
,
30
,
.65
f
,
NoTransform
);
test
.
run
();
}
TEST_P
(
DistanceAndOverlap
,
Boosting
)
{
TrackerTest
test
(
Tracker
::
create
(
"BOOSTING"
),
dataset
,
70
,
.
65
f
,
NoTransform
);
TrackerTest
test
(
Tracker
::
create
(
"BOOSTING"
),
dataset
,
70
,
.
7
f
,
NoTransform
);
test
.
run
();
}
...
...
@@ -486,13 +464,13 @@ TEST_P(DistanceAndOverlap, TLD)
//Tests with shifted initial window
TEST_P
(
DistanceAndOverlap
,
Shifted_Data_MedianFlow
)
{
TrackerTest
test
(
Tracker
::
create
(
"MEDIANFLOW"
),
dataset
,
80
,
.
3
f
,
CenterShiftLeft
,
1
,
1
);
TrackerTest
test
(
Tracker
::
create
(
"MEDIANFLOW"
),
dataset
,
80
,
.
2
f
,
CenterShiftLeft
,
1
,
1
);
test
.
run
();
}
TEST_P
(
DistanceAndOverlap
,
Shifted_Data_MIL
)
{
TrackerTest
test
(
Tracker
::
create
(
"MIL"
),
dataset
,
30
,
0.65
f
,
CenterShiftLeft
);
TrackerTest
test
(
Tracker
::
create
(
"MIL"
),
dataset
,
30
,
.6
f
,
CenterShiftLeft
);
test
.
run
();
}
...
...
@@ -511,25 +489,25 @@ TEST_P(DistanceAndOverlap, Shifted_Data_TLD)
//Tests with scaled initial window
TEST_P
(
DistanceAndOverlap
,
Scaled_Data_MedianFlow
)
{
TrackerTest
test
(
Tracker
::
create
(
"MEDIANFLOW"
),
dataset
,
25
,
.
4
5
f
,
Scale_1_1
,
1
,
1
);
TrackerTest
test
(
Tracker
::
create
(
"MEDIANFLOW"
),
dataset
,
25
,
.5
f
,
Scale_1_1
,
1
,
1
);
test
.
run
();
}
TEST_P
(
DistanceAndOverlap
,
Scaled_Data_MIL
)
{
TrackerTest
test
(
Tracker
::
create
(
"MIL"
),
dataset
,
30
,
0.65
f
,
Scale_1_1
);
TrackerTest
test
(
Tracker
::
create
(
"MIL"
),
dataset
,
30
,
.7
f
,
Scale_1_1
);
test
.
run
();
}
TEST_P
(
DistanceAndOverlap
,
Scaled_Data_Boosting
)
{
TrackerTest
test
(
Tracker
::
create
(
"BOOSTING"
),
dataset
,
80
,
.
65
f
,
Scale_1_1
);
TrackerTest
test
(
Tracker
::
create
(
"BOOSTING"
),
dataset
,
80
,
.
7
f
,
Scale_1_1
);
test
.
run
();
}
TEST_P
(
DistanceAndOverlap
,
Scaled_Data_TLD
)
{
TrackerTest
test
(
Tracker
::
create
(
"TLD"
),
dataset
,
120
,
.4
f
,
Scale_1_1
);
TrackerTest
test
(
Tracker
::
create
(
"TLD"
),
dataset
,
120
,
.4
5
f
,
Scale_1_1
);
test
.
run
();
}
...
...
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