1 /*************************************************************************
2 Copyright 2009, Matthew Thompson, Lee Hicks
4 This file is part of EconoBoard.
6 EconoBoard is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 EconoBoard is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with EconoBoard. If not, see <http://www.gnu.org/licenses/>.
18 *************************************************************************/
20 #ifndef EBCAMERATHREAD_H
21 #define EBCAMERATHREAD_H
30 #define SMALLEST_REGION 10
35 class CameraThread
: public QThread
40 CameraThread(QObject
*parent
= 0);
43 inline bool canCapture()
51 inline int threshold()
62 void setThreshold(int t
);
63 void setCamera(int idx
);
64 void setDisplayUpdate(int ms
); // set to 0 to stop converting
65 void setCaptureUpdate(int ms
);
66 void setApplyThreshold(bool apply
);
72 void imageGrabbed(const QImage
&img
);
73 void FPSCalculated(int fps
);
82 TargetPoint() : valid(false) {}
83 TargetPoint(int X
, int Y
) : valid(true), x(X
), y(Y
) {}
91 IplImage
*captureFrame();
93 QImage
defaultImage();
94 QImage
convertImage();
96 void allocateBuffers();
97 void destroyBuffers();
99 TargetPoint
applyFilters(IplImage
*img
);
101 int camid
, numchannels
, thresh
;
102 int updateDelay
, captureDelay
, views
;
107 QTimer updateTimer
, captureTimer
;
108 QMutex filterMut
, captureMut
;
111 IplImage
*bufferImg
, *filterImg
, *tmpImg
;