Mohammad
Mohammad

Reputation: 21

initializing transitionMatrix in kalman filter

I am working on a object tracking project and I want to improve the results I am getting using a Kalman filter.

KalmanFilter KF(4 , 2 , 2 ,CV_32F );
Mat_<float> state(4, 1);
Mat_<float> processNoise(4, 1, CV_32F);
Mat_<float> measurement(2 , 1 , CV_32F); 
measurement.setTo(Scalar(0));

KF.statePre.at<float>(0) = 0;
KF.statePre.at<float>(1) = 0;
KF.statePre.at<float>(2) = 0;
KF.statePre.at<float>(3) = 0;

KF.transitionMatrix = *(Mat_<float>(4, 4) << 1,0,1,0,   0,1,0,1,  0,0,1,0,  0,0,0,1); //Including velocity

in last line,we have error "Windows has triggered a breakpoint in Project(Kalman).exe.

This may be due to a corruption of the heap, which indicates a bug in Project(Kalman).exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while Project(Kalman).exe has focus." please help me :(

Upvotes: 1

Views: 218

Answers (1)

Mohammad
Mohammad

Reputation: 21

const float transition[2][2] = { 1, 1, 0, 1} ; memcpy(KF.transitionMatrix.data , transition , sizeof(transition) ) ;

Upvotes: 1

Related Questions