YaDICs  V04.14.a
Yet another Digital Image Correlation software: platform dedicated to 2/3D Fluid and Solid kinematics field measurements.
 All Classes Files Functions Variables Pages
Ccorrelation_opticalFlow_fem.h
Go to the documentation of this file.
1 /**********************************************************************
2  * Copyright (C) 2012, The YaDICs Project Developers.
3  * See the COPYRIGHT file at the top-level directory of this distribution ./COPYRIGHT.
4  * See ./COPYING file for copying and redistribution conditions.
5  *
6  * This file is part of YaDICs.
7  * YaDICs is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * YaDICs is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with YaDICs. If not, see <http://www.gnu.org/licenses/>.
19  *
20  * Information about how to use the software are provided at http://yadic.univ-lille1.fr/
21  **********************************************************************/
22 
23 
24 #ifndef CCORRELATION_OPTICALFLOW_FEM
25 #define CCORRELATION_OPTICALFLOW_FEM
26 
27 
39 
40 
41 
42 template<typename T,typename Timg>
44 {
45 
46  public:
47 
49  {// constructor
50 
51  this->class_name = "Correlation : Optical Flow Finite Element Method";
52 
53  }
54 
55  virtual void init(CParameterNetCDF &fp)
56  {// init from parameter file
57 
63 
64  std::string attribute_name = "median_filter";
65  int error = fp.loadAttribute(attribute_name,this->m_medianFilter);
66  if (this->m_verbose){printf("\t\t median filter over following domain -> %i\n",this->m_medianFilter);}
67 
68  }
69 
70  virtual void assignL(const Cmesh<T,Timg> &oMesh, CImgList<T> &Ve)
71  {//assign approriate size Ve = Grad[dim].N[dim][mode] product at pix
72 
73  Ve.assign(oMesh.num_var(), oMesh.num_mod(),1,1,1, 0);
74 
75  }
76 
77  virtual void evalGN(const std::vector<T> &grad,const CImgList<T> &N, CImgList<T> &Ve)
78  {//eval V[dim][mode] = grad[dim].N[dim][mode] product
79 
80  cimglist_for(N, dim)
81  {
82  cimg_forX(N[dim], mode)
83  {
84  Ve[dim][mode] = grad[dim] * N[dim][mode];
85  }
86  }
87 
88  }
89 
90  virtual void e_ref(const Cimage<Timg> &oImage, const Cmesh<T,Timg> &oMesh, const int &elem, std::vector<T> &ref)
91  {// store position of upper left node as element position reference
92 
93  cimglist_for(oMesh.m_node, dim)
94  {
95  ref[dim] = oMesh.m_node[dim][oMesh.m_connect[elem].front()]*oImage.m_pix[dim] ;
96  }
97 
98  }
99 
100  virtual void evalShape(const CImg<Timg> &list, const Cimage<Timg> &oImage, const Cfield<T,Timg> &oField, const std::vector<T> &ref, const std::vector<T> &lCoor, const std::vector<T> &gCoor, CImgList<T> &N)
101  {
102 
103  std::vector<T> coor;
104  coor = lCoor;
105 
106  (oField.m_pShape)->exec(list, coor, N);
107 
108  }
109 
110  virtual void evalU(const CImgList<T> &solution, const Cmesh<T,Timg> &oMesh, const int &elem, const CImgList<T> &N, std::vector<T> &U)
111  {//eval U[dim] at pix
112 
113  U[2] = 0;//init required if dimension is lower than 3
114 
115  cimglist_for(N, dim)
116  {
117 
118  U[dim] = 0;
119 
120  cimg_forX(N[dim], mode)
121  {
122  U[dim] += solution[dim][oMesh.m_connect[elem][mode]] * N[dim][mode];
123  }
124 
125  }
126 
127 
128  }
129 
130 };
131 
132 #endif
virtual void init(CParameterNetCDF &fp)
Definition: Ccorrelation_opticalFlow_fem.h:55
This is the mother class of Optical Flow strategies: It implements different steps required for the i...
Definition: Ccorrelation_opticalFlow.h:53
It implements optical flow strategy.
Definition: Cmesh.h:61
Definition: Cfield.h:51
Definition: Cimage.h:57
Definition: Ccorrelation_opticalFlow_fem.h:43
virtual void init(CParameterNetCDF &fp)
Definition: Ccorrelation_opticalFlow.h:69