Capture.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of ALVAR, A Library for Virtual and Augmented Reality.
00003  *
00004  * Copyright 2007-2012 VTT Technical Research Centre of Finland
00005  *
00006  * Contact: VTT Augmented Reality Team <alvar.info@vtt.fi>
00007  *          <http://www.vtt.fi/multimedia/alvar.html>
00008  *
00009  * ALVAR is free software; you can redistribute it and/or modify it under the
00010  * terms of the GNU Lesser General Public License as published by the Free
00011  * Software Foundation; either version 2.1 of the License, or (at your option)
00012  * any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful, but WITHOUT
00015  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00016  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00017  * for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public License
00020  * along with ALVAR; if not, see
00021  * <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>.
00022  */
00023 
00024 #ifndef CAPTURE_H
00025 #define CAPTURE_H
00026 
00033 #include "Alvar.h"
00034 #include "CaptureDevice.h"
00035 #include "Util.h"
00036 
00037 namespace alvar {
00038 
00046 class ALVAR_EXPORT Capture
00047 {
00048 public:
00054     Capture(const CaptureDevice captureDevice)
00055         : mCaptureDevice(captureDevice)
00056         , mXResolution(0)
00057         , mYResolution(0)
00058         , mIsCapturing(false)
00059     {
00060     }
00061 
00065     virtual ~Capture() {}
00066 
00070     CaptureDevice captureDevice() {return mCaptureDevice;}
00071 
00075     unsigned long xResolution() {return mXResolution;}
00076 
00080     unsigned long yResolution() {return mYResolution;}
00081 
00085     bool isCapturing() {return mIsCapturing;}
00086 
00093     virtual void setResolution(const unsigned long xResolution, const unsigned long yResolution)
00094     {
00095     }
00096 
00102     virtual bool start() = 0;
00103 
00107     virtual void stop() = 0;
00108 
00116     virtual IplImage *captureImage() = 0;
00117 
00124         virtual bool saveSettings(std::string filename) {
00125         if (!isCapturing()) {
00126             return false;
00127         }
00128 
00129                 Serialization serialization(filename);
00130                 try {
00131             serialization << (*this);
00132         }
00133                 catch (...) {
00134             return false;
00135         }
00136                 return true;
00137         }
00138 
00145     virtual bool loadSettings(std::string filename) {
00146         if (!isCapturing()) {
00147             return false;
00148         }
00149 
00150                 Serialization serialization(filename);
00151                 try {
00152             serialization >> (*this);
00153         }
00154                 catch (...) {
00155             return false;
00156         }
00157                 return true;
00158         }
00159 
00164     virtual bool showSettingsDialog() = 0;
00165 
00169         virtual std::string SerializeId() = 0;
00170 
00177         virtual bool Serialize(Serialization *serialization) = 0;
00178 
00179 protected:
00180     CaptureDevice mCaptureDevice;
00181     unsigned long mXResolution;
00182     unsigned long mYResolution;
00183     bool mIsCapturing;
00184 };
00185 
00186 } // namespace alvar
00187 
00188 #endif


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Sat Dec 28 2013 16:46:15