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
e67b9e9e
Commit
e67b9e9e
authored
Aug 18, 2014
by
Alex Leontiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dependence on optim module
With all functionality preserved. Pure renaming.
parent
eee3e052
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
20 deletions
+21
-20
CMakeLists.txt
modules/tracking/CMakeLists.txt
+1
-1
tracker.hpp
modules/tracking/include/opencv2/tracking/tracker.hpp
+4
-3
benchmark.cpp
modules/tracking/samples/benchmark.cpp
+1
-1
PFSolver.hpp
modules/tracking/src/PFSolver.hpp
+13
-13
trackerSamplerAlgorithm.cpp
modules/tracking/src/trackerSamplerAlgorithm.cpp
+2
-2
No files found.
modules/tracking/CMakeLists.txt
View file @
e67b9e9e
set
(
the_description
"Tracking API"
)
ocv_define_module
(
tracking opencv_imgproc opencv_
optim
opencv_video opencv_highgui
)
ocv_define_module
(
tracking opencv_imgproc opencv_
core
opencv_video opencv_highgui
)
modules/tracking/include/opencv2/tracking/tracker.hpp
View file @
e67b9e9e
...
...
@@ -804,7 +804,8 @@ class CV_EXPORTS_W TrackerSamplerCS : public TrackerSamplerAlgorithm
};
class
CV_EXPORTS_W
TrackerSamplerPF
:
public
TrackerSamplerAlgorithm
{
class
CV_EXPORTS_W
TrackerSamplerPF
:
public
TrackerSamplerAlgorithm
{
public
:
struct
CV_EXPORTS
Params
{
...
...
@@ -819,8 +820,8 @@ protected:
bool
samplingImpl
(
const
Mat
&
image
,
Rect
boundingBox
,
std
::
vector
<
Mat
>&
sample
);
private
:
Params
params
;
Ptr
<
optim
::
Solver
>
_solver
;
Ptr
<
optim
::
Solver
::
Function
>
_function
;
Ptr
<
MinProblem
Solver
>
_solver
;
Ptr
<
MinProblem
Solver
::
Function
>
_function
;
};
/************************************ Specific TrackerFeature Classes ************************************/
...
...
modules/tracking/samples/benchmark.cpp
View file @
e67b9e9e
...
...
@@ -8,7 +8,7 @@
#include <climits>
const
int
CMDLINEMAX
=
30
;
const
int
ASSESS_TILL
=
100
;
const
int
ASSESS_TILL
=
INT_MAX
;
const
int
LINEMAX
=
40
;
using
namespace
std
;
...
...
modules/tracking/src/PFSolver.hpp
View file @
e67b9e9e
#include "opencv2/
optim
.hpp"
#include "opencv2/
core
.hpp"
#include "opencv2/core/core_c.h"
#include <algorithm>
#include <typeinfo>
...
...
@@ -8,9 +8,9 @@
namespace
cv
{
//!particle filtering class
class
PFSolver
:
public
optim
::
Solver
{
class
PFSolver
:
public
MinProblem
Solver
{
public
:
class
Function
:
public
optim
::
Solver
::
Function
class
Function
:
public
MinProblem
Solver
::
Function
{
public
:
//!if parameters have no sense due to some reason (e.g. lie outside of function domain), this function "corrects" them,
...
...
@@ -31,13 +31,13 @@ namespace cv{
void
getParamsSTD
(
OutputArray
std
)
const
;
void
setParamsSTD
(
InputArray
std
);
Ptr
<
optim
::
Solver
::
Function
>
getFunction
()
const
;
void
setFunction
(
const
Ptr
<
Solver
::
Function
>&
f
);
Ptr
<
MinProblem
Solver
::
Function
>
getFunction
()
const
;
void
setFunction
(
const
Ptr
<
MinProblem
Solver
::
Function
>&
f
);
TermCriteria
getTermCriteria
()
const
;
void
setTermCriteria
(
const
TermCriteria
&
termcrit
);
private
:
Mat_
<
double
>
_std
,
_particles
,
_logweight
;
Ptr
<
Solver
::
Function
>
_Function
;
Ptr
<
MinProblem
Solver
::
Function
>
_Function
;
PFSolver
::
Function
*
_real_function
;
TermCriteria
_termcrit
;
int
_maxItNum
,
_iter
,
_particlesNum
;
...
...
@@ -46,11 +46,11 @@ namespace cv{
RNG
rng
;
};
CV_EXPORTS_W
Ptr
<
PFSolver
>
createPFSolver
(
const
Ptr
<
optim
::
Solver
::
Function
>&
f
=
Ptr
<
optim
::
Solver
::
Function
>
(),
InputArray
std
=
Mat
(),
CV_EXPORTS_W
Ptr
<
PFSolver
>
createPFSolver
(
const
Ptr
<
MinProblemSolver
::
Function
>&
f
=
Ptr
<
MinProblem
Solver
::
Function
>
(),
InputArray
std
=
Mat
(),
TermCriteria
termcrit
=
TermCriteria
(
TermCriteria
::
MAX_ITER
,
5
,
0.0
),
int
particlesNum
=
100
,
double
alpha
=
0.6
);
PFSolver
::
PFSolver
(){
_Function
=
Ptr
<
Solver
::
Function
>
();
_Function
=
Ptr
<
MinProblem
Solver
::
Function
>
();
_real_function
=
NULL
;
_std
=
Mat_
<
double
>
();
rng
=
RNG
(
getTickCount
());
...
...
@@ -154,14 +154,14 @@ namespace cv{
double
PFSolver
::
getAlpha
(){
return
_alpha
;
}
Ptr
<
optim
::
Solver
::
Function
>
PFSolver
::
getFunction
()
const
{
Ptr
<
MinProblem
Solver
::
Function
>
PFSolver
::
getFunction
()
const
{
return
_Function
;
}
void
PFSolver
::
setFunction
(
const
Ptr
<
optim
::
Solver
::
Function
>&
f
){
void
PFSolver
::
setFunction
(
const
Ptr
<
MinProblem
Solver
::
Function
>&
f
){
CV_Assert
(
f
.
empty
()
==
false
);
Ptr
<
Solver
::
Function
>
non_const_f
(
f
);
Solver
::
Function
*
f_ptr
=
static_cast
<
Solver
::
Function
*>
(
non_const_f
);
Ptr
<
MinProblem
Solver
::
Function
>
non_const_f
(
f
);
MinProblemSolver
::
Function
*
f_ptr
=
static_cast
<
MinProblem
Solver
::
Function
*>
(
non_const_f
);
PFSolver
::
Function
*
pff
=
dynamic_cast
<
PFSolver
::
Function
*>
(
f_ptr
);
CV_Assert
(
pff
!=
NULL
);
...
...
@@ -194,7 +194,7 @@ namespace cv{
}
}
Ptr
<
PFSolver
>
createPFSolver
(
const
Ptr
<
optim
::
Solver
::
Function
>&
f
,
InputArray
std
,
TermCriteria
termcrit
,
int
particlesNum
,
double
alpha
){
Ptr
<
PFSolver
>
createPFSolver
(
const
Ptr
<
MinProblem
Solver
::
Function
>&
f
,
InputArray
std
,
TermCriteria
termcrit
,
int
particlesNum
,
double
alpha
){
Ptr
<
PFSolver
>
ptr
(
new
PFSolver
());
if
(
f
.
empty
()
==
false
){
...
...
modules/tracking/src/trackerSamplerAlgorithm.cpp
View file @
e67b9e9e
...
...
@@ -397,11 +397,11 @@ bool TrackerSamplerPF::samplingImpl( const Mat& image, Rect boundingBox, std::ve
Ptr
<
TrackerTargetState
>
ptr
;
Mat_
<
double
>
_last_guess
=
(
Mat_
<
double
>
(
1
,
4
)
<<
(
double
)
boundingBox
.
x
,(
double
)
boundingBox
.
y
,
(
double
)
boundingBox
.
x
+
boundingBox
.
width
,(
double
)
boundingBox
.
y
+
boundingBox
.
height
);
PFSolver
*
promoted_solver
=
dynamic_cast
<
PFSolver
*>
(
static_cast
<
optim
::
Solver
*>
(
_solver
));
PFSolver
*
promoted_solver
=
dynamic_cast
<
PFSolver
*>
(
static_cast
<
MinProblem
Solver
*>
(
_solver
));
promoted_solver
->
setParamsSTD
(
params
.
std
);
promoted_solver
->
minimize
(
_last_guess
);
dynamic_cast
<
TrackingFunctionPF
*>
(
static_cast
<
optim
::
Solver
::
Function
*>
(
promoted_solver
->
getFunction
()))
->
update
(
image
);
dynamic_cast
<
TrackingFunctionPF
*>
(
static_cast
<
MinProblem
Solver
::
Function
*>
(
promoted_solver
->
getFunction
()))
->
update
(
image
);
while
(
promoted_solver
->
iteration
()
<=
promoted_solver
->
getTermCriteria
().
maxCount
);
promoted_solver
->
getOptParam
(
_last_guess
);
...
...
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