My Project
CapturePluginHighgui.h
Go to the documentation of this file.
1 /*
2  * This file is part of ALVAR, A Library for Virtual and Augmented Reality.
3  *
4  * Copyright 2007-2012 VTT Technical Research Centre of Finland
5  *
6  * Contact: VTT Augmented Reality Team <alvar.info@vtt.fi>
7  * <http://www.vtt.fi/multimedia/alvar.html>
8  *
9  * ALVAR is free software; you can redistribute it and/or modify it under the
10  * terms of the GNU Lesser General Public License as published by the Free
11  * Software Foundation; either version 2.1 of the License, or (at your option)
12  * any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
17  * for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with ALVAR; if not, see
21  * <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>.
22  */
23 
24 #include <opencv2/videoio.hpp>
25 
26 #ifndef CAPTUREPLUGINHIGHGUI_H
27 # define CAPTUREPLUGINHIGHGUI_H
28 
35 # ifdef WIN32
36 # ifdef ALVAR_Capture_Plugin_Highgui_BUILD
37 # define ALVAR_CAPTURE_PLUGIN_HIGHGUI_EXPORT __declspec(dllexport)
38 # else
39 # define ALVAR_CAPTURE_PLUGIN_HIGHGUI_EXPORT __declspec(dllimport)
40 # endif
41 # else
42 # define ALVAR_CAPTURE_PLUGIN_HIGHGUI_EXPORT
43 # endif
44 
45 # include "Capture.h"
46 # include "CapturePlugin.h"
47 # include <opencv2/videoio.hpp>
48 # include <opencv2/highgui.hpp>
49 
50 namespace alvar {
51 
55 namespace plugins {
56 
60 class ALVAR_CAPTURE_PLUGIN_HIGHGUI_EXPORT CaptureHighgui : public alvar::Capture
61 {
62 public:
68  CaptureHighgui(const CaptureDevice captureDevice);
73  void setResolution(const unsigned long xResolution, const unsigned long yResolution);
74  bool start();
75  void stop();
76  cv::Mat captureImage();
78  std::string SerializeId();
79  bool Serialize(Serialization *serialization);
80 
81 private:
82  cv::VideoCapture mVideoCapture;
83  cv::Mat mMatrix;
84  cv::Mat mImage;
85 };
86 
90 class ALVAR_CAPTURE_PLUGIN_HIGHGUI_EXPORT CapturePluginHighgui : public alvar::CapturePlugin
91 {
92 public:
98  CapturePluginHighgui(const std::string &captureType);
104  Capture * createCapture(const CaptureDevice captureDevice);
105 };
106 
107 extern "C" ALVAR_CAPTURE_PLUGIN_HIGHGUI_EXPORT void
108 registerPlugin(const std::string &captureType, alvar::CapturePlugin *&capturePlugin);
109 
110 } // namespace plugins
111 } // namespace alvar
112 
113 #endif
This file implements a capture interface.
This file implements a capture plugin interface.
CaptureDevice holder for camera information.
Definition: CaptureDevice.h:45
Capture interface that plugins must implement.
Definition: Capture.h:47
CapturePlugin interface that plugins must implement.
Definition: CapturePlugin.h:45
std::vector< CaptureDevice > CaptureDeviceVector
Vector of CaptureDevices.
Definition: CapturePlugin.h:59
Class for serializing class content to/from file or std::iostream.
Definition: Util.h:371
Implementation of Capture interface for Highgui plugin.
bool Serialize(Serialization *serialization)
Performs serialization of the class members and configuration.
CaptureHighgui(const CaptureDevice captureDevice)
Constructor.
cv::Mat captureImage()
Capture one image from the camera.
void setResolution(const unsigned long xResolution, const unsigned long yResolution)
Set the resolution.
void stop()
Stops the camera capture.
bool start()
Starts the camera capture.
bool showSettingsDialog()
Show the settings dialog of the camera.
std::string SerializeId()
The identification of the class for serialization.
Implementation of CapturePlugin interface for Highgui plugin.
Capture * createCapture(const CaptureDevice captureDevice)
Create Capture class. Transfers onwership to the caller.
CapturePluginHighgui(const std::string &captureType)
Constructor.
CaptureDeviceVector enumerateDevices()
Enumerate capture devices currently available.
Main ALVAR namespace.
Definition: Alvar.h:174