42 template<
typename T,
typename Timg>
48 std::string class_name;
49 std::vector<Timg> m_parameters;
50 T m_neighb, m_CornerX, m_CornerY;
58 class_name =
"Cpeak_fit";
80 imgC = img.get_crop(this->m_x0-m_neighb,this->m_y0-m_neighb,this->m_x0+m_neighb,this->m_y0+m_neighb,
"false");
89 void ssd(CImg<Timg> &img)
106 CImg<Timg> n(6,1,1,1,1,0,0,0,0,0), b(1,6,1,1,0);
107 CImg<Timg> nnt(6,6,1,1,0);
116 nnt+=matrixProduct(n.get_transpose(),n);
117 b+=(n.get_transpose())*img(x,y);
123 for (
int i=0; i<b.height(); i++)
126 m_parameters.push_back(b(i));
136 m_CornerX = this->m_x0-m_neighb;
137 m_CornerY = this->m_y0-m_neighb;
140 T X1(-2*(m_parameters[1]*m_parameters[4]+m_parameters[2]*m_parameters[5])/(4*m_parameters[3]*m_parameters[4]-m_parameters[5]*m_parameters[5])),
141 Y1((-m_parameters[1]*m_parameters[5]+2*m_parameters[2]*m_parameters[3])/(m_parameters[5]*m_parameters[5]-4*m_parameters[4]*m_parameters[3]));
144 (*this).m_x0 = m_CornerX+X1;
145 (*this).m_y0 = m_CornerY+Y1;
147 if(m_CornerX<0){m_CornerX=0;};
148 if(m_CornerY<0){m_CornerY=0;};
152 virtual void peak_fit(CImg<Timg> &img) = 0;
Definition: Cpeak_fit.h:43
Definition: Cpeak_subPix.h:42
void ssd(CImg< Timg > &img)
Definition: Cpeak_fit.h:89
virtual void sub_pixel(CImg< Timg > &img)
Definition: Cpeak_fit.h:62