Changeset 7794
- Timestamp:
- 07/16/06 01:38:53 (18 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/Changelog
r7792 r7794 1 1 -*-*- END -*-*- 2 3 2006/07/16 Thomas Bretz 4 5 * leds.txt: 6 - new values 7 8 * gui/MGCoordinate.cc: 9 - increased size of output text to display sign 10 11 * gui/MGCosy.cc: 12 - named MACS correctly MACS 13 14 * gui/MGNumStars.cc: 15 - changed color for correlated stars from magenta to cyan 16 17 * main/MStarguider.cc: 18 - changed starguider angle to -0.2 19 - changed pixsize to 48.9 20 - update num stars only if starguider is switched on 21 - removed bug which caused the rotation angle in fact to 22 be always 0 23 - reimplemented the algorithm which only takes the n-th brightest 24 stars from the catalog if n is the number of detected stars 25 (otherwise the catalog might be so crowded with stars that 26 one spot is correlated with many catalog stars) 27 - decreased the search region for the LEDs 28 - some things are not done anymore if not necesarry 29 30 * videodev/FilterLed.[h,cc]: 31 - cleaned up 32 - changed the interface of the ClusterFinder slightly to 33 allow it beeing used for the TPoint spot of the star 34 35 36 2 37 2006/07/16 Daniela Dorner 3 38 -
trunk/MagicSoft/Cosy/gui/MGCoordinate.cc
r7790 r7794 60 60 const int ypos = (flag==1?56:26)-offset; 61 61 62 fLabelDeg = new TGLabel(this, "**** ");63 fLabelMin = new TGLabel(this, "*** ");64 fLabelSec = new TGLabel(this, "*** ");62 fLabelDeg = new TGLabel(this, "*****"); 63 fLabelMin = new TGLabel(this, "****"); 64 fLabelSec = new TGLabel(this, "****"); 65 65 fLabelDeg->SetTextJustify(kTextRight); 66 66 fLabelMin->SetTextJustify(kTextRight); -
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r7790 r7794 253 253 fStopping = new TGLabel(f, "Stopping"); 254 254 fStopped = new TGLabel(f, "Stopped"); 255 fAvailMac1 = new TGLabel(f, "- MAC 1 -");256 fAvailMac2 = new TGLabel(f, "- MAC 2 -");255 fAvailMac1 = new TGLabel(f, "- MACS1 -"); 256 fAvailMac2 = new TGLabel(f, "- MACS2 -"); 257 257 //fAvailMac3 = new TGLabel(f, "- MAC3 -"); 258 258 fAvailSe1 = new TGLabel(f, "-SE/Zd1-"); … … 281 281 fStopped->SetBackgroundColor(color); 282 282 283 fArmed ->MoveResize(10, 25, 60, 20);284 fError ->MoveResize(10, 25+25, 60, 20);285 fMoving ->MoveResize(10, 25+25+20, 60, 20);286 fTracking->MoveResize(10, 25+25+40, 60, 20);287 fStopping->MoveResize(10, 25+25+60, 60, 20);288 fStopped ->MoveResize(10, 25+25+80, 60, 20);289 fAvailMac1->MoveResize(10, 25+25+120, 60, 20);290 fAvailMac2->MoveResize(10, 25+25+140, 60, 20);283 fArmed ->MoveResize(10, 25, 70, 20); 284 fError ->MoveResize(10, 25+25, 70, 20); 285 fMoving ->MoveResize(10, 25+25+20, 70, 20); 286 fTracking->MoveResize(10, 25+25+40, 70, 20); 287 fStopping->MoveResize(10, 25+25+60, 70, 20); 288 fStopped ->MoveResize(10, 25+25+80, 70, 20); 289 fAvailMac1->MoveResize(10, 25+25+120, 70, 20); 290 fAvailMac2->MoveResize(10, 25+25+140, 70, 20); 291 291 //fAvailMac3->Move(10, 25+160); 292 fAvailSe1->MoveResize(10, 25+25+200, 60, 20);293 fAvailSe2->MoveResize(10, 25+25+220, 60, 20);294 fAvailSe3->MoveResize(10, 25+25+180, 60, 20);292 fAvailSe1->MoveResize(10, 25+25+200, 70, 20); 293 fAvailSe2->MoveResize(10, 25+25+220, 70, 20); 294 fAvailSe3->MoveResize(10, 25+25+180, 70, 20); 295 295 296 296 fList->Add(fArmed); -
trunk/MagicSoft/Cosy/gui/MGNumStars.cc
r7790 r7794 89 89 90 90 InitGraph(fGraph1, kBlue); 91 InitGraph(fGraph2, k Magenta);91 InitGraph(fGraph2, kCyan); 92 92 93 93 InitText(); -
trunk/MagicSoft/Cosy/main/MStarguider.cc
r7792 r7794 130 130 131 131 fGStarg->Update(fPos, fD); 132 fGNumStars->Update(fNumStarsDetected, fNumStarsCorrelated); 132 if (fDisplay->IsEntryChecked(IDM_kStarguider)) 133 fGNumStars->Update(fNumStarsDetected, fNumStarsCorrelated); 133 134 134 135 return kTRUE; … … 445 446 446 447 // Set input box for rotation angle 447 const Double_t angle = -0. 4;448 const Double_t angle = -0.2; 448 449 fSao->SetRotationAngle(angle); 449 450 … … 458 459 459 460 // Set input box for pixel size 460 const Double_t pixsize = 48. 8; // used to be 23.4461 const Double_t pixsize = 48.9; // used to be 23.4 461 462 462 463 fSao->SetPixSize(pixsize); 463 fSao->SetRotationAngle(0);464 464 465 465 txt = ""; … … 519 519 fCRaDec->UnmapWindow(); 520 520 fCZdAz->UnmapWindow(); 521 fCZdAzText->UnmapWindow(); 521 522 fPZdAz->UnmapWindow(); 522 523 fPZdAzText->UnmapWindow(); … … 723 724 fDisplay->CheckEntry(IDM_kCatalog); 724 725 fCRaDec->MapWindow(); 725 fCRaDecText-MapWindow();726 726 fCZdAz->MapWindow(); 727 727 fCZdAzText->MapWindow(); … … 771 771 //catalog 772 772 fCRaDec->UnmapWindow(); 773 fCRaDecText-UnmapWindow();774 773 fCZdAz->UnmapWindow(); 775 774 fCZdAzText->UnmapWindow(); … … 1408 1407 { 1409 1408 num = leds.GetEntries(); 1409 //cout << "Num: " << num << endl; 1410 1410 if (num < 3) //was 1 1411 1411 { … … 1416 1416 } 1417 1417 1418 //cout << "Cat: " << stars.GetRealEntries() << endl; 1418 1419 if (stars.GetRealEntries() < 3) 1419 1420 { … … 1437 1438 1438 1439 // FIXME: Is predefined value 3 a good idea? 1440 Int_t cnt=0; 1439 1441 1440 1442 MStar *star; 1441 1443 MStarListIter NextStar(&stars); 1442 while ((star=NextStar()) )1444 while ((star=NextStar()) && cnt<num+5) 1443 1445 { 1444 1446 TIter NextSp(&leds); … … 1457 1459 x.AddAt(dpos.X(), idx); 1458 1460 y.AddAt(dpos.Y(), idx); 1459 mag.AddAt(spot->GetMag()/star->GetMag(), idx); 1461 mag.AddAt(log(spot->GetMag())/star->GetMag(), idx); 1462 1460 1463 #ifdef EXPERT 1461 1464 if (fout) … … 1463 1466 fout << spot->GetX() << " " 1464 1467 << spot->GetY() << " " 1465 << spot->GetMag() << " "1468 << -2.5*log(spot->GetMag()) << " " 1466 1469 << star->GetX() << " " 1467 1470 << star->GetY() << " " … … 1471 1474 #endif 1472 1475 } 1476 cnt++; 1473 1477 } 1474 1478 … … 1477 1481 if (numcor<1) 1478 1482 return 0; 1483 1484 //cout << "Cor: " << numcor << endl; 1479 1485 1480 1486 fDZdAz->SetCoordinates(d); … … 1829 1835 if (fCosy) 1830 1836 pos = fCosy->GetPointingPos(); 1831 center = fCaos->Run(img, printl, printr, pos, t, 50, 3.0);1837 center = fCaos->Run(img, printl, printr, pos, t, 19, 3.0); 1832 1838 cout << "Caos Filter Camera center position: " << center.GetX() << " " << center.GetY() << endl; 1833 1839 … … 1835 1841 1836 1842 // Find Star at Center---for Tpoint Procedure 1837 if (fDisplay->IsEntryChecked(IDM_kFindStar)) 1843 if (fDisplay->IsEntryChecked(IDM_kFindStar) && 1844 center.GetX()>0 && center.GetY()>0) 1838 1845 { 1839 1846 // SCALE FACTOR ASSUMED TO BE 70 … … 1888 1895 << sgcenter.GetY()-293.6<< "pix" << endl; 1889 1896 #endif 1890 if (fDisplay->IsEntryChecked(IDM_kStargFindStar)) 1897 if (fDisplay->IsEntryChecked(IDM_kStargFindStar) && 1898 sgcenter.GetX()>0 && sgcenter.GetY()>0) 1891 1899 { 1892 1900 star = FindStar(f, f2, sgcenter, t, 4.5, 30, 267/161.9); // [deg] … … 1972 1980 MTime time(*tm); 1973 1981 1974 XY xy = fCRaDec->GetCoordinates(); 1975 fRaDec->Set(xy.X()*360/24, xy.Y()); 1982 XY xy = fCRaDec->GetCoordinates(); //[h, deg] 1983 fRaDec->Set(xy.X()*360/24, xy.Y()); //[deg,deg] 1976 1984 1977 1985 UpdatePosZoom(); 1978 1986 1979 1987 // Always call SetMjd first! 1980 1988 fSao->SetPointing(time.GetMjd(), *fRaDec); 1981 1989 fCZdAz->SetCoordinates(fSao->GetZdAz()); 1982 1990 … … 2048 2056 const Int_t rc = CalcTrackingError(spots, stars, fD, t, bright, numstars); 2049 2057 2050 const Bool_t monitoring = brightnessisvalid && centerisvalid ;2058 const Bool_t monitoring = brightnessisvalid && centerisvalid && fNumStarsCorrelated>2; 2051 2059 2052 2060 fStatus = monitoring ? MDriveCom::kMonitoring : MDriveCom::kError; … … 2082 2090 f2.DrawHexagon(skycenter, 2.06/ap, 0x0a); 2083 2091 f2.DrawHexagon(skycenter, 3.50/ap, 0x0a); 2084 2085 /*2086 f2.DrawCircle(skycenter, 2.06*.5*74.0, 0x0a);2087 f2.DrawCircle(skycenter, 2.32*.5*74.0, 0x0a);2088 f2.DrawCircle(skycenter, 3.50*.5*74.0, 0x0a);2089 f2.DrawCircle(skycenter, 3.84*.5*74.0, 0x0a);2090 */2091 2092 } 2092 2093 … … 2094 2095 2095 2096 // Draw Circles around center of Camera 2096 if (fDisplay->IsEntryChecked(IDM_kCaosFilter)) 2097 if (fDisplay->IsEntryChecked(IDM_kCaosFilter) && 2098 center.GetX()>0 && center.GetY()>0) 2097 2099 { 2098 2100 f2.DrawCircle(center, 0x0a); … … 2104 2106 } 2105 2107 2106 if (fDisplay->IsEntryChecked(IDM_kStargCaosFilter)) 2108 if (fDisplay->IsEntryChecked(IDM_kStargCaosFilter) && 2109 sgcenter.GetX()>0 && sgcenter.GetY()>0) 2107 2110 { 2108 2111 f2.DrawCircle(sgcenter, 0x0a); … … 2110 2113 fDisplay->IsEntryChecked(IDM_kFindStar)?3:0xb0); 2111 2114 } 2112 2113 // if (fDisplay->IsEntryChecked(IDM_kCatalog))2114 // {2115 // fSao->PaintImg(cimg, 768, 576);2116 // const float r = 60*60/fSao->GetPixSize();2117 // f2.DrawCircle(0.5*r, 0x0a);2118 // f2.DrawCircle(1.0*r, 0x0a);2119 // f2.DrawCircle(1.5*r, 0x0a);2120 // }2121 2115 2122 2116 if (fDisplay->IsEntryChecked(IDM_kCaosFilter) || -
trunk/MagicSoft/Cosy/videodev/FilterLed.cc
r7790 r7794 11 11 12 12 ClassImp(FilterLed); 13 14 class ClusterFinder 15 { 16 private: 17 byte *fImg; 18 19 UInt_t fW; 20 UInt_t fH; 21 22 Int_t fX0; 23 Int_t fX1; 24 25 Int_t fY0; 26 Int_t fY1; 27 28 UInt_t fLimitingSize; 29 30 UInt_t fCount; 31 Float_t fSumX; 32 Float_t fSumY; 33 34 Float_t FindCluster(Int_t x, Int_t y) 35 { 36 // if edge is touched stop finding cluster 37 if (x<fX0 || x>=fX1 || y<fY0 || y>=fY1) 38 return -1; 39 40 if (fCount>fLimitingSize) 41 return -2; 42 43 // get the value 44 Float_t val = fImg[y*fW+x]; 45 46 // if its empty we have found the border of the cluster 47 if (val==0) 48 return 0; 49 50 // mark the point as processed 51 fImg[y*fW+x] = 0; 52 53 fSumX += x*val; // sumx 54 fSumY += y*val; // sumy 55 fCount++; 56 57 Float_t rc[4]; 58 rc[0] = FindCluster(x+1, y ); 59 rc[1] = FindCluster(x, y+1); 60 rc[2] = FindCluster(x-1, y ); 61 rc[3] = FindCluster(x, y-1); 62 63 for (int i=0; i<4; i++) 64 { 65 if (rc[i]<0) // check if edge is touched 66 return rc[i]; 67 68 val += rc[i]; 69 } 70 71 return val; 72 } 73 74 public: 75 ClusterFinder(byte *img, UInt_t w, UInt_t h) : fLimitingSize(999) 76 { 77 fW = w; 78 fH = h; 79 80 fX0 = 0; 81 fY0 = 0; 82 fX1 = fW; 83 fY1 = fH; 84 85 fImg = new byte[fW*fH]; 86 87 memcpy(fImg, img, fW*fH); 88 } 89 90 ~ClusterFinder() 91 { 92 delete fImg; 93 } 94 Double_t GetSumX() const { return fSumX; } 95 Double_t GetSumY() const { return fSumY; } 96 97 UInt_t GetCount() const { return fCount; } 98 99 void SetLimitingSize(UInt_t lim) { fLimitingSize=lim; } 100 101 Float_t FindClusterAt(Int_t x, Int_t y) 102 { 103 fCount = 0; 104 fSumX = 0; 105 fSumY = 0; 106 107 return FindCluster(x, y); 108 } 109 110 void SetRange(Int_t x0=0, Int_t y0=0, Int_t x1=0, Int_t y1=0) 111 { 112 fX0 = x0; 113 fY0 = y0; 114 fX1 = x1==0?fW:x1; 115 fY1 = y1==0?fH:y1; 116 } 117 118 void FindCluster(Leds &leds, Int_t x0=0, Int_t y0=0, Int_t x1=0, Int_t y1=0) 119 { 120 fX0 = x0; 121 fY0 = y0; 122 fX1 = x1==0?fW:x1; 123 fY1 = y1==0?fH:y1; 124 125 for (Int_t x=fX0; x<fX1; x++) 126 for (Int_t y=fY0; y<fY1; y++) 127 { 128 const byte &b = fImg[y*fW+x]; 129 if (b==0) 130 continue; 131 132 const Float_t mag = FindClusterAt(x, y); 133 if (fCount>999) 134 { 135 cout << "ERROR - Spot with Size>999 detected..." << endl; 136 return; 137 } 138 139 if (mag>0 && fCount>6) 140 leds.Add(fSumX/mag, fSumY/mag, 0, 0, mag); 141 } 142 leds.Compress(); 143 } 144 }; 145 13 146 14 147 void FilterLed::DrawBox(const int x1, const int y1, … … 33 166 void FilterLed::MarkPoint(const Led &led) const 34 167 { 168 /* 169 Int_t M = (int)(log(led.GetMag())*20); 170 171 cout << led.GetMag() << endl; 172 173 if (M>0xff) 174 M=0xff; 175 if (M<0xc0) 176 M=0xc0; 177 */ 178 35 179 const int x = (int)(led.GetX()+.5); 36 180 const int y = (int)(led.GetY()+.5); 37 const int m = (int)(led.GetMag()); 38 39 MarkPoint(x, y, m); 181 182 MarkPoint(x, y, 0xff); 40 183 } 41 184 … … 164 307 maxx=dx; 165 308 maxy=dy; 166 max =sum ;309 max =sumloc; 167 310 } 168 311 } … … 170 313 // 2. Calculate mean position inside a circle around 171 314 // the highst cross-signal with radius of 6 pixels. 172 unsigned int sumx=0; 173 unsigned int sumy=0; 174 175 const int rad = 17; 176 177 x0 = TMath::Max(x-box, maxx-rad); 178 y0 = TMath::Max(y-box, maxy-rad); 179 180 x1 = TMath::Min(x+box+1, maxx+rad+1); 181 y1 = TMath::Min(y+box+1, maxy+rad+1); 182 183 sum=0; 184 for (int dx=x0; dx<x1; dx++) 185 for (int dy=y0; dy<y1; dy++) 186 { 187 const byte &m = fImg[dy*fW+dx]; 188 189 sumx += m*dx; 190 sumy += m*dy; 191 sum += m; 192 } 193 194 mx = (float)sumx/sum; 195 my = (float)sumy/sum; 315 ClusterFinder find(fImg, fW, fH); 316 find.SetLimitingSize(9999); 317 find.SetRange(x0, y0, x1, y1); 318 319 const Float_t mag = find.FindClusterAt(maxx, maxy); 320 321 mx = find.GetSumX()/mag; 322 my = find.GetSumY()/mag; 323 324 sum = (int)(mag+0.5); 196 325 197 326 return (int)my*fW + (int)mx; … … 204 333 unsigned int sum; 205 334 return GetMeanPositionBox(x, y, box, mx, my, sum); 206 }207 208 209 /*210 void FilterLed::RemoveTwins(Leds &leds, Double_t radius)211 {212 for (int i=first; i<leds.GetEntriesFast(); i++)213 {214 const Led &led1 = leds(i);215 216 const Double_t x1 = led1.GetX();217 const Double_t y1 = led1.GetY();218 219 for (int j=first; j<leds.GetEntriesFast(); j++)220 {221 if (j==i)222 continuel223 224 const Led &led2 = leds(j);225 226 const Double_t x2 = led2.GetX();227 const Double_t y2 = led2.GetY();228 229 const Double_t dx = x2-x1;230 const Double_t dy = y2-y1;231 232 if (dx*dx+dy*dy<radius*radius)233 {234 // FIXME: Interpolation235 leds.Remove(led2);236 }237 }238 }239 }240 */241 void FilterLed::RemoveTwinsInterpol(Leds &leds, Int_t first, Double_t radius) const242 {243 const Int_t num=leds.GetEntriesFast();244 245 for (int i=first; i<num; i++)246 {247 Led *led1 = (Led*)leds.UncheckedAt(i);248 if (!led1)249 continue;250 251 const Double_t x1 = led1->GetX();252 const Double_t y1 = led1->GetY();253 254 Double_t mag = led1->GetMag();255 Double_t x = x1*mag;256 Double_t y = y1*mag;257 258 Double_t sqm = mag*mag;259 Double_t sqx = x*x;260 Double_t sqy = y*y;261 262 Int_t n=1;263 264 for (int j=first; j<num; j++)265 {266 if (i==j)267 continue;268 269 Led *led2 = (Led*)leds.UncheckedAt(j);270 if (!led2)271 continue;272 273 Double_t x2 = led2->GetX();274 Double_t y2 = led2->GetY();275 276 const Double_t dx = x2-x1;277 const Double_t dy = y2-y1;278 279 if (dx*dx+dy*dy>radius*radius)280 continue;281 282 // Multiply with weihgt283 const Double_t w = led2->GetMag();284 x2 *= w;285 y2 *= w;286 287 x += x2;288 y += y2;289 mag += w;290 291 sqx += x2*x2;292 sqy += y2*y2;293 sqm += w*w;294 295 n++;296 leds.Remove(led2);297 }298 299 x /= mag;300 y /= mag;301 302 sqx /= sqm;303 sqy /= sqm;304 305 leds.Add(x, y, 0/*sqrt(sqx-x*x)*/, 0/*sqrt(sqy-y*y)*/, mag/n);306 leds.Remove(led1);307 }308 leds.Compress();309 335 } 310 336 … … 344 370 } 345 371 346 class ClusterFinder347 {348 private:349 byte *fImg;350 351 UInt_t fW;352 UInt_t fH;353 354 Int_t fX0;355 Int_t fX1;356 357 Int_t fY0;358 Int_t fY1;359 360 UInt_t fCount;361 Float_t fSumX;362 Float_t fSumY;363 364 Float_t FindCluster(Int_t x, Int_t y)365 {366 // if edge is touched stop finding cluster367 if (x<fX0 || x>=fX1 || y<fY0 || y>=fY1)368 return -1;369 370 if (fCount>999)371 return -1;372 373 // get the value374 Float_t val = fImg[y*fW+x];375 376 // if its empty we have found the border of the cluster377 if (val==0)378 return 0;379 380 // mark the point as processed381 fImg[y*fW+x] = 0;382 383 fSumX += x*val; // sumx384 fSumY += y*val; // sumy385 fCount++;386 387 Float_t rc[4];388 rc[0] = FindCluster(x+1, y );389 rc[1] = FindCluster(x, y+1);390 rc[2] = FindCluster(x-1, y );391 rc[3] = FindCluster(x, y-1);392 393 for (int i=0; i<4; i++)394 {395 if (rc[i]<0) // check if edge is touched396 return -1;397 398 val += rc[i];399 }400 401 return val;402 }403 public:404 ClusterFinder(byte *img, UInt_t w, UInt_t h)405 {406 fW = w;407 fH = h;408 409 fImg = new byte[fW*fH];410 411 memcpy(fImg, img, fW*fH);412 }413 414 ~ClusterFinder()415 {416 delete fImg;417 }418 void FindCluster(Leds &leds, Int_t x0=0, Int_t y0=0, Int_t x1=0, Int_t y1=0)419 {420 fX0 = x0;421 fY0 = y0;422 fX1 = x1==0?fW:x1;423 fY1 = y1==0?fH:y1;424 425 for (Int_t x=fX0; x<fX1; x++)426 for (Int_t y=fY0; y<fY1; y++)427 {428 const byte &b = fImg[y*fW+x];429 if (b==0)430 continue;431 432 fCount = 0;433 fSumX = 0;434 fSumY = 0;435 436 const Float_t mag = FindCluster(x, y);437 if (fCount>999)438 {439 cout << "ERROR - Spot with Size>999 detected..." << endl;440 return;441 }442 443 if (mag>0 && fCount>6)444 {445 Float_t M = mag/0xff;446 if (M>0xf0)447 M=0xf0;448 449 leds.Add(fSumX/mag, fSumY/mag, 0, 0, 0xf0);450 }451 }452 leds.Compress();453 }454 };455 456 372 void FilterLed::Execute(Leds &leds, int xc, int yc, double &bright) const 457 373 { … … 506 422 } 507 423 508 /*509 void FilterLed::Execute(Leds &leds, int xc, int yc, double &bright) const510 {511 const int x0 = TMath::Max(xc-fBox, 0);512 const int y0 = TMath::Max(yc-fBox, 0);513 const int x1 = TMath::Min(xc+fBox, fW);514 const int y1 = TMath::Min(yc+fBox, fH);515 516 const int wx = x1-x0;517 const int hy = y1-y0;518 519 double sum = 0;520 double sq = 0;521 522 for (int x=x0; x<x1; x++)523 for (int y=y0; y<y1; y++)524 {525 byte &b = fImg[y*fW+x];526 527 sum += b;528 sq += b*b;529 }530 531 sum /= wx*hy;532 sq /= wx*hy;533 534 bright=sum;535 536 537 // 254 because b<=max and not b<max538 const double sdev = sqrt(sq-sum*sum);539 const byte max = sum+fCut*sdev>254 ? 254 : (byte)(sum+fCut*sdev);540 541 //542 // clean image from noise543 // (FIXME: A lookup table could accelerate things...544 //545 for (int x=x0; x<x1; x++)546 for (int y=y0; y<y1; y++)547 {548 byte &b = fImg[y*fW+x];549 if (b<=max)550 b = 0;551 }552 553 //554 // find mean points555 //556 const int maxpnt = wx*hy>0x4000?0x4000:wx*hy;557 558 int pos[maxpnt]; // (Use 'new' instead for big numbers!)559 byte mag[maxpnt]; // (Use 'new' instead for big numbers!)560 561 const int r = 5;562 563 int cnt = 0;564 for (int x=x0+r; x<x1-r; x++)565 for (int y=y0+r; y<y1-r; y++)566 {567 byte &b = fImg[y*fW+x];568 if (b==0)569 continue;570 571 const int ipos = GetMeanPosition(x, y, r);572 573 int j;574 for (j=0; j<cnt; j++)575 {576 if (pos[j]==ipos)577 {578 if (mag[j]<0xff)579 mag[j]++; // how often found (area)580 break;581 }582 }583 if (cnt && j<cnt)584 continue;585 586 pos[cnt] = ipos;587 mag[cnt] = 1;588 589 cnt++;590 if (cnt==0x4000)591 return;592 }593 594 if (cnt>1000)595 cout << "FIXME: Cnt>1000." << endl;596 597 //598 // Add found positions to array599 //600 const int first=leds.GetEntriesFast();601 602 for (int i=0; i<cnt; i++)603 {604 if (mag[i]<=7)605 continue;606 607 Float_t mx, my;608 unsigned int sum;609 GetMeanPosition(pos[i]%fW, pos[i]/fW, r, mx, my, sum);610 611 leds.Add(mx, my, 0, 0, 0);//mag[i]*10);612 }613 614 RemoveTwinsInterpol(leds, first, r);615 }616 */617 424 void FilterLed::FindStar(Leds &leds, int xc, int yc, bool box) const 618 425 { … … 714 521 return; 715 522 716 cout << "Mean=" << sum << " SDev=" << sdev << " : ";717 cout << "Sum/n = " << sum << "/" << n << " = " << (n==0?0:mag/n) << endl;523 // cout << "Mean=" << sum << " SDev=" << sdev << " : "; 524 // cout << "Sum/n = " << sum << "/" << n << " = " << (n==0?0:mag/n) << endl; 718 525 719 526 leds.Add(mx, my, 0, 0, -2.5*log10((float)mag)+13.7); -
trunk/MagicSoft/Cosy/videodev/FilterLed.h
r7790 r7794 34 34 unsigned int &sum) const; 35 35 36 void RemoveTwinsInterpol(Leds &leds, Int_t first, Double_t radius) const;37 36 void DrawBox(const int x1, const int y1, 38 37 const int x2, const int y2,
Note:
See TracChangeset
for help on using the changeset viewer.