Help needed with cvCalcCovarMatrix

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Help needed with cvCalcCovarMatrix

illidan_thedemonhunter
<I posted once but don't know why it wasn't approved, so i'm trying to
post again>

Hi guys,

I am new to openCV and image processing field also.. I am having a
problem with the function cvCalcCovarMatrix and wasn't able to get an
output..

I am trying to implement Aaron & James' "Action Recognition Using
temporal template", so i'm trying to put the 7 Hu moments of the MHI
template to an 7 x 1 array and calculate the CovarMatrix using the
function..

However, the output is not correct (i think).

The inputs:
Moments:
0.000797733 1.49697e-09 3.37663e-11 1.7367e-12 -9.97495e-25
1.22641e-17 1.32619e-23
Moments:
0.000753894 1.76006e-09 2.88337e-11 1.00063e-12 2.50285e-24
-4.97276e-18 4.75651e-24

Output:
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0

And here's the piece of codes:
                CV_MAT_ELEM (*vec, double, 0, 0) = temporalHu.hu1;
                CV_MAT_ELEM (*vec, double, 0, 1) = temporalHu.hu2;
                CV_MAT_ELEM (*vec, double, 0, 2) = temporalHu.hu3;
                CV_MAT_ELEM (*vec, double, 0, 3) = temporalHu.hu4;
                CV_MAT_ELEM (*vec, double, 0, 4) = temporalHu.hu5;
                CV_MAT_ELEM (*vec, double, 0, 5) = temporalHu.hu6;
                CV_MAT_ELEM (*vec, double, 0, 6) = temporalHu.hu7;
               
                vects[0] = vec;
               
                CV_MAT_ELEM (*vec, double, 0, 0) = temporalHu1.hu1;
                CV_MAT_ELEM (*vec, double, 0, 1) = temporalHu1.hu2;
                CV_MAT_ELEM (*vec, double, 0, 2) = temporalHu1.hu3;
                CV_MAT_ELEM (*vec, double, 0, 3) = temporalHu1.hu4;
                CV_MAT_ELEM (*vec, double, 0, 4) = temporalHu1.hu5;
                CV_MAT_ELEM (*vec, double, 0, 5) = temporalHu1.hu6;
                CV_MAT_ELEM (*vec, double, 0, 6) = temporalHu1.hu7;

                vects[1] = vec;

                cvCalcCovarMatrix(vects, 2, C, M, CV_COVAR_NORMAL);
                //cvmSet (C, 0, 0, 1.23);
                printCovar(C);
                               
                cout<<cvmGet(M, 0, 0)<<" "<<cvmGet(M, 0,1)<<" "<<cvmGet(M, 0, 2)<<"
"<<cvmGet(M, 0, 3)<<" "<<cvmGet(C, 0, 4)<<" "<<cvmGet(M, 0, 5)<<"
"<<cvmGet(M, 0, 6)<<"\n";
               
                cvInvert(C, invC, CV_SVD);
               
                printCovar(invC);

So did I do something wrong?

Please help as I been working on this problem for quite a few days
Thanks :)