Probleme avec CV_MAT_ELEM
Bonjour,
d'après la FAQ (http://osdir.com/ml/lib.opencv/2006-03/msg00332.html) je peux accéder a une matrix CvMat *mat de type float avec la fonction:
CV_MAT_ELEM( mat, float, 0, 0 ) = 1.f;
j'ai essayer cela pour initialiser le predictor de kalman:
Code:
1 2 3 4 5
|
CvKalman* kalman = cvCreateKalman(4,2,0);
...
CV_MAT_ELEM(kalman->state_post,float,0,0) = (float)x;
CV_MAT_ELEM(kalman->state_post,float,0,1) = (float)y; |
Et j'obtiens les erreur suivantes à la compilation:
Code:
1 2 3 4 5 6 7 8 9
|
src\kalman.c: In function `initKalman':
src\kalman.c:67: error: request for member `rows' in something not a structure or union
src\kalman.c:67: error: request for member `cols' in something not a structure or union
src\kalman.c:67: error: request for member `data' in something not a structure or union
src\kalman.c:67: error: request for member `step' in something not a structure or union
src\kalman.c:67: error: invalid type argument of `unary *'
Build error occurred, build is stopped |
Si qqun peux m'expliquer pourquoi j'obtiens ces erreurs ca serait sympa.
PS: pour l'instant j'utilise la methode classic d'acceder au pointeur, mais je trouve plus jolie l'autre methode!
Code:
1 2 3 4
|
p = (float*)kalman->state_post->data.fl;
p[0] = (float)x;
p[1] = (float)y; |