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_interpBiLin.h
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_INTERPBILIN
25 #define CPEAK_INTERPBILIN
26 
37 #include "Cpeak_subPix.h"
38 
39 
42 template<typename T>
44 {
45 
46  public:
47 
48  std::string class_name;
49  int m_neighb, m_interpFactor;
50  std::vector<T> m_posInt;
51 
52  Cpeak_interpBiLin() : Cpeak_subPix<T>(), m_neighb(3), m_interpFactor(3)
53  {// constructor
54 
55  class_name = "Cpeak_interpBiLin";
56  m_posInt.clear();
57 
58  }
59 
60  virtual void sub_pixel(CImg<T> &img)
61  {
62 
63  //stores int peak location
64  m_posInt.clear();
65  for (int i=0; i<this->m_pos.size(); i++){m_posInt.push_back(this->m_pos[i]);}
66 
67  CImg<T> imgC = interp(img);
68 
70 
71  set_position();
72 
73  }
74 
75  CImg<T> interp(CImg<T> img)
76  {// interp [n-neighbours][n][n+neighbours]
77 
78  if(!img.is_sameZ(1))
79  {
80  return img.crop(this->m_pos[0]-m_neighb, this->m_pos[1]-m_neighb, this->m_pos[2]-m_neighb,0, this->m_pos[0]+m_neighb, this->m_pos[1]+m_neighb, this->m_pos[2]+m_neighb,0, "false").resize(-m_interpFactor*100,-m_interpFactor*100,-m_interpFactor*100,-100,3);
81  }
82  else
83  {
84  return img.crop(this->m_pos[0]-m_neighb, this->m_pos[1]-m_neighb, 0,0,this->m_pos[0]+m_neighb, this->m_pos[1]+m_neighb, 0,0,"false").resize(-m_interpFactor*100,-m_interpFactor*100,-100,-100,3);
85  }
86 
87  }
88 
89  void set_position()
90  {//actualizes sub-pix position
91 
92  for (int i=0; i<m_posInt.size(); i++)
93  {
94  (*this).m_pos[i] = m_posInt[i]-m_neighb + (*this).m_pos[i]/(double)m_interpFactor;
95  }
96 
97  }
98 
99 
100 };
101 
102 #endif
Definition: Cpeak_subPix.h:42
Definition: Cpeak_interpBiLin.h:43
virtual void peak_detection(CImg< T > &img)
Definition: Cpeak_max.h:60