00001 /*!@file Devices/FrameGrabberFactory.C */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00005 // by the University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Devices/FrameGrabberFactory.C $ 00035 // $Id: FrameGrabberFactory.C 14559 2011-03-01 22:02:47Z ehu $ 00036 // 00037 00038 #ifndef DEVICES_FRAMEGRABBERFACTORY_C_DEFINED 00039 #define DEVICES_FRAMEGRABBERFACTORY_C_DEFINED 00040 00041 #include "Devices/XCgrabber.H" 00042 #include "Devices/XCgrabberFlex.H" 00043 #include "Devices/FrameGrabberFactory.H" 00044 #include "Devices/V4Lgrabber.H" 00045 #include "Devices/V4L2grabber.H" 00046 #include "Devices/IEEE1394grabber.H" 00047 #include "Devices/KinectGrabber.H" 00048 #include "Devices/OpenNIGrabber.H" 00049 #include "Util/log.H" 00050 00051 // ###################################################################### 00052 nub::ref<FrameIstream> 00053 makeV4Lgrabber(OptionManager& mgr, 00054 const std::string& descrName, 00055 const std::string& tagName, 00056 const ParamFlag flags) 00057 { 00058 #ifndef HAVE_LINUX_VIDEODEV_H 00059 LFATAL("<linux/videodev.h> must be installed to build a V4Lgrabber"); 00060 return nub::ref<FrameIstream>((FrameIstream*)0); // can't happen, but placate compiler 00061 #else 00062 return nub::ref<FrameIstream> 00063 (new V4Lgrabber(mgr, descrName, tagName, flags)); 00064 #endif 00065 } 00066 00067 // ###################################################################### 00068 nub::ref<FrameIstream> 00069 makeV4L2grabber(OptionManager& mgr, 00070 const std::string& descrName, 00071 const std::string& tagName, 00072 const ParamFlag flags) 00073 { 00074 #ifndef HAVE_LINUX_VIDEODEV2_H 00075 LFATAL("<linux/videodev2.h> must be installed to build a V4L2grabber"); 00076 return nub::ref<FrameIstream>((FrameIstream*)0); // can't happen, but placate compiler 00077 #else 00078 return nub::ref<FrameIstream> 00079 (new V4L2grabber(mgr, descrName, tagName, flags)); 00080 #endif 00081 } 00082 00083 // ###################################################################### 00084 nub::ref<FrameIstream> 00085 makeIEEE1394grabber(OptionManager& mgr, 00086 const std::string& descrName, 00087 const std::string& tagName, 00088 const ParamFlag flags) 00089 { 00090 return nub::ref<FrameIstream> 00091 (new IEEE1394grabber(mgr, descrName, tagName, flags)); 00092 } 00093 00094 // ###################################################################### 00095 nub::ref<FrameIstream> 00096 makeXCgrabber(OptionManager& mgr, 00097 const std::string& descrName, 00098 const std::string& tagName, 00099 const ParamFlag flags) 00100 { 00101 return nub::ref<FrameIstream> 00102 (new XCgrabber(mgr, descrName, tagName, flags)); 00103 } 00104 // ###################################################################### 00105 nub::ref<FrameIstream> 00106 makeXCgrabberFlex(OptionManager& mgr, 00107 const std::string& descrName, 00108 const std::string& tagName, 00109 const ParamFlag flags) 00110 { 00111 return nub::ref<FrameIstream> 00112 (new XCgrabberFlex(mgr, descrName, tagName, flags)); 00113 } 00114 00115 // ###################################################################### 00116 nub::ref<FrameIstream> 00117 makeKinectgrabber(OptionManager& mgr, 00118 const std::string& descrName, 00119 const std::string& tagName, 00120 const ParamFlag flags) 00121 { 00122 #ifndef INVT_HAVE_LIBFREENECT 00123 LFATAL("<libfreenect/libfreenect.h> must be installed to build a KinectGrabber"); 00124 return nub::ref<FrameIstream>((FrameIstream*)0); // can't happen, but placate compiler 00125 #else 00126 return nub::ref<FrameIstream>(new KinectGrabber(mgr, descrName, tagName, flags)); 00127 #endif 00128 } 00129 // ###################################################################### 00130 nub::ref<FrameIstream> 00131 makeOpenNIgrabber(OptionManager& mgr, 00132 const std::string& descrName, 00133 const std::string& tagName, 00134 const ParamFlag flags) 00135 { 00136 #ifndef INVT_HAVE_OPENNI 00137 LFATAL("OpenNI must be installed to build a OpenNIGrabber"); 00138 return nub::ref<FrameIstream>((FrameIstream*)0); // can't happen, but placate compiler 00139 #else 00140 00141 return nub::ref<FrameIstream>(new OpenNIGrabber(mgr, descrName, tagName, flags)); 00142 #endif 00143 } 00144 00145 // ###################################################################### 00146 /* So things look consistent in everyone's emacs... */ 00147 /* Local Variables: */ 00148 /* mode: c++ */ 00149 /* indent-tabs-mode: nil */ 00150 /* End: */ 00151 00152 #endif // DEVICES_FRAMEGRABBERFACTORY_C_DEFINED