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
470a8221
Commit
470a8221
authored
Jun 29, 2014
by
Alex Leontiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vadim
parent
ff73c6f4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
59 deletions
+75
-59
TLD.cpp
modules/tracking/src/TLD.cpp
+9
-7
TLD.hpp
modules/tracking/src/TLD.hpp
+11
-3
trackerMedianFlow.cpp
modules/tracking/src/trackerMedianFlow.cpp
+17
-9
trackerTLD.cpp
modules/tracking/src/trackerTLD.cpp
+38
-40
No files found.
modules/tracking/src/TLD.cpp
View file @
470a8221
...
...
@@ -86,15 +86,15 @@ void myassert(const Mat& img){
}
}
}
printf
(
"black: %d out of %d (%f)
\n
"
,
count
,
img
.
rows
*
img
.
cols
,
1.0
*
count
/
img
.
rows
/
img
.
cols
);
dprintf
((
"black: %d out of %d (%f)
\n
"
,
count
,
img
.
rows
*
img
.
cols
,
1.0
*
count
/
img
.
rows
/
img
.
cols
)
);
}
void
printPatch
(
const
Mat_
<
uchar
>&
standardPatch
){
for
(
int
i
=
0
;
i
<
standardPatch
.
rows
;
i
++
){
for
(
int
j
=
0
;
j
<
standardPatch
.
cols
;
j
++
){
printf
(
"%5.2f, "
,(
double
)
standardPatch
(
i
,
j
));
dprintf
((
"%5.2f, "
,(
double
)
standardPatch
(
i
,
j
)
));
}
printf
(
"
\n
"
);
dprintf
((
"
\n
"
)
);
}
}
...
...
@@ -180,6 +180,8 @@ double variance(const Mat& img){
}
double
variance
(
Mat_
<
unsigned
int
>&
intImgP
,
Mat_
<
unsigned
int
>&
intImgP2
,
Rect
box
){
int
x
=
(
box
.
x
),
y
=
(
box
.
y
),
width
=
(
box
.
width
),
height
=
(
box
.
height
);
CV_Assert
(
0
<=
x
&&
(
x
+
width
)
<=
intImgP
.
cols
&&
(
x
+
width
)
<=
intImgP2
.
cols
);
CV_Assert
(
0
<=
y
&&
(
y
+
height
)
<=
intImgP
.
rows
&&
(
y
+
height
)
<=
intImgP2
.
rows
);
double
p
=
0
,
p2
=
0
;
unsigned
int
A
,
B
,
C
,
D
;
...
...
@@ -206,17 +208,17 @@ double NCC(Mat_<uchar> patch1,Mat_<uchar> patch2){
double
s1
=
sum
(
patch1
)(
0
),
s2
=
sum
(
patch2
)(
0
);
double
n1
=
norm
(
patch1
),
n2
=
norm
(
patch2
);
double
prod
=
patch1
.
dot
(
patch2
);
double
sq1
=
sqrt
(
n1
*
n1
-
s1
*
s1
/
N
),
sq2
=
sqrt
(
n2
*
n2
-
s2
*
s2
/
N
);
double
sq1
=
sqrt
(
MAX
(
0.0
,
n1
*
n1
-
s1
*
s1
/
N
)),
sq2
=
sqrt
(
MAX
(
0.0
,
n2
*
n2
-
s2
*
s2
/
N
)
);
double
ares
=
(
sq2
==
0
)
?
sq1
/
abs
(
sq1
)
:
(
prod
-
s1
*
s2
/
N
)
/
sq1
/
sq2
;
return
ares
;
/*Mat_<uchar> p1(80,80),p2(80,80);
printf("NCC\n"
);
dprintf(("NCC\n")
);
resample(patch1,Rect2d(Point2d(0,0),patch1.size()),p1);
resample(patch2,Rect2d(Point2d(0,0),patch2.size()),p2);
imshow("patch1",p1);
imshow("patch2",p2);
printf("NCC=%f\n",ncc
);
dprintf(("NCC=%f\n",ncc)
);
waitKey();*/
}
unsigned
int
getMedian
(
const
std
::
vector
<
unsigned
int
>&
values
,
int
size
){
...
...
@@ -359,7 +361,7 @@ unsigned short int TLDEnsembleClassifier::code(const uchar* data,int rowstep)con
position
=
position
<<
1
;
}
//codeS[13]='\0';
//
printf("integrate with code %s\n",codeS
);
//
dprintf(("integrate with code %s\n",codeS)
);
return
position
;
}
...
...
modules/tracking/src/TLD.hpp
View file @
470a8221
...
...
@@ -49,14 +49,22 @@ namespace cv {namespace tld
{
//debug functions and variables
#define ALEX_DEBUG
#ifdef ALEX_DEBUG
#define dfprintf(x) fprintf x
#define dprintf(x) printf x
#else
#define dfprintf(x)
#define dprintf(x)
#endif
#define MEASURE_TIME(a) {\
clock_t start;float milisec=0.0;\
start=clock();{a} milisec=1000.0*(clock()-start)/CLOCKS_PER_SEC;\
printf("%-90s took %f milis\n",#a,milisec
); }
#define HERE
fprintf(stderr,"%d\n",__LINE__
);fflush(stderr);
dprintf(("%-90s took %f milis\n",#a,milisec)
); }
#define HERE
dprintf(("%d\n",__LINE__)
);fflush(stderr);
#define START_TICK(name) { clock_t start;double milisec=0.0; start=clock();
#define END_TICK(name) milisec=1000.0*(clock()-start)/CLOCKS_PER_SEC;\
printf("%s took %f milis\n",name,milisec
); }
dprintf(("%s took %f milis\n",name,milisec)
); }
extern
Rect2d
etalon
;
void
myassert
(
const
Mat
&
img
);
void
printPatch
(
const
Mat_
<
uchar
>&
standardPatch
);
...
...
modules/tracking/src/trackerMedianFlow.cpp
View file @
470a8221
...
...
@@ -48,6 +48,15 @@
namespace
cv
{
#undef ALEX_DEBUG
#ifdef ALEX_DEBUG
#define dfprintf(x) fprintf x
#define dprintf(x) printf x
#else
#define dfprintf(x)
#define dprintf(x)
#endif
/*
* TrackerMedianFlow
*/
...
...
@@ -200,7 +209,7 @@ bool MedianFlowCore::medianFlowImpl(Mat oldImage,Mat newImage,Rect2d& oldBox){
std
::
vector
<
uchar
>
status
(
pointsToTrackOld
.
size
());
std
::
vector
<
float
>
errors
(
pointsToTrackOld
.
size
());
calcOpticalFlowPyrLK
(
oldImage_gray
,
newImage_gray
,
pointsToTrackOld
,
pointsToTrackNew
,
status
,
errors
,
Size
(
3
,
3
),
5
,
termcrit
,
0
);
printf
(
"
\t
%d after LK forward
\n
"
,(
int
)
pointsToTrackOld
.
size
(
));
dprintf
((
"
\t
%d after LK forward
\n
"
,(
int
)
pointsToTrackOld
.
size
()
));
std
::
vector
<
Point2f
>
di
;
for
(
int
i
=
0
;
i
<
(
int
)
pointsToTrackOld
.
size
();
i
++
){
...
...
@@ -222,7 +231,7 @@ bool MedianFlowCore::medianFlowImpl(Mat oldImage,Mat newImage,Rect2d& oldBox){
i
--
;
}
}
printf
(
"
\t
%d after LK backward
\n
"
,(
int
)
pointsToTrackOld
.
size
(
));
dprintf
((
"
\t
%d after LK backward
\n
"
,(
int
)
pointsToTrackOld
.
size
()
));
if
(
pointsToTrackOld
.
size
()
==
0
||
di
.
size
()
==
0
){
return
false
;
...
...
@@ -239,7 +248,6 @@ bool MedianFlowCore::medianFlowImpl(Mat oldImage,Mat newImage,Rect2d& oldBox){
return
false
;
}
//return newBddBox;
return
true
;
}
...
...
@@ -286,7 +294,7 @@ Rect2d MedianFlowCore::vote(const std::vector<Point2f>& oldPoints,const std::vec
}
double
scale
=
getMedian
(
buf
,
n
*
(
n
-
1
)
/
2
);
printf
(
"iter %d %f %f %f
\n
"
,
iteration
,
xshift
,
yshift
,
scale
);
dprintf
((
"iter %d %f %f %f
\n
"
,
iteration
,
xshift
,
yshift
,
scale
)
);
newRect
.
x
=
newCenter
.
x
-
scale
*
oldRect
.
width
/
2.0
;
newRect
.
y
=
newCenter
.
y
-
scale
*
oldRect
.
height
/
2.0
;
newRect
.
width
=
scale
*
oldRect
.
width
;
...
...
@@ -294,8 +302,8 @@ Rect2d MedianFlowCore::vote(const std::vector<Point2f>& oldPoints,const std::vec
/*if(newRect.x<=0){
exit(0);
}*/
printf
(
"rect old [%f %f %f %f]
\n
"
,
oldRect
.
x
,
oldRect
.
y
,
oldRect
.
width
,
oldRect
.
height
);
printf
(
"rect [%f %f %f %f]
\n
"
,
newRect
.
x
,
newRect
.
y
,
newRect
.
width
,
newRect
.
height
);
dprintf
((
"rect old [%f %f %f %f]
\n
"
,
oldRect
.
x
,
oldRect
.
y
,
oldRect
.
width
,
oldRect
.
height
)
);
dprintf
((
"rect [%f %f %f %f]
\n
"
,
newRect
.
x
,
newRect
.
y
,
newRect
.
width
,
newRect
.
height
)
);
iteration
++
;
return
newRect
;
...
...
@@ -326,7 +334,7 @@ void MedianFlowCore::computeStatistics(std::vector<float>& data,int size){
bins
[
std
::
min
((
int
)(
binnum
*
(
data
[
i
]
-
mini
)
/
(
maxi
-
mini
)),
binnum
-
1
)]
++
;
}
for
(
int
i
=
0
;
i
<
binnum
;
i
++
){
printf
(
"[%4f,%4f] -- %4d
\n
"
,
mini
+
(
maxi
-
mini
)
/
binnum
*
i
,
mini
+
(
maxi
-
mini
)
/
binnum
*
(
i
+
1
),
bins
[
i
]
);
dprintf
((
"[%4f,%4f] -- %4d
\n
"
,
mini
+
(
maxi
-
mini
)
/
binnum
*
i
,
mini
+
(
maxi
-
mini
)
/
binnum
*
(
i
+
1
),
bins
[
i
])
);
}
}
double
MedianFlowCore
::
l2distance
(
Point2f
p1
,
Point2f
p2
){
...
...
@@ -350,8 +358,8 @@ void MedianFlowCore::check_FB(const Mat& oldImage,const Mat& newImage,
FBerror
[
i
]
=
l2distance
(
oldPoints
[
i
],
pointsToTrackReprojection
[
i
]);
}
double
FBerrorMedian
=
getMedian
(
FBerror
);
printf
(
"point median=%f
\n
"
,
FBerrorMedian
);
printf
(
"FBerrorMedian=%f
\n
"
,
FBerrorMedian
);
dprintf
((
"point median=%f
\n
"
,
FBerrorMedian
)
);
dprintf
((
"FBerrorMedian=%f
\n
"
,
FBerrorMedian
)
);
for
(
int
i
=
0
;
i
<
(
int
)
oldPoints
.
size
();
i
++
){
status
[
i
]
=
(
FBerror
[
i
]
<
FBerrorMedian
);
}
...
...
modules/tracking/src/trackerTLD.cpp
View file @
470a8221
...
...
@@ -70,9 +70,7 @@ using namespace tld;
*
* vadim:
*
* dprintf
* variance outside
* NCC sqrt(-)
* standard patch out (403)
* pos by 2 in code()
*
...
...
@@ -268,7 +266,7 @@ bool TrackerTLD::initImpl(const Mat& image, const Rect2d& boundingBox ){
privateInfo
.
push_back
(
Ptr
<
Data
>
(
data
));
#if !1
printf
(
"here I am
\n
"
);
dprintf
((
"here I am
\n
"
)
);
Mat
image_blurred
;
GaussianBlur
(
image_gray
,
image_blurred
,
GaussBlurKernelSize
,
0.0
);
MyMouseCallbackDEBUG
*
callback
=
new
MyMouseCallbackDEBUG
(
image_gray
,
image_blurred
,
detector
);
...
...
@@ -322,15 +320,15 @@ bool TrackerTLD::updateImpl(const Mat& image, Rect2d& boundingBox){
std
::
vector
<
double
>::
iterator
it
=
std
::
max_element
(
candidatesRes
.
begin
(),
candidatesRes
.
end
());
fprintf
(
stdout
,
"scale=%f
\n
"
,
log
(
1.0
*
boundingBox
.
width
/
(
data
->
getMinSize
()).
width
)
/
log
(
1.2
));
dfprintf
((
stdout
,
"scale=%f
\n
"
,
log
(
1.0
*
boundingBox
.
width
/
(
data
->
getMinSize
()).
width
)
/
log
(
1.2
)
));
for
(
int
i
=
0
;
i
<
(
int
)
candidatesRes
.
size
();
i
++
){
printf
(
"
\t
candidatesRes[%d]=%f
\n
"
,
i
,
candidatesRes
[
i
]
);
dprintf
((
"
\t
candidatesRes[%d]=%f
\n
"
,
i
,
candidatesRes
[
i
])
);
}
data
->
printme
();
tldModel
->
printme
(
stdout
);
#if !1
if
(
data
->
frameNum
==
82
){
printf
(
"here I am
\n
"
);
dprintf
((
"here I am
\n
"
)
);
MyMouseCallbackDEBUG
*
callback
=
new
MyMouseCallbackDEBUG
(
imageForDetector
,
image_blurred
,
detector
);
imshow
(
"picker"
,
imageForDetector
);
setMouseCallback
(
"picker"
,
MyMouseCallbackDEBUG
::
onMouse
,
(
void
*
)
callback
);
...
...
@@ -352,11 +350,11 @@ bool TrackerTLD::updateImpl(const Mat& image, Rect2d& boundingBox){
if
(
!
false
&&
it
!=
candidatesRes
.
end
()){
resample
(
imageForDetector
,
candidates
[
it
-
candidatesRes
.
begin
()],
standardPatch
);
fprintf
(
stderr
,
"%d %f %f
\n
"
,
data
->
frameNum
,
tldModel
->
Sc
(
standardPatch
),
tldModel
->
Sr
(
standardPatch
));
dfprintf
((
stderr
,
"%d %f %f
\n
"
,
data
->
frameNum
,
tldModel
->
Sc
(
standardPatch
),
tldModel
->
Sr
(
standardPatch
)
));
if
(
candidatesRes
.
size
()
==
2
&&
it
==
(
candidatesRes
.
begin
()
+
1
))
fprintf
(
stderr
,
"detector WON
\n
"
);
dfprintf
((
stderr
,
"detector WON
\n
"
)
);
}
else
{
fprintf
(
stderr
,
"%d x x
\n
"
,
data
->
frameNum
);
dfprintf
((
stderr
,
"%d x x
\n
"
,
data
->
frameNum
)
);
}
if
(
*
it
>
CORE_THRESHOLD
){
...
...
@@ -382,7 +380,7 @@ bool TrackerTLD::updateImpl(const Mat& image, Rect2d& boundingBox){
isObject
[
i
]
=
expertResult
;
}
tldModel
->
integrateRelabeled
(
imageForDetector
,
image_blurred
,
detectorResults
,
isObject
,
shouldBeIntegrated
);
printf
(
"%d relabeled by nExpert
\n
"
,
negRelabeled
);
dprintf
((
"%d relabeled by nExpert
\n
"
,
negRelabeled
)
);
pExpert
.
additionalExamples
(
examplesForModel
,
examplesForEnsemble
);
tldModel
->
integrateAdditional
(
examplesForModel
,
examplesForEnsemble
,
true
);
examplesForModel
.
clear
();
examplesForEnsemble
.
clear
();
...
...
@@ -459,7 +457,7 @@ timeStampPositiveNext(0),timeStampNegativeNext(0),params_(params){
}
}
}
printf
(
"positive patches: %d
\n
negative patches: %d
\n
"
,(
int
)
positiveExamples
.
size
(),(
int
)
negativeExamples
.
size
(
));
dprintf
((
"positive patches: %d
\n
negative patches: %d
\n
"
,(
int
)
positiveExamples
.
size
(),(
int
)
negativeExamples
.
size
()
));
}
void
TLDDetector
::
generateScanGrid
(
int
rows
,
int
cols
,
Size
initBox
,
std
::
vector
<
Rect2d
>&
res
,
bool
withScaling
){
...
...
@@ -485,7 +483,7 @@ void TLDDetector::generateScanGrid(int rows,int cols,Size initBox,std::vector<Re
break
;
}
}
printf
(
"%d rects in res
\n
"
,(
int
)
res
.
size
(
));
dprintf
((
"%d rects in res
\n
"
,(
int
)
res
.
size
()
));
}
bool
TLDDetector
::
detect
(
const
Mat
&
img
,
const
Mat
&
imgBlurred
,
Rect2d
&
res
,
std
::
vector
<
Rect2d
>&
rect
,
std
::
vector
<
bool
>&
isObject
,
...
...
@@ -551,7 +549,7 @@ bool TLDDetector::detect(const Mat& img,const Mat& imgBlurred,Rect2d& res,std::v
}
while
(
size
.
width
>=
initSize
.
width
&&
size
.
height
>=
initSize
.
height
);
END_TICK
(
"detector"
);
fprintf
(
stdout
,
"after NCC: nneg=%d npos=%d
\n
"
,
nneg
,
npos
);
dfprintf
((
stdout
,
"after NCC: nneg=%d npos=%d
\n
"
,
nneg
,
npos
)
);
#if !0
std
::
vector
<
Rect2d
>
poss
,
negs
;
for
(
int
i
=
0
;
i
<
(
int
)
rect
.
size
();
i
++
){
...
...
@@ -560,7 +558,7 @@ bool TLDDetector::detect(const Mat& img,const Mat& imgBlurred,Rect2d& res,std::v
else
negs
.
push_back
(
rect
[
i
]);
}
fprintf
(
stdout
,
"%d pos and %d neg
\n
"
,(
int
)
poss
.
size
(),(
int
)
negs
.
size
(
));
dfprintf
((
stdout
,
"%d pos and %d neg
\n
"
,(
int
)
poss
.
size
(),(
int
)
negs
.
size
()
));
drawWithRects
(
img
,
negs
,
poss
);
#endif
#if !1
...
...
@@ -590,7 +588,7 @@ bool TLDDetector::detect(const Mat& img,const Mat& imgBlurred,Rect2d& res,std::v
waitKey
();
#endif
fprintf
(
stdout
,
"%d after ensemble
\n
"
,
pass
);
dfprintf
((
stdout
,
"%d after ensemble
\n
"
,
pass
)
);
if
(
maxSc
<
0
){
return
false
;
}
...
...
@@ -690,14 +688,14 @@ void TrackerTLDModel::integrateRelabeled(Mat& img,Mat& imgBlurred,const std::vec
}
}
if
(
negativeIntoModel
>
0
)
fprintf
(
stdout
,
"negativeIntoModel=%d "
,
negativeIntoModel
);
dfprintf
((
stdout
,
"negativeIntoModel=%d "
,
negativeIntoModel
)
);
if
(
positiveIntoModel
>
0
)
fprintf
(
stdout
,
"positiveIntoModel=%d "
,
positiveIntoModel
);
dfprintf
((
stdout
,
"positiveIntoModel=%d "
,
positiveIntoModel
)
);
if
(
negativeIntoEnsemble
>
0
)
fprintf
(
stdout
,
"negativeIntoEnsemble=%d "
,
negativeIntoEnsemble
);
dfprintf
((
stdout
,
"negativeIntoEnsemble=%d "
,
negativeIntoEnsemble
)
);
if
(
positiveIntoEnsemble
>
0
)
fprintf
(
stdout
,
"positiveIntoEnsemble=%d "
,
positiveIntoEnsemble
);
fprintf
(
stdout
,
"
\n
"
);
dfprintf
((
stdout
,
"positiveIntoEnsemble=%d "
,
positiveIntoEnsemble
)
);
dfprintf
((
stdout
,
"
\n
"
)
);
}
void
TrackerTLDModel
::
integrateAdditional
(
const
std
::
vector
<
Mat_
<
uchar
>
>&
eForModel
,
const
std
::
vector
<
Mat_
<
uchar
>
>&
eForEnsemble
,
bool
isPositive
){
...
...
@@ -730,14 +728,14 @@ void TrackerTLDModel::integrateAdditional(const std::vector<Mat_<uchar> >& eForM
}
}
if
(
negativeIntoModel
>
0
)
fprintf
(
stdout
,
"negativeIntoModel=%d "
,
negativeIntoModel
);
dfprintf
((
stdout
,
"negativeIntoModel=%d "
,
negativeIntoModel
)
);
if
(
positiveIntoModel
>
0
)
fprintf
(
stdout
,
"positiveIntoModel=%d "
,
positiveIntoModel
);
dfprintf
((
stdout
,
"positiveIntoModel=%d "
,
positiveIntoModel
)
);
if
(
negativeIntoEnsemble
>
0
)
fprintf
(
stdout
,
"negativeIntoEnsemble=%d "
,
negativeIntoEnsemble
);
dfprintf
((
stdout
,
"negativeIntoEnsemble=%d "
,
negativeIntoEnsemble
)
);
if
(
positiveIntoEnsemble
>
0
)
fprintf
(
stdout
,
"positiveIntoEnsemble=%d "
,
positiveIntoEnsemble
);
fprintf
(
stdout
,
"
\n
"
);
dfprintf
((
stdout
,
"positiveIntoEnsemble=%d "
,
positiveIntoEnsemble
)
);
dfprintf
((
stdout
,
"
\n
"
)
);
}
int
Pexpert
::
additionalExamples
(
std
::
vector
<
Mat_
<
uchar
>
>&
examplesForModel
,
std
::
vector
<
Mat_
<
uchar
>
>&
examplesForEnsemble
){
...
...
@@ -789,20 +787,20 @@ Data::Data(Rect2d initBox){
minSize
.
width
=
(
int
)(
initBox
.
width
*
20.0
/
minDim
);
minSize
.
height
=
(
int
)(
initBox
.
height
*
20.0
/
minDim
);
frameNum
=
0
;
printf
(
"minSize= %dx%d
\n
"
,
minSize
.
width
,
minSize
.
height
);
dprintf
((
"minSize= %dx%d
\n
"
,
minSize
.
width
,
minSize
.
height
)
);
}
void
Data
::
printme
(
FILE
*
port
){
fprintf
(
port
,
"Data:
\n
"
);
fprintf
(
port
,
"
\t
frameNum=%d
\n
"
,
frameNum
);
fprintf
(
port
,
"
\t
confident=%s
\n
"
,
confident
?
"true"
:
"false"
);
fprintf
(
port
,
"
\t
failedLastTime=%s
\n
"
,
failedLastTime
?
"true"
:
"false"
);
fprintf
(
port
,
"
\t
minSize=%dx%d
\n
"
,
minSize
.
width
,
minSize
.
height
);
dfprintf
((
port
,
"Data:
\n
"
)
);
dfprintf
((
port
,
"
\t
frameNum=%d
\n
"
,
frameNum
)
);
dfprintf
((
port
,
"
\t
confident=%s
\n
"
,
confident
?
"true"
:
"false"
)
);
dfprintf
((
port
,
"
\t
failedLastTime=%s
\n
"
,
failedLastTime
?
"true"
:
"false"
)
);
dfprintf
((
port
,
"
\t
minSize=%dx%d
\n
"
,
minSize
.
width
,
minSize
.
height
)
);
}
void
TrackerTLDModel
::
printme
(
FILE
*
port
){
fprintf
(
port
,
"TrackerTLDModel:
\n
"
);
fprintf
(
port
,
"
\t
positiveExamples.size()=%d
\n
"
,(
int
)
positiveExamples
.
size
(
));
fprintf
(
port
,
"
\t
negativeExamples.size()=%d
\n
"
,(
int
)
negativeExamples
.
size
(
));
dfprintf
((
port
,
"TrackerTLDModel:
\n
"
)
);
dfprintf
((
port
,
"
\t
positiveExamples.size()=%d
\n
"
,(
int
)
positiveExamples
.
size
()
));
dfprintf
((
port
,
"
\t
negativeExamples.size()=%d
\n
"
,(
int
)
negativeExamples
.
size
()
));
}
void
MyMouseCallbackDEBUG
::
onMouse
(
int
event
,
int
x
,
int
y
){
if
(
event
==
EVENT_LBUTTONDOWN
){
...
...
@@ -827,17 +825,17 @@ void MyMouseCallbackDEBUG::onMouse( int event, int x, int y){
int
dx
=
initSize
.
width
/
10
,
dy
=
initSize
.
height
/
10
,
i
=
(
int
)(
x
/
scale
/
dx
),
j
=
(
int
)(
y
/
scale
/
dy
);
fprintf
(
stderr
,
"patchVariance=%s
\n
"
,(
detector_
->
patchVariance
(
intImgP
,
intImgP2
,
originalVariance
,
Point
(
dx
*
i
,
dy
*
j
),
initSize
))
?
"true"
:
"false"
);
fprintf
(
stderr
,
"p=%f
\n
"
,(
detector_
->
ensembleClassifierNum
(
&
blurred_img
.
at
<
uchar
>
(
dy
*
j
,
dx
*
i
),(
int
)
blurred_img
.
step
[
0
]
)));
dfprintf
((
stderr
,
"patchVariance=%s
\n
"
,(
detector_
->
patchVariance
(
intImgP
,
intImgP2
,
originalVariance
,
Point
(
dx
*
i
,
dy
*
j
),
initSize
))
?
"true"
:
"false"
)
);
dfprintf
((
stderr
,
"p=%f
\n
"
,(
detector_
->
ensembleClassifierNum
(
&
blurred_img
.
at
<
uchar
>
(
dy
*
j
,
dx
*
i
),(
int
)
blurred_img
.
step
[
0
])
)));
fprintf
(
stderr
,
"ensembleClassifier=%s
\n
"
,
(
detector_
->
ensembleClassifier
(
&
blurred_img
.
at
<
uchar
>
(
dy
*
j
,
dx
*
i
),(
int
)
blurred_img
.
step
[
0
]))
?
"true"
:
"false"
);
resample
(
resized_img
,
Rect2d
(
Point
(
dx
*
i
,
dy
*
j
),
initSize
),
standardPatch
);
tmp
=
tldModel
->
Sr
(
standardPatch
);
fprintf
(
stderr
,
"Sr=%f
\n
"
,
tmp
);
fprintf
(
stderr
,
"isObject=%s
\n
"
,(
tmp
>
THETA_NN
)
?
"true"
:
"false"
);
fprintf
(
stderr
,
"shouldBeIntegrated=%s
\n
"
,(
abs
(
tmp
-
THETA_NN
)
<
0.1
)
?
"true"
:
"false"
);
fprintf
(
stderr
,
"Sc=%f
\n
"
,
tldModel
->
Sc
(
standardPatch
));
dfprintf
((
stderr
,
"Sr=%f
\n
"
,
tmp
)
);
dfprintf
((
stderr
,
"isObject=%s
\n
"
,(
tmp
>
THETA_NN
)
?
"true"
:
"false"
)
);
dfprintf
((
stderr
,
"shouldBeIntegrated=%s
\n
"
,(
abs
(
tmp
-
THETA_NN
)
<
0.1
)
?
"true"
:
"false"
)
);
dfprintf
((
stderr
,
"Sc=%f
\n
"
,
tldModel
->
Sc
(
standardPatch
)
));
rectangle
(
imgCanvas
,
Rect2d
(
Point2d
(
scale
*
dx
*
i
,
scale
*
dy
*
j
),
Size2d
(
initSize
.
width
*
scale
,
initSize
.
height
*
scale
)),
0
,
2
,
1
);
imshow
(
"picker"
,
imgCanvas
);
...
...
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