18 cout <<
"ERROR - Cannot open " << name << endl;
24 cout <<
" Reading " << name <<
":" << endl;
25 cout <<
"------------------------------" << endl;
29 fin >> px >> py >> phi;
33 cout <<
" Led #" << fPositions.size() <<
": ";
34 cout << setw(3) << px <<
" ";
35 cout << setw(3) << py <<
" (";
36 cout << setw(3) << phi <<
")\n";
37 AddPosition(px, py, phi);
39 cout <<
"Found " << fPositions.size() <<
" leds." << endl;
46 const int nPoints = leds.size();
49 if (nPoints<fMinNumberLeds || nPoints<3)
54 for (
int i=0;
i<nPoints-2;
i++)
55 for (
int j=
i+1; j<nPoints-1; j++)
56 for (
int k=j+1; k<nPoints; k++)
67 if ((min>=0&&ring.
GetR()<min) || (max>=0&&ring.
GetR()>max))
70 fRings.push_back(ring);
76 CalcCenters(leds, min, max);
78 fCenter.InterpolCenters(fRings);
80 for (
auto it=leds.begin(); it!=leds.end(); it++)
91 FilterLed f(img, 768, 576, fSizeBox, fSizeBox, fCut);
93 for (
auto it=fPositions.begin(); it!=fPositions.end(); it++)
98 f.
Execute(arr, floor(it->GetX()), floor(it->GetY()));
101 for (
auto jt=arr.begin(); jt!=arr.end(); jt++)
107 jt->SetPhi(it->GetPhi());
110 f.
MarkPoint(jt->GetX(), jt->GetY(), jt->GetMag());
113 fLeds.insert(fLeds.end(), arr.begin(), arr.end());
116 fNumDetectedRings = CalcRings(fLeds, fMinRadius, fMaxRadius);
119 for (
auto it=fLeds.begin(); it!=fLeds.end(); it++)
122 double dphi = it->CalcPhi(fCenter) - it->GetPhi();
132 fCenter.SetPhi(sumphi/fLeds.size());
int32_t CalcRings(std::vector< Led > &leds, float min=-1, float max=-1)
void MarkPoint(const Led &led) const
void Execute(std::vector< Led > &leds, int xc, int yc, double &bright) const
void CalcCenters(const std::vector< Led > &leds, float min, float max)
bool CalcCenter(Led, Led, Led)
void ReadResources(const char *name="leds.txt")