Capture.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 #ifndef CAPTURE_H
25 #define CAPTURE_H
26 
33 #include "Alvar.h"
34 #include "CaptureDevice.h"
35 #include "Util.h"
36 
37 namespace alvar {
38 
47 {
48 public:
54  Capture(const CaptureDevice captureDevice)
55  : mCaptureDevice(captureDevice)
56  , mXResolution(0)
57  , mYResolution(0)
58  , mIsCapturing(false)
59  {
60  }
61 
65  virtual ~Capture() {}
66 
70  CaptureDevice captureDevice() {return mCaptureDevice;}
71 
75  unsigned long xResolution() {return mXResolution;}
76 
80  unsigned long yResolution() {return mYResolution;}
81 
85  bool isCapturing() {return mIsCapturing;}
86 
93  virtual void setResolution(const unsigned long xResolution, const unsigned long yResolution)
94  {
95  }
96 
102  virtual bool start() = 0;
103 
107  virtual void stop() = 0;
108 
116  virtual IplImage *captureImage() = 0;
117 
124  virtual bool saveSettings(std::string filename) {
125  if (!isCapturing()) {
126  return false;
127  }
128 
129  Serialization serialization(filename);
130  try {
131  serialization << (*this);
132  }
133  catch (...) {
134  return false;
135  }
136  return true;
137  }
138 
145  virtual bool loadSettings(std::string filename) {
146  if (!isCapturing()) {
147  return false;
148  }
149 
150  Serialization serialization(filename);
151  try {
152  serialization >> (*this);
153  }
154  catch (...) {
155  return false;
156  }
157  return true;
158  }
159 
164  virtual bool showSettingsDialog() = 0;
165 
169  virtual std::string SerializeId() = 0;
170 
177  virtual bool Serialize(Serialization *serialization) = 0;
178 
179 protected:
181  unsigned long mXResolution;
182  unsigned long mYResolution;
184 };
185 
186 } // namespace alvar
187 
188 #endif
Main ALVAR namespace.
Definition: Alvar.h:174
CaptureDevice captureDevice()
The camera information associated to this capture object.
Definition: Capture.h:70
CaptureDevice mCaptureDevice
Definition: Capture.h:180
unsigned long mXResolution
Definition: Capture.h:181
unsigned long xResolution()
The resolution along the x axis (horizontal).
Definition: Capture.h:75
unsigned long yResolution()
The resolution along the y axis (vertical).
Definition: Capture.h:80
CaptureDevice holder for camera information.
Definition: CaptureDevice.h:44
virtual ~Capture()
Destructor.
Definition: Capture.h:65
This file implements generic utility functions and a serialization interface.
#define ALVAR_EXPORT
Definition: Alvar.h:168
bool isCapturing()
Test if the camera was properly initialized.
Definition: Capture.h:85
Capture interface that plugins must implement.
Definition: Capture.h:46
This file implements a capture device to hold camera information.
Class for serializing class content to/from file or std::iostream.
Definition: Util.h:352
virtual bool loadSettings(std::string filename)
Load camera settings from a file.
Definition: Capture.h:145
virtual void setResolution(const unsigned long xResolution, const unsigned long yResolution)
Set the resolution.
Definition: Capture.h:93
bool mIsCapturing
Definition: Capture.h:183
This file defines library export definitions, version numbers and build information.
virtual bool saveSettings(std::string filename)
Save camera settings to a file.
Definition: Capture.h:124
unsigned long mYResolution
Definition: Capture.h:182
Capture(const CaptureDevice captureDevice)
Constructor.
Definition: Capture.h:54


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Mon Jun 10 2019 12:47:03