source: trunk/Cosy/videodev/FilterLed.h@ 9628

Last change on this file since 9628 was 9439, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 2.7 KB
Line 
1#ifndef CAOS_FilterLed
2#define CAOS_FilterLed
3
4#ifndef __CINT__
5#include <TROOT.h>
6#endif
7
8typedef unsigned char byte;
9
10class Led;
11class Leds;
12class Ring;
13
14class FilterLed
15{
16 byte *fImg;
17 int fW;
18 int fH;
19 int fBoxX;
20 int fBoxY;
21 float fCut;
22
23 Float_t FindCluster(int &cnt, float *sum, UInt_t x, UInt_t y,
24 UInt_t x0, UInt_t y0, UInt_t x1, UInt_t y1) const;
25
26 void GetMinMax(const int offset, byte *min, byte *max) const;
27 int GetMeanPosition(const int x, const int y, const int boxx, const int boxy) const;
28 int GetMeanPosition(const int x, const int y, const int boxx, const int boxy,
29 float &mx, float &my, unsigned int &sum) const;
30
31 int GetMeanPositionBox(const int x, const int y,
32 const int boxx, const int boxy) const;
33 int GetMeanPositionBox(const int x, const int y,
34 const int boxx, const int boxy, float &mx, float &my,
35 unsigned int &sum) const;
36
37 void DrawBox(const int x1, const int y1,
38 const int x2, const int y2,
39 const int col) const;
40
41public:
42 FilterLed(byte *img, int w, int h, double cut=2.5)
43 : fImg(img), fW(w), fH(h), fBoxX(w), fBoxY(h), fCut(cut)
44 {
45 }
46
47 FilterLed(byte *img, int w, int h, int boxx, int boxy, double cut=2.5)
48 : fImg(img), fW(w), fH(h), fBoxX(boxx), fBoxY(boxy), fCut(cut)
49 {
50 }
51 virtual ~FilterLed() { }
52
53 void SetBox(int box) { fBoxX = fBoxY = box; }
54 void SetBox(int boxx, int boxy) { fBoxX = boxx; fBoxY = boxy; }
55 void SetCut(float cut) { fCut = cut; }
56 void FindStar(Leds &leds, int xc, int yc, bool circle=false) const;
57
58 void Execute(Leds &leds, int xc, int yc, double &bright) const;
59 void Execute(Leds &leds, int xc, int yc) const;
60 void Execute(Leds &leds) const { Execute(leds, fW/2, fH/2); }
61 void ExecuteAndMark(Leds &leds, int xc, int yc) const;
62 void ExecuteAndMark(Leds &leds, int xc, int yc, double &bright) const;
63 void ExecuteAndMark(Leds &leds) const { ExecuteAndMark(leds, fW/2, fH/2); }
64 void Execute(int xc, int yc) const;
65 void Execute() const { Execute(fW/2, fH/2); }
66 void MarkPoint(const Led &led) const;
67 void MarkPoint(Float_t x, Float_t y, Float_t mag) const;
68 void Stretch() const;
69 void DrawCircle(float cx, float cy, float r, byte col=0x40) const;
70 void DrawCircle(float r, byte col=0x40) const { DrawCircle(fW/2, fH/2, r, col); }
71 void DrawCircle(const Ring &c, byte col=0x40) const;
72 void DrawCircle(const Ring &c, double r, byte col) const;
73 void DrawHexagon(float cx, float cy, float r, byte col=0x40) const;
74 void DrawHexagon(const Ring &c, double r, byte col) const;
75
76 ClassDef(FilterLed, 0)
77};
78
79#endif
Note: See TracBrowser for help on using the repository browser.