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_interpP.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_INTERPP
25 #define CPEAK_INTERPP
26 
37 #include "Cpeak_interp.h"
38 
41 template<typename T>
42 class Cpeak_interpP : public Cpeak_interp<T>
43 {
44 
45  public:
46 
47  std::string class_name;
48 
50  {// constructor
51 
52  class_name = "Cpeak_interpP";
53 
54  }
55 
56  virtual void sub_pixel(CImg<T> &img)
57  {// sub_pixel (polynomial)
58 
59  std::vector<T> cur, prev, next;
60  cur.assign(3,0);
61  prev.assign(3,0);
62  next.assign(3,0);
63 
64  for (int i=0; i<this->m_pos.size(); i++)
65  {// to keep only one formalisme for 2d and 3d
66  cur[i] = this->m_pos[i];
67  prev[i] = this->m_pos[i];
68  next[i] = this->m_pos[i];
69  }
70 
71 
72  for (int i=0; i<this->m_pos.size(); i++)
73  {
74 
75  if (cur[i]>0 and cur[i]<dim(img,i)-1)
76  {//borders conditions
77 
78  prev[i] = prev[i]-1;
79  next[i] = next[i]+1;
80 
81  this->interp(img(cur[0],cur[1],cur[2]), img(prev[0],prev[1],prev[2]), img(next[0],next[1],next[2]), this->m_pos[i]);
82 
83  prev[i] = cur[i];
84  next[i] = cur[i];
85 
86  }
87  //else one keeps integer value
88 
89  }
90 
91  }
92 
93  int dim(CImg<T> &img,const int &i)
94  {
95 
96  switch(i)
97  {
98  case 0: return img.width(); break;
99  case 1: return img.height(); break;
100  case 2: return img.depth(); break;
101  case 3: return img.spectrum(); break;
102  default:
103  {
104  std::cerr<<class_name<<"::"<<__func__<<": error: id="<<i<<" is unknown as CImg dimensions\n"<<std::flush;
105  return 0;
106  }
107  }
108 
109  }
110 
111 };
112 
113 #endif
114 
Definition: Cpeak_interpP.h:42
Definition: Cpeak_interp.h:43