FrameIstream.C

Go to the documentation of this file.
00001 /*!@file Transport/FrameIstream.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: Rob Peters <rjpeters at usc dot edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Transport/FrameIstream.C $
00035 // $Id: FrameIstream.C 13273 2010-04-21 22:08:00Z rand $
00036 //
00037 
00038 #ifndef TRANSPORT_FRAMEISTREAM_C_DEFINED
00039 #define TRANSPORT_FRAMEISTREAM_C_DEFINED
00040 
00041 #include "Transport/FrameIstream.H"
00042 #include "Media/FrameRange.H"
00043 
00044 #include "Image/Image.H"
00045 #include "Image/Pixels.H"
00046 #include "Raster/GenericFrame.H"
00047 #include "Util/SimTime.H"
00048 
00049 FrameListener::~FrameListener()
00050 {}
00051 
00052 FrameIstream::FrameIstream(OptionManager& mgr,
00053                            const std::string& descrName,
00054                            const std::string& tag)
00055   :
00056   ModelComponent(mgr, descrName, tag)
00057 {}
00058 
00059 FrameIstream::~FrameIstream()
00060 {}
00061 
00062 void FrameIstream::setConfigInfo(const std::string& cfg)
00063 {
00064   // do nothing, subclasses can override if they need to handle this
00065   // user input
00066 }
00067 
00068 void FrameIstream::setListener(rutz::shared_ptr<FrameListener> listener)
00069 {
00070   // do nothing, just ignore the listener; subclasses can override if
00071   // they want to do something with the listener
00072 }
00073 
00074 bool FrameIstream::setFrameNumber(int)
00075 {
00076   // do nothing, subclasses can override if they need to know the
00077   // frame number
00078 
00079   return true;
00080 }
00081 
00082 SimTime FrameIstream::getNaturalFrameTime() const
00083 {
00084   return SimTime::ZERO();
00085 }
00086 
00087 Dims FrameIstream::peekDims()
00088 {
00089   return this->peekFrameSpec().dims;
00090 }
00091 
00092 int FrameIstream::getWidth()
00093 {
00094   return this->peekFrameSpec().dims.w();
00095 }
00096 
00097 int FrameIstream::getHeight()
00098 {
00099   return this->peekFrameSpec().dims.h();
00100 }
00101 
00102 void FrameIstream::startStream()
00103 {
00104   // do nothing, subclasses can override if they need special
00105   // preparation to start the frame stream
00106 }
00107 
00108 Image<PixRGB<byte> > FrameIstream::readRGB()
00109 {
00110   return this->readFrame().asRgb();
00111 }
00112 
00113 Image<PixRGB<uint16> > FrameIstream::readRGBU16()
00114 {
00115   return this->readFrame().asRgbU16();
00116 }
00117 
00118 Image<byte> FrameIstream::readGray()
00119 {
00120   return this->readFrame().asGray();
00121 }
00122 
00123 Image<uint16> FrameIstream::readGrayU16()
00124 {
00125   return this->readFrame().asGrayU16();
00126 }
00127 
00128 Image<float> FrameIstream::readFloat()
00129 {
00130   return this->readFrame().asFloat();
00131 }
00132 
00133 bool FrameIstream::readAndDiscardFrame()
00134 {
00135   const GenericFrame frame = this->readFrame();
00136   return frame.initialized();
00137 }
00138 
00139 bool FrameIstream::supportsSeek()
00140 {
00141   return false;
00142 }
00143 
00144 FrameRange FrameIstream::getFrameRange()
00145 {
00146   return FrameRange();
00147 }
00148 
00149 // ######################################################################
00150 /* So things look consistent in everyone's emacs... */
00151 /* Local Variables: */
00152 /* indent-tabs-mode: nil */
00153 /* End: */
00154 
00155 #endif // TRANSPORT_FRAMEISTREAM_C_DEFINED
Generated on Sun May 8 08:42:24 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3