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
b318e38b
Commit
b318e38b
authored
9 years ago
by
Vladimir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debug through candidates display
parent
ada26814
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
18 deletions
+38
-18
tldDetector.cpp
modules/tracking/src/tldDetector.cpp
+12
-2
tldDetector.hpp
modules/tracking/src/tldDetector.hpp
+8
-6
tldTracker.cpp
modules/tracking/src/tldTracker.cpp
+18
-4
tldTracker.hpp
modules/tracking/src/tldTracker.hpp
+0
-6
No files found.
modules/tracking/src/tldDetector.cpp
View file @
b318e38b
...
...
@@ -491,6 +491,10 @@ namespace cv
continue
;
varBuffer
.
push_back
(
Point
(
dx
*
i
,
dy
*
j
));
varScaleIDs
.
push_back
(
scaleID
);
//Debug display candidates after Variance Filter
double
curScale
=
pow
(
tld
::
SCALE_STEP
,
scaleID
);
debugStack
[
0
].
push_back
(
Rect2d
(
dx
*
i
*
curScale
,
dy
*
j
*
curScale
,
initSize
.
width
*
curScale
,
initSize
.
height
*
curScale
));
}
}
scaleID
++
;
...
...
@@ -520,6 +524,9 @@ namespace cv
//t = (e2 - e1) / getTickFrequency()*1000.0;
//printf("Ensemble: %d\t%f\n", ensBuffer.size(), t);
//printf("varBuffer: %d\n", varBuffer.size());
//printf("ensBuffer: %d\n", ensBuffer.size());
//NN classification
//e1 = getTickCount();
for
(
int
i
=
0
;
i
<
(
int
)
ensBuffer
.
size
();
i
++
)
...
...
@@ -561,8 +568,11 @@ namespace cv
if
(
maxSc
<
0
)
return
false
;
res
=
maxScRect
;
return
true
;
else
{
res
=
maxScRect
;
return
true
;
}
}
bool
TLDDetector
::
ocl_detect
(
const
Mat
&
img
,
const
Mat
&
imgBlurred
,
Rect2d
&
res
,
std
::
vector
<
LabeledPatch
>&
patches
,
Size
initSize
)
...
...
This diff is collapsed.
Click to expand it.
modules/tracking/src/tldDetector.hpp
View file @
b318e38b
...
...
@@ -66,6 +66,8 @@ namespace cv
static
const
cv
::
Size
GaussBlurKernelSize
(
3
,
3
);
class
TLDDetector
{
public
:
...
...
@@ -79,6 +81,7 @@ namespace cv
double
ocl_Sc
(
const
Mat_
<
uchar
>&
patch
);
void
ocl_batchSrSc
(
const
Mat_
<
uchar
>&
patches
,
double
*
resultSr
,
double
*
resultSc
,
int
numOfPatches
);
std
::
vector
<
Rect2d
>
debugStack
[
10
];
std
::
vector
<
TLDEnsembleClassifier
>
classifiers
;
Mat
*
posExp
,
*
negExp
;
int
*
posNum
,
*
negNum
;
...
...
@@ -93,15 +96,14 @@ namespace cv
bool
isObject
,
shouldBeIntegrated
;
};
bool
detect
(
const
Mat
&
img
,
const
Mat
&
imgBlurred
,
Rect2d
&
res
,
std
::
vector
<
LabeledPatch
>&
patches
,
Size
initSize
);
bool
ocl_detect
(
const
Mat
&
img
,
const
Mat
&
imgBlurred
,
Rect2d
&
res
,
std
::
vector
<
LabeledPatch
>&
patches
,
Size
initSize
);
protected
:
bool
ocl_detect
(
const
Mat
&
img
,
const
Mat
&
imgBlurred
,
Rect2d
&
res
,
std
::
vector
<
LabeledPatch
>&
patches
,
Size
initSize
);
friend
class
MyMouseCallbackDEBUG
;
void
computeIntegralImages
(
const
Mat
&
img
,
Mat_
<
double
>&
intImgP
,
Mat_
<
double
>&
intImgP2
){
integral
(
img
,
intImgP
,
intImgP2
,
CV_64F
);
}
inline
bool
patchVariance
(
Mat_
<
double
>&
intImgP
,
Mat_
<
double
>&
intImgP2
,
double
*
originalVariance
,
Point
pt
,
Size
size
);
static
void
computeIntegralImages
(
const
Mat
&
img
,
Mat_
<
double
>&
intImgP
,
Mat_
<
double
>&
intImgP2
){
integral
(
img
,
intImgP
,
intImgP2
,
CV_64F
);
}
static
inline
bool
patchVariance
(
Mat_
<
double
>&
intImgP
,
Mat_
<
double
>&
intImgP2
,
double
*
originalVariance
,
Point
pt
,
Size
size
);
};
}
}
...
...
This diff is collapsed.
Click to expand it.
modules/tracking/src/tldTracker.cpp
View file @
b318e38b
...
...
@@ -45,6 +45,13 @@
namespace
cv
{
TrackerTLD
::
Params
::
Params
(){}
void
TrackerTLD
::
Params
::
read
(
const
cv
::
FileNode
&
/*fn*/
){}
void
TrackerTLD
::
Params
::
write
(
cv
::
FileStorage
&
/*fs*/
)
const
{}
Ptr
<
TrackerTLD
>
TrackerTLD
::
createTracker
(
const
TrackerTLD
::
Params
&
parameters
)
{
return
Ptr
<
tld
::
TrackerTLDImpl
>
(
new
tld
::
TrackerTLDImpl
(
parameters
));
...
...
@@ -112,7 +119,6 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
Mat_
<
uchar
>
standardPatch
(
STANDARD_PATCH_SIZE
,
STANDARD_PATCH_SIZE
);
std
::
vector
<
TLDDetector
::
LabeledPatch
>
detectorResults
;
//best overlap around 92%
std
::
vector
<
Rect2d
>
candidates
;
std
::
vector
<
double
>
candidatesRes
;
bool
trackerNeedsReInit
=
false
;
...
...
@@ -123,12 +129,11 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
if
(
i
==
1
)
{
if
(
ocl
::
haveOpenCL
())
if
(
!
ocl
::
haveOpenCL
())
DETECT_FLG
=
tldModel
->
detector
->
ocl_detect
(
imageForDetector
,
image_blurred
,
tmpCandid
,
detectorResults
,
tldModel
->
getMinSize
());
else
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
);
...
...
@@ -144,7 +149,6 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
trackerNeedsReInit
=
true
;
}
}
std
::
vector
<
double
>::
iterator
it
=
std
::
max_element
(
candidatesRes
.
begin
(),
candidatesRes
.
end
());
//dfprintf((stdout, "scale = %f\n", log(1.0 * boundingBox.width / (data->getMinSize()).width) / log(SCALE_STEP)));
...
...
@@ -230,6 +234,16 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
#endif
}
//Debug display candidates after Variance Filter
////////////////////////////////////////////////
Mat
tmpImg
=
image
;
for
(
int
i
=
0
;
i
<
tldModel
->
detector
->
debugStack
[
0
].
size
();
i
++
)
//rectangle(tmpImg, tldModel->detector->debugStack[0][i], Scalar(255, 255, 255), 1, 1, 0);
tldModel
->
detector
->
debugStack
[
0
].
clear
();
tmpImg
.
copyTo
(
image
);
////////////////////////////////////////////////
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
modules/tracking/src/tldTracker.hpp
View file @
b318e38b
...
...
@@ -52,12 +52,6 @@
namespace
cv
{
TrackerTLD
::
Params
::
Params
(){}
void
TrackerTLD
::
Params
::
read
(
const
cv
::
FileNode
&
/*fn*/
){}
void
TrackerTLD
::
Params
::
write
(
cv
::
FileStorage
&
/*fs*/
)
const
{}
namespace
tld
{
class
TrackerProxy
...
...
This diff is collapsed.
Click to expand it.
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