source: trunk/MagicSoft/Cosy/videodev/FilterLed.h@ 9432

Last change on this file since 9432 was 8810, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 2.5 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 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
40public:
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 virtual ~FilterLed() { }
51
52 void SetBox(int box) { fBox = box; }
53 void SetCut(float cut) { fCut = cut; }
54 void FindStar(Leds &leds, int xc, int yc, bool circle=false) const;
55
56 void Execute(Leds &leds, int xc, int yc, double &bright) const;
57 void Execute(Leds &leds, int xc, int yc) const;
58 void Execute(Leds &leds) const { Execute(leds, fW/2, fH/2); }
59 void ExecuteAndMark(Leds &leds, int xc, int yc) const;
60 void ExecuteAndMark(Leds &leds, int xc, int yc, double &bright) const;
61 void ExecuteAndMark(Leds &leds) const { ExecuteAndMark(leds, fW/2, fH/2); }
62 void Execute(int xc, int yc) const;
63 void Execute() const { Execute(fW/2, fH/2); }
64 void MarkPoint(const Led &led) const;
65 void MarkPoint(Float_t x, Float_t y, Float_t mag) const;
66 void Stretch() const;
67 void DrawCircle(float cx, float cy, float r, byte col=0x40) const;
68 void DrawCircle(float r, byte col=0x40) const { DrawCircle(fW/2, fH/2, r, col); }
69 void DrawCircle(const Ring &c, byte col=0x40) const;
70 void DrawCircle(const Ring &c, double r, byte col) const;
71 void DrawHexagon(float cx, float cy, float r, byte col=0x40) const;
72 void DrawHexagon(const Ring &c, double r, byte col) const;
73
74 ClassDef(FilterLed, 0)
75};
76
77#endif
Note: See TracBrowser for help on using the repository browser.