1 | #ifndef CAOS_FilterLed
|
---|
2 | #define CAOS_FilterLed
|
---|
3 |
|
---|
4 | #ifndef __CINT__
|
---|
5 | #include <TROOT.h>
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | typedef unsigned char byte;
|
---|
9 |
|
---|
10 | class Led;
|
---|
11 | class Leds;
|
---|
12 | class Ring;
|
---|
13 |
|
---|
14 | class FilterLed
|
---|
15 | {
|
---|
16 | byte *fImg;
|
---|
17 | int fW;
|
---|
18 | int fH;
|
---|
19 | int fBox;
|
---|
20 | float fCut;
|
---|
21 |
|
---|
22 | Float_t FindCluster(int &cnt, float *sum, UInt_t x, UInt_t y,
|
---|
23 | UInt_t x0, UInt_t y0, UInt_t x1, UInt_t y1) const;
|
---|
24 |
|
---|
25 | void GetMinMax(const int offset, byte *min, byte *max) const;
|
---|
26 | int GetMeanPosition(const int x, const int y, const int box) const;
|
---|
27 | int GetMeanPosition(const int x, const int y, const int box,
|
---|
28 | float &mx, float &my, unsigned int &sum) const;
|
---|
29 |
|
---|
30 | int GetMeanPositionBox(const int x, const int y,
|
---|
31 | const int box) const;
|
---|
32 | int GetMeanPositionBox(const int x, const int y,
|
---|
33 | const int box, float &mx, float &my,
|
---|
34 | unsigned int &sum) const;
|
---|
35 |
|
---|
36 | void DrawBox(const int x1, const int y1,
|
---|
37 | const int x2, const int y2,
|
---|
38 | const int col) const;
|
---|
39 |
|
---|
40 | public:
|
---|
41 | FilterLed(byte *img, int w, int h, double cut=2.5)
|
---|
42 | : fImg(img), fW(w), fH(h), fBox(w>h?w:h), fCut(cut)
|
---|
43 | {
|
---|
44 | }
|
---|
45 |
|
---|
46 | FilterLed(byte *img, int w, int h, int box, double cut=2.5)
|
---|
47 | : fImg(img), fW(w), fH(h), fBox(box), fCut(cut)
|
---|
48 | {
|
---|
49 | }
|
---|
50 |
|
---|
51 | void SetBox(int box) { fBox = box; }
|
---|
52 | void SetCut(float cut) { fCut = cut; }
|
---|
53 | void FindStar(Leds &leds, int xc, int yc, bool circle=false) const;
|
---|
54 |
|
---|
55 | void Execute(Leds &leds, int xc, int yc, double &bright) const;
|
---|
56 | void Execute(Leds &leds, int xc, int yc) const;
|
---|
57 | void Execute(Leds &leds) const { Execute(leds, fW/2, fH/2); }
|
---|
58 | void ExecuteAndMark(Leds &leds, int xc, int yc) const;
|
---|
59 | void ExecuteAndMark(Leds &leds, int xc, int yc, double &bright) const;
|
---|
60 | void ExecuteAndMark(Leds &leds) const { ExecuteAndMark(leds, fW/2, fH/2); }
|
---|
61 | void Execute(int xc, int yc) const;
|
---|
62 | void Execute() const { Execute(fW/2, fH/2); }
|
---|
63 | void MarkPoint(const Led &led) const;
|
---|
64 | void MarkPoint(Float_t x, Float_t y, Float_t mag) const;
|
---|
65 | void Stretch() const;
|
---|
66 | void DrawCircle(float cx, float cy, float r, byte col=0x40) const;
|
---|
67 | void DrawCircle(float r, byte col=0x40) const { DrawCircle(fW/2, fH/2, r, col); }
|
---|
68 | void DrawCircle(const Ring &c, byte col=0x40) const;
|
---|
69 | void DrawCircle(const Ring &c, double r, byte col) const;
|
---|
70 | void DrawHexagon(float cx, float cy, float r, byte col=0x40) const;
|
---|
71 | void DrawHexagon(const Ring &c, double r, byte col) const;
|
---|
72 |
|
---|
73 | ClassDef(FilterLed, 0)
|
---|
74 | };
|
---|
75 |
|
---|
76 | #endif
|
---|