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
895a9143
Commit
895a9143
authored
Aug 30, 2017
by
Vladislav Sovrasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tracking: fix unitialized memory access in TLD
parent
a6215264
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
17 deletions
+22
-17
tldModel.cpp
modules/tracking/src/tldModel.cpp
+11
-9
tldTracker.cpp
modules/tracking/src/tldTracker.cpp
+10
-7
tldTracker.hpp
modules/tracking/src/tldTracker.hpp
+1
-1
No files found.
modules/tracking/src/tldModel.cpp
View file @
895a9143
...
...
@@ -87,9 +87,9 @@ namespace cv
//Generate initial positive samples and put them to the model
positiveExamples
.
reserve
(
200
);
for
(
int
i
=
0
;
i
<
(
int
)
closest
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
closest
.
size
();
i
++
)
{
for
(
in
t
j
=
0
;
j
<
20
;
j
++
)
for
(
size_
t
j
=
0
;
j
<
20
;
j
++
)
{
Point2f
center
;
Size2f
size
;
...
...
@@ -102,13 +102,15 @@ namespace cv
resample
(
scaledImg
,
RotatedRect
(
center
,
size
,
angle
),
standardPatch
);
for
(
int
y
=
0
;
y
<
standardPatch
.
rows
;
y
++
)
{
for
(
int
x
=
0
;
x
<
standardPatch
.
cols
;
x
++
)
{
standardPatch
(
x
,
y
)
+=
(
uchar
)
rng
.
gaussian
(
5.0
);
}
}
for
(
int
y
=
0
;
y
<
standardPatch
.
rows
;
y
++
)
{
uchar
*
patchRow
=
standardPatch
.
ptr
(
y
);
for
(
int
x
=
0
;
x
<
standardPatch
.
cols
;
x
++
)
{
int
newValue
=
patchRow
[
x
]
+
cvRound
(
rng
.
gaussian
(
5.0
));
patchRow
[
x
]
=
saturate_cast
<
uchar
>
(
newValue
);
}
}
#ifdef BLUR_AS_VADIM
GaussianBlur
(
standardPatch
,
blurredPatch
,
GaussBlurKernelSize
,
0.0
);
...
...
modules/tracking/src/tldTracker.cpp
View file @
895a9143
...
...
@@ -41,7 +41,6 @@
#include "tldTracker.hpp"
namespace
cv
{
...
...
@@ -156,7 +155,7 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
else
#endif
DETECT_FLG
=
tldModel
->
detector
->
detect
(
imageForDetector
,
image_blurred
,
tmpCandid
,
detectorResults
,
tldModel
->
getMinSize
());
}
}
if
(
(
(
i
==
0
)
&&
!
data
->
failedLastTime
&&
trackerProxy
->
update
(
image
,
tmpCandid
)
)
||
(
DETECT_FLG
))
{
candidates
.
push_back
(
tmpCandid
);
...
...
@@ -174,7 +173,7 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
}
std
::
vector
<
double
>::
iterator
it
=
std
::
max_element
(
candidatesRes
.
begin
(),
candidatesRes
.
end
());
if
(
it
==
candidatesRes
.
end
()
)
if
(
it
==
candidatesRes
.
end
()
)
//candidates are empty
{
data
->
confident
=
false
;
data
->
failedLastTime
=
true
;
...
...
@@ -259,6 +258,7 @@ int TrackerTLDImpl::Pexpert::additionalExamples(std::vector<Mat_<uchar> >& examp
double
scale
=
scaleAndBlur
(
img_
,
cvRound
(
log
(
1.0
*
resultBox_
.
width
/
(
initSize_
.
width
))
/
log
(
SCALE_STEP
)),
scaledImg
,
blurredImg
,
GaussBlurKernelSize
,
SCALE_STEP
);
TLDDetector
::
generateScanGrid
(
img_
.
rows
,
img_
.
cols
,
initSize_
,
scanGrid
);
getClosestN
(
scanGrid
,
Rect2d
(
resultBox_
.
x
/
scale
,
resultBox_
.
y
/
scale
,
resultBox_
.
width
/
scale
,
resultBox_
.
height
/
scale
),
10
,
closest
);
...
...
@@ -275,21 +275,24 @@ int TrackerTLDImpl::Pexpert::additionalExamples(std::vector<Mat_<uchar> >& examp
size
.
height
=
(
float
)(
closest
[
i
].
height
*
rng
.
uniform
((
double
)
0.99
,
(
double
)
1.01
));
float
angle
=
(
float
)
rng
.
uniform
(
-
5.0
,
5.0
);
resample
(
scaledImg
,
RotatedRect
(
center
,
size
,
angle
),
standardPatch
);
for
(
int
y
=
0
;
y
<
standardPatch
.
rows
;
y
++
)
{
uchar
*
patchRow
=
standardPatch
.
ptr
(
y
);
for
(
int
x
=
0
;
x
<
standardPatch
.
cols
;
x
++
)
{
standardPatch
(
x
,
y
)
+=
(
uchar
)
rng
.
gaussian
(
5.0
);
int
newValue
=
patchRow
[
x
]
+
cvRound
(
rng
.
gaussian
(
5.0
));
patchRow
[
x
]
=
saturate_cast
<
uchar
>
(
newValue
);
}
}
#ifdef BLUR_AS_VADIM
examplesForModel
.
push_back
(
standardPatch
);
#if defined BLUR_AS_VADIM
GaussianBlur
(
standardPatch
,
blurredPatch
,
GaussBlurKernelSize
,
0.0
);
resize
(
blurredPatch
,
blurredPatch
,
initSize_
);
#else
resample
(
blurredImg
,
RotatedRect
(
center
,
size
,
angle
),
blurredPatch
);
#endif
resample
(
scaledImg
,
RotatedRect
(
center
,
size
,
angle
),
standardPatch
);
examplesForModel
.
push_back
(
standardPatch
);
examplesForEnsemble
.
push_back
(
blurredPatch
);
}
}
...
...
modules/tracking/src/tldTracker.hpp
View file @
895a9143
...
...
@@ -112,7 +112,7 @@ private:
};
#
define
BLUR_AS_VADIM
#
undef
BLUR_AS_VADIM
#undef CLOSED_LOOP
class
TrackerTLDImpl
:
public
TrackerTLD
...
...
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