FACT++  1.0
Ring MCaos::Run ( uint8_t *  img)

Definition at line 86 of file MCaos.cc.

References FilterLed::Execute(), and FilterLed::MarkPoint().

Referenced by GetNumDetectedRings(), and MStarguider::ProcessFrame().

87 {
88  fLeds.clear();
89 
90  // img width height radius sigma
91  FilterLed f(img, 768, 576, fSizeBox, fSizeBox, fCut);
92 
93  for (auto it=fPositions.begin(); it!=fPositions.end(); it++)
94  {
95  std::vector<Led> arr;
96 
97  // Try to find Led in this area
98  f.Execute(arr, floor(it->GetX()), floor(it->GetY()));
99 
100  // Loop over newly found Leds
101  for (auto jt=arr.begin(); jt!=arr.end(); jt++)
102  {
103  // Add Offset to Led
104  //jt->AddOffset(it->GetDx(), it->GetDy());
105 
106  // Remember the expected phi for each detected led
107  jt->SetPhi(it->GetPhi());
108 
109  // Mark Led in image (FIXME: Move to MStarguider)
110  f.MarkPoint(jt->GetX(), jt->GetY(), jt->GetMag());
111  }
112 
113  fLeds.insert(fLeds.end(), arr.begin(), arr.end());
114  }
115 
117 
118  double sumphi = 0;
119  for (auto it=fLeds.begin(); it!=fLeds.end(); it++)
120  {
121  //cout << it->CalcPhi(fCenter) << "|" << it->GetPhi() << " ";
122  double dphi = it->CalcPhi(fCenter) - it->GetPhi();
123  if (dphi>M_PI)
124  dphi -= 2*M_PI;
125  if (dphi<-M_PI)
126  dphi += 2*M_PI;
127 
128  sumphi += dphi;
129  }
130  //cout << endl;
131 
132  fCenter.SetPhi(sumphi/fLeds.size());
133 
134  return fCenter;
135 }
int32_t CalcRings(std::vector< Led > &leds, float min=-1, float max=-1)
Definition: MCaos.cc:74
double fCut
Definition: MCaos.h:18
std::vector< Led > fLeds
Definition: MCaos.h:12
Ring fCenter
Definition: MCaos.h:22
int32_t fNumDetectedRings
Definition: MCaos.h:20
void SetPhi(double phi)
Definition: Ring.h:26
double fMaxRadius
Definition: MCaos.h:16
std::vector< Led > fPositions
Definition: MCaos.h:11
uint16_t fSizeBox
Definition: MCaos.h:17
double fMinRadius
Definition: MCaos.h:15

+ Here is the call graph for this function:

+ Here is the caller graph for this function: