]> git.defcon.no Git - qopencamwidget/blob - qopencamwidget.h
Updated structure of documentation. No need to include GDB includes and Qt Core/GUI...
[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 QSize *vSize;
39 QSize *res;
40
41 public:
42 // Defaults, standard elements ;)
43 QOpenCamWidget(QWidget *parent = 0, QSize *viewSize = NULL, QSize *resolution = NULL);
44 ~QOpenCamWidget(void);
45
46 // Overides, reimplementation of abstract
47 void paintEvent ( QPaintEvent * event );
48
49 // Public methods specific to this class
50 bool grabCapture(int source);
51 void startCapture(void);
52 QImage* Ipl2QImage(IplImage *img);
53
54 public slots:
55 void grabFrame(void);
56 void startSnap();
57 signals:
58 void imageReady(QImage snapshot);
59 };
60
61 #endif
62