From: Leonardo Florez-Valencia Date: Thu, 3 Sep 2015 23:08:22 +0000 (-0500) Subject: ... X-Git-Tag: v0.1~390 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=cf0831ad1843b74c2c4982ca147e17be51faabd2;p=cpPlugins.git ... --- diff --git a/appli/examples/CMakeLists.txt b/appli/examples/CMakeLists.txt index 70ea3ee..1da1a2e 100644 --- a/appli/examples/CMakeLists.txt +++ b/appli/examples/CMakeLists.txt @@ -39,6 +39,7 @@ SET( example_3DImageGradient example_2DGulsunTekMedialness example_3DGulsunTekMedialness + example_KalmanVelocity ) FOREACH(prog ${NOPLUGINS_EXAMPLES_PROGRAMS}) ADD_EXECUTABLE( diff --git a/lib/cpPlugins/Extensions/Algorithms/KalmanFilter.hxx b/lib/cpPlugins/Extensions/Algorithms/KalmanFilter.hxx index 0e4f106..a75fb7f 100644 --- a/lib/cpPlugins/Extensions/Algorithms/KalmanFilter.hxx +++ b/lib/cpPlugins/Extensions/Algorithms/KalmanFilter.hxx @@ -7,20 +7,23 @@ template< class M > void cpPlugins::Extensions::Algorithms::KalmanFilter< T >:: Kronecker( M& AkB, const M& A, const M& B ) { - unsigned int Ar = A.rows( ); unsigned int Ac = A.cols( ); - unsigned int Br = B.rows( ); unsigned int Bc = B.cols( ); - AkB.set_size( Ar * Br, Ac * Bc ); + unsigned int m = A.rows( ); unsigned int n = A.cols( ); + unsigned int p = B.rows( ); unsigned int q = B.cols( ); + AkB.set_size( m * p, n * q ); - for( unsigned int ar = 0; ar < Ar; ar++ ) + for( unsigned int i = 1; i <= m; ++i ) { - for( unsigned int ac = 0; ac < Ac; ac++ ) + for( unsigned int j = 1; j <= n; ++j ) { - typename M::element_type vA = A[ ar ][ ac ]; - for( unsigned int br = 0; br < Br; br++ ) + for( unsigned int k = 1; k <= p; ++k ) { - unsigned int rOff = ar + ( br * ( Br - 1 ) ); - for( unsigned int bc = 0; bc < Bc; bc++ ) - AkB[ rOff ][ ac + ( bc * ( Bc - 1 ) ) ] = vA * B[ br ][ bc ]; + for( unsigned int l = 1; l <= q; ++l ) + { + unsigned int al = ( ( p * ( i - 1 ) ) + k ) - 1; + unsigned int be = ( ( q * ( j - 1 ) ) + l ) - 1; + AkB[ al ][ be ] = A[ i - 1 ][ j - 1 ] * B[ k - 1 ][ l - 1 ]; + + } // rof } // rof