00001 /*!@file Channels/SingleSvChannel.H Channel for a single stream of processing 00002 in space variant mode. */ 00003 00004 // //////////////////////////////////////////////////////////////////// // 00005 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00006 // University of Southern California (USC) and the iLab at USC. // 00007 // See http://iLab.usc.edu for information about this project. // 00008 // //////////////////////////////////////////////////////////////////// // 00009 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00010 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00011 // in Visual Environments, and Applications'' by Christof Koch and // 00012 // Laurent Itti, California Institute of Technology, 2001 (patent // 00013 // pending; application number 09/912,225 filed July 23, 2001; see // 00014 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00015 // //////////////////////////////////////////////////////////////////// // 00016 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00017 // // 00018 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00019 // redistribute it and/or modify it under the terms of the GNU General // 00020 // Public License as published by the Free Software Foundation; either // 00021 // version 2 of the License, or (at your option) any later version. // 00022 // // 00023 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00024 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00025 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00026 // PURPOSE. See the GNU General Public License for more details. // 00027 // // 00028 // You should have received a copy of the GNU General Public License // 00029 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00030 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00031 // Boston, MA 02111-1307 USA. // 00032 // //////////////////////////////////////////////////////////////////// // 00033 // 00034 // Primary maintainer for this file: David J. Berg <dberg@usc.edu> 00035 // $HeadURL: svn://isvn.usc.edu:/software/invt/trunk/saliency/src/Channels/SingleSvChannel.H $ 00036 00037 #ifndef SINGLESVCHANNEL_H_DEFINED 00038 #define SINGLESVCHANNEL_H_DEFINED 00039 00040 #include "Channels/SingleChannel.H" 00041 #include "Component/ModelParam.H" 00042 #include "SpaceVariant/SVChanLevels.H" 00043 00044 // ###################################################################### 00045 //! SingleSvChannel represents a single stream of processing in space variant mode 00046 // templates, bias maps etc should be in space variant coordinates. 00047 // ###################################################################### 00048 class SingleSvChannel : public ChannelBase, public ChannelFacetMap 00049 { 00050 public: 00051 //! Constructor. See ChannelBase.H 00052 /*! @param mgr our ModelManager (see ModelManager.H) 00053 @param descrName descriptive name for human usage 00054 @param tagName name for ParamMap usage 00055 @param vs The VisualFeature implemented by the channel 00056 @param spacevariantmodule the module to use for the sv channel*/ 00057 SingleSvChannel(OptionManager& mgr, const std::string& descrName, 00058 const std::string& tagName, const VisualFeature vs, const SpaceVariantModule& spacevariantmodule); 00059 00060 //! destructor 00061 virtual ~SingleSvChannel(); 00062 00063 //! Computes the channel's pyramid but doesn't store it 00064 virtual ImageSet<float> computePyramid(const Image<float>& bwimg, 00065 const rutz::shared_ptr<PyramidCache<float> >& cache); 00066 //!get output map dimensions 00067 virtual Dims getMapDims() const; 00068 00069 //! non-op for this class 00070 virtual Image<float> centerSurround(const uint cntr, const uint surr) const; 00071 00072 //! non-op for this class 00073 virtual void centerSurround(const uint cntr, const uint surr, 00074 Image<float>& pos, Image<float>& neg) const; 00075 00076 //!get the submap name 00077 virtual std::string getSubmapName(const uint index) const; 00078 00079 //!get the submap short name 00080 virtual std::string getSubmapNameShort(const uint index) const; 00081 00082 //get feature values at a location 00083 virtual void getFeatures(const Point2D<int>& locn, 00084 std::vector<float>& mean) const; 00085 00086 //get feature values at many location 00087 virtual void getFeaturesBatch(std::vector<Point2D<int>*> *locn, 00088 std::vector<std::vector<float> > *mean, 00089 int *count) const; 00090 00091 //! non-op for this class 00092 virtual LevelSpec getLevelSpec() const; 00093 00094 //! make the clipping pyramid from the clip mask 00095 virtual void setClipPyramid(const Image<byte>& clipMask); 00096 00097 //store a precomputed pyramid 00098 virtual void storePyramid(const ImageSet<float>& p, const SimTime& t) 00099 00100 //used by getSubmap() 00101 virtual Image<float> getRawCSmap(const uint idx) const; 00102 00103 //get the min pyramid level 00104 virtual int getMinPyrLevel() const; 00105 00106 //get the max pyramid level 00107 virtual int getMaxPyrLevel() const; 00108 00109 //grab a subchannel (level from the pyramid) splitting pos/neg values and possibly taking abs, square etc 00110 void computeSubChanSplit(const uint idx, Image<float>& pos, Image<float>& neg) const; 00111 00112 //grab a subchannel (level from the pyramid) splitting pos/neg values and possibly taking abs, square etc 00113 Image<float> computeSubChan(const uint idx) const; 00114 00115 protected: 00116 OModelParam<Dims> itsChanDims;//output dims for the channel 00117 OModelParam<SVChanLevels> itsLevels;//variance of each level 00118 NModelParam<bool> itsTakeSquare;//should we take squareroot 00119 NModelParam<bool> isPolarized;//do we have positive and negative values from a subtraction? 00120 NModelParam<bool> itsUseSpaceVariantBoundary;//we must have this param to allow RetinaCT 00121 00122 // get us started (see ModelComponent.H) 00123 /*! If you overload this, make sure you call SingleChannel::start1() 00124 at the beginning of your overload */ 00125 virtual void start1(); 00126 00127 virtual uint csToIndex(uint centerlev, uint surroundlev) const; 00128 00129 virtual indexToCS(const uint idx, uint& centerlev, uint& surroundlev) const; 00130 00131 //!get the maximum depth of the feature pyramid 00132 virtual uint maxIndex() const; 00133 00134 private: 00135 nub::ref<SpaceVariantModule> itsTransform; 00136 }; 00137 00138 // ###################################################################### 00139 /* So things look consistent in everyone's emacs... */ 00140 /* Local Variables: */ 00141 /* indent-tabs-mode: nil */ 00142 /* End: */ 00143 00144 #endif // !SINGLESVCHANNEL_H_DEFINED