Image Component Library (ICL)
|
00001 /******************************************************************** 00002 ** Image Component Library (ICL) ** 00003 ** ** 00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld ** 00005 ** Neuroinformatics Group ** 00006 ** Website: www.iclcv.org and ** 00007 ** http://opensource.cit-ec.de/projects/icl ** 00008 ** ** 00009 ** File : ICLIO/src/ICLIO/OpenCVCamGrabber.h ** 00010 ** Module : ICLIO ** 00011 ** Authors: Christian Groszewski, Christof Elbrechter, Viktor ** 00012 ** Richter ** 00013 ** ** 00014 ** ** 00015 ** GNU LESSER GENERAL PUBLIC LICENSE ** 00016 ** This file may be used under the terms of the GNU Lesser General ** 00017 ** Public License version 3.0 as published by the ** 00018 ** ** 00019 ** Free Software Foundation and appearing in the file LICENSE.LGPL ** 00020 ** included in the packaging of this file. Please review the ** 00021 ** following information to ensure the license requirements will ** 00022 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt ** 00023 ** ** 00024 ** The development of this software was supported by the ** 00025 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** 00026 ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** 00027 ** Forschungsgemeinschaft (DFG) in the context of the German ** 00028 ** Excellence Initiative. ** 00029 ** ** 00030 ********************************************************************/ 00031 00032 #pragma once 00033 #include <ICLUtils/CompatMacros.h> 00034 #include <ICLCore/OpenCV.h> 00035 #include <ICLIO/Grabber.h> 00036 #include <ICLUtils/Exception.h> 00037 #include <ICLUtils/Mutex.h> 00038 00039 #ifdef ICL_HAVE_OPENCV 00040 #ifdef ICL_HAVE_OPENCV_OLD_STYLE 00041 #include <opencv/highgui.h> 00042 #include <opencv/cxcore.h> 00043 #else 00044 #include <opencv2/highgui/highgui_c.h> 00045 #include <opencv/cxcore.h> 00046 #endif 00047 #endif 00048 namespace icl{ 00049 namespace io{ 00050 00052 class ICLIO_API OpenCVCamGrabber : public Grabber{ 00053 private: 00055 CvCapture *cvc; 00057 int device; 00059 utils::Mutex m_mutex; 00061 core::ImgBase *m_buffer; 00062 public: 00063 00065 00066 virtual const core::ImgBase *acquireImage(); 00067 00069 void processPropertyChange(const utils::Configurable::Property &prop); 00070 00072 00085 OpenCVCamGrabber(int dev=0) throw (utils::ICLException); 00086 00088 ~OpenCVCamGrabber(); 00089 00090 // returns a list of all valid device IDs 00097 00098 static const std::vector<GrabberDeviceDescription> &getDeviceList(std::string hint, bool rescan); 00099 }; 00100 00101 } // namespace io 00102 } 00103