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
4e14e8c8
Commit
4e14e8c8
authored
Aug 05, 2014
by
Alex Leontiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coding style
parent
ed4aeef7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
28 deletions
+35
-28
tld_tracker.cpp
modules/tracking/src/tld_tracker.cpp
+0
-0
tld_tracker.hpp
modules/tracking/src/tld_tracker.hpp
+35
-28
tld_utils.cpp
modules/tracking/src/tld_utils.cpp
+0
-0
No files found.
modules/tracking/src/tld_tracker.cpp
View file @
4e14e8c8
This diff is collapsed.
Click to expand it.
modules/tracking/src/tld_tracker.hpp
View file @
4e14e8c8
...
...
@@ -57,60 +57,67 @@ namespace cv {namespace tld
#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;\
dprintf(("%-90s took %f milis\n",#a,milisec)); }
#define HERE dprintf(("line %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;\
dprintf(("%s took %f milis\n",name,milisec)); }
#define MEASURE_TIME(a)\
{\
clock_t start; float milisec = 0.0; \
start = clock(); {a} milisec = 1000.0 * (clock() - start) / CLOCKS_PER_SEC; \
dprintf(("%-90s took %f milis\n", #a, milisec));\
}
#define HERE dprintf(("line %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; \
dprintf(("%s took %f milis\n", name, milisec)); \
}
extern
Rect2d
etalon
;
void
myassert
(
const
Mat
&
img
);
void
printPatch
(
const
Mat_
<
uchar
>&
standardPatch
);
std
::
string
type2str
(
const
Mat
&
mat
);
void
drawWithRects
(
const
Mat
&
img
,
std
::
vector
<
Rect2d
>&
blackOnes
,
Rect2d
whiteOne
=
Rect2d
(
-
1.0
,
-
1.0
,
-
1.0
,
-
1.0
));
void
drawWithRects
(
const
Mat
&
img
,
std
::
vector
<
Rect2d
>&
blackOnes
,
std
::
vector
<
Rect2d
>&
whiteOnes
,
String
fileName
=
""
);
void
drawWithRects
(
const
Mat
&
img
,
std
::
vector
<
Rect2d
>&
blackOnes
,
Rect2d
whiteOne
=
Rect2d
(
-
1.0
,
-
1.0
,
-
1.0
,
-
1.0
));
void
drawWithRects
(
const
Mat
&
img
,
std
::
vector
<
Rect2d
>&
blackOnes
,
std
::
vector
<
Rect2d
>&
whiteOnes
,
String
fileName
=
""
);
//aux functions and variables
template
<
typename
T
>
inline
T
CLIP
(
T
x
,
T
a
,
T
b
){
return
std
::
min
(
std
::
max
(
x
,
a
),
b
);
}
template
<
typename
T
>
inline
T
CLIP
(
T
x
,
T
a
,
T
b
){
return
std
::
min
(
std
::
max
(
x
,
a
),
b
);
}
/** Computes overlap between the two given rectangles. Overlap is computed as ratio of rectangles' intersection to that
* of their union.*/
double
overlap
(
const
Rect2d
&
r1
,
const
Rect2d
&
r2
);
double
overlap
(
const
Rect2d
&
r1
,
const
Rect2d
&
r2
);
/** Resamples the area surrounded by r2 in img so it matches the size of samples, where it is written.*/
void
resample
(
const
Mat
&
img
,
const
RotatedRect
&
r2
,
Mat_
<
uchar
>&
samples
);
void
resample
(
const
Mat
&
img
,
const
RotatedRect
&
r2
,
Mat_
<
uchar
>&
samples
);
/** Specialization of resample() for rectangles without retation for better performance and simplicity.*/
void
resample
(
const
Mat
&
img
,
const
Rect2d
&
r2
,
Mat_
<
uchar
>&
samples
);
void
resample
(
const
Mat
&
img
,
const
Rect2d
&
r2
,
Mat_
<
uchar
>&
samples
);
/** Computes the variance of single given image.*/
double
variance
(
const
Mat
&
img
);
/** Computes normalized corellation coefficient between the two patches (they should be
* of the same size).*/
double
NCC
(
const
Mat_
<
uchar
>&
patch1
,
const
Mat_
<
uchar
>&
patch2
);
void
getClosestN
(
std
::
vector
<
Rect2d
>&
scanGrid
,
Rect2d
bBox
,
int
n
,
std
::
vector
<
Rect2d
>&
res
);
double
scaleAndBlur
(
const
Mat
&
originalImg
,
int
scale
,
Mat
&
scaledImg
,
Mat
&
blurredImg
,
Size
GaussBlurKernelSize
,
double
scaleStep
);
double
NCC
(
const
Mat_
<
uchar
>&
patch1
,
const
Mat_
<
uchar
>&
patch2
);
void
getClosestN
(
std
::
vector
<
Rect2d
>&
scanGrid
,
Rect2d
bBox
,
int
n
,
std
::
vector
<
Rect2d
>&
res
);
double
scaleAndBlur
(
const
Mat
&
originalImg
,
int
scale
,
Mat
&
scaledImg
,
Mat
&
blurredImg
,
Size
GaussBlurKernelSize
,
double
scaleStep
);
int
getMedian
(
const
std
::
vector
<
int
>&
values
,
int
size
=
-
1
);
class
TLDEnsembleClassifier
{
class
TLDEnsembleClassifier
{
public
:
static
int
makeClassifiers
(
Size
size
,
int
measurePerClassifier
,
int
gridSize
,
std
::
vector
<
TLDEnsembleClassifier
>&
classifiers
);
void
integrate
(
const
Mat_
<
uchar
>&
patch
,
bool
isPositive
);
double
posteriorProbability
(
const
uchar
*
data
,
int
rowstep
)
const
;
double
posteriorProbabilityFast
(
const
uchar
*
data
)
const
;
static
int
makeClassifiers
(
Size
size
,
int
measurePerClassifier
,
int
gridSize
,
std
::
vector
<
TLDEnsembleClassifier
>&
classifiers
);
void
integrate
(
const
Mat_
<
uchar
>&
patch
,
bool
isPositive
);
double
posteriorProbability
(
const
uchar
*
data
,
int
rowstep
)
const
;
double
posteriorProbabilityFast
(
const
uchar
*
data
)
const
;
void
prepareClassifier
(
int
rowstep
);
private
:
TLDEnsembleClassifier
(
const
std
::
vector
<
Vec4b
>&
meas
,
int
beg
,
int
end
);
static
void
stepPrefSuff
(
std
::
vector
<
Vec4b
>
&
arr
,
int
pos
,
int
len
,
int
gridSize
);
int
code
(
const
uchar
*
data
,
int
rowstep
)
const
;
int
codeFast
(
const
uchar
*
data
)
const
;
TLDEnsembleClassifier
(
const
std
::
vector
<
Vec4b
>&
meas
,
int
beg
,
int
end
);
static
void
stepPrefSuff
(
std
::
vector
<
Vec4b
>
&
arr
,
int
pos
,
int
len
,
int
gridSize
);
int
code
(
const
uchar
*
data
,
int
rowstep
)
const
;
int
codeFast
(
const
uchar
*
data
)
const
;
std
::
vector
<
Point2i
>
posAndNeg
;
std
::
vector
<
Vec4b
>
measurements
;
std
::
vector
<
Point2i
>
offset
;
int
lastStep_
;
};
class
TrackerProxy
{
class
TrackerProxy
{
public
:
virtual
bool
init
(
const
Mat
&
image
,
const
Rect2d
&
boundingBox
)
=
0
;
virtual
bool
init
(
const
Mat
&
image
,
const
Rect2d
&
boundingBox
)
=
0
;
virtual
bool
update
(
const
Mat
&
image
,
Rect2d
&
boundingBox
)
=
0
;
virtual
~
TrackerProxy
(){}
};
...
...
modules/tracking/src/tld_utils.cpp
View file @
4e14e8c8
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