Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Commits
92fb499b
Commit
92fb499b
authored
Nov 22, 2010
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added type selection in the Kalman filter (thanks to Nghia Ho for the patch; see ticket #693)
parent
e406dfee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
20 deletions
+21
-20
tracking.hpp
modules/video/include/opencv2/video/tracking.hpp
+2
-2
kalman.cpp
modules/video/src/kalman.cpp
+19
-18
No files found.
modules/video/include/opencv2/video/tracking.hpp
View file @
92fb499b
...
...
@@ -280,9 +280,9 @@ public:
//! the default constructor
CV_WRAP
KalmanFilter
();
//! the full constructor taking the dimensionality of the state, of the measurement and of the control vector
CV_WRAP
KalmanFilter
(
int
dynamParams
,
int
measureParams
,
int
controlParams
=
0
);
CV_WRAP
KalmanFilter
(
int
dynamParams
,
int
measureParams
,
int
controlParams
=
0
,
int
type
=
CV_32F
);
//! re-initializes Kalman filter. The previous content is destroyed.
void
init
(
int
dynamParams
,
int
measureParams
,
int
controlParams
=
0
);
void
init
(
int
dynamParams
,
int
measureParams
,
int
controlParams
=
0
,
int
type
=
CV_32F
);
//! computes predicted state
CV_WRAP
const
Mat
&
predict
(
const
Mat
&
control
=
Mat
());
...
...
modules/video/src/kalman.cpp
View file @
92fb499b
...
...
@@ -211,38 +211,39 @@ namespace cv
{
KalmanFilter
::
KalmanFilter
()
{}
KalmanFilter
::
KalmanFilter
(
int
dynamParams
,
int
measureParams
,
int
controlParams
)
KalmanFilter
::
KalmanFilter
(
int
dynamParams
,
int
measureParams
,
int
controlParams
,
int
type
)
{
init
(
dynamParams
,
measureParams
,
controlParams
);
init
(
dynamParams
,
measureParams
,
controlParams
,
type
);
}
void
KalmanFilter
::
init
(
int
DP
,
int
MP
,
int
CP
)
void
KalmanFilter
::
init
(
int
DP
,
int
MP
,
int
CP
,
int
type
)
{
CV_Assert
(
DP
>
0
&&
MP
>
0
);
CV_Assert
(
type
==
CV_32F
||
type
==
CV_64F
);
CP
=
std
::
max
(
CP
,
0
);
statePre
=
Mat
::
zeros
(
DP
,
1
,
CV_32F
);
statePost
=
Mat
::
zeros
(
DP
,
1
,
CV_32F
);
transitionMatrix
=
Mat
::
eye
(
DP
,
DP
,
CV_32F
);
statePre
=
Mat
::
zeros
(
DP
,
1
,
type
);
statePost
=
Mat
::
zeros
(
DP
,
1
,
type
);
transitionMatrix
=
Mat
::
eye
(
DP
,
DP
,
type
);
processNoiseCov
=
Mat
::
eye
(
DP
,
DP
,
CV_32F
);
measurementMatrix
=
Mat
::
zeros
(
MP
,
DP
,
CV_32F
);
measurementNoiseCov
=
Mat
::
eye
(
MP
,
MP
,
CV_32F
);
processNoiseCov
=
Mat
::
eye
(
DP
,
DP
,
type
);
measurementMatrix
=
Mat
::
zeros
(
MP
,
DP
,
type
);
measurementNoiseCov
=
Mat
::
eye
(
MP
,
MP
,
type
);
errorCovPre
=
Mat
::
zeros
(
DP
,
DP
,
CV_32F
);
errorCovPost
=
Mat
::
zeros
(
DP
,
DP
,
CV_32F
);
gain
=
Mat
::
zeros
(
DP
,
MP
,
CV_32F
);
errorCovPre
=
Mat
::
zeros
(
DP
,
DP
,
type
);
errorCovPost
=
Mat
::
zeros
(
DP
,
DP
,
type
);
gain
=
Mat
::
zeros
(
DP
,
MP
,
type
);
if
(
CP
>
0
)
controlMatrix
=
Mat
::
zeros
(
DP
,
CP
,
CV_32F
);
controlMatrix
=
Mat
::
zeros
(
DP
,
CP
,
type
);
else
controlMatrix
.
release
();
temp1
.
create
(
DP
,
DP
,
CV_32F
);
temp2
.
create
(
MP
,
DP
,
CV_32F
);
temp3
.
create
(
MP
,
MP
,
CV_32F
);
temp4
.
create
(
MP
,
DP
,
CV_32F
);
temp5
.
create
(
MP
,
1
,
CV_32F
);
temp1
.
create
(
DP
,
DP
,
type
);
temp2
.
create
(
MP
,
DP
,
type
);
temp3
.
create
(
MP
,
MP
,
type
);
temp4
.
create
(
MP
,
DP
,
type
);
temp5
.
create
(
MP
,
1
,
type
);
}
const
Mat
&
KalmanFilter
::
predict
(
const
Mat
&
control
)
...
...
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