From 9158dfdfd5dca3cc29e6ec4421aef81aca971256 Mon Sep 17 00:00:00 2001 From: 020535 <020535@07accd87-1e0b-0410-939d-c05d8a058e03> Date: Wed, 10 Jun 2009 23:53:40 +0000 Subject: [PATCH] Qt Widget that handles webcams :D Uses OpenCV to get the camera data. git-svn-id: https://dilbert.hig.no/svn/student/020535/qopencamwidget/trunk@170 07accd87-1e0b-0410-939d-c05d8a058e03 --- Doxyfile | 304 +++++ doc/html/annotated.html | 33 + doc/html/classQOpenCamWidget-members.html | 47 + doc/html/classQOpenCamWidget.html | 530 ++++++++ doc/html/classView-members.html | 33 + doc/html/classView.html | 121 ++ doc/html/doxygen.css | 473 +++++++ doc/html/doxygen.png | Bin 0 -> 1281 bytes doc/html/files.html | 36 + doc/html/ftv2blank.png | Bin 0 -> 174 bytes doc/html/ftv2doc.png | Bin 0 -> 255 bytes doc/html/ftv2folderclosed.png | Bin 0 -> 259 bytes doc/html/ftv2folderopen.png | Bin 0 -> 261 bytes doc/html/ftv2lastnode.png | Bin 0 -> 233 bytes doc/html/ftv2link.png | Bin 0 -> 358 bytes doc/html/ftv2mlastnode.png | Bin 0 -> 160 bytes doc/html/ftv2mnode.png | Bin 0 -> 194 bytes doc/html/ftv2node.png | Bin 0 -> 235 bytes doc/html/ftv2plastnode.png | Bin 0 -> 165 bytes doc/html/ftv2pnode.png | Bin 0 -> 200 bytes doc/html/ftv2vertline.png | Bin 0 -> 229 bytes doc/html/functions.html | 80 ++ doc/html/functions_func.html | 66 + doc/html/functions_vars.html | 54 + doc/html/globals.html | 41 + doc/html/globals_func.html | 41 + doc/html/index.html | 11 + doc/html/main.html | 25 + doc/html/main_8cpp-source.html | 57 + doc/html/main_8cpp.html | 65 + doc/html/qopencamwidget_8cpp-source.html | 217 ++++ doc/html/qopencamwidget_8cpp.html | 29 + doc/html/qopencamwidget_8h-source.html | 87 ++ doc/html/qopencamwidget_8h.html | 34 + doc/html/tab_b.gif | Bin 0 -> 35 bytes doc/html/tab_l.gif | Bin 0 -> 706 bytes doc/html/tab_r.gif | Bin 0 -> 2585 bytes doc/html/tabs.css | 102 ++ doc/html/tree.html | 83 ++ doc/html/view_8cpp-source.html | 108 ++ doc/html/view_8cpp.html | 30 + doc/html/view_8h-source.html | 39 + doc/html/view_8h.html | 32 + doc/man/man3/QOpenCamWidget.3 | 286 +++++ doc/man/man3/View.3 | 51 + doc/man/man3/main.cpp.3 | 28 + doc/man/man3/qopencamwidget.cpp.3 | 14 + doc/man/man3/qopencamwidget.h.3 | 25 + doc/man/man3/view.cpp.3 | 16 + doc/man/man3/view.h.3 | 21 + doc/rtf/refman.rtf | 1407 +++++++++++++++++++++ main.cpp | 36 + notes | 7 + qcv.pro | 9 + qopencamwidget.cpp | 319 +++++ qopencamwidget.h | 66 + view.cpp | 87 ++ view.h | 18 + 58 files changed, 5168 insertions(+) create mode 100644 Doxyfile create mode 100644 doc/html/annotated.html create mode 100644 doc/html/classQOpenCamWidget-members.html create mode 100644 doc/html/classQOpenCamWidget.html create mode 100644 doc/html/classView-members.html create mode 100644 doc/html/classView.html create mode 100644 doc/html/doxygen.css create mode 100644 doc/html/doxygen.png create mode 100644 doc/html/files.html create mode 100644 doc/html/ftv2blank.png create mode 100644 doc/html/ftv2doc.png create mode 100644 doc/html/ftv2folderclosed.png create mode 100644 doc/html/ftv2folderopen.png create mode 100644 doc/html/ftv2lastnode.png create mode 100644 doc/html/ftv2link.png create mode 100644 doc/html/ftv2mlastnode.png create mode 100644 doc/html/ftv2mnode.png create mode 100644 doc/html/ftv2node.png create mode 100644 doc/html/ftv2plastnode.png create mode 100644 doc/html/ftv2pnode.png create mode 100644 doc/html/ftv2vertline.png create mode 100644 doc/html/functions.html create mode 100644 doc/html/functions_func.html create mode 100644 doc/html/functions_vars.html create mode 100644 doc/html/globals.html create mode 100644 doc/html/globals_func.html create mode 100644 doc/html/index.html create mode 100644 doc/html/main.html create mode 100644 doc/html/main_8cpp-source.html create mode 100644 doc/html/main_8cpp.html create mode 100644 doc/html/qopencamwidget_8cpp-source.html create mode 100644 doc/html/qopencamwidget_8cpp.html create mode 100644 doc/html/qopencamwidget_8h-source.html create mode 100644 doc/html/qopencamwidget_8h.html create mode 100644 doc/html/tab_b.gif create mode 100644 doc/html/tab_l.gif create mode 100644 doc/html/tab_r.gif create mode 100644 doc/html/tabs.css create mode 100644 doc/html/tree.html create mode 100644 doc/html/view_8cpp-source.html create mode 100644 doc/html/view_8cpp.html create mode 100644 doc/html/view_8h-source.html create mode 100644 doc/html/view_8h.html create mode 100644 doc/man/man3/QOpenCamWidget.3 create mode 100644 doc/man/man3/View.3 create mode 100644 doc/man/man3/main.cpp.3 create mode 100644 doc/man/man3/qopencamwidget.cpp.3 create mode 100644 doc/man/man3/qopencamwidget.h.3 create mode 100644 doc/man/man3/view.cpp.3 create mode 100644 doc/man/man3/view.h.3 create mode 100644 doc/rtf/refman.rtf create mode 100644 main.cpp create mode 100644 notes create mode 100644 qcv.pro create mode 100644 qopencamwidget.cpp create mode 100644 qopencamwidget.h create mode 100644 view.cpp create mode 100644 view.h diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000..9767692 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,304 @@ +# Doxyfile 1.5.6 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = QOpenCamWidget +PROJECT_NUMBER = +OUTPUT_DIRECTORY = /home/jonl/qcv/doc +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = /home/jonl/qcv/ +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +TYPEDEF_HIDES_STRUCT = NO +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +SHOW_FILES = YES +SHOW_NAMESPACES = YES +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = /home/jonl/qcv +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.vhd \ + *.vhdl \ + *.C \ + *.CC \ + *.C++ \ + *.II \ + *.I++ \ + *.H \ + *.HH \ + *.H++ \ + *.CS \ + *.PHP \ + *.PHP3 \ + *.M \ + *.MM \ + *.PY \ + *.F90 \ + *.F \ + *.VHD \ + *.VHDL +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +HTML_DYNAMIC_SECTIONS = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +CHM_INDEX_ENCODING = +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = ALL +TREEVIEW_WIDTH = 250 +FORMULA_FONTSIZE = 10 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = YES +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = YES +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +MSCGEN_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +DOT_FONTNAME = FreeSans +DOT_FONTPATH = +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = YES +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/doc/html/annotated.html b/doc/html/annotated.html new file mode 100644 index 0000000..259c2b6 --- /dev/null +++ b/doc/html/annotated.html @@ -0,0 +1,33 @@ + + +QOpenCamWidget: Class List + + + + + +
+

Class List

Here are the classes, structs, unions and interfaces with brief descriptions: + + +
QOpenCamWidget
View
+
+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/classQOpenCamWidget-members.html b/doc/html/classQOpenCamWidget-members.html new file mode 100644 index 0000000..69534bb --- /dev/null +++ b/doc/html/classQOpenCamWidget-members.html @@ -0,0 +1,47 @@ + + +QOpenCamWidget: Member List + + + + + +
+

QOpenCamWidget Member List

This is the complete list of members for QOpenCamWidget, including all inherited members.

+ + + + + + + + + + + + + + + + + +
canvasQOpenCamWidget [private]
captureQOpenCamWidget [private]
frametimerQOpenCamWidget [private]
grabCapture(int source)QOpenCamWidget
grabFrame(void)QOpenCamWidget [slot]
imageReady(QImage snapshot)QOpenCamWidget [signal]
Ipl2QImage(const IplImage *img)QOpenCamWidget
layoutQOpenCamWidget [private]
nextFrameQOpenCamWidget [private]
paintEvent(QPaintEvent *event)QOpenCamWidget
QOpenCamWidget(QWidget *parent=0)QOpenCamWidget
setSnapshotVisible(bool visible)QOpenCamWidget
startCapture(void)QOpenCamWidget
startSnap()QOpenCamWidget [slot]
triggerQOpenCamWidget [private]
trigger_activeQOpenCamWidget [private]
~QOpenCamWidget(void)QOpenCamWidget

+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/classQOpenCamWidget.html b/doc/html/classQOpenCamWidget.html new file mode 100644 index 0000000..a9aecff --- /dev/null +++ b/doc/html/classQOpenCamWidget.html @@ -0,0 +1,530 @@ + + +QOpenCamWidget: QOpenCamWidget Class Reference + + + + + +
+

QOpenCamWidget Class Reference

#include <qopencamwidget.h> +

+ +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Slots

void grabFrame (void)
 Grabs a frame and causes an update() when triggered.
void startSnap ()
 Trigger this slot to save a frame from the widget.

Signals

void imageReady (QImage snapshot)

Public Member Functions

 QOpenCamWidget (QWidget *parent=0)
 Consctructs a QWidget based widget for displaying video coming from an OpenCV capture source.
 ~QOpenCamWidget (void)
void paintEvent (QPaintEvent *event)
 A paint event is a request to repaint all or part of a widget.
void setSnapshotVisible (bool visible)
 Changes the visibility of the optional built-in "Take snapshot" button.
bool grabCapture (int source)
 Grabs an OpenCV video capture source.
void startCapture (void)
 Starts up grabbing of video frames.
QImage * Ipl2QImage (const IplImage *img)
 Converts from the OpenCV IplImage data structure to a QImage.

Private Attributes

CvCapture * capture
QTimer * frametimer
QImage * nextFrame
QLabel * canvas
QVBoxLayout * layout
QPushButton * trigger
bool trigger_active
+


Detailed Description

+ +

Definition at line 29 of file qopencamwidget.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + +
QOpenCamWidget::QOpenCamWidget (QWidget *  parent = 0  ) 
+
+
+ +

+Consctructs a QWidget based widget for displaying video coming from an OpenCV capture source. +

+Including webcam data in a Qt application can be problematic, at least as long as Phonon does not support webcams, and the Phonon GStreamer backend only supports simple pipelines.

+This class solves the complexity of adding a webcam view, by using the cross-platform available OpenCV library.

+Limitations, i.e. reasons to read this code and reimplement, are: saving or streaming video is not really available (unless you do repeated timer-triggered connections to the startSnap slot), the widget size is identical to the video source dimensions (it resizes the wodget using setMinimuSize to the video dimensions, and does not handle resizing to sizes above this dimension.

+A brief summary of how to use this class:

 QOpenCamWidget *cw = new QOpenCamWidget(this);
+ if ( cw->grabCapture(-1) ) {
+   cw->setSnapshotVisible(true);
+   cw->startCapture();
+ }
+ connect( cw, SIGNAL(imageReady(QImage)), this, SLOT(saveImage(QImage)));
+

+

Parameters:
+ + +
*parent The parent widget containing this widget, defaults to NULL.
+
+ +

Definition at line 60 of file qopencamwidget.cpp.

+ +

References canvas, frametimer, layout, nextFrame, trigger, and trigger_active.

+ +
+

+ +

+
+ + + + + + + + + +
QOpenCamWidget::~QOpenCamWidget (void   ) 
+
+
+ +

+ +

Definition at line 88 of file qopencamwidget.cpp.

+ +

References canvas, capture, and trigger.

+ +
+

+


Member Function Documentation

+ +
+
+ + + + + + + + + +
void QOpenCamWidget::paintEvent (QPaintEvent *  event  ) 
+
+
+ +

+A paint event is a request to repaint all or part of a widget. +

+It can happen for one of the following reasons:

+

    +
  • repaint() or update() was invoked,
  • +
  • the widget was obscured and has now been uncovered, or
  • +
  • many other reasons.
  • +
+QOpenCamWidget uses the paintEvent to draw each frame onto the screen. The paintEvent itself is regularily triggered by explicit update() calls in QOpenCamWidget::grabFrame(). +

Definition at line 144 of file qopencamwidget.cpp.

+ +

References canvas, and nextFrame.

+ +
+

+ +

+
+ + + + + + + + + +
void QOpenCamWidget::setSnapshotVisible (bool  visible  ) 
+
+
+ +

+Changes the visibility of the optional built-in "Take snapshot" button. +

+The widget contains a push-button that optionally can be displayed. When visible, this button is located at the bottom of the widget, and causes the SLOT QOpenCamWidget::startSnap to be triggered when clicked.

+

Parameters:
+ + +
visible True makes the button display, and trigger, false turns the feature off. False, i.e. no button, is default.
+
+ +

Definition at line 110 of file qopencamwidget.cpp.

+ +

References layout, startSnap(), trigger, and trigger_active.

+ +

Referenced by View::View().

+ +
+

+ +

+
+ + + + + + + + + +
bool QOpenCamWidget::grabCapture (int  source  ) 
+
+
+ +

+Grabs an OpenCV video capture source. +

+By grabbing a source, it is meant to open the capture source, and have it ready to start streaming/capturing frames. Returns true on success, false on error. The grabCapture is separated from the constructor and/or frame-grabbing, so that you may do the error-checking you really should do before proceeding.

+

Parameters:
+ + +
source The OpenCV capture source enumeration index to open
+
+ +

Definition at line 183 of file qopencamwidget.cpp.

+ +

References canvas, and capture.

+ +

Referenced by View::View().

+ +
+

+ +

+
+ + + + + + + + + +
void QOpenCamWidget::startCapture (void   ) 
+
+
+ +

+Starts up grabbing of video frames. +

+The actual grabbing and displaying of video frames is performed by a QTimer triggering the SLOT QOpenCamWidget::grabFrame(). startCapture() sets up the timer running this captureFrame loop.

+The SLOT QOpenCamWidget::startSnap() is used to get image frames out from the widget for other uses, like saving or processing. This function relies on the timer created and configured by startCapture(), and as such, this function is the only permitted way to start the actual capture/streaming of video from the source. +

Definition at line 217 of file qopencamwidget.cpp.

+ +

References frametimer, grabFrame(), and trigger.

+ +

Referenced by View::View().

+ +
+

+ +

+
+ + + + + + + + + +
QImage * QOpenCamWidget::Ipl2QImage (const IplImage *  img  ) 
+
+
+ +

+Converts from the OpenCV IplImage data structure to a QImage. +

+OpenCV uses a data strcuture calles IplImage, optimized for computer vision image processing tasks. This code was adapted from kcamwidget.cpp, part of the KDE SVN at playground/multimedia/kcam/kcamwidget.cpp

+In regard that the IplImage can be forced into a format that aligns well with a RBG888-format, the conversion becomes one of the shortes, simples IplImage->QImage I've seen.

+

Parameters:
+ + +
*img The IplImage to be converted to a QImage.
+
+ +

Definition at line 241 of file qopencamwidget.cpp.

+ +

Referenced by grabFrame().

+ +
+

+ +

+
+ + + + + + + + + +
void QOpenCamWidget::grabFrame (void   )  [slot]
+
+
+ +

+Grabs a frame and causes an update() when triggered. +

+This is the SLOT that actually reads the video source and causes the widget to display live video. Preferably this slot will never be called my any other signal that a timeout() on the frametimer, which is controlled by QOpenCamWidget::startCapture() +

Definition at line 266 of file qopencamwidget.cpp.

+ +

References capture, Ipl2QImage(), and nextFrame.

+ +

Referenced by startCapture().

+ +
+

+ +

+
+ + + + + + + + + +
void QOpenCamWidget::startSnap (void   )  [slot]
+
+
+ +

+Trigger this slot to save a frame from the widget. +

+When this slot is triggered, the widgets capture loop is temporarily stopped, and the last displayed frame is "captured", and made available through the emitting of the class imageReady SIGNAL.

+With the "Take snapshot" button visible (setSnapshotVisible(true)), this SLOT is triggered when the user clicks on the trigger button. If you do not wish to use the internal trigger button, you will have to add a different mechanism to trigger this SLOT.

+It is possible, though I would not recommend, to use repeated triggering of this slot to do repeated frame-capture, and thus make a form of "Animation" or "Video" capture. +

Definition at line 306 of file qopencamwidget.cpp.

+ +

References frametimer, imageReady(), and nextFrame.

+ +

Referenced by setSnapshotVisible().

+ +
+

+ +

+
+ + + + + + + + + +
void QOpenCamWidget::imageReady (QImage  snapshot  )  [signal]
+
+
+ +

+ +

Referenced by startSnap().

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
CvCapture* QOpenCamWidget::capture [private]
+
+
+ +

+ +

Definition at line 35 of file qopencamwidget.h.

+ +

Referenced by grabCapture(), grabFrame(), and ~QOpenCamWidget().

+ +
+

+ +

+
+ + + + +
QTimer* QOpenCamWidget::frametimer [private]
+
+
+ +

+ +

Definition at line 36 of file qopencamwidget.h.

+ +

Referenced by QOpenCamWidget(), startCapture(), and startSnap().

+ +
+

+ +

+
+ + + + +
QImage* QOpenCamWidget::nextFrame [private]
+
+
+ +

+ +

Definition at line 37 of file qopencamwidget.h.

+ +

Referenced by grabFrame(), paintEvent(), QOpenCamWidget(), and startSnap().

+ +
+

+ +

+
+ + + + +
QLabel* QOpenCamWidget::canvas [private]
+
+
+ +

+ +

Definition at line 39 of file qopencamwidget.h.

+ +

Referenced by grabCapture(), paintEvent(), QOpenCamWidget(), and ~QOpenCamWidget().

+ +
+

+ +

+
+ + + + +
QVBoxLayout* QOpenCamWidget::layout [private]
+
+
+ +

+ +

Definition at line 40 of file qopencamwidget.h.

+ +

Referenced by QOpenCamWidget(), and setSnapshotVisible().

+ +
+

+ +

+
+ + + + +
QPushButton* QOpenCamWidget::trigger [private]
+
+
+ +

+ +

Definition at line 41 of file qopencamwidget.h.

+ +

Referenced by QOpenCamWidget(), setSnapshotVisible(), startCapture(), and ~QOpenCamWidget().

+ +
+

+ +

+
+ + + + +
bool QOpenCamWidget::trigger_active [private]
+
+
+ +

+ +

Definition at line 42 of file qopencamwidget.h.

+ +

Referenced by QOpenCamWidget(), and setSnapshotVisible().

+ +
+

+


The documentation for this class was generated from the following files: +
+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/classView-members.html b/doc/html/classView-members.html new file mode 100644 index 0000000..ad6d22b --- /dev/null +++ b/doc/html/classView-members.html @@ -0,0 +1,33 @@ + + +QOpenCamWidget: Member List + + + + + +
+

View Member List

This is the complete list of members for View, including all inherited members.

+ + + +
saveImage(QImage image)View [slot]
View(QWidget *parent=0)View
~View(void)View

+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/classView.html b/doc/html/classView.html new file mode 100644 index 0000000..cd6ff9e --- /dev/null +++ b/doc/html/classView.html @@ -0,0 +1,121 @@ + + +QOpenCamWidget: View Class Reference + + + + + +
+

View Class Reference

#include <view.h> +

+ +

+List of all members. + + + + + + + + + +

Public Slots

void saveImage (QImage image)

Public Member Functions

 View (QWidget *parent=0)
 ~View (void)
+


Detailed Description

+ +

Definition at line 5 of file view.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + +
View::View (QWidget *  parent = 0  ) 
+
+ +

+ +

+
+ + + + + + + + + +
View::~View (void   ) 
+
+
+ +

+ +

Definition at line 74 of file view.cpp.

+ +
+

+


Member Function Documentation

+ +
+
+ + + + + + + + + +
void View::saveImage (QImage  image  )  [slot]
+
+
+ +

+ +

Definition at line 78 of file view.cpp.

+ +

Referenced by View().

+ +
+

+


The documentation for this class was generated from the following files: +
+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/doxygen.css b/doc/html/doxygen.css new file mode 100644 index 0000000..22c4843 --- /dev/null +++ b/doc/html/doxygen.css @@ -0,0 +1,473 @@ +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} +H1 { + text-align: center; + font-size: 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} +CAPTION { + font-weight: bold +} +DIV.qindex { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navpath { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navtab { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1A419D; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1A419D +} +A.qindex:hover { + text-decoration: none; + background-color: #ddddff; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +A.qindexHL:visited { + text-decoration: none; + background-color: #6666cc; + color: #ffffff +} +A.el { + text-decoration: none; + font-weight: bold +} +A.elRef { + font-weight: bold +} +A.code:link { + text-decoration: none; + font-weight: normal; + color: #0000FF +} +A.code:visited { + text-decoration: none; + font-weight: normal; + color: #0000FF +} +A.codeRef:link { + font-weight: normal; + color: #0000FF +} +A.codeRef:visited { + font-weight: normal; + color: #0000FF +} +A:hover { + text-decoration: none; + background-color: #f2f2ff +} +DL.el { + margin-left: -1cm +} +.fragment { + font-family: monospace, fixed; + font-size: 95%; +} +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px +} + +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +DIV.groupText { + margin-left: 16px; + font-style: italic; + font-size: 90% +} +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #e8eef2; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #e8eef2; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { + text-align: center; +} +IMG.formulaDsp { +} +IMG.formulaInl { + vertical-align: middle; +} +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +SPAN.vhdldigit { color: #ff00ff } +SPAN.vhdlchar { color: #000000 } +SPAN.vhdlkeyword { color: #700070 } +SPAN.vhdllogic { color: #ff0000 } + +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { + color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +TD.tiny { + font-size: 75%; +} +a { + color: #1A41A8; +} +a:visited { + color: #2A3798; +} +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; +} +TH.dirtab { + background: #e8eef2; + font-weight: bold; +} +HR { + height: 1px; + border: none; + border-top: 1px solid black; +} + +/* Style for detailed member documentation */ +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; + margin-left: 3px; +} +.memnav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +.memitem { + padding: 4px; + background-color: #eef3f5; + border-width: 1px; + border-style: solid; + border-color: #dedeee; + -moz-border-radius: 8px 8px 8px 8px; +} +.memname { + white-space: nowrap; + font-weight: bold; +} +.memdoc{ + padding-left: 10px; +} +.memproto { + background-color: #d5e1e8; + width: 100%; + border-width: 1px; + border-style: solid; + border-color: #84b0c7; + font-weight: bold; + -moz-border-radius: 8px 8px 8px 8px; +} +.paramkey { + text-align: right; +} +.paramtype { + white-space: nowrap; +} +.paramname { + color: #602020; + font-style: italic; + white-space: nowrap; +} +/* End Styling for detailed member documentation */ + +/* for the tree view */ +.ftvtree { + font-family: sans-serif; + margin:0.5em; +} +/* these are for tree view when used as main index */ +.directory { + font-size: 9pt; + font-weight: bold; +} +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +/* The following two styles can be used to replace the root node title */ +/* with an image of your choice. Simply uncomment the next two styles, */ +/* specify the name of your image and be sure to set 'height' to the */ +/* proper pixel height of your image. */ + +/* .directory h3.swap { */ +/* height: 61px; */ +/* background-repeat: no-repeat; */ +/* background-image: url("yourimage.gif"); */ +/* } */ +/* .directory h3.swap span { */ +/* display: none; */ +/* } */ + +.directory > h3 { + margin-top: 0; +} +.directory p { + margin: 0px; + white-space: nowrap; +} +.directory div { + display: none; + margin: 0px; +} +.directory img { + vertical-align: -30%; +} +/* these are for tree view when not used as main index */ +.directory-alt { + font-size: 100%; + font-weight: bold; +} +.directory-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} +.directory-alt > h3 { + margin-top: 0; +} +.directory-alt p { + margin: 0px; + white-space: nowrap; +} +.directory-alt div { + display: none; + margin: 0px; +} +.directory-alt img { + vertical-align: -30%; +} + diff --git a/doc/html/doxygen.png b/doc/html/doxygen.png new file mode 100644 index 0000000000000000000000000000000000000000..f0a274bbaffdd67f6d784c894d9cf28729db0e14 GIT binary patch literal 1281 zcmaJ>ZA?>F7(Vx-ms?uoS`b@hdRtpo6o^%HU>M$hfGrBvQnk$LE?p^P!kn&ikhyq! zX~V@&tPF5Qt@V?oTL96Bi%aRiwbe1)9DWQI#?)=HxS7QSw`J`5fAJ*eJbB;uNuKA& zdERDo*{Y<(If(#(B$Lr#;nB(8Y#ia=ZCeW?JfPLuQY`=@cW$k}Rivq|vbxGrRq1Tl9;+(gNt?}UtVKM2`T5t1jLzuL@0UIs`S#vlhl4)^ zLgSYrPj@$+`|j?eSbXTmiHGkWxV8V}BzNR?pl9k_s4pDu9vd5a_UzZEPk)}Ad{AV_ zzddrjrh4=Imr`E06;LY{)YYt?o}L~H@7C}F^WB!Ra=v`Q0bj{>5&$66CWF>mf6vjP z2N>RRY6ZYa=K`76>+|_)Xdwko+7wv}7cN|btOhWb(*{sta~6b?S8Omrxw}!4`NhGr zZVpNqpu1@BE`QGWNTpEpcJVW5izu~2B^GlM?1(OPg)zwW;QcP@Ltcclm>XbJL9C|j z=9!2?ua=uIlf0%AndzHsRC}IyTL$EhAee(fdKB`?27KeS^2M8M_7b~PiCFO&r5LC7 z7gl1*a<8;SjNaw#h=843_AV9iZbWQOAp5YOC^&_F*9K0> zB|6%IDb?aM#3viTxkLU4aXg&@+CkNTOnQ1iMP*^?b|^lJy$4C)Zk4isV!|RZ*XhXh zw8q3$=*0LeGC!XI_Wc?dkT~3+*Gu%%yIqP+Wr3H$=&ROMQU6q}Ag^P~>c5vAEO;a- z_dK-3PPeKar%)6$j~vI2#*-YH!1h6HYVtwCX5_wM`iF#UKz&&@9Oo5w3%XGYrX zW>dY~)SG-((Yim%`InwgTvyRC?e=Wh^8KCao!R6Eg&TpVWUY1sN~4G}V?nFnEGo-; zHZ_$eW9-GnC%^WS9b z@p;-$oH#MtC0v>Q$HX%4^JdFdO$0cbv-W)Q TtK}Eh@>>I#ipmV1>S*>q-hkC} literal 0 HcmV?d00001 diff --git a/doc/html/files.html b/doc/html/files.html new file mode 100644 index 0000000..33f0314 --- /dev/null +++ b/doc/html/files.html @@ -0,0 +1,36 @@ + + +QOpenCamWidget: File Index + + + + + +
+

File List

Here is a list of all files with brief descriptions: + + + + + +
main.cpp [code]
qopencamwidget.cpp [code]
qopencamwidget.h [code]
view.cpp [code]
view.h [code]
+
+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/ftv2blank.png b/doc/html/ftv2blank.png new file mode 100644 index 0000000000000000000000000000000000000000..493c3c0b615ade5b22027bde773faf2c0e076d66 GIT binary patch literal 174 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr2qYM%T@!Q%(o7{me!&ckj8p!u14)&*MwA5S zr6z#mEsk^N1FBF3sc_EE%}vcKVF=AhO-xa6_jFST&P^;T z2~I3aEm8;rVk12R#UIz>f`J-DJY5_^DsClP9B62eH+WF*G=YJMp~A-KbWwke5Kx}M M)78&qol`;+0EL(^EC2ui literal 0 HcmV?d00001 diff --git a/doc/html/ftv2doc.png b/doc/html/ftv2doc.png new file mode 100644 index 0000000000000000000000000000000000000000..f72999f92172cca6edaa2538286b3e369bec9f49 GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^5yjnX4egh%q=bp-`Pe zR7&bp17l3gfhmh7Fm(iZ2eAfco|q!h5)>qKG?UBh!IC9QGMbJAHf6IEiufk_g|d7~ qkWqJ4k(|I-Aeo-5U~n{Fnc?dN!3Uwu?t6hQVDNPHb6Mw<&;$TLIZ`G7 literal 0 HcmV?d00001 diff --git a/doc/html/ftv2folderclosed.png b/doc/html/ftv2folderclosed.png new file mode 100644 index 0000000000000000000000000000000000000000..d6d063440cbf13c4128dacd96661b6fce58abf26 GIT binary patch literal 259 zcmeAS@N?(olHy`uVBq!ia0vp^55uo^`BphW;jCHO69?}tw{JfcdnZ<*@N=4I z?xF5Qc|QYEmKAIZ;JRGVHe=bn*tx1_|J^^vyg*oVM#A1kZlFULJYD@<);T3K0RTgB BWg7qh literal 0 HcmV?d00001 diff --git a/doc/html/ftv2folderopen.png b/doc/html/ftv2folderopen.png new file mode 100644 index 0000000000000000000000000000000000000000..bbe2c913cf493ee37ad8e3a5132382138d93ac92 GIT binary patch literal 261 zcmeAS@N?(olHy`uVBq!ia0vp^5u(C zYP)Mg%H-DB+{J~>rPn_#pYTax?r*V6ubqGX{lvROQ{?n5_cbm+cQAOm`njxgN@xNA D92;js literal 0 HcmV?d00001 diff --git a/doc/html/ftv2lastnode.png b/doc/html/ftv2lastnode.png new file mode 100644 index 0000000000000000000000000000000000000000..e7b9ba90cb0cf71c8ce662956bfee7d64cf60fa6 GIT binary patch literal 233 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!py+H=+kU?6UZ?L@CkAK|NlRbNhD}!Xpp$P zU;Pg)ksC(lf|p%(p+w2Gk+!>EaktaVt4N i!r*{E4>QXNV>t$uAA#a^n)TVt_DW*G8-srQl%FeIsRSdYm zeDdtWec}u&7@8h5rqv#p7g*pRdwwmugmlS-+cHV~j}#7`Nwj9m+AU)JGGo`8z_}`K z?s#Xsy%Z;1_jl5Y+?Gum8WyK6`MBvup0SAOKJ)mWcHyteJ?WLL>>-)=?&<$H&t5oH Vd!azZ1yDdSc)I$ztaD0e0sw}(dc*(# literal 0 HcmV?d00001 diff --git a/doc/html/ftv2mlastnode.png b/doc/html/ftv2mlastnode.png new file mode 100644 index 0000000000000000000000000000000000000000..09ceb6adb01054ce799ad20c0e818ab9272f2df2 GIT binary patch literal 160 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr#LU3Jc=+&fg$isFPOjJ*AaIJQGm()YSDb0rfjgNefXW#>UHx3vIVCg! E0ORy6RsaA1 literal 0 HcmV?d00001 diff --git a/doc/html/ftv2mnode.png b/doc/html/ftv2mnode.png new file mode 100644 index 0000000000000000000000000000000000000000..3254c05112199fbc80aad313611c58a5b388792d GIT binary patch literal 194 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!py+H=+kU?6Ub2s@Ck7}aNq!ti3c<^Gz9OH zn+a6GSQ6wH%;50sMjDVKR^l2_5}cn_Ql40p%8;I!W>k=uu3)5RqGz-?&YcgaLd(;| zF{I*Fa>4?=2W(CyOv{5p*uLi}G<-ambjQcb>&~4!CzK3KXWY6d$*{eWU47N}X+XCz OFnGH9xvXPg)ksC(lf|p%(p+w2Gk+y>EaktaVt4N l!r*{E4>Lv;t literal 0 HcmV?d00001 diff --git a/doc/html/ftv2plastnode.png b/doc/html/ftv2plastnode.png new file mode 100644 index 0000000000000000000000000000000000000000..0b07e00913d8069ebbb51bd7fd6d70d8bba88f75 GIT binary patch literal 165 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr#LU3Jc=+&MJ literal 0 HcmV?d00001 diff --git a/doc/html/ftv2pnode.png b/doc/html/ftv2pnode.png new file mode 100644 index 0000000000000000000000000000000000000000..2001b797ba2b98a4127f1d3efca64aef08bf6d51 GIT binary patch literal 200 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!py+H=+kU?6Ub2s@Ck7}aNq!ti3c<^Gz9OH zn+a6GSQ6wH%;50sMjDVKR^l2_5}cn_Ql40p%8;I!W>k=uu3)5RqGz-?&Ycga!obtT zF{I*Fa>4?=2W(Dkd1@Anj~<0|oqBMOmqox%*rjK-r)THv+0v0L%h-agt(X~hWwYzA SIxU|Ma*U^|pUXO@geCywmoZiV literal 0 HcmV?d00001 diff --git a/doc/html/ftv2vertline.png b/doc/html/ftv2vertline.png new file mode 100644 index 0000000000000000000000000000000000000000..b330f3a33c0085c183ff39fc56b1b274160c1da0 GIT binary patch literal 229 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!py+H=+kU?6UZ?L@CkAK|NlRbNhD}!Xpp$P zU;Pg)ksC(lf|p%(p+w2Gqgt>EaktaVt4N e!r*{^G#i7W2*a|cHZQDzQVgE1elF{r5}E+)J2fZ( literal 0 HcmV?d00001 diff --git a/doc/html/functions.html b/doc/html/functions.html new file mode 100644 index 0000000..12325d4 --- /dev/null +++ b/doc/html/functions.html @@ -0,0 +1,80 @@ + + +QOpenCamWidget: Class Members + + + + + +
+Here is a list of all class members with links to the classes they belong to: +

+

+
+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/functions_func.html b/doc/html/functions_func.html new file mode 100644 index 0000000..bb21470 --- /dev/null +++ b/doc/html/functions_func.html @@ -0,0 +1,66 @@ + + +QOpenCamWidget: Class Members - Functions + + + + + +
+  +

+

+
+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/functions_vars.html b/doc/html/functions_vars.html new file mode 100644 index 0000000..1964345 --- /dev/null +++ b/doc/html/functions_vars.html @@ -0,0 +1,54 @@ + + +QOpenCamWidget: Class Members - Variables + + + + + +
+  +

+

+
+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/globals.html b/doc/html/globals.html new file mode 100644 index 0000000..c8020b5 --- /dev/null +++ b/doc/html/globals.html @@ -0,0 +1,41 @@ + + +QOpenCamWidget: Class Members + + + + + +
+Here is a list of all file members with links to the files they belong to: +

+

+
+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/globals_func.html b/doc/html/globals_func.html new file mode 100644 index 0000000..899a60d --- /dev/null +++ b/doc/html/globals_func.html @@ -0,0 +1,41 @@ + + +QOpenCamWidget: Class Members + + + + + +
+  +

+

+
+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/index.html b/doc/html/index.html new file mode 100644 index 0000000..325a8bd --- /dev/null +++ b/doc/html/index.html @@ -0,0 +1,11 @@ + + +QOpenCamWidget + + + + + <a href="main.html">Frames are disabled. Click here to go to the main page.</a> + + + diff --git a/doc/html/main.html b/doc/html/main.html new file mode 100644 index 0000000..5f03c44 --- /dev/null +++ b/doc/html/main.html @@ -0,0 +1,25 @@ + + +QOpenCamWidget: Main Page + + + + + +
+

QOpenCamWidget Documentation

+

+

+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/main_8cpp-source.html b/doc/html/main_8cpp-source.html new file mode 100644 index 0000000..dbf4f5f --- /dev/null +++ b/doc/html/main_8cpp-source.html @@ -0,0 +1,57 @@ + + +QOpenCamWidget: main.cpp Source File + + + + + +
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/main_8cpp.html b/doc/html/main_8cpp.html new file mode 100644 index 0000000..180ec03 --- /dev/null +++ b/doc/html/main_8cpp.html @@ -0,0 +1,65 @@ + + +QOpenCamWidget: main.cpp File Reference + + + + + +
+

main.cpp File Reference

#include <QtGui/QApplication>
+#include "view.h"
+ +

+Go to the source code of this file. + + + + +

Functions

int main (int argc, char *argv[])
+


Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
int main (int  argc,
char *  argv[] 
)
+
+
+ +

+ +

Definition at line 28 of file main.cpp.

+ +
+

+

+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/qopencamwidget_8cpp-source.html b/doc/html/qopencamwidget_8cpp-source.html new file mode 100644 index 0000000..6086746 --- /dev/null +++ b/doc/html/qopencamwidget_8cpp-source.html @@ -0,0 +1,217 @@ + + +QOpenCamWidget: qopencamwidget.cpp Source File + + + + + +
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/qopencamwidget_8cpp.html b/doc/html/qopencamwidget_8cpp.html new file mode 100644 index 0000000..58696cc --- /dev/null +++ b/doc/html/qopencamwidget_8cpp.html @@ -0,0 +1,29 @@ + + +QOpenCamWidget: qopencamwidget.cpp File Reference + + + + + +
+

qopencamwidget.cpp File Reference

#include "qopencamwidget.h"
+ +

+Go to the source code of this file. + +
+

+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/qopencamwidget_8h-source.html b/doc/html/qopencamwidget_8h-source.html new file mode 100644 index 0000000..2380488 --- /dev/null +++ b/doc/html/qopencamwidget_8h-source.html @@ -0,0 +1,87 @@ + + +QOpenCamWidget: qopencamwidget.h Source File + + + + + +
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/qopencamwidget_8h.html b/doc/html/qopencamwidget_8h.html new file mode 100644 index 0000000..07f0115 --- /dev/null +++ b/doc/html/qopencamwidget_8h.html @@ -0,0 +1,34 @@ + + +QOpenCamWidget: qopencamwidget.h File Reference + + + + + +
+

qopencamwidget.h File Reference

#include <QtGui>
+#include <opencv/cv.h>
+#include <opencv/highgui.h>
+ +

+Go to the source code of this file. + + + + +

Classes

class  QOpenCamWidget
+

+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/tab_b.gif b/doc/html/tab_b.gif new file mode 100644 index 0000000000000000000000000000000000000000..0d623483ffdf5f9f96900108042a7ab0643fe2a3 GIT binary patch literal 35 ncmZ?wbhEHbWMp7uXkcJy*>IeJfk6j|fqX^=1|}vKMh0sDa2W*H literal 0 HcmV?d00001 diff --git a/doc/html/tab_l.gif b/doc/html/tab_l.gif new file mode 100644 index 0000000000000000000000000000000000000000..9b1e6337c9299a700401a2a78a2c6ffced475216 GIT binary patch literal 706 zcmZ?wbhEHbZT`}F1e&(Gg}Y(8=I;HA5#Z$3JI=gGB)FQ#odI(O&E^@q;x zK6mr*m3xOS-#u~t!I@i+u0DKm^U160k6t`|^WpV}&n+8{U%dD9&a>B#U%!9-@yol< zU%&tQ{rk_K|NsC0`}dE5ET99@1@a36+kb~?0UJ*yc&I3X_m z!ND^5$O7$#8OFRuDhG}!?8z?cdZK&!`PWjdR;Aj^wZ` zeK{IEYHBJ)6K8VIp1`BVt++swf6j+=L{p1*nO(VhE`pFexG@5$|>uaCcd z`0m=9m+yak{QmXN#Sc$^{$X9h9&q2jiKAI|&T)a;PPx2K9p`YIdw8HtR5k2Q$2-O2 z*;3y{MQ-RnJTgJfI&R5|O)AHxDf_00XbPvDZPy4t=hHd)nfLPvms&O`Ok(sD()5v$ z5U@&h;a=#xbxVbo2~X&Xj0Ie(f{v>vERH+qC+nTG=B8Nca=wU-O$?1&vUgV~9=!H; zx>3p9Yn%*<>t~sk+&0xfyS8RsPfYBd<~wWK%j-LmpU>O7yX^h#UCp1x-p#i7@bE;py8XI6 zmY<)m>~)W~yIWcMVoiPg{duuf<*)9qZ9l$m*Ph&W&$jlv*Vpa+{pH@n=IQ$L?0$ax ec60Ul|8o2P|NVbd{6P)#weSbE3}s?04AuZvx_~SI literal 0 HcmV?d00001 diff --git a/doc/html/tab_r.gif b/doc/html/tab_r.gif new file mode 100644 index 0000000000000000000000000000000000000000..ce9dd9f533cb5486d6941844f442b59d4a9e9175 GIT binary patch literal 2585 zcmbV}`9Bkk1ILFF--w5zJc=ZZT(zjE=;2|_S)Qm~rCWz1Pc)KPl;jv%A#&v2*x}yc zmf2~Jm~&=xjJY?PqwIN}f8qQ2{r$uH{c*nJbmr{cR5??*egHrs-B=MzCF`3%e{FAW z{oL5xTHn~5TM{jaB;@|_Ue5F&Zb@p(kMyG{*;gWDg zyeL|eZf7Qd8=#bXzSiR{yzRgLSj-fJS8>lBjVHN z^o-0eS=nE6a`W;LChBs=`+QAJP~{b93>H^eRb5kCSC1zUNezun%`L5M?RDzv#%jk7 zYVRX=vATPD`+oEfum^{RM@GjuP?-r=yh0!p;Vx^T9G7~`7%5ydH%70=jyJ;;`d;hv92x3R=z{xp+Lg2!*@OK*K15-t&okoPtSED)h&$RLxdbA zseWm^C3d%-yRNi-ryk^!ek+C`n&~cd$#ZWct_cUL{l~i+Nzx^5d!n94(>bW-iL~Rl z&8r)?q|1DIo=0=judQ{FaGcfLERz8gfn3-Qt<2lksh{mzpT}DXxUuR^z=^key&q4! z+wWI45vL0k$R^(F#{qfqhUsN@WA+w-V?LPH33!Q?WFSB3)WBojE@hK41Nb?KfS+Qo zXgrzfsP$wr4Qzy*{OD>uJBjdgGM@VMml5)2f~_}lD*YyOb}Hjeobhz#4c`w(l^>KK zr?Ud;W~Z}*w;%hZ|2^p^+f06gJDJQD zeIhGADbDmm&6arh(q>EZ<7mjzg7l|z$hRL8=1>)Nv=S7CY$B}iYJ&*T_-T_OG*L1q ztZ3Lana33?y3AKnyq^YCF|4x%Rb5WU&2qcl{TFKey%QJeMxn^SdT!hZ5+0i1zeusiYVp-phBl7b5+Px-X&LhByq z0F&<;K0l2+v>qiHlXb#$jXMv$uK-dEGE9L~qtdU(XeRXmvu*K2Q&6!fD**JxYP4b4BR7FdJ$Qx9G9`J%-_X!a#LGpp3g9)VWytGCa;7`S1_e8F~!R+aSJ zOF17p2`H?2kPs8Q`_;U}+D%3p zs2-0BTqFwpUoBk`?P;iPQ(IbEA|JmMx!P&YYG|R@S=5Mnw;-?A6rEEVyV%d7{iU4a zNk`i!%F(Ykpm`}#oH;BjY->@b8vQedv;pza2FL&*6ufjd+*3Ute&>kes~TU?^KkojsTh(o~(3tk1Y6>4(yn( z#U*ID9@eg-beKo1B;HXe+}{Z%n@7m0+yxivuqk9~;!1LGQlah)xYK4>wgL}l6dsaN zIxlRlq`*`j9PG4*0hD6YV_b_2w5b#)o7J?`q#{GjvvKlD`T*dWcZx<-s(ZvLB44E# z=!|sw!?)@%y$oRNL#25WS3lzdii}TuQ3?CLnvQ1_n};2sT_;Y;#d3=+-(O% zMN$>O!3;ke(UuLR%h_&)N zs^!-@A>QR}4yB1bPp`9S19ikTbZ~O{&FF-yHK{En;mmShDUIEw03`j(DBIsM}Rjki2J#SQa3gFZTKBPDeIiLt9Z z%bL3(B@Qw%(B`wSMS~dPh$=R`(}lBoFXKy(s|*{#ru$wjsBc_O#zxNk9w+UUHmx(U zmJ8+M+ndtnZ<7|VU9Mbt61zpo9T&3%Wx&XII=#QJxjR`CZf22ac3d51Z?GD%LEe_&*t46Qf;4`bZ7p2K(Ab5>GfT^}4! zBT&HZD`^PEgWoI&{~o-ID0F?O`75sm(87x%A{(}Ch1)QlzdJ)1B-eqe5a(weg0`4lQIf1evjvbBY50DVbzO7CLf|vP z2#0(U-|jZ`H{y5N^o7%iK6H>_HEGN->U6^!)1{XpJV!!4(Ig7wzZQ*9WYF4X1rG0x z=1uA@i`rIAciubDC{;~b(|&|A@xkjRP5aRcvRU9tvIm}jDB6J eQ0-6-y)mpwdT=ayS0tBxKDA*~;EWmo literal 0 HcmV?d00001 diff --git a/doc/html/tabs.css b/doc/html/tabs.css new file mode 100644 index 0000000..95f00a9 --- /dev/null +++ b/doc/html/tabs.css @@ -0,0 +1,102 @@ +/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ + +DIV.tabs +{ + float : left; + width : 100%; + background : url("tab_b.gif") repeat-x bottom; + margin-bottom : 4px; +} + +DIV.tabs UL +{ + margin : 0px; + padding-left : 10px; + list-style : none; +} + +DIV.tabs LI, DIV.tabs FORM +{ + display : inline; + margin : 0px; + padding : 0px; +} + +DIV.tabs FORM +{ + float : right; +} + +DIV.tabs A +{ + float : left; + background : url("tab_r.gif") no-repeat right top; + border-bottom : 1px solid #84B0C7; + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + +DIV.tabs A:hover +{ + background-position: 100% -150px; +} + +DIV.tabs A:link, DIV.tabs A:visited, +DIV.tabs A:active, DIV.tabs A:hover +{ + color: #1A419D; +} + +DIV.tabs SPAN +{ + float : left; + display : block; + background : url("tab_l.gif") no-repeat left top; + padding : 5px 9px; + white-space : nowrap; +} + +DIV.tabs INPUT +{ + float : right; + display : inline; + font-size : 1em; +} + +DIV.tabs TD +{ + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + + + +/* Commented Backslash Hack hides rule from IE5-Mac \*/ +DIV.tabs SPAN {float : none;} +/* End IE5-Mac hack */ + +DIV.tabs A:hover SPAN +{ + background-position: 0% -150px; +} + +DIV.tabs LI.current A +{ + background-position: 100% -150px; + border-width : 0px; +} + +DIV.tabs LI.current SPAN +{ + background-position: 0% -150px; + padding-bottom : 6px; +} + +DIV.navpath +{ + background : none; + border : none; + border-bottom : 1px solid #84B0C7; +} diff --git a/doc/html/tree.html b/doc/html/tree.html new file mode 100644 index 0000000..a36c826 --- /dev/null +++ b/doc/html/tree.html @@ -0,0 +1,83 @@ + + + + + + + TreeView + + + + + + diff --git a/doc/html/view_8cpp-source.html b/doc/html/view_8cpp-source.html new file mode 100644 index 0000000..e11a248 --- /dev/null +++ b/doc/html/view_8cpp-source.html @@ -0,0 +1,108 @@ + + +QOpenCamWidget: view.cpp Source File + + + + + +
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/view_8cpp.html b/doc/html/view_8cpp.html new file mode 100644 index 0000000..c3958a2 --- /dev/null +++ b/doc/html/view_8cpp.html @@ -0,0 +1,30 @@ + + +QOpenCamWidget: view.cpp File Reference + + + + + +
+

view.cpp File Reference

#include "view.h"
+#include "qopencamwidget.h"
+ +

+Go to the source code of this file. + +
+

+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/view_8h-source.html b/doc/html/view_8h-source.html new file mode 100644 index 0000000..2f22f0d --- /dev/null +++ b/doc/html/view_8h-source.html @@ -0,0 +1,39 @@ + + +QOpenCamWidget: view.h Source File + + + + + +
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/html/view_8h.html b/doc/html/view_8h.html new file mode 100644 index 0000000..49666b2 --- /dev/null +++ b/doc/html/view_8h.html @@ -0,0 +1,32 @@ + + +QOpenCamWidget: view.h File Reference + + + + + +
+

view.h File Reference

#include <QtGui>
+ +

+Go to the source code of this file. + + + + +

Classes

class  View
+

+
Generated on Thu Jun 11 01:49:57 2009 for QOpenCamWidget by  + +doxygen 1.5.6
+ + diff --git a/doc/man/man3/QOpenCamWidget.3 b/doc/man/man3/QOpenCamWidget.3 new file mode 100644 index 0000000..3758b7e --- /dev/null +++ b/doc/man/man3/QOpenCamWidget.3 @@ -0,0 +1,286 @@ +.TH "QOpenCamWidget" 3 "11 Jun 2009" "QOpenCamWidget" \" -*- nroff -*- +.ad l +.nh +.SH NAME +QOpenCamWidget \- +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.PP +.SS "Public Slots" + +.in +1c +.ti -1c +.RI "void \fBgrabFrame\fP (void)" +.br +.RI "\fIGrabs a frame and causes an update() when triggered. \fP" +.ti -1c +.RI "void \fBstartSnap\fP ()" +.br +.RI "\fITrigger this slot to save a frame from the widget. \fP" +.in -1c +.SS "Signals" + +.in +1c +.ti -1c +.RI "void \fBimageReady\fP (QImage snapshot)" +.br +.in -1c +.SS "Public Member Functions" + +.in +1c +.ti -1c +.RI "\fBQOpenCamWidget\fP (QWidget *parent=0)" +.br +.RI "\fIConsctructs a QWidget based widget for displaying video coming from an OpenCV capture source. \fP" +.ti -1c +.RI "\fB~QOpenCamWidget\fP (void)" +.br +.ti -1c +.RI "void \fBpaintEvent\fP (QPaintEvent *event)" +.br +.RI "\fIA paint event is a request to repaint all or part of a widget. \fP" +.ti -1c +.RI "void \fBsetSnapshotVisible\fP (bool visible)" +.br +.RI "\fIChanges the visibility of the optional built-in 'Take snapshot' button. \fP" +.ti -1c +.RI "bool \fBgrabCapture\fP (int source)" +.br +.RI "\fIGrabs an OpenCV video capture source. \fP" +.ti -1c +.RI "void \fBstartCapture\fP (void)" +.br +.RI "\fIStarts up grabbing of video frames. \fP" +.ti -1c +.RI "QImage * \fBIpl2QImage\fP (const IplImage *img)" +.br +.RI "\fIConverts from the OpenCV IplImage data structure to a QImage. \fP" +.in -1c +.SS "Private Attributes" + +.in +1c +.ti -1c +.RI "CvCapture * \fBcapture\fP" +.br +.ti -1c +.RI "QTimer * \fBframetimer\fP" +.br +.ti -1c +.RI "QImage * \fBnextFrame\fP" +.br +.ti -1c +.RI "QLabel * \fBcanvas\fP" +.br +.ti -1c +.RI "QVBoxLayout * \fBlayout\fP" +.br +.ti -1c +.RI "QPushButton * \fBtrigger\fP" +.br +.ti -1c +.RI "bool \fBtrigger_active\fP" +.br +.in -1c +.SH "Detailed Description" +.PP +Definition at line 29 of file qopencamwidget.h. +.SH "Constructor & Destructor Documentation" +.PP +.SS "QOpenCamWidget::QOpenCamWidget (QWidget * parent = \fC0\fP)" +.PP +Consctructs a QWidget based widget for displaying video coming from an OpenCV capture source. +.PP +Including webcam data in a Qt application can be problematic, at least as long as Phonon does not support webcams, and the Phonon GStreamer backend only supports simple pipelines. +.PP +This class solves the complexity of adding a webcam view, by using the cross-platform available OpenCV library. +.PP +Limitations, i.e. reasons to read this code and reimplement, are: saving or streaming video is not really available (unless you do repeated timer-triggered connections to the startSnap slot), the widget size is identical to the video source dimensions (it resizes the wodget using setMinimuSize to the video dimensions, and does not handle resizing to sizes above this dimension. +.PP +A brief summary of how to use this class: +.PP +.nf + QOpenCamWidget *cw = new QOpenCamWidget(this); + if ( cw->grabCapture(-1) ) { + cw->setSnapshotVisible(true); + cw->startCapture(); + } + connect( cw, SIGNAL(imageReady(QImage)), this, SLOT(saveImage(QImage))); + +.fi +.PP +.PP +\fBParameters:\fP +.RS 4 +\fI*parent\fP The parent widget containing this widget, defaults to NULL. +.RE +.PP + +.PP +Definition at line 60 of file qopencamwidget.cpp. +.PP +References canvas, frametimer, layout, nextFrame, trigger, and trigger_active. +.SS "QOpenCamWidget::~QOpenCamWidget (void)" +.PP +Definition at line 88 of file qopencamwidget.cpp. +.PP +References canvas, capture, and trigger. +.SH "Member Function Documentation" +.PP +.SS "void QOpenCamWidget::paintEvent (QPaintEvent * event)" +.PP +A paint event is a request to repaint all or part of a widget. +.PP +It can happen for one of the following reasons: +.PP +.PD 0 +.IP "\(bu" 2 +repaint() or update() was invoked, +.IP "\(bu" 2 +the widget was obscured and has now been uncovered, or +.IP "\(bu" 2 +many other reasons. +.PP +\fBQOpenCamWidget\fP uses the paintEvent to draw each frame onto the screen. The paintEvent itself is regularily triggered by explicit update() calls in \fBQOpenCamWidget::grabFrame()\fP. +.PP +Definition at line 144 of file qopencamwidget.cpp. +.PP +References canvas, and nextFrame. +.SS "void QOpenCamWidget::setSnapshotVisible (bool visible)" +.PP +Changes the visibility of the optional built-in 'Take snapshot' button. +.PP +The widget contains a push-button that optionally can be displayed. When visible, this button is located at the bottom of the widget, and causes the SLOT \fBQOpenCamWidget::startSnap\fP to be triggered when clicked. +.PP +\fBParameters:\fP +.RS 4 +\fIvisible\fP True makes the button display, and trigger, false turns the feature off. False, i.e. no button, is default. +.RE +.PP + +.PP +Definition at line 110 of file qopencamwidget.cpp. +.PP +References layout, startSnap(), trigger, and trigger_active. +.PP +Referenced by View::View(). +.SS "bool QOpenCamWidget::grabCapture (int source)" +.PP +Grabs an OpenCV video capture source. +.PP +By grabbing a source, it is meant to open the capture source, and have it ready to start streaming/capturing frames. Returns true on success, false on error. The grabCapture is separated from the constructor and/or frame-grabbing, so that you may do the error-checking you really should do before proceeding. +.PP +\fBParameters:\fP +.RS 4 +\fIsource\fP The OpenCV capture source enumeration index to open +.RE +.PP + +.PP +Definition at line 183 of file qopencamwidget.cpp. +.PP +References canvas, and capture. +.PP +Referenced by View::View(). +.SS "void QOpenCamWidget::startCapture (void)" +.PP +Starts up grabbing of video frames. +.PP +The actual grabbing and displaying of video frames is performed by a QTimer triggering the SLOT \fBQOpenCamWidget::grabFrame()\fP. \fBstartCapture()\fP sets up the timer running this captureFrame loop. +.PP +The SLOT \fBQOpenCamWidget::startSnap()\fP is used to get image frames out from the widget for other uses, like saving or processing. This function relies on the timer created and configured by \fBstartCapture()\fP, and as such, this function is the only permitted way to start the actual capture/streaming of video from the source. +.PP +Definition at line 217 of file qopencamwidget.cpp. +.PP +References frametimer, grabFrame(), and trigger. +.PP +Referenced by View::View(). +.SS "QImage * QOpenCamWidget::Ipl2QImage (const IplImage * img)" +.PP +Converts from the OpenCV IplImage data structure to a QImage. +.PP +OpenCV uses a data strcuture calles IplImage, optimized for computer vision image processing tasks. This code was adapted from kcamwidget.cpp, part of the KDE SVN at playground/multimedia/kcam/kcamwidget.cpp +.PP +In regard that the IplImage can be forced into a format that aligns well with a RBG888-format, the conversion becomes one of the shortes, simples IplImage->QImage I've seen. +.PP +\fBParameters:\fP +.RS 4 +\fI*img\fP The IplImage to be converted to a QImage. +.RE +.PP + +.PP +Definition at line 241 of file qopencamwidget.cpp. +.PP +Referenced by grabFrame(). +.SS "void QOpenCamWidget::grabFrame (void)\fC [slot]\fP" +.PP +Grabs a frame and causes an update() when triggered. +.PP +This is the SLOT that actually reads the video source and causes the widget to display live video. Preferably this slot will never be called my any other signal that a timeout() on the frametimer, which is controlled by \fBQOpenCamWidget::startCapture()\fP +.PP +Definition at line 266 of file qopencamwidget.cpp. +.PP +References capture, Ipl2QImage(), and nextFrame. +.PP +Referenced by startCapture(). +.SS "void QOpenCamWidget::startSnap (void)\fC [slot]\fP" +.PP +Trigger this slot to save a frame from the widget. +.PP +When this slot is triggered, the widgets capture loop is temporarily stopped, and the last displayed frame is 'captured', and made available through the emitting of the class imageReady SIGNAL. +.PP +With the 'Take snapshot' button visible (setSnapshotVisible(true)), this SLOT is triggered when the user clicks on the trigger button. If you do not wish to use the internal trigger button, you will have to add a different mechanism to trigger this SLOT. +.PP +It is possible, though I would not recommend, to use repeated triggering of this slot to do repeated frame-capture, and thus make a form of 'Animation' or 'Video' capture. +.PP +Definition at line 306 of file qopencamwidget.cpp. +.PP +References frametimer, imageReady(), and nextFrame. +.PP +Referenced by setSnapshotVisible(). +.SS "void QOpenCamWidget::imageReady (QImage snapshot)\fC [signal]\fP" +.PP +Referenced by startSnap(). +.SH "Member Data Documentation" +.PP +.SS "CvCapture* \fBQOpenCamWidget::capture\fP\fC [private]\fP" +.PP +Definition at line 35 of file qopencamwidget.h. +.PP +Referenced by grabCapture(), grabFrame(), and ~QOpenCamWidget(). +.SS "QTimer* \fBQOpenCamWidget::frametimer\fP\fC [private]\fP" +.PP +Definition at line 36 of file qopencamwidget.h. +.PP +Referenced by QOpenCamWidget(), startCapture(), and startSnap(). +.SS "QImage* \fBQOpenCamWidget::nextFrame\fP\fC [private]\fP" +.PP +Definition at line 37 of file qopencamwidget.h. +.PP +Referenced by grabFrame(), paintEvent(), QOpenCamWidget(), and startSnap(). +.SS "QLabel* \fBQOpenCamWidget::canvas\fP\fC [private]\fP" +.PP +Definition at line 39 of file qopencamwidget.h. +.PP +Referenced by grabCapture(), paintEvent(), QOpenCamWidget(), and ~QOpenCamWidget(). +.SS "QVBoxLayout* \fBQOpenCamWidget::layout\fP\fC [private]\fP" +.PP +Definition at line 40 of file qopencamwidget.h. +.PP +Referenced by QOpenCamWidget(), and setSnapshotVisible(). +.SS "QPushButton* \fBQOpenCamWidget::trigger\fP\fC [private]\fP" +.PP +Definition at line 41 of file qopencamwidget.h. +.PP +Referenced by QOpenCamWidget(), setSnapshotVisible(), startCapture(), and ~QOpenCamWidget(). +.SS "bool \fBQOpenCamWidget::trigger_active\fP\fC [private]\fP" +.PP +Definition at line 42 of file qopencamwidget.h. +.PP +Referenced by QOpenCamWidget(), and setSnapshotVisible(). + +.SH "Author" +.PP +Generated automatically by Doxygen for QOpenCamWidget from the source code. diff --git a/doc/man/man3/View.3 b/doc/man/man3/View.3 new file mode 100644 index 0000000..192b38a --- /dev/null +++ b/doc/man/man3/View.3 @@ -0,0 +1,51 @@ +.TH "View" 3 "11 Jun 2009" "QOpenCamWidget" \" -*- nroff -*- +.ad l +.nh +.SH NAME +View \- +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.PP +.SS "Public Slots" + +.in +1c +.ti -1c +.RI "void \fBsaveImage\fP (QImage image)" +.br +.in -1c +.SS "Public Member Functions" + +.in +1c +.ti -1c +.RI "\fBView\fP (QWidget *parent=0)" +.br +.ti -1c +.RI "\fB~View\fP (void)" +.br +.in -1c +.SH "Detailed Description" +.PP +Definition at line 5 of file view.h. +.SH "Constructor & Destructor Documentation" +.PP +.SS "View::View (QWidget * parent = \fC0\fP)" +.PP +Definition at line 32 of file view.cpp. +.PP +References QOpenCamWidget::grabCapture(), saveImage(), QOpenCamWidget::setSnapshotVisible(), and QOpenCamWidget::startCapture(). +.SS "View::~View (void)" +.PP +Definition at line 74 of file view.cpp. +.SH "Member Function Documentation" +.PP +.SS "void View::saveImage (QImage image)\fC [slot]\fP" +.PP +Definition at line 78 of file view.cpp. +.PP +Referenced by View(). + +.SH "Author" +.PP +Generated automatically by Doxygen for QOpenCamWidget from the source code. diff --git a/doc/man/man3/main.cpp.3 b/doc/man/man3/main.cpp.3 new file mode 100644 index 0000000..d14a23d --- /dev/null +++ b/doc/man/man3/main.cpp.3 @@ -0,0 +1,28 @@ +.TH "main.cpp" 3 "11 Jun 2009" "QOpenCamWidget" \" -*- nroff -*- +.ad l +.nh +.SH NAME +main.cpp \- +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br +\fC#include 'view.h'\fP +.br + +.SS "Functions" + +.in +1c +.ti -1c +.RI "int \fBmain\fP (int argc, char *argv[])" +.br +.in -1c +.SH "Function Documentation" +.PP +.SS "int main (int argc, char * argv[])" +.PP +Definition at line 28 of file main.cpp. +.SH "Author" +.PP +Generated automatically by Doxygen for QOpenCamWidget from the source code. diff --git a/doc/man/man3/qopencamwidget.cpp.3 b/doc/man/man3/qopencamwidget.cpp.3 new file mode 100644 index 0000000..b7cc0c4 --- /dev/null +++ b/doc/man/man3/qopencamwidget.cpp.3 @@ -0,0 +1,14 @@ +.TH "qopencamwidget.cpp" 3 "11 Jun 2009" "QOpenCamWidget" \" -*- nroff -*- +.ad l +.nh +.SH NAME +qopencamwidget.cpp \- +.SH SYNOPSIS +.br +.PP +\fC#include 'qopencamwidget.h'\fP +.br + +.SH "Author" +.PP +Generated automatically by Doxygen for QOpenCamWidget from the source code. diff --git a/doc/man/man3/qopencamwidget.h.3 b/doc/man/man3/qopencamwidget.h.3 new file mode 100644 index 0000000..c9c487d --- /dev/null +++ b/doc/man/man3/qopencamwidget.h.3 @@ -0,0 +1,25 @@ +.TH "qopencamwidget.h" 3 "11 Jun 2009" "QOpenCamWidget" \" -*- nroff -*- +.ad l +.nh +.SH NAME +qopencamwidget.h \- +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br +\fC#include \fP +.br +\fC#include \fP +.br + +.SS "Classes" + +.in +1c +.ti -1c +.RI "class \fBQOpenCamWidget\fP" +.br +.in -1c +.SH "Author" +.PP +Generated automatically by Doxygen for QOpenCamWidget from the source code. diff --git a/doc/man/man3/view.cpp.3 b/doc/man/man3/view.cpp.3 new file mode 100644 index 0000000..8a03c21 --- /dev/null +++ b/doc/man/man3/view.cpp.3 @@ -0,0 +1,16 @@ +.TH "view.cpp" 3 "11 Jun 2009" "QOpenCamWidget" \" -*- nroff -*- +.ad l +.nh +.SH NAME +view.cpp \- +.SH SYNOPSIS +.br +.PP +\fC#include 'view.h'\fP +.br +\fC#include 'qopencamwidget.h'\fP +.br + +.SH "Author" +.PP +Generated automatically by Doxygen for QOpenCamWidget from the source code. diff --git a/doc/man/man3/view.h.3 b/doc/man/man3/view.h.3 new file mode 100644 index 0000000..2014d1b --- /dev/null +++ b/doc/man/man3/view.h.3 @@ -0,0 +1,21 @@ +.TH "view.h" 3 "11 Jun 2009" "QOpenCamWidget" \" -*- nroff -*- +.ad l +.nh +.SH NAME +view.h \- +.SH SYNOPSIS +.br +.PP +\fC#include \fP +.br + +.SS "Classes" + +.in +1c +.ti -1c +.RI "class \fBView\fP" +.br +.in -1c +.SH "Author" +.PP +Generated automatically by Doxygen for QOpenCamWidget from the source code. diff --git a/doc/rtf/refman.rtf b/doc/rtf/refman.rtf new file mode 100644 index 0000000..aff5083 --- /dev/null +++ b/doc/rtf/refman.rtf @@ -0,0 +1,1407 @@ +{\rtf1\ansi\ansicpg1252\uc1 \deff0\deflang1033\deflangfe1033 +{\comment Begining font list} +{\fonttbl {\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;} +{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;} +{\f3\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;} +} +{\comment begin colors} +{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;} +{\comment Beginning style list} +{\stylesheet +{\widctlpar\adjustright \fs20\cgrid \snext0 Normal;} +{\s1\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs36\kerning36\cgrid \sbasedon0 \snext0 heading 1;} +{\s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid \sbasedon0 \snext0 heading 2;} +{\s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid \sbasedon0 \snext0 heading 3;} +{\s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid \sbasedon0 \snext0 heading 4;}{\*\cs10 \additive Default Paragraph Font;} +{\s5\sb90\sa30\keepn\widctlpar\adjustright \b\f1\fs20\cgrid \sbasedon0 \snext0 heading 5;}{\*\cs10 \additive Default Paragraph Font;} +{\s15\qc\sb240\sa60\widctlpar\outlinelevel0\adjustright \b\f1\fs32\kerning28\cgrid \sbasedon0 \snext15 Title;} +{\s16\qc\sa60\widctlpar\outlinelevel1\adjustright \f1\cgrid \sbasedon0 \snext16 Subtitle;} +{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid \sbasedon0 \snext17 BodyText;} +{\s18\widctlpar\fs22\cgrid \sbasedon0 \snext18 DenseText;} +{\s28\widctlpar\tqc\tx4320\tqr\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext28 header;} +{\s29\widctlpar\tqc\tx4320\tqr\tx8640\qr\adjustright \fs20\cgrid \sbasedon0 \snext29 footer;} +{\s30\li360\sa60\sb120\keepn\widctlpar\adjustright \b\f1\fs20\cgrid \sbasedon0 \snext30 GroupHeader;} +{\s40\li0\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext41 Code Example 0;} +{\s41\li360\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext42 Code Example 1;} +{\s42\li720\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext43 Code Example 2;} +{\s43\li1080\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext44 Code Example 3;} +{\s44\li1440\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext45 Code Example 4;} +{\s45\li1800\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext46 Code Example 5;} +{\s46\li2160\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext47 Code Example 6;} +{\s47\li2520\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext48 Code Example 7;} +{\s48\li2880\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext49 Code Example 8;} +{\s49\li3240\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext49 Code Example 9;} +{\s50\li0\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext51 List Continue 0;} +{\s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext52 List Continue 1;} +{\s52\li720\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext53 List Continue 2;} +{\s53\li1080\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext54 List Continue 3;} +{\s54\li1440\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext55 List Continue 4;} +{\s55\li1800\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext56 List Continue 5;} +{\s56\li2160\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext57 List Continue 6;} +{\s57\li2520\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext58 List Continue 7;} +{\s58\li2880\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext59 List Continue 8;} +{\s59\li3240\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext59 List Continue 9;} +{\s60\li0\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext61 DescContinue 0;} +{\s61\li360\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext62 DescContinue 1;} +{\s62\li720\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext63 DescContinue 2;} +{\s63\li1080\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext64 DescContinue 3;} +{\s64\li1440\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext65 DescContinue 4;} +{\s65\li1800\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext66 DescContinue 5;} +{\s66\li2160\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext67 DescContinue 6;} +{\s67\li2520\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext68 DescContinue 7;} +{\s68\li2880\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext69 DescContinue 8;} +{\s69\li3240\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext69 DescContinue 9;} +{\s70\li0\sa30\sb30\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext81 LatexTOC 0;} +{\s71\li360\sa27\sb27\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext82 LatexTOC 1;} +{\s72\li720\sa24\sb24\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext83 LatexTOC 2;} +{\s73\li1080\sa21\sb21\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext84 LatexTOC 3;} +{\s74\li1440\sa18\sb18\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext85 LatexTOC 4;} +{\s75\li1800\sa15\sb15\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext86 LatexTOC 5;} +{\s76\li2160\sa12\sb12\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext87 LatexTOC 6;} +{\s77\li2520\sa9\sb9\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext88 LatexTOC 7;} +{\s78\li2880\sa6\sb6\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext89 LatexTOC 8;} +{\s79\li3240\sa3\sb3\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext89 LatexTOC 9;} +{\s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid \sbasedon0 \snext81 \sautoupd List Bullet 0;} +{\s81\fi-360\li720\widctlpar\jclisttab\tx720{\*\pn \pnlvlbody\ilvl0\ls2\pnrnot0\pndec }\ls2\adjustright \fs20\cgrid \sbasedon0 \snext82 \sautoupd List Bullet 1;} +{\s82\fi-360\li1080\widctlpar\jclisttab\tx1080{\*\pn \pnlvlbody\ilvl0\ls3\pnrnot0\pndec }\ls3\adjustright \fs20\cgrid \sbasedon0 \snext83 \sautoupd List Bullet 2;} +{\s83\fi-360\li1440\widctlpar\jclisttab\tx1440{\*\pn \pnlvlbody\ilvl0\ls4\pnrnot0\pndec }\ls4\adjustright \fs20\cgrid \sbasedon0 \snext84 \sautoupd List Bullet 3;} +{\s84\fi-360\li1800\widctlpar\jclisttab\tx1800{\*\pn \pnlvlbody\ilvl0\ls5\pnrnot0\pndec }\ls5\adjustright \fs20\cgrid \sbasedon0 \snext85 \sautoupd List Bullet 4;} +{\s85\fi-360\li2160\widctlpar\jclisttab\tx2160{\*\pn \pnlvlbody\ilvl0\ls6\pnrnot0\pndec }\ls6\adjustright \fs20\cgrid \sbasedon0 \snext86 \sautoupd List Bullet 5;} +{\s86\fi-360\li2520\widctlpar\jclisttab\tx2520{\*\pn \pnlvlbody\ilvl0\ls7\pnrnot0\pndec }\ls7\adjustright \fs20\cgrid \sbasedon0 \snext87 \sautoupd List Bullet 6;} +{\s87\fi-360\li2880\widctlpar\jclisttab\tx2880{\*\pn \pnlvlbody\ilvl0\ls8\pnrnot0\pndec }\ls8\adjustright \fs20\cgrid \sbasedon0 \snext88 \sautoupd List Bullet 7;} +{\s88\fi-360\li3240\widctlpar\jclisttab\tx3240{\*\pn \pnlvlbody\ilvl0\ls9\pnrnot0\pndec }\ls9\adjustright \fs20\cgrid \sbasedon0 \snext89 \sautoupd List Bullet 8;} +{\s89\fi-360\li3600\widctlpar\jclisttab\tx3600{\*\pn \pnlvlbody\ilvl0\ls10\pnrnot0\pndec }\ls10\adjustright \fs20\cgrid \sbasedon0 \snext89 \sautoupd List Bullet 9;} +{\s90\fi-360\li360\widctlpar\fs20\cgrid \sbasedon0 \snext91 \sautoupd List Enum 0;} +{\s91\fi-360\li720\widctlpar\fs20\cgrid \sbasedon0 \snext92 \sautoupd List Enum 1;} +{\s92\fi-360\li1080\widctlpar\fs20\cgrid \sbasedon0 \snext93 \sautoupd List Enum 2;} +{\s93\fi-360\li1440\widctlpar\fs20\cgrid \sbasedon0 \snext94 \sautoupd List Enum 3;} +{\s94\fi-360\li1800\widctlpar\fs20\cgrid \sbasedon0 \snext95 \sautoupd List Enum 4;} +{\s95\fi-360\li2160\widctlpar\fs20\cgrid \sbasedon0 \snext96 \sautoupd List Enum 5;} +{\s96\fi-360\li2520\widctlpar\fs20\cgrid \sbasedon0 \snext96 \sautoupd List Enum 5;} +{\s97\fi-360\li2880\widctlpar\fs20\cgrid \sbasedon0 \snext98 \sautoupd List Enum 7;} +{\s98\fi-360\li3240\widctlpar\fs20\cgrid \sbasedon0 \snext99 \sautoupd List Enum 8;} +{\s99\fi-360\li3600\widctlpar\fs20\cgrid \sbasedon0 \snext99 \sautoupd List Enum 9;} +} +{\comment begin body} +{\info +{\title {\comment QOpenCamWidget }QOpenCamWidget} +{\comment Generated byDoxgyen. } +{\creatim \yr2009\mo6\dy11\hr1\min49\sec57} +}{\comment end of infoblock} +\pard\plain +\sectd\pgnlcrm +{\footer \s29\widctlpar\tqc\tx4320\tqr\tx8640\qr\adjustright \fs20\cgrid {\chpgn}} +{\comment begin title page} +\pard\plain \s16\qc\sa60\widctlpar\outlinelevel1\adjustright \f1\cgrid +\vertalc\qc\par\par\par\par\par\par\par +\pard\plain \s15\qc\sb240\sa60\widctlpar\outlinelevel0\adjustright \b\f1\fs32\kerning28\cgrid +{\field\fldedit {\*\fldinst TITLE \\*MERGEFORMAT}{\fldrslt TITLE}}\par +\pard\plain \s16\qc\sa60\widctlpar\outlinelevel1\adjustright \f1\cgrid +\par +\par\par\par\par\par\par\par\par\par\par\par\par +\pard\plain \s16\qc\sa60\widctlpar\outlinelevel1\adjustright \f1\cgrid +{\field\fldedit {\*\fldinst AUTHOR \\*MERGEFORMAT}{\fldrslt AUTHOR}}\par +Version \par{\field\fldedit {\*\fldinst CREATEDATE \\*MERGEFORMAT}{\fldrslt CREATEDATE}}\par +\page\page{\comment End title page} +{\comment Table of contents} +\vertalt +\pard\plain +\s1\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs36\kerning36\cgrid Table of Contents\par +\pard\plain \par +{\field\fldedit {\*\fldinst TOC \\f \\*MERGEFORMAT}{\fldrslt Table of contents}}\par +\pard\plain +{\comment Beginning Body of RTF Document} +\sect \sbkpage \pgndec \pgnrestart +\sect \sectd \sbknone +{\footer \s29\widctlpar\tqc\tx4320\tqr\tx8640\qr\adjustright \fs20\cgrid {\chpgn}} + +{\comment BeginRTFChapter} +\pard\plain \sect\sbkpage +\s1\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs36\kerning36\cgrid +Class Index\par \pard\plain +{\tc \v Class Index} +{\comment begin include annotated.rtf} +{\comment startTitleHead} +\pard\plain \s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +Class List{\comment endTitleHead} +\par \pard\plain +{\comment startTextBlock} +{ +\pard\plain \s17\sa60\sb30\widctlpar\qj \fs22\cgrid Here are the classes, structs, unions and interfaces with brief descriptions:{\comment endTextBlock} +} +{\comment (startIndexList)} +{ +\par +\pard\plain \s71\li360\sa27\sb27\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid +{\comment (startIndexKey)} +{\b {\b QOpenCamWidget}{\comment (endIndexKey)} +{\comment (startIndexValue)} + {\comment (endIndexValue)} +} \tab {\field\fldedit {\*\fldinst PAGEREF AAAAAAAAAG \\*MERGEFORMAT}{\fldrslt pagenum}} +{\comment (newParagraph)} +\par +{\comment (startIndexKey)} +{\b {\b View}{\comment (endIndexKey)} +{\comment (startIndexValue)} + {\comment (endIndexValue)} +} \tab {\field\fldedit {\*\fldinst PAGEREF AAAAAAAAAH \\*MERGEFORMAT}{\fldrslt pagenum}} +{\comment (newParagraph)} +\par +{\comment (endIndexList)} +\par}{\comment endFile} +{\comment end include annotated.rtf} + +{\comment BeginRTFChapter} +\pard\plain \sect\sbkpage +\s1\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs36\kerning36\cgrid +File Index\par \pard\plain +{\tc \v File Index} +{\comment begin include files.rtf} +{\comment startTitleHead} +\pard\plain \s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +File List{\comment endTitleHead} +\par \pard\plain +{\comment startTextBlock} +{ +\pard\plain \s17\sa60\sb30\widctlpar\qj \fs22\cgrid Here is a list of all files with brief descriptions:{\comment endTextBlock} +} +{\comment (startIndexList)} +{ +\par +\pard\plain \s71\li360\sa27\sb27\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid +{\comment (startIndexKey)} +{\b {\b main.cpp}{\comment (endIndexKey)} +{\comment (startIndexValue)} + {\comment (endIndexValue)} +} \tab {\field\fldedit {\*\fldinst PAGEREF AAAAAAAAAA \\*MERGEFORMAT}{\fldrslt pagenum}} +{\comment (newParagraph)} +\par +{\comment (startIndexKey)} +{\b {\b qopencamwidget.cpp}{\comment (endIndexKey)} +{\comment (startIndexValue)} + {\comment (endIndexValue)} +} \tab {\field\fldedit {\*\fldinst PAGEREF AAAAAAAAAC \\*MERGEFORMAT}{\fldrslt pagenum}} +{\comment (newParagraph)} +\par +{\comment (startIndexKey)} +{\b {\b qopencamwidget.h}{\comment (endIndexKey)} +{\comment (startIndexValue)} + {\comment (endIndexValue)} +} \tab {\field\fldedit {\*\fldinst PAGEREF AAAAAAAAAD \\*MERGEFORMAT}{\fldrslt pagenum}} +{\comment (newParagraph)} +\par +{\comment (startIndexKey)} +{\b {\b view.cpp}{\comment (endIndexKey)} +{\comment (startIndexValue)} + {\comment (endIndexValue)} +} \tab {\field\fldedit {\*\fldinst PAGEREF AAAAAAAAAE \\*MERGEFORMAT}{\fldrslt pagenum}} +{\comment (newParagraph)} +\par +{\comment (startIndexKey)} +{\b {\b view.h}{\comment (endIndexKey)} +{\comment (startIndexValue)} + {\comment (endIndexValue)} +} \tab {\field\fldedit {\*\fldinst PAGEREF AAAAAAAAAF \\*MERGEFORMAT}{\fldrslt pagenum}} +{\comment (newParagraph)} +\par +{\comment (endIndexList)} +\par}{\comment endFile} +{\comment end include files.rtf} + +{\comment BeginRTFChapter} +\pard\plain \sect\sbkpage +\s1\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs36\kerning36\cgrid +Class Documentation{\tc \v Class Documentation} +\par \pard\plain +{\comment begin include classQOpenCamWidget.rtf} +{\comment startTitleHead} +\pard\plain \s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +QOpenCamWidget Class Reference{\comment endTitleHead} +\par \pard\plain +{\tc\tcl2 \v QOpenCamWidget} +{\xe \v QOpenCamWidget} +{\comment writeAnchor (classQOpenCamWidget)} +{\bkmkstart AAAAAAAAAG} +{\bkmkend AAAAAAAAAG} +{\comment startTextBlock} +{ +\pard\plain \s17\sa60\sb30\widctlpar\qj \fs22\cgrid {\f2 #include }{\comment (newParagraph)} +\par +{\comment (newParagraph)} +\par +{\comment endTextBlock} +} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Public Slots{\comment endGroupHeader} +\par +\pard\plain + +{\comment (startMemberList) } +{ +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +void {\b grabFrame} (void){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (startMemberDescription)} +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid {\i {\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Grabs a frame and causes an update() when triggered. \par +}{\comment (endMemberDescription)} +}} +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +void {\b startSnap} (){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (startMemberDescription)} +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid {\i {\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Trigger this slot to save a frame from the widget. \par +}{\comment (endMemberDescription)} +}} +{\comment (endMemberList) } +} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Signals{\comment endGroupHeader} +\par +\pard\plain + +{\comment (startMemberList) } +{ +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +void {\b imageReady} (QImage snapshot){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (endMemberList) } +} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Public Member Functions{\comment endGroupHeader} +\par +\pard\plain + +{\comment (startMemberList) } +{ +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +{\b QOpenCamWidget} (QWidget *parent=0){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (startMemberDescription)} +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid {\i {\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Consctructs a QWidget based widget for displaying video coming from an OpenCV capture source. \par +}{\comment (endMemberDescription)} +}} +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +{\b ~QOpenCamWidget} (void){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +void {\b paintEvent} (QPaintEvent *event){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (startMemberDescription)} +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid {\i {\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +A paint event is a request to repaint all or part of a widget. \par +}{\comment (endMemberDescription)} +}} +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +void {\b setSnapshotVisible} (bool visible){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (startMemberDescription)} +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid {\i {\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Changes the visibility of the optional built-in "Take snapshot" button. \par +}{\comment (endMemberDescription)} +}} +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +bool {\b grabCapture} (int source){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (startMemberDescription)} +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid {\i {\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Grabs an OpenCV video capture source. \par +}{\comment (endMemberDescription)} +}} +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +void {\b startCapture} (void){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (startMemberDescription)} +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid {\i {\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Starts up grabbing of video frames. \par +}{\comment (endMemberDescription)} +}} +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +QImage * {\b Ipl2QImage} (const IplImage *img){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (startMemberDescription)} +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid {\i {\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Converts from the OpenCV IplImage data structure to a QImage. \par +}{\comment (endMemberDescription)} +}} +{\comment (endMemberList) } +} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Private Attributes{\comment endGroupHeader} +\par +\pard\plain + +{\comment (startMemberList) } +{ +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +CvCapture * {\b capture}{\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +QTimer * {\b frametimer}{\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +QImage * {\b nextFrame}{\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +QLabel * {\b canvas}{\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +QVBoxLayout * {\b layout}{\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +QPushButton * {\b trigger}{\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +bool {\b trigger_active}{\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (endMemberList) } +} +{\comment (rtfwriteRuler_thin)} +{\pard\widctlpar\brdrb\brdrs\brdrw5\brsp20 \adjustright \par} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Detailed Description{\comment endGroupHeader} +\par +\pard\plain +{\comment startTextBlock} +{ +\pard\plain \s17\sa60\sb30\widctlpar\qj \fs22\cgrid {\comment startParagraph} +{ +Definition at line 29 of file qopencamwidget.h.{\comment endParagraph} +}\par +{\comment endTextBlock} +} +{\comment (rtfwriteRuler_thin)} +{\pard\widctlpar\brdrb\brdrs\brdrw5\brsp20 \adjustright \par} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Constructor & Destructor Documentation{\comment endGroupHeader} +\par +\pard\plain +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v QOpenCamWidget\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:QOpenCamWidget} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +QOpenCamWidget::QOpenCamWidget ({\comment (startParameterList)} +QWidget * {\i parent} = {\f2 0}){\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAI} +{\bkmkend AAAAAAAAAI} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Consctructs a QWidget based widget for displaying video coming from an OpenCV capture source. \par +}{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Including webcam data in a Qt application can be problematic, at least as long as Phonon does not support webcams, and the Phonon GStreamer backend only supports simple pipelines.\par +This class solves the complexity of adding a webcam view, by using the cross-platform available OpenCV library.\par +Limitations, i.e. reasons to read this code and reimplement, are: saving or streaming video is not really available (unless you do repeated timer-triggered connections to the startSnap slot), the widget size is identical to the video source dimensions (it resizes the wodget using setMinimuSize to the video dimensions, and does not handle resizing to sizes above this dimension.\par +A brief summary of how to use this class: { +\par +\pard\plain \s41\li360\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid QOpenCamWidget *cw = new QOpenCamWidget(this);{\comment (lineBreak)} +\par + if ( cw->grabCapture(-1) ) \{{\comment (lineBreak)} +\par + cw->setSnapshotVisible(true);{\comment (lineBreak)} +\par + cw->startCapture();{\comment (lineBreak)} +\par + \}{\comment (lineBreak)} +\par + connect( cw, SIGNAL(imageReady(QImage)), this, SLOT(saveImage(QImage)));{\comment (lineBreak)} +\par +} +\par +{{\s5\sb90\sa30\keepn\widctlpar\adjustright \b\f1\fs20\cgrid +Parameters:\par} +\pard\plain \s62\li720\widctlpar\ql\adjustright \fs20\cgrid {\i *parent} The parent widget containing this widget, defaults to NULL. \par +} +}{\comment startParagraph} +{ +Definition at line 60 of file qopencamwidget.cpp.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +References canvas, frametimer, layout, nextFrame, trigger, and trigger_active.{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v ~QOpenCamWidget\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:~QOpenCamWidget} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +QOpenCamWidget::~QOpenCamWidget ({\comment (startParameterList)} +void){\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAJ} +{\bkmkend AAAAAAAAAJ} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Definition at line 88 of file qopencamwidget.cpp.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +References canvas, capture, and trigger.{\comment endParagraph} +}\par +} +{\comment (rtfwriteRuler_thin)} +{\pard\widctlpar\brdrb\brdrs\brdrw5\brsp20 \adjustright \par} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Member Function Documentation{\comment endGroupHeader} +\par +\pard\plain +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v paintEvent\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:paintEvent} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +void QOpenCamWidget::paintEvent ({\comment (startParameterList)} +QPaintEvent * {\i event}){\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAK} +{\bkmkend AAAAAAAAAK} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +A paint event is a request to repaint all or part of a widget. \par +}{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +It can happen for one of the following reasons:\par +{ +\par\pard\plain \s81\fi-360\li720\widctlpar\jclisttab\tx720{\*\pn \pnlvlbody\ilvl0\ls2\pnrnot0\pndec }\ls2\adjustright \fs20\cgrid +repaint() or update() was invoked, \par\pard\plain \s81\fi-360\li720\widctlpar\jclisttab\tx720{\*\pn \pnlvlbody\ilvl0\ls2\pnrnot0\pndec }\ls2\adjustright \fs20\cgrid +the widget was obscured and has now been uncovered, or \par\pard\plain \s81\fi-360\li720\widctlpar\jclisttab\tx720{\*\pn \pnlvlbody\ilvl0\ls2\pnrnot0\pndec }\ls2\adjustright \fs20\cgrid +many other reasons.\par +} +{\b QOpenCamWidget} uses the paintEvent to draw each frame onto the screen. The paintEvent itself is regularily triggered by explicit update() calls in {\b QOpenCamWidget::grabFrame()}. \par +}{\comment startParagraph} +{ +Definition at line 144 of file qopencamwidget.cpp.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +References canvas, and nextFrame.{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v setSnapshotVisible\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:setSnapshotVisible} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +void QOpenCamWidget::setSnapshotVisible ({\comment (startParameterList)} +bool {\i visible}){\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAL} +{\bkmkend AAAAAAAAAL} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Changes the visibility of the optional built-in "Take snapshot" button. \par +}{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +The widget contains a push-button that optionally can be displayed. When visible, this button is located at the bottom of the widget, and causes the SLOT {\b QOpenCamWidget::startSnap} to be triggered when clicked.\par +{{\s5\sb90\sa30\keepn\widctlpar\adjustright \b\f1\fs20\cgrid +Parameters:\par} +\pard\plain \s62\li720\widctlpar\ql\adjustright \fs20\cgrid {\i visible} True makes the button display, and trigger, false turns the feature off. False, i.e. no button, is default. \par +} +}{\comment startParagraph} +{ +Definition at line 110 of file qopencamwidget.cpp.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +References layout, startSnap(), trigger, and trigger_active.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by View::View().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v grabCapture\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:grabCapture} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +bool QOpenCamWidget::grabCapture ({\comment (startParameterList)} +int {\i source}){\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAM} +{\bkmkend AAAAAAAAAM} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Grabs an OpenCV video capture source. \par +}{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +By grabbing a source, it is meant to open the capture source, and have it ready to start streaming/capturing frames. Returns true on success, false on error. The grabCapture is separated from the constructor and/or frame-grabbing, so that you may do the error-checking you really should do before proceeding.\par +{{\s5\sb90\sa30\keepn\widctlpar\adjustright \b\f1\fs20\cgrid +Parameters:\par} +\pard\plain \s62\li720\widctlpar\ql\adjustright \fs20\cgrid {\i source} The OpenCV capture source enumeration index to open \par +} +}{\comment startParagraph} +{ +Definition at line 183 of file qopencamwidget.cpp.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +References canvas, and capture.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by View::View().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v startCapture\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:startCapture} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +void QOpenCamWidget::startCapture ({\comment (startParameterList)} +void){\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAN} +{\bkmkend AAAAAAAAAN} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Starts up grabbing of video frames. \par +}{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +The actual grabbing and displaying of video frames is performed by a QTimer triggering the SLOT {\b QOpenCamWidget::grabFrame()}. {\b startCapture()} sets up the timer running this captureFrame loop.\par +The SLOT {\b QOpenCamWidget::startSnap()} is used to get image frames out from the widget for other uses, like saving or processing. This function relies on the timer created and configured by {\b startCapture()}, and as such, this function is the only permitted way to start the actual capture/streaming of video from the source. \par +}{\comment startParagraph} +{ +Definition at line 217 of file qopencamwidget.cpp.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +References frametimer, grabFrame(), and trigger.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by View::View().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v Ipl2QImage\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:Ipl2QImage} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +QImage * QOpenCamWidget::Ipl2QImage ({\comment (startParameterList)} +const IplImage * {\i img}){\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAO} +{\bkmkend AAAAAAAAAO} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Converts from the OpenCV IplImage data structure to a QImage. \par +}{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +OpenCV uses a data strcuture calles IplImage, optimized for computer vision image processing tasks. This code was adapted from kcamwidget.cpp, part of the KDE SVN at playground/multimedia/kcam/kcamwidget.cpp\par +In regard that the IplImage can be forced into a format that aligns well with a RBG888-format, the conversion becomes one of the shortes, simples IplImage->QImage I've seen.\par +{{\s5\sb90\sa30\keepn\widctlpar\adjustright \b\f1\fs20\cgrid +Parameters:\par} +\pard\plain \s62\li720\widctlpar\ql\adjustright \fs20\cgrid {\i *img} The IplImage to be converted to a QImage. \par +} +}{\comment startParagraph} +{ +Definition at line 241 of file qopencamwidget.cpp.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by grabFrame().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v grabFrame\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:grabFrame} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +void QOpenCamWidget::grabFrame ({\comment (startParameterList)} +void){\f2 [slot]}{\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAP} +{\bkmkend AAAAAAAAAP} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Grabs a frame and causes an update() when triggered. \par +}{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +This is the SLOT that actually reads the video source and causes the widget to display live video. Preferably this slot will never be called my any other signal that a timeout() on the frametimer, which is controlled by {\b QOpenCamWidget::startCapture()} \par +}{\comment startParagraph} +{ +Definition at line 266 of file qopencamwidget.cpp.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +References capture, Ipl2QImage(), and nextFrame.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by startCapture().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v startSnap\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:startSnap} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +void QOpenCamWidget::startSnap ({\comment (startParameterList)} +void){\f2 [slot]}{\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAQ} +{\bkmkend AAAAAAAAAQ} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +Trigger this slot to save a frame from the widget. \par +}{\s17\sa60\sb30\widctlpar\qj \fs22\cgrid +When this slot is triggered, the widgets capture loop is temporarily stopped, and the last displayed frame is "captured", and made available through the emitting of the class imageReady SIGNAL.\par +With the "Take snapshot" button visible (setSnapshotVisible(true)), this SLOT is triggered when the user clicks on the trigger button. If you do not wish to use the internal trigger button, you will have to add a different mechanism to trigger this SLOT.\par +It is possible, though I would not recommend, to use repeated triggering of this slot to do repeated frame-capture, and thus make a form of "Animation" or "Video" capture. \par +}{\comment startParagraph} +{ +Definition at line 306 of file qopencamwidget.cpp.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +References frametimer, imageReady(), and nextFrame.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by setSnapshotVisible().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v imageReady\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:imageReady} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +void QOpenCamWidget::imageReady ({\comment (startParameterList)} +QImage {\i snapshot}){\f2 [signal]}{\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAR} +{\bkmkend AAAAAAAAAR} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Referenced by startSnap().{\comment endParagraph} +}\par +} +{\comment (rtfwriteRuler_thin)} +{\pard\widctlpar\brdrb\brdrs\brdrw5\brsp20 \adjustright \par} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Member Data Documentation{\comment endGroupHeader} +\par +\pard\plain +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v capture\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:capture} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +CvCapture* {\b QOpenCamWidget::capture}{\f2 [private]}{\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAS} +{\bkmkend AAAAAAAAAS} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Definition at line 35 of file qopencamwidget.h.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by grabCapture(), grabFrame(), and ~QOpenCamWidget().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v frametimer\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:frametimer} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +QTimer* {\b QOpenCamWidget::frametimer}{\f2 [private]}{\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAT} +{\bkmkend AAAAAAAAAT} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Definition at line 36 of file qopencamwidget.h.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by QOpenCamWidget(), startCapture(), and startSnap().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v nextFrame\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:nextFrame} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +QImage* {\b QOpenCamWidget::nextFrame}{\f2 [private]}{\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAU} +{\bkmkend AAAAAAAAAU} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Definition at line 37 of file qopencamwidget.h.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by grabFrame(), paintEvent(), QOpenCamWidget(), and startSnap().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v canvas\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:canvas} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +QLabel* {\b QOpenCamWidget::canvas}{\f2 [private]}{\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAV} +{\bkmkend AAAAAAAAAV} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Definition at line 39 of file qopencamwidget.h.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by grabCapture(), paintEvent(), QOpenCamWidget(), and ~QOpenCamWidget().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v layout\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:layout} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +QVBoxLayout* {\b QOpenCamWidget::layout}{\f2 [private]}{\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAW} +{\bkmkend AAAAAAAAAW} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Definition at line 40 of file qopencamwidget.h.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by QOpenCamWidget(), and setSnapshotVisible().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v trigger\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:trigger} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +QPushButton* {\b QOpenCamWidget::trigger}{\f2 [private]}{\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAX} +{\bkmkend AAAAAAAAAX} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Definition at line 41 of file qopencamwidget.h.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by QOpenCamWidget(), setSnapshotVisible(), startCapture(), and ~QOpenCamWidget().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v trigger_active\:QOpenCamWidget} +{\xe \v QOpenCamWidget\:trigger_active} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +bool {\b QOpenCamWidget::trigger_active}{\f2 [private]}{\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAY} +{\bkmkend AAAAAAAAAY} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Definition at line 42 of file qopencamwidget.h.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by QOpenCamWidget(), and setSnapshotVisible().{\comment endParagraph} +}\par +} +{\comment startTextBlock} +{ +\pard\plain \s17\sa60\sb30\widctlpar\qj \fs22\cgrid {\comment (rtfwriteRuler_thin)} +{\pard\widctlpar\brdrb\brdrs\brdrw5\brsp20 \adjustright \par} +The documentation for this class was generated from the following files:{\comment (startItemList level=0) } +{{\comment (writeListItem)} +{\comment (newParagraph)} +\par +\pard\plain \s81\fi-360\li720\widctlpar\jclisttab\tx720{\*\pn \pnlvlbody\ilvl0\ls2\pnrnot0\pndec }\ls2\adjustright \fs20\cgrid +{\b qopencamwidget.h}{\comment (writeListItem)} +{\comment (newParagraph)} +\par +\pard\plain \s81\fi-360\li720\widctlpar\jclisttab\tx720{\*\pn \pnlvlbody\ilvl0\ls2\pnrnot0\pndec }\ls2\adjustright \fs20\cgrid +{\b qopencamwidget.cpp}{\comment (newParagraph)} +\par +{\comment (endItemList level=1)} +}{\comment endTextBlock} +} +{\comment endFile} +{\comment end include classQOpenCamWidget.rtf} +\par \pard\plain + +{\comment BeginRTFSection} +\pard\plain \sect\sbkpage +\s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +{\comment begin include classView.rtf} +{\comment startTitleHead} +\pard\plain \s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +View Class Reference{\comment endTitleHead} +\par \pard\plain +{\tc\tcl2 \v View} +{\xe \v View} +{\comment writeAnchor (classView)} +{\bkmkstart AAAAAAAAAH} +{\bkmkend AAAAAAAAAH} +{\comment startTextBlock} +{ +\pard\plain \s17\sa60\sb30\widctlpar\qj \fs22\cgrid {\f2 #include }{\comment (newParagraph)} +\par +{\comment (newParagraph)} +\par +{\comment endTextBlock} +} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Public Slots{\comment endGroupHeader} +\par +\pard\plain + +{\comment (startMemberList) } +{ +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +void {\b saveImage} (QImage image){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (endMemberList) } +} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Public Member Functions{\comment endGroupHeader} +\par +\pard\plain + +{\comment (startMemberList) } +{ +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +{\b View} (QWidget *parent=0){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +{\b ~View} (void){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (endMemberList) } +} +{\comment (rtfwriteRuler_thin)} +{\pard\widctlpar\brdrb\brdrs\brdrw5\brsp20 \adjustright \par} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Detailed Description{\comment endGroupHeader} +\par +\pard\plain +{\comment startTextBlock} +{ +\pard\plain \s17\sa60\sb30\widctlpar\qj \fs22\cgrid {\comment startParagraph} +{ +Definition at line 5 of file view.h.{\comment endParagraph} +}\par +{\comment endTextBlock} +} +{\comment (rtfwriteRuler_thin)} +{\pard\widctlpar\brdrb\brdrs\brdrw5\brsp20 \adjustright \par} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Constructor & Destructor Documentation{\comment endGroupHeader} +\par +\pard\plain +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v View\:View} +{\xe \v View\:View} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +View::View ({\comment (startParameterList)} +QWidget * {\i parent} = {\f2 0}){\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAZ} +{\bkmkend AAAAAAAAAZ} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Definition at line 32 of file view.cpp.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +References QOpenCamWidget::grabCapture(), saveImage(), QOpenCamWidget::setSnapshotVisible(), and QOpenCamWidget::startCapture().{\comment endParagraph} +}\par +} +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v ~View\:View} +{\xe \v View\:~View} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +View::~View ({\comment (startParameterList)} +void){\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAABA} +{\bkmkend AAAAAAAABA} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Definition at line 74 of file view.cpp.{\comment endParagraph} +}\par +} +{\comment (rtfwriteRuler_thin)} +{\pard\widctlpar\brdrb\brdrs\brdrw5\brsp20 \adjustright \par} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Member Function Documentation{\comment endGroupHeader} +\par +\pard\plain +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v saveImage\:View} +{\xe \v View\:saveImage} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +void View::saveImage ({\comment (startParameterList)} +QImage {\i image}){\f2 [slot]}{\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAABB} +{\bkmkend AAAAAAAABB} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Definition at line 78 of file view.cpp.{\comment endParagraph} +}\par +{\comment startParagraph} +{ +Referenced by View().{\comment endParagraph} +}\par +} +{\comment startTextBlock} +{ +\pard\plain \s17\sa60\sb30\widctlpar\qj \fs22\cgrid {\comment (rtfwriteRuler_thin)} +{\pard\widctlpar\brdrb\brdrs\brdrw5\brsp20 \adjustright \par} +The documentation for this class was generated from the following files:{\comment (startItemList level=0) } +{{\comment (writeListItem)} +{\comment (newParagraph)} +\par +\pard\plain \s81\fi-360\li720\widctlpar\jclisttab\tx720{\*\pn \pnlvlbody\ilvl0\ls2\pnrnot0\pndec }\ls2\adjustright \fs20\cgrid +{\b view.h}{\comment (writeListItem)} +{\comment (newParagraph)} +\par +\pard\plain \s81\fi-360\li720\widctlpar\jclisttab\tx720{\*\pn \pnlvlbody\ilvl0\ls2\pnrnot0\pndec }\ls2\adjustright \fs20\cgrid +{\b view.cpp}{\comment (newParagraph)} +\par +{\comment (endItemList level=1)} +}{\comment endTextBlock} +} +{\comment endFile} +{\comment end include classView.rtf} + +{\comment BeginRTFChapter} +\pard\plain \sect\sbkpage +\s1\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs36\kerning36\cgrid +File Documentation{\tc \v File Documentation} +\par \pard\plain +{\comment begin include main_8cpp.rtf} +{\comment startTitleHead} +\pard\plain \s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +main.cpp File Reference{\comment endTitleHead} +\par \pard\plain +{\tc\tcl2 \v main.cpp} +{\xe \v main.cpp} +{\comment writeAnchor (main_8cpp)} +{\bkmkstart AAAAAAAAAA} +{\bkmkend AAAAAAAAAA} +{\comment startTextBlock} +{ +\pard\plain \s18\widctlpar\fs22\cgrid {\f2 #include }{\comment (lineBreak)} +\par +{\f2 #include "view.h"}{\comment (lineBreak)} +\par +{\comment endTextBlock} +} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Functions{\comment endGroupHeader} +\par +\pard\plain + +{\comment (startMemberList) } +{ +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +int {\b main} (int argc, char *argv[]){\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (endMemberList) } +} +{\comment (rtfwriteRuler_thin)} +{\pard\widctlpar\brdrb\brdrs\brdrw5\brsp20 \adjustright \par} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Function Documentation{\comment endGroupHeader} +\par +\pard\plain +{\comment startDoxyAnchor} +{\comment startMemberDoc} +{\xe \v main\:main.cpp} +{\xe \v main.cpp\:main} +\pard\plain \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid { +{\b +int main ({\comment (startParameterList)} +int {\i argc}, {\comment (startParameterList)} + char * {\i argv}[]){\comment endMemberDoc} +} +}{\comment (newParagraph)} +\par +{\comment endDoxyAnchor} +{\bkmkstart AAAAAAAAAB} +{\bkmkend AAAAAAAAAB} +{\comment (startIndent) } +{ +\pard\plain \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid +{\comment startParagraph} +{\comment (newParagraph)} +\par +{ +Definition at line 28 of file main.cpp.{\comment endParagraph} +}\par +} +{\comment endFile} +{\comment end include main_8cpp.rtf} +\par \pard\plain + +{\comment BeginRTFSection} +\pard\plain \sect\sbkpage +\s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +{\comment begin include qopencamwidget_8cpp.rtf} +{\comment startTitleHead} +\pard\plain \s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +qopencamwidget.cpp File Reference{\comment endTitleHead} +\par \pard\plain +{\tc\tcl2 \v qopencamwidget.cpp} +{\xe \v qopencamwidget.cpp} +{\comment writeAnchor (qopencamwidget_8cpp)} +{\bkmkstart AAAAAAAAAC} +{\bkmkend AAAAAAAAAC} +{\comment startTextBlock} +{ +\pard\plain \s18\widctlpar\fs22\cgrid {\f2 #include "qopencamwidget.h"}{\comment (lineBreak)} +\par +{\comment endTextBlock} +} +{\comment endFile} +{\comment end include qopencamwidget_8cpp.rtf} +\par \pard\plain + +{\comment BeginRTFSection} +\pard\plain \sect\sbkpage +\s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +{\comment begin include qopencamwidget_8h.rtf} +{\comment startTitleHead} +\pard\plain \s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +qopencamwidget.h File Reference{\comment endTitleHead} +\par \pard\plain +{\tc\tcl2 \v qopencamwidget.h} +{\xe \v qopencamwidget.h} +{\comment writeAnchor (qopencamwidget_8h)} +{\bkmkstart AAAAAAAAAD} +{\bkmkend AAAAAAAAAD} +{\comment startTextBlock} +{ +\pard\plain \s18\widctlpar\fs22\cgrid {\f2 #include }{\comment (lineBreak)} +\par +{\f2 #include }{\comment (lineBreak)} +\par +{\f2 #include }{\comment (lineBreak)} +\par +{\comment endTextBlock} +} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Classes{\comment endGroupHeader} +\par +\pard\plain + +{\comment (startMemberList) } +{ +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +class {\b QOpenCamWidget}{\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (endMemberList) } +} +{\comment endFile} +{\comment end include qopencamwidget_8h.rtf} +\par \pard\plain + +{\comment BeginRTFSection} +\pard\plain \sect\sbkpage +\s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +{\comment begin include view_8cpp.rtf} +{\comment startTitleHead} +\pard\plain \s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +view.cpp File Reference{\comment endTitleHead} +\par \pard\plain +{\tc\tcl2 \v view.cpp} +{\xe \v view.cpp} +{\comment writeAnchor (view_8cpp)} +{\bkmkstart AAAAAAAAAE} +{\bkmkend AAAAAAAAAE} +{\comment startTextBlock} +{ +\pard\plain \s18\widctlpar\fs22\cgrid {\f2 #include "view.h"}{\comment (lineBreak)} +\par +{\f2 #include "qopencamwidget.h"}{\comment (lineBreak)} +\par +{\comment endTextBlock} +} +{\comment endFile} +{\comment end include view_8cpp.rtf} +\par \pard\plain + +{\comment BeginRTFSection} +\pard\plain \sect\sbkpage +\s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +{\comment begin include view_8h.rtf} +{\comment startTitleHead} +\pard\plain \s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid +view.h File Reference{\comment endTitleHead} +\par \pard\plain +{\tc\tcl2 \v view.h} +{\xe \v view.h} +{\comment writeAnchor (view_8h)} +{\bkmkstart AAAAAAAAAF} +{\bkmkend AAAAAAAAAF} +{\comment startTextBlock} +{ +\pard\plain \s18\widctlpar\fs22\cgrid {\f2 #include }{\comment (lineBreak)} +\par +{\comment endTextBlock} +} +{\comment startGroupHeader} +\pard\plain \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid +Classes{\comment endGroupHeader} +\par +\pard\plain + +{\comment (startMemberList) } +{ +{\comment startMemberItem } +\pard\plain \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid +class {\b View}{\comment endMemberItem } +{\comment (newParagraph)} +\par +{\comment (endMemberList) } +} +{\comment endFile} +{\comment end include view_8h.rtf} + +{\comment BeginRTFChapter} +\pard\plain \sect\sbkpage +\s1\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs36\kerning36\cgrid +\s1\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs36\kerning36\cgrid Index\par +\pard\plain +{\tc \v Index} +{\field\fldedit {\*\fldinst INDEX \\c2 \\*MERGEFORMAT}{\fldrslt INDEX}} +{\comment endFile} +} \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..787a7eb --- /dev/null +++ b/main.cpp @@ -0,0 +1,36 @@ +/* + QOpenCamWidget demo application main code stup (main.c) + This file is part of a demonstration application, illustrating + how to use the QOpenCamWidget, a Qt 4 widget that displays + video input from a webcam, along with a snapshot button. + + Copyright (C) 2009 Jon Langseth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation in its version 2 + of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include +#include "view.h" + +// The contents of this file is simply a Qt Main app stub. +int main (int argc, char*argv[]) +{ + QApplication app(argc, argv); + app.setApplicationName("QOpenCamWidget testapp"); + View v; + v.show(); + return app.exec(); +} + diff --git a/notes b/notes new file mode 100644 index 0000000..b93ff9c --- /dev/null +++ b/notes @@ -0,0 +1,7 @@ +/* + * http://dridk.blogspot.com/2009/05/webcam-for-kde-new-way-for-gluon-games.html + * http://websvn.kde.org/trunk/playground/multimedia/kcam/kcamwidget.cpp?view=markup&pathrev=971995 + + * http://websvn.kde.org/trunk/playground/multimedia/kcam/kcamwidget.h?view=markup + * http://websvn.kde.org/trunk/playground/multimedia/kcam/kcam.cpp?view=markup + */ diff --git a/qcv.pro b/qcv.pro new file mode 100644 index 0000000..3ad259c --- /dev/null +++ b/qcv.pro @@ -0,0 +1,9 @@ +TEMPLATE = app +TARGET = qcv +DEPENDPATH += . +LIBS += -lcv -lhighgui + +SOURCES += main.cpp qopencamwidget.cpp view.cpp +HEADERS += qopencamwidget.h view.h + + diff --git a/qopencamwidget.cpp b/qopencamwidget.cpp new file mode 100644 index 0000000..cd5d1b2 --- /dev/null +++ b/qopencamwidget.cpp @@ -0,0 +1,319 @@ +/* + This file is one part of two, that together make + QOpenCamWidget, a Qt 4 widget that displays video input + from a webcam, along with an optional snapshot button. + + Copyright (C) 2009 Jon Langseth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation in its version 2 + of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "qopencamwidget.h" + +// ------------------------------------------------------------- // +// Constructor and Destructor +// ------------------------------------------------------------- // + +/*! + * \brief Consctructs a QWidget based widget for displaying video + * coming from an OpenCV capture source + * + * Including webcam data in a Qt application can be problematic, + * at least as long as Phonon does not support webcams, and the + * Phonon GStreamer backend only supports simple pipelines. + * + * This class solves the complexity of adding a webcam view, + * by using the cross-platform available OpenCV library. + * + * Limitations, i.e. reasons to read this code and reimplement, + * are: saving or streaming video is not really available (unless + * you do repeated timer-triggered connections to the startSnap slot), + * the widget size is identical to the video source dimensions (it + * resizes the wodget using setMinimuSize to the video dimensions, + * and does not handle resizing to sizes above this dimension. + * + * A brief summary of how to use this class: + * \code + * QOpenCamWidget *cw = new QOpenCamWidget(this); + * if ( cw->grabCapture(-1) ) { + * cw->setSnapshotVisible(true); + * cw->startCapture(); + * } + * connect( cw, SIGNAL(imageReady(QImage)), this, SLOT(saveImage(QImage))); + * \endcode + * + * \param *parent The parent widget containing this widget, defaults to NULL. + * + **/ +QOpenCamWidget::QOpenCamWidget(QWidget *parent) + : QWidget(parent) +{ + // private CvCapture *nextFrame from class definition + nextFrame = NULL; + // private QTimer *frametimer from class definition + frametimer = NULL; + // private QVBoxLayout *layout from class definition + layout = new QVBoxLayout(this); + + // private QLabel *canvas from class definition + canvas = new QLabel(this); + canvas->setMinimumSize(200, 100); + canvas->setAlignment(Qt::AlignCenter); + + // private QPushButton *trigger from class definition + trigger = new QPushButton(this); + trigger->setText("Take picture"); + trigger->setEnabled(false); + trigger->hide(); + + // private bool trigger_active from class definition + trigger_active = false; + + layout->addWidget(canvas); + this->setLayout(layout); +} + +QOpenCamWidget::~QOpenCamWidget(void) +{ + cvReleaseCapture( &capture ); + delete canvas; + delete trigger; +} +// ------------------------------------------------------------- // +// Public methods (not signals/slots) +// ------------------------------------------------------------- // + +/*! + * \brief Changes the visibility of the optional built-in "Take snapshot" button. + * + * The widget contains a push-button that optionally can be displayed. When + * visible, this button is located at the bottom of the widget, and causes + * the SLOT QOpenCamWidget::startSnap to be triggered when clicked. + * + * \param visible True makes the button display, and trigger, + * false turns the feature off. False, i.e. no button, is default. + * + **/ +void +QOpenCamWidget::setSnapshotVisible(bool visible) +{ + // Checking both parameter and private "sanity" variable, + // as a sanity- and error-control + if ( visible && !trigger_active ) + { + connect( trigger, SIGNAL(clicked()), this, SLOT(startSnap())); + layout->addWidget(trigger); + trigger->show(); + trigger_active = true; + } + if ( !visible && trigger_active ) + { + layout->removeWidget(trigger); + disconnect( trigger, SIGNAL(clicked()), 0, 0 ); + trigger->hide(); + trigger_active = false; + } +} +/*! + * \brief A paint event is a request to repaint all or part of a widget. + * + * It can happen for one of the following reasons: + * + * \li repaint() or update() was invoked, + * \li the widget was obscured and has now been uncovered, or + * \li many other reasons. + * + * QOpenCamWidget uses the paintEvent to draw each frame onto the screen. + * The paintEvent itself is regularily triggered by explicit update() + * calls in QOpenCamWidget::grabFrame(). + * + **/ +void +QOpenCamWidget::paintEvent ( QPaintEvent * event ) +{ + QPainter * paint = new QPainter; + paint->begin(this); + + if ( nextFrame ) + { + // Using this objects painter to draw the image + // causes a cute, but not desired effect.. + //paint->drawImage(event->rect(), *nextFrame); + + // Until I find a better solution on how to do the + // redraw of the image, setPixmap on the canvas + // does do the job. This may cause a performance + // penalty though, and is considered a FIXME + // Another drawback is that the widget does not resize.. + canvas->setPixmap( QPixmap::fromImage(*nextFrame) ); + } + else + { + canvas->setText("No data, check/test camera"); + } + paint->end(); +} + + +/*! + * \brief Grabs an OpenCV video capture source + * + * By grabbing a source, it is meant to open the capture source, + * and have it ready to start streaming/capturing frames. + * Returns true on success, false on error. The grabCapture + * is separated from the constructor and/or frame-grabbing, so that you + * may do the error-checking you really should do before proceeding. + * + * \param source The OpenCV capture source enumeration index to open + * + **/ +bool +QOpenCamWidget::grabCapture(int source) +{ + capture = cvCaptureFromCAM(0); + if (!capture) + { + qDebug() << "QOpenCamWidget::grabCapture(" << source << ") failed"; + return false; + } + cvGrabFrame(capture); // Grab a single frame, do resizing based on it. + IplImage *image = cvRetrieveFrame(capture); + QSize t_size = QSize(image->width,image->height); + + qDebug() << "Device image format: " << image->width << "x" << image->height; + canvas->setMinimumSize(t_size); + canvas->setMaximumSize(t_size); + + return true; +} + +/*! + * \brief Starts up grabbing of video frames + * + * The actual grabbing and displaying of video frames is performed by + * a QTimer triggering the SLOT QOpenCamWidget::grabFrame(). + * startCapture() sets up the timer running this captureFrame loop. + * + * The SLOT QOpenCamWidget::startSnap() is used to get image frames + * out from the widget for other uses, like saving or processing. + * This function relies on the timer created and configured by + * startCapture(), and as such, this function is the only permitted + * way to start the actual capture/streaming of video from the source. + * + **/ +void +QOpenCamWidget::startCapture(void) +{ + frametimer = new QTimer(this); + frametimer->start(70); + connect(frametimer,SIGNAL(timeout()), this,SLOT(grabFrame())); + trigger->setEnabled(true); +} + +/*! + * \brief Converts from the OpenCV IplImage data structure to a QImage + * + * OpenCV uses a data strcuture calles IplImage, optimized for + * computer vision image processing tasks. This code was adapted + * from kcamwidget.cpp, part of the KDE SVN at + * playground/multimedia/kcam/kcamwidget.cpp + * + * In regard that the IplImage can be forced into a format + * that aligns well with a RBG888-format, the conversion + * becomes one of the shortes, simples IplImage->QImage I've seen. + * + * \param *img The IplImage to be converted to a QImage. + * + **/ +QImage* +QOpenCamWidget::Ipl2QImage(const IplImage *img) +{ + IplImage *tmp=cvCloneImage(img); + cvConvertImage(img,tmp, CV_CVTIMG_SWAP_RB ); + QImage * qimage = new QImage(reinterpret_cast(tmp->imageData), + tmp->width, + tmp->height, + 3* tmp->width, + QImage::Format_RGB888); + return qimage; + +} +// ------------------------------------------------------------- // +// Public SLOTS +// ------------------------------------------------------------- // + +/*! + * \brief Grabs a frame and causes an update() when triggered. + * + * This is the SLOT that actually reads the video source and + * causes the widget to display live video. Preferably this + * slot will never be called my any other signal that a timeout() + * on the frametimer, which is controlled by QOpenCamWidget::startCapture() + * + **/ +void QOpenCamWidget::grabFrame(void) +{ + if ( !capture ) + { + qDebug() << "Capture device not ready!"; + return; + } + + cvGrabFrame(capture); + + IplImage *iplimage = cvRetrieveFrame(capture); + + if (iplimage) + { + nextFrame = Ipl2QImage(iplimage); + } + else + { + nextFrame = NULL; + } + update(); +} + +/*! + * \brief Trigger this slot to save a frame from the widget. + * + * When this slot is triggered, the widgets capture loop is temporarily + * stopped, and the last displayed frame is "captured", and made + * available through the emitting of the class imageReady SIGNAL. + * + * With the "Take snapshot" button visible (setSnapshotVisible(true)), + * this SLOT is triggered when the user clicks on the trigger button. + * If you do not wish to use the internal trigger button, you + * will have to add a different mechanism to trigger this SLOT. + * + * It is possible, though I would not recommend, to use repeated + * triggering of this slot to do repeated frame-capture, and thus + * make a form of "Animation" or "Video" capture. + * + **/ +void QOpenCamWidget::startSnap(void) +{ + if ( frametimer ) { + if (frametimer->isActive()) + { + frametimer->stop(); + qDebug() << "SNAP!"; + + emit imageReady(QImage(*nextFrame)); + frametimer->start(); + } + } +} + diff --git a/qopencamwidget.h b/qopencamwidget.h new file mode 100644 index 0000000..ef93a15 --- /dev/null +++ b/qopencamwidget.h @@ -0,0 +1,66 @@ +/* + This file is one part of two, that together make + QOpenCamWidget, a Qt 4 widget that displays video input + from a webcam, along with an optional snapshot button. + + Copyright (C) 2009 Jon Langseth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation in its version 2 + of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef QOPENCVWIDGET_H +#define QOPENCVWIDGET_H +#include +#include +#include + +class QOpenCamWidget + : public QWidget +{ + Q_OBJECT + + private: + CvCapture *capture; + QTimer *frametimer; + QImage *nextFrame; + //QImage *snapshot; + QLabel *canvas; + QVBoxLayout *layout; + QPushButton *trigger; + bool trigger_active; + + public: + // Defaults, standard elements ;) + QOpenCamWidget(QWidget *parent = 0); + ~QOpenCamWidget(void); + + // Overides, reimplementation of abstract + void paintEvent ( QPaintEvent * event ); + + // Public methods specific to this class + void setSnapshotVisible( bool visible ); + bool grabCapture(int source); + void startCapture(void); + QImage* Ipl2QImage(const IplImage *img); + + public slots: + void grabFrame(void); + void startSnap(); + signals: + void imageReady(QImage snapshot); +}; + +#endif + diff --git a/view.cpp b/view.cpp new file mode 100644 index 0000000..72bc101 --- /dev/null +++ b/view.cpp @@ -0,0 +1,87 @@ +/* + QOpenCamWidget demo application main window (view.c) + This file is part of a demonstration application, illustrating + how to use the QOpenCamWidget, a Qt 4 widget that displays + video input from a webcam, along with a snapshot button. + + Copyright (C) 2009 Jon Langseth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation in its version 2 + of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "view.h" +#include "qopencamwidget.h" + +// The View class is a QMainWindow, used to display our QOpenCamWidget +// The constructor of the View takes care of setting up the Widget, +// and handles the result of a user clicking (or activating) the widget's +// "Take snapshot" button. + +View::View( QWidget *parent) + : QMainWindow(parent) +{ + + // Create the widget, setting the Main window (this) as its parent. + QOpenCamWidget *cw = new QOpenCamWidget(this); + + // bool QOpenCamWidget::grabCapture(int source) tries to get a + // video capture handle from OpenCV, using the source number + // as the device to open. Here I use -1 as the number, meaning + // "give me any supported and available video devica you can find". + if ( cw->grabCapture(-1) ) + { + // grabCapture() returns true on success. This means that + // we have a capture device available, and can start streaming + // video from the device to display on the widget. + + // TODO: Document this feature.. + cw->setSnapshotVisible(true); + + // Video output does not start until QOpenCamWidget::startCapture() + // is explicitly called. + cw->startCapture(); + } + + // The QOpenCamWidget does not provide a video stream for further + // processing, but it does provide a snapshot of the stream if + // the SLOT void QOpenCamWidget::startSnap(void) is triggered. + // In this demo app, the slot is connected to the widgets + // internal "Take snapshot" trigger button, but the SLOT is + // public, and may easily be triggered from "outside". + // + // When startSnap() is triggered, it will use a SIGNAL to return + // its image, if the aquisition was successful. The image + // will be available through QOpenCamWidget::imageReady(Qimage); + // In this sample, I hook that signal up to a slot on this QMainWindow, + // that saves the image, and exits the application. + connect( cw, SIGNAL(imageReady(QImage)), this, SLOT(saveImage(QImage))); + + this->setCentralWidget(cw); +} + +View::~View(void) +{ +} + +void View::saveImage(QImage image) +{ + // This is the SLOT that recieves QOpenCamWidget::imageReady(QImage) SIGNAL. + // To keep the example as simple as possible, I do as little as possible.. + qDebug() << "Recieved an image of size " + << image.width() << "x" << image.height(); + image.save("snapshot.png"); + + QApplication::exit(); +} diff --git a/view.h b/view.h new file mode 100644 index 0000000..6ebdb76 --- /dev/null +++ b/view.h @@ -0,0 +1,18 @@ +#ifndef VIEW_H +#define VIEW_H +#include + +class View + : public QMainWindow +{ + Q_OBJECT + + public: + View(QWidget *parent = 0); + ~View(void); + + public slots: + void saveImage(QImage image); +}; + +#endif -- 2.39.2