FACT++  1.0
int FilterLed::GetMeanPosition ( const int  x,
const int  y,
const int  boxx,
const int  boxy,
float &  mx,
float &  my,
unsigned int &  sum 
) const
private

Definition at line 246 of file FilterLed.cc.

249 {
250  unsigned int sumx=0;
251  unsigned int sumy=0;
252 
253  sum=0;
254  for (int dx=x-boxx; dx<x+boxx+1; dx++)
255  for (int dy=y-boxy; dy<y+boxy+1; dy++)
256  {
257  const uint8_t &m = fImg[dy*fW+dx];
258 
259  sumx += m*dx;
260  sumy += m*dy;
261  sum += m;
262  }
263 
264  mx = (float)sumx/sum;
265  my = (float)sumy/sum;
266 
267  return (int)my*fW + (int)mx;
268 }
int fW
Definition: FilterLed.h:13
uint8_t * fImg
Definition: FilterLed.h:12