kalman sample code problem

asked 2013-11-09 00:44:45 -0500

Egnatius gravatar image

Hi, just trying the openCV kalman.cpp

my computer crashes at this line because of reading forbidden memory:

KF.transitionMatrix = *(Mat_<float>(2, 2) << 1, 1, 0, 1);

And I don't understand why this cause a violating read.

the program works (in a sense) after I changed it to use "at" function to modify each element separately. It works "in a sense" because it now crashes after I hit ESC,q or Q. And the only line of code after that is return 0. I'm not a CS student but what makes a program crash when returning?

And if use memcpy to do it, it will crash after several (about 10) times I restart the Kalman process by pressing any key other than ESC, q, Q.

My computer seems to have problems with all kinds of sample codes even if I follow the instruction carefully, does anybody know any probable cause?

edit retag flag offensive close merge delete


above line won't even compile. why are you trying to dereference something, that is not a pointer ?

berak gravatar imageberak ( 2013-11-09 04:55:57 -0500 )edit