00001 /*!@file Channels/InputFrame.H */ 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/Channels/InputFrame.H $ 00035 // $Id: InputFrame.H 14631 2011-03-23 19:02:41Z dberg $ 00036 // 00037 00038 #ifndef CHANNELS_INPUTFRAME_H_DEFINED 00039 #define CHANNELS_INPUTFRAME_H_DEFINED 00040 00041 #include "Image/Image.H" 00042 #include "Image/Pixels.H" 00043 #include "Image/PyramidCache.H" 00044 #include "Util/SimTime.H" 00045 #include "rutz/shared_ptr.h" 00046 00047 class InputFrame 00048 { 00049 public: 00050 //! Uninitialized constructor 00051 InputFrame(); 00052 00053 // default dtor, copy, assignment OK 00054 00055 // ###################################################################### 00056 /*! @name Pseudo-constructors 00057 00058 There are several ways to construct an input frame. These are 00059 provided to allow maximum efficiency, so that only the minimum 00060 required information must be passed in. The size of the input 00061 image(s) can later be queried with getDims(). The timestamp 00062 parameter (t, in seconds) is used to compute transient responses 00063 to flickering stimuli. */ 00064 //@{ 00065 00066 //! Initialize to a new input frame 00067 /*! @param in input image -- this is a pointer for the input 00068 argument so as to avoid unwanted implicit conversion -- we want 00069 to really initialize from a byte-rgb image, and not a float-rgb 00070 image, nor a byte-grayscale image 00071 */ 00072 static InputFrame fromRgb(const Image<PixRGB<byte> >* in, 00073 SimTime t = SimTime::ZERO(), 00074 const Image<byte>* clip = 0, 00075 const rutz::shared_ptr<PyramidCache<float> >& cache = emptyCache, 00076 bool disableCache = false); 00077 00078 static InputFrame fromRgbFloat(const Image<PixRGB<float> >* col, 00079 SimTime t = SimTime::ZERO(), 00080 const Image<byte> * clip = 0, 00081 const rutz::shared_ptr<PyramidCache<float> >& cache = emptyCache, 00082 bool disableCache = false); 00083 00084 static InputFrame fromGrayFloat(const Image<float>* bw, 00085 SimTime t = SimTime::ZERO(), 00086 const Image<byte> * clip = 0, 00087 const rutz::shared_ptr<PyramidCache<float> >& cache = emptyCache, 00088 bool disableCache = false); 00089 00090 static InputFrame fromRgbAndGrayFloat(const Image<PixRGB<byte> >* rgbb, 00091 const Image<PixRGB<float> >* rgbf, 00092 const Image<float>* bw, 00093 SimTime t = SimTime::ZERO(), 00094 const Image<byte> * clip = 0, 00095 const rutz::shared_ptr<PyramidCache<float> >& cache = emptyCache, 00096 bool disableCache = false); 00097 00098 static InputFrame fromRgbDepth(const Image<PixRGB<byte> >* in, 00099 const Image<uint16>* depth, 00100 SimTime t = SimTime::ZERO(), 00101 const Image<byte>* clip = 0, 00102 const rutz::shared_ptr<PyramidCache<float> >& cache = emptyCache, 00103 bool disableCache = false); 00104 //@} 00105 00106 SimTime time() const { return itsTime; } 00107 00108 const Dims& getDims() const { return itsDims; } 00109 const int getWidth() const { return itsDims.w(); } 00110 const int getHeight() const { return itsDims.h(); } 00111 00112 const Image<byte>& clipMask() const { return itsClipMask; } 00113 00114 const Image<PixRGB<byte> >& colorByte() const { return itsColorByte; } 00115 const Image<PixRGB<float> >& colorFloat() const; 00116 const Image<float>& grayFloat() const { return itsGrayFloat; } 00117 00118 const rutz::shared_ptr<PyramidCache<float> >& pyrCache() const { return itsPyrCache; } 00119 00120 static const rutz::shared_ptr<PyramidCache<float> > emptyCache; 00121 00122 const Image<uint16> getDepthImage() const { return itsDepthImage; } 00123 00124 const bool hasDepthImage() const { return itsDepthImage.initialized(); } 00125 00126 void setPyrCacheRgb(const rutz::shared_ptr<PyramidCache<PixRGB<float> > >& pyr) 00127 { itsPyrCacheRgb = pyr; } 00128 00129 void setPyrCache(const rutz::shared_ptr<PyramidCache<float> >& pyr) 00130 { itsPyrCache = pyr; } 00131 00132 private: 00133 SimTime itsTime; 00134 Dims itsDims; 00135 Image<byte> itsClipMask; 00136 Image<PixRGB<byte> > itsColorByte; 00137 mutable Image<PixRGB<float> > itsColorFloat; 00138 Image<float> itsGrayFloat; 00139 rutz::shared_ptr<PyramidCache<float> > itsPyrCache; 00140 rutz::shared_ptr<PyramidCache<PixRGB<float> > > itsPyrCacheRgb; 00141 Image<uint16> itsDepthImage; 00142 }; 00143 00144 // ###################################################################### 00145 /* So things look consistent in everyone's emacs... */ 00146 /* Local Variables: */ 00147 /* indent-tabs-mode: nil */ 00148 /* End: */ 00149 00150 #endif // CHANNELS_INPUTFRAME_H_DEFINED