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_intercor_fftw_phase.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_INTERCOR_FFTW_PHASE
25 #define CCORRELATION_INTERCOR_FFTW_PHASE
26 
27 
28 
42 
45 template<typename T,typename Timg>
47 {
48 
49  int m_factor;
50 
51  public:
52 
54  {// constructor
55 
56  this->class_name = "Correlation : Inter-correlation by FFTW-Phase";
57 
58  }
59 
60  virtual void init(CParameterNetCDF &fp)
61  {// init from parameter file
62 
68 
69  std::string attribute_name = "phase_threshold";
70  int error = fp.loadAttribute(attribute_name,m_factor);
71  printf("\t\t phase signal threshold -> %i\n", m_factor);
72 
73  }
74 
75  virtual void interCor(CImgList<T> &correlogram, CImgList<T> &F, CImgList<T> &G)
76  {//inter-correlation
77 
78  cimg_forXYZ(F[0],x,y,z)
79  {// CImgList correlogram is used to store ||F|| and ||G||, in order not to create other variables
80  correlogram(0,x,y,z) = std::sqrt( std::pow(F(0,x,y,z),2) + std::pow(F(1,x,y,z),2) );
81  correlogram(1,x,y,z) = std::sqrt( std::pow(G(0,x,y,z),2) + std::pow(G(1,x,y,z),2) );
82  }
83 
84  normalized(correlogram, F, G);// compute F and G phases in place
85 
86  Ccorrelation_intercor<T,Timg>::interCor(correlogram, F, G);// classic inter-correlation
87 
88  }
89 
90  void normalized(CImgList<T> &correlogram, CImgList<T> &F, CImgList<T> &G)
91  {// phase calcul from division by the norm
92 
93  float maxF(correlogram[0].max());
94 
95  cimglist_for(F,L)
96  {//phase
97  cimg_forXYZ(F[L],x,y,z)
98  {
99 
100  if (correlogram(0,x,y,z)<maxF*m_factor/100 or correlogram(1,x,y,z)<maxF*m_factor/100)
101  {//smoothing in Fourier space of low magnitude signal
102  F(L,x,y,z) = 0;
103  G(L,x,y,z) = 0;
104  }
105  else
106  {
107  F(L,x,y,z) = F(L,x,y,z)/correlogram(0,x,y,z);
108  G(L,x,y,z) = G(L,x,y,z)/correlogram(1,x,y,z);
109  }
110 
111  }
112  }
113 
114  }
115 
116 };
117 
118 #endif
virtual void init(CParameterNetCDF &fp)
Definition: Ccorrelation_intercor_fftw_phase.h:60
this branch doesn't requires image size equal to a power of 2 since it uses FFtw which already implem...
Definition: Ccorrelation_intercor_fftw_phase.h:46
Definition: Ccorrelation_intercor_fftw.h:39
virtual void init(CParameterNetCDF &fp)
Definition: Ccorrelation_intercor.h:61
this class implement 7 functions:
Definition: Ccorrelation_intercor.h:45