35 int id = rhs[0].toInt();
36 string method(rhs[1].toString());
39 if (method ==
"new") {
51 if (method ==
"delete") {
56 else if (method ==
"init") {
57 nargchk(nrhs>=4 && (nrhs%2)==0 && nlhs==0);
58 int dynamParams = rhs[2].toInt();
59 int measureParams = rhs[3].toInt();
60 int controlParams = 0;
62 for (
int i=4; i<nrhs; i+=2) {
63 string key(rhs[i].toString());
64 if (key ==
"ControlParams")
65 controlParams = rhs[i+1].toInt();
66 else if (key ==
"Type")
67 type = (rhs[i+1].isChar()) ?
71 "Unrecognized option %s", key.
c_str());
73 obj->
init(dynamParams, measureParams, controlParams,
type);
75 else if (method ==
"predict") {
76 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
78 for (
int i=2; i<nrhs; i+=2) {
79 string key(rhs[i].toString());
81 control = rhs[i+1].toMat();
84 "Unrecognized option %s", key.
c_str());
88 else if (method ==
"correct") {
93 else if (method ==
"get") {
95 string prop(rhs[2].toString());
96 if (prop ==
"statePre")
98 else if (prop ==
"statePost")
100 else if (prop ==
"transitionMatrix")
102 else if (prop ==
"controlMatrix")
104 else if (prop ==
"measurementMatrix")
106 else if (prop ==
"measurementNoiseCov")
108 else if (prop ==
"processNoiseCov")
110 else if (prop ==
"errorCovPre")
112 else if (prop ==
"errorCovPost")
114 else if (prop ==
"gain")
118 "Unrecognized property %s", prop.
c_str());
120 else if (method ==
"set") {
122 string prop(rhs[2].toString());
123 if (prop ==
"statePre")
125 else if (prop ==
"statePost")
127 else if (prop ==
"transitionMatrix")
129 else if (prop ==
"controlMatrix")
131 else if (prop ==
"measurementMatrix")
133 else if (prop ==
"measurementNoiseCov")
135 else if (prop ==
"processNoiseCov")
137 else if (prop ==
"errorCovPre")
139 else if (prop ==
"errorCovPost")
141 else if (prop ==
"gain")
142 obj->
gain = rhs[3].toMat();
145 "Unrecognized property %s", prop.
c_str());
149 "Unrecognized operation %s", method.
c_str());
int last_id
Last object id to allocate.
const ConstMap< std::string, int > ClassNameMap
Translates class name used in MATLAB to equivalent OpenCV depth.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
struct mxArray_tag mxArray
Forward declaration for mxArray.
map< int, Ptr< KalmanFilter > > obj_
Object container.
LIBMWMEX_API_EXTERN_C void mexErrMsgIdAndTxt(const char *identifier, const char *err_msg,...)
Issue formatted error message with corresponding error identifier and return to MATLAB prompt...
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
Global constant definitions.
const Mat & correct(const Mat &measurement)
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
void init(int dynamParams, int measureParams, int controlParams=0, int type=CV_32F)
const Mat & predict(const Mat &control=Mat())