]> git.defcon.no Git - qopencamwidget/blob - qopencamwidget.h
Cleared out a load of uneeded stuff.
[qopencamwidget] / qopencamwidget.h
1 /*
2 This file is one part of two, that together make
3 QOpenCamWidget, a Qt 4 widget that displays video input
4 from a webcam, along with an optional snapshot button.
5
6 Copyright (C) 2009 Jon Langseth
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation in its version 2
11 of the License.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23 #ifndef QOPENCVWIDGET_H
24 #define QOPENCVWIDGET_H
25 #include <QtGui>
26 #include <opencv/cv.h>
27 #include <opencv/highgui.h>
28
29 class QOpenCamWidget
30 : public QWidget
31 {
32 Q_OBJECT
33
34 private:
35 CvCapture *capture;
36 QTimer *frametimer;
37 QImage *nextFrame;
38
39 public:
40 // Defaults, standard elements ;)
41 QOpenCamWidget(QWidget *parent = 0);
42 ~QOpenCamWidget(void);
43
44 // Overides, reimplementation of abstract
45 void paintEvent ( QPaintEvent * event );
46
47 // Public methods specific to this class
48 bool grabCapture(int source);
49 void startCapture(void);
50 QImage* Ipl2QImage(IplImage *img);
51
52 public slots:
53 void grabFrame(void);
54 void startSnap();
55 signals:
56 void imageReady(QImage snapshot);
57 };
58
59 #endif
60