24 mx::improc::eigenImage<realT>
m_quad;
26 mx::improc::eigenImage<realT>
m_circ;
36 float m_bg[4] = { 0, 0, 0, 0 };
37 float m_med[4] = { 0, 0, 0, 0 };
60 int threshold( mx::improc::eigenImage<realT> &im );
62 int getQuad( mx::improc::eigenImage<realT> &quad, mx::improc::eigenImage<realT> &im,
int quadNo );
64 int putQuad( mx::improc::eigenImage<realT> &im, mx::improc::eigenImage<realT> &quad,
int quadNo );
66 int outerpix(
float &avgx,
float &avgy,
float &avgr,
int quadNo );
68 int fit( mx::improc::eigenImage<realT> &im, mx::improc::eigenImage<realT> &edged );
79 m_quad.resize( m_rows, m_cols );
80 m_circ.resize( m_rows, m_cols );
83 m_quadMag.resize( m_quad.rows() * 10, m_quad.cols() * 10 );
84 m_circMag.resize( m_circ.rows() * 10, m_circ.cols() * 10 );
86 m_pixs.resize( m_quadMag.rows() * m_quadMag.cols() );
149 if( im.rows() != 2 * m_rows || im.cols() != 2 * m_cols )
154 size_t i0 = 0, j0 = 0;
155 quadCoords( i0, j0, quadNo );
157 for(
size_t i = i0; i < i0 + m_rows; ++i )
159 for(
size_t j = j0; j < j0 + m_cols; ++j )
161 quad( i - i0, j - j0 ) = im( i, j );
171 if( im.rows() != 2 * m_rows || im.cols() != 2 * m_cols )
176 size_t i0 = 0, j0 = 0;
177 quadCoords( i0, j0, quadNo );
179 for(
size_t i = i0; i < i0 + m_rows; ++i )
181 for(
size_t j = j0; j < j0 + m_cols; ++j )
183 im( i, j ) = quad( i - i0, j - j0 );
197 mx::improc::circleOuterpix( x0, y0, avgr0, avgx, avgy, avgr, m_circMag, m_quadMag );
203 size_t i0 = 0, j0 = 0;
204 quadCoords( i0, j0, quadNo );
218 mx::improc::eigenImage<realT> imin = im;
220 for(
int i = 0; i < m_numPupils; ++i )
223 getQuad( m_quad, imin, i );
225 mx::improc::imageMagnify( m_quadMag, m_quad, mx::improc::bilinearTransform<realT>() );
229 for(
size_t j = 0; j < m_pixs.size(); ++j )
231 m_pixs[j] = m_quadMag.data()[j];
234 std::sort( m_pixs.begin(), m_pixs.end() );
236 m_bg[i] = m_pixs[m_bgMedIndex * m_pixs.size()];
238 m_med[i] = m_pixs[m_pupMedIndex * m_pixs.size()];
241 m_quadMag = ( m_quadMag - m_bg[i] ) / ( m_med[i] - m_bg[i] );
244 threshold( m_quadMag );
247 outerpix( m_avgx[i], m_avgy[i], m_avgr[i], i );
250 mx::improc::imageRebinSum( m_quad, m_quadMag,
true );
251 mx::improc::imageRebinSum( m_circ, m_circMag );
252 putQuad( im, m_quad, i );
253 putQuad( edged, m_circ, i );
258 catch(
const std::exception &e )
260 std::cerr << __FILE__ <<
' ' << __LINE__ <<
' ' << e.what() <<
'\n';