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
Cpeak_interpG.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 CPEAK_INTERPG
25 #define CPEAK_INTERPG
26 
37 #include "Cpeak_interpP.h"
38 
41 template<typename T>
42 class Cpeak_interpG : public Cpeak_interpP<T>
43 {
44 
45  public:
46 
47  std::string class_name;
48 
50  {// constructor
51 
52  class_name = "Cpeak_interpG";
53 
54  }
55 
56  virtual void sub_pixel(CImg<T> &img)
57  {
58 
59  std::vector<T> cur;
60  cur.assign(3,0);
61 
62  for (int i=0; i<this->m_pos.size(); i++)
63  {// to keep only one formalisme for 2d and 3d
64  cur[i] = this->m_pos[i];
65  }
66 
67 
68  if (img.get_crop(cur[0]-1,cur[1]-1,cur[2]-1,0,cur[0]+1,cur[1]+1,cur[2]+1,0).get_stats()[0]<=0)// min(img)<=0
69  {
71  printf("\t\t\t\t\t\t\t\tWarning, image value incompatible with gaussian fit, polynomial one is used");
72  }
73  else
74  {
75 
76  std::vector<T> prev, next;
77  prev.assign(3,0);
78  next.assign(3,0);
79 
80  for (int i=0; i<this->m_pos.size(); i++)
81  {// to keep only one formalisme for 2d and 3d
82  prev[i] = this->m_pos[i];
83  next[i] = this->m_pos[i];
84  }
85 
86  for (int i=0; i<this->m_pos.size(); i++)
87  {
88 
89  if (cur[i]>0 and cur[i]<this->dim(img,i)-1)
90  {
91 
92  prev[i] = prev[i]-1;
93  next[i] = next[i]+1;
94 
95  this->interp(log(img(cur[0],cur[1],cur[2])), log(img(prev[0],prev[1],prev[2])), log(img(next[0],next[1],next[2])), this->m_pos[i]);
96 
97  prev[i] = cur[i];
98  next[i] = cur[i];
99  }
100 
101  }
102 
103  }
104 
105  }// sub_pixel (gaussian)
106 
107 };
108 
109 #endif
110 
Definition: Cpeak_interpG.h:42
Definition: Cpeak_interpP.h:42