1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv=
"Content-Type" content=
"text/html;charset=UTF-8">
3 <title>QOpenCamWidget: qopencamwidget.h Source File
</title>
4 <link href=
"doxygen.css" rel=
"stylesheet" type=
"text/css">
5 <link href=
"tabs.css" rel=
"stylesheet" type=
"text/css">
7 <!-- Generated by Doxygen 1.5.6 -->
8 <div class=
"navigation" id=
"top">
11 <li><a href=
"main.html"><span>Main
Page
</span></a></li>
12 <li><a href=
"annotated.html"><span>Classes
</span></a></li>
13 <li class=
"current"><a href=
"files.html"><span>Files
</span></a></li>
16 <h1>qopencamwidget.h
</h1><a href=
"qopencamwidget_8h.html">Go to the documentation of this file.
</a><div class=
"fragment"><pre class=
"fragment"><a name=
"l00001"></a>00001 <span class=
"comment">/*
</span>
17 <a name=
"l00002"></a>00002 <span class=
"comment"> This file is one part of two, that together make
</span>
18 <a name=
"l00003"></a>00003 <span class=
"comment"> QOpenCamWidget, a Qt
4 widget that displays video input
</span>
19 <a name=
"l00004"></a>00004 <span class=
"comment"> from a webcam, along with an optional snapshot button.
</span>
20 <a name=
"l00005"></a>00005 <span class=
"comment"></span>
21 <a name=
"l00006"></a>00006 <span class=
"comment"> Copyright (C)
2009 Jon Langseth
</span>
22 <a name=
"l00007"></a>00007 <span class=
"comment"></span>
23 <a name=
"l00008"></a>00008 <span class=
"comment"> This program is free software; you can redistribute it and/or
</span>
24 <a name=
"l00009"></a>00009 <span class=
"comment"> modify it under the terms of the GNU General Public License
</span>
25 <a name=
"l00010"></a>00010 <span class=
"comment"> as published by the Free Software Foundation in its version
2</span>
26 <a name=
"l00011"></a>00011 <span class=
"comment"> of the License.
</span>
27 <a name=
"l00012"></a>00012 <span class=
"comment"></span>
28 <a name=
"l00013"></a>00013 <span class=
"comment"> This program is distributed in the hope that it will be useful,
</span>
29 <a name=
"l00014"></a>00014 <span class=
"comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of
</span>
30 <a name=
"l00015"></a>00015 <span class=
"comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
</span>
31 <a name=
"l00016"></a>00016 <span class=
"comment"> GNU General Public License for more details.
</span>
32 <a name=
"l00017"></a>00017 <span class=
"comment"></span>
33 <a name=
"l00018"></a>00018 <span class=
"comment"> You should have received a copy of the GNU General Public License
</span>
34 <a name=
"l00019"></a>00019 <span class=
"comment"> along with this program; if not, write to the Free Software
</span>
35 <a name=
"l00020"></a>00020 <span class=
"comment"> Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA
02110-
1301, USA.
</span>
36 <a name=
"l00021"></a>00021 <span class=
"comment"> */
</span>
37 <a name=
"l00022"></a>00022
38 <a name=
"l00023"></a>00023 <span class=
"preprocessor">#ifndef QOPENCVWIDGET_H
</span>
39 <a name=
"l00024"></a>00024 <span class=
"preprocessor"></span><span class=
"preprocessor">#define QOPENCVWIDGET_H
</span>
40 <a name=
"l00025"></a>00025 <span class=
"preprocessor"></span><span class=
"preprocessor">#include
<QtGui
></span>
41 <a name=
"l00026"></a>00026 <span class=
"preprocessor">#include
<opencv/cv.h
></span>
42 <a name=
"l00027"></a>00027 <span class=
"preprocessor">#include
<opencv/highgui.h
></span>
43 <a name=
"l00028"></a>00028
44 <a name=
"l00029"></a><a class=
"code" href=
"classQOpenCamWidget.html">00029</a> <span class=
"keyword">class
</span><a class=
"code" href=
"classQOpenCamWidget.html">QOpenCamWidget
</a>
45 <a name=
"l00030"></a>00030 :
<span class=
"keyword">public
</span> QWidget
46 <a name=
"l00031"></a>00031 {
47 <a name=
"l00032"></a>00032 Q_OBJECT
48 <a name=
"l00033"></a>00033
49 <a name=
"l00034"></a>00034 <span class=
"keyword">private
</span>:
50 <a name=
"l00035"></a><a class=
"code" href=
"classQOpenCamWidget.html#fde0c9d47e2ea44f2aeea499fd570368">00035</a> CvCapture *
<a class=
"code" href=
"classQOpenCamWidget.html#fde0c9d47e2ea44f2aeea499fd570368">capture
</a>;
51 <a name=
"l00036"></a><a class=
"code" href=
"classQOpenCamWidget.html#2e70551b39fd2bd15fc99ca4fa12107f">00036</a> QTimer *
<a class=
"code" href=
"classQOpenCamWidget.html#2e70551b39fd2bd15fc99ca4fa12107f">frametimer
</a>;
52 <a name=
"l00037"></a><a class=
"code" href=
"classQOpenCamWidget.html#92dab283a477c1b8a6d6d5470d5ef94d">00037</a> QImage *
<a class=
"code" href=
"classQOpenCamWidget.html#92dab283a477c1b8a6d6d5470d5ef94d">nextFrame
</a>;
53 <a name=
"l00038"></a>00038 <span class=
"comment">//QImage *snapshot;
</span>
54 <a name=
"l00039"></a><a class=
"code" href=
"classQOpenCamWidget.html#7ac719f26d5f4a0a80ac6e4ffd4fe46d">00039</a> QLabel *
<a class=
"code" href=
"classQOpenCamWidget.html#7ac719f26d5f4a0a80ac6e4ffd4fe46d">canvas
</a>;
55 <a name=
"l00040"></a><a class=
"code" href=
"classQOpenCamWidget.html#e91d147fdd20819b56ebd7861d7ab44e">00040</a> QVBoxLayout *
<a class=
"code" href=
"classQOpenCamWidget.html#e91d147fdd20819b56ebd7861d7ab44e">layout
</a>;
56 <a name=
"l00041"></a><a class=
"code" href=
"classQOpenCamWidget.html#a0aaf9bfc43d01979a7af03741620624">00041</a> QPushButton *
<a class=
"code" href=
"classQOpenCamWidget.html#a0aaf9bfc43d01979a7af03741620624">trigger
</a>;
57 <a name=
"l00042"></a><a class=
"code" href=
"classQOpenCamWidget.html#1718e4971977520cfe642daa78e1997e">00042</a> <span class=
"keywordtype">bool
</span> <a class=
"code" href=
"classQOpenCamWidget.html#1718e4971977520cfe642daa78e1997e">trigger_active
</a>;
58 <a name=
"l00043"></a>00043
59 <a name=
"l00044"></a>00044 <span class=
"keyword">public
</span>:
60 <a name=
"l00045"></a>00045 <span class=
"comment">// Defaults, standard elements ;)
</span>
61 <a name=
"l00046"></a>00046 <a class=
"code" href=
"classQOpenCamWidget.html#5835e06a54f1b09b4fd157d88dc72b6e" title=
"Consctructs a QWidget based widget for displaying video coming from an OpenCV capture...">QOpenCamWidget
</a>(QWidget *parent =
0);
62 <a name=
"l00047"></a>00047 <a class=
"code" href=
"classQOpenCamWidget.html#b0ad4890d7d638354289e074a6f71a3f">~QOpenCamWidget
</a>(
<span class=
"keywordtype">void
</span>);
63 <a name=
"l00048"></a>00048
64 <a name=
"l00049"></a>00049 <span class=
"comment">// Overides, reimplementation of abstract
</span>
65 <a name=
"l00050"></a>00050 <span class=
"keywordtype">void
</span> <a class=
"code" href=
"classQOpenCamWidget.html#c6186d1e510b5c8635b2d3bf5d94def6" title=
"A paint event is a request to repaint all or part of a widget.">paintEvent
</a> ( QPaintEvent * event );
66 <a name=
"l00051"></a>00051
67 <a name=
"l00052"></a>00052 <span class=
"comment">// Public methods specific to this class
</span>
68 <a name=
"l00053"></a>00053 <span class=
"keywordtype">void
</span> <a class=
"code" href=
"classQOpenCamWidget.html#8f885a8bb88870cd19cfc9eb4e02e2ce" title=
"Changes the visibility of the optional built-in &quot;Take snapshot&quot; button...">setSnapshotVisible
</a>(
<span class=
"keywordtype">bool
</span> visible );
69 <a name=
"l00054"></a>00054 <span class=
"keywordtype">bool
</span> <a class=
"code" href=
"classQOpenCamWidget.html#23574314cbd7a74bc6f32a640041d55a" title=
"Grabs an OpenCV video capture source.">grabCapture
</a>(
<span class=
"keywordtype">int
</span> source);
70 <a name=
"l00055"></a>00055 <span class=
"keywordtype">void
</span> <a class=
"code" href=
"classQOpenCamWidget.html#b378daa447e8d9b94e1c7c8c6853b880" title=
"Starts up grabbing of video frames.">startCapture
</a>(
<span class=
"keywordtype">void
</span>);
71 <a name=
"l00056"></a>00056 QImage*
<a class=
"code" href=
"classQOpenCamWidget.html#aba8721f46b41d76326e048e3c876f1d" title=
"Converts from the OpenCV IplImage data structure to a QImage.">Ipl2QImage
</a>(
<span class=
"keyword">const
</span> IplImage *img);
72 <a name=
"l00057"></a>00057
73 <a name=
"l00058"></a>00058 <span class=
"keyword">public
</span> slots:
74 <a name=
"l00059"></a>00059 <span class=
"keywordtype">void
</span> <a class=
"code" href=
"classQOpenCamWidget.html#27c30cec9a8d44c1802e4218bea7bdb4" title=
"Grabs a frame and causes an update() when triggered.">grabFrame
</a>(
<span class=
"keywordtype">void
</span>);
75 <a name=
"l00060"></a>00060 <span class=
"keywordtype">void
</span> <a class=
"code" href=
"classQOpenCamWidget.html#82540c90d3efa85631f13af3a60fa94b" title=
"Trigger this slot to save a frame from the widget.">startSnap
</a>();
76 <a name=
"l00061"></a>00061 signals:
77 <a name=
"l00062"></a>00062 <span class=
"keywordtype">void
</span> <a class=
"code" href=
"classQOpenCamWidget.html#d410be92ce25ff591726ba255070d09e">imageReady
</a>(QImage snapshot);
78 <a name=
"l00063"></a>00063 };
79 <a name=
"l00064"></a>00064
80 <a name=
"l00065"></a>00065 <span class=
"preprocessor">#endif
</span>
81 <a name=
"l00066"></a>00066 <span class=
"preprocessor"></span>
83 <hr size=
"1"><address style=
"text-align: right;"><small>Generated on Thu Jun
11 01:
49:
57 2009 for QOpenCamWidget by
84 <a href=
"http://www.doxygen.org/index.html">
85 <img src=
"doxygen.png" alt=
"doxygen" align=
"middle" border=
"0"></a> 1.5.6 </small></address>