24 #ifndef CCORRELATION_OPTICALFLOW_FEM_NEWTON
25 #define CCORRELATION_OPTICALFLOW_FEM_NEWTON
42 template<
typename T,
typename Timg>
51 this->class_name =
"Correlation : Optical Flow Finite Element Method using Newton strategy";
59 std::vector<int> count;
63 for (
int nd = 0; nd<oMesh.m_node[0].size(); nd++)
65 if (K[1][oMesh.num_var()*nd] != 0)
71 if (count.size()*oMesh.num_var() != K[0].width())
76 printf(
"Stiffness tensor densification required (because of mask)\n");
77 std::cout<<
"Densification : from "<<count.size()*oMesh.num_var()<<
" to "<<K[0].width()<<
" \n";
81 Kc[0].assign(count.size()*oMesh.num_var(), count.size()*oMesh.num_var(), 1, 1, 0);
82 Kc[1].assign(1, count.size()*oMesh.num_var(), 1, 1, 0);
84 for (
int dim=0; dim<oMesh.num_var(); dim++)
86 for (
int i=0; i<count.size(); i++)
88 for (
int j=0; j<count.size(); j++)
90 Kc[0](i*oMesh.num_var()+dim,j*oMesh.num_var()+dim) = K[0](count[i]*oMesh.num_var()+dim, count[j]*oMesh.num_var()+dim);
92 Kc[1][i*oMesh.num_var()+dim] = K[1][count[i]*oMesh.num_var()+dim];
104 for (
int node=0; node<count.size(); node++)
106 for (
int dim=0; dim<oMesh.num_var(); dim++)
108 solution[dim][count[node]] += Kc[1][node*oMesh.num_var()+dim];
114 virtual void assignG(
const Cmesh<T,Timg> &oMesh, CImgList<T> &K, CImgList<T> &Ke)
119 K[0].assign(oMesh.num_node()*oMesh.num_var(),oMesh.num_node()*oMesh.num_var(),1,1, 0);
120 K[1].assign(1,oMesh.num_node()*oMesh.num_var(),1,1, 0);
122 Ke[0].assign(oMesh.num_mod(),oMesh.num_mod(),oMesh.num_var(),this->m_threadNB, 0);
123 Ke[1].assign(1,oMesh.num_mod(),oMesh.num_var(),this->m_threadNB, 0);
127 virtual void assembly(
const int &thread,
const Cmesh<T,Timg> &oMesh,
const int &elem,
const CImgList<T> &Ke, CImgList<T> &K)
133 cimg_forZ(Ke[0], dim)
135 cimg_forX(Ke[0], modi)
137 cimg_forY(Ke[0], modj)
141 K[0](oMesh.m_connect[elem][modi]*Ke[0].depth()+dim,oMesh.m_connect[elem][modj]*Ke[0].depth()+dim) += Ke[0](modi,modj,dim,thread);
147 K[1][oMesh.m_connect[elem][modi]*Ke[0].depth()+dim] += Ke[1](0,modi,dim,thread);
It implements optical flow strategy for FEM method.
This is the mother class of Optical Flow strategies: It implements different steps required for the i...
Definition: Ccorrelation_opticalFlow.h:53
Definition: Ccorrelation_opticalFlow_fem_newton.h:43
virtual void solve(CImgList< T > &K, const Cmesh< T, Timg > &oMesh, CImgList< T > &solution)
Definition: Ccorrelation_opticalFlow_fem_newton.h:55
Definition: Ccorrelation_opticalFlow_fem.h:43