FoeMSTChannel.C

Go to the documentation of this file.
00001 /*!@file Channels/FoeMSTChannel.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/Channels/FoeMSTChannel.C $
00035 // $Id: FoeMSTChannel.C 12962 2010-03-06 02:13:53Z irock $
00036 //
00037 
00038 #ifndef FOEMSTCHANNEL_C_DEFINED
00039 #define FOEMSTCHANNEL_C_DEFINED
00040 
00041 #include "Channels/FoeMSTChannel.H"
00042 
00043 #include "Channels/ChannelOpts.H"
00044 #include "Channels/MSTChannel.H"
00045 #include "Channels/MotionChannel.H"
00046 #include "Channels/DirectionChannel.H"
00047 #include "Component/OptionManager.H"
00048 #include "rutz/trace.h"
00049 
00050 // ######################################################################
00051 // L MST Channel member definitions:
00052 // ######################################################################
00053 FoeMSTChannel::FoeMSTChannel(OptionManager& mgr,
00054                                    nub::soft_ref<MotionChannel> oc)
00055   :
00056   ComplexChannel(mgr, "FoeMST", "foe-mst", FOEMST),
00057   itsNumDirs(&OPT_NumDirections, this), // see Channels/ChannelOpts.{H,C}
00058   itsOriChan(oc)
00059 {
00060 GVX_TRACE(__PRETTY_FUNCTION__);
00061   // let's build our channels
00062   buildSubChans();
00063 }
00064 
00065 // ######################################################################
00066 FoeMSTChannel::~FoeMSTChannel()
00067 {
00068 GVX_TRACE(__PRETTY_FUNCTION__);
00069 }
00070 
00071 // ######################################################################
00072 void FoeMSTChannel::buildSubChans()
00073 {
00074 GVX_TRACE(__PRETTY_FUNCTION__);
00075   // kill any subchans we may have had...
00076   this->removeAllSubChans();
00077 
00078   LINFO("Using %d directions spanning [0..360]deg", itsNumDirs.getVal());
00079   for (uint ori = 0; ori < 8; )
00080     {
00081       switch (ori)
00082         {
00083         case 0: //The point in the center POINT 0
00084           addSubChan(makeSharedComp
00085                      (new MSTChannel(getManager(), itsOriChan,
00086                                           visualFeature(),
00087                                           1,1,1,1,1,1,1,1 )),
00088                      "", 1.0, /* exportOpts = */ true);
00089           break;
00090         case 1: //The point in the center POINT 1
00091           addSubChan(makeSharedComp
00092                      (new MSTChannel(getManager(), itsOriChan,
00093                                           visualFeature(),
00094                                           1,0,0,0,0,0,0,0 )),
00095                      "", 1.0, /* exportOpts = */ true);
00096           break;
00097         case 2: //The point in the center POINT 2
00098           addSubChan(makeSharedComp
00099                      (new MSTChannel(getManager(), itsOriChan,
00100                                           visualFeature(),
00101                                           1,1,1,0,0,0,0,0 )),
00102                      "", 1.0, /* exportOpts = */ true);
00103           break;
00104         case 3://The point in the center POINT 3
00105           addSubChan(makeSharedComp
00106                      (new MSTChannel(getManager(), itsOriChan,
00107                                           visualFeature(),
00108                                           0,0,1,0,0,0,0,0 )),
00109                      "", 1.0, /* exportOpts = */ true);
00110           break;
00111         case 4: //The point in the center POINT 4
00112           addSubChan(makeSharedComp
00113                      (new MSTChannel(getManager(), itsOriChan,
00114                                           visualFeature(),
00115                                           0,1,1,1,0,0,0,0 )),
00116                      "", 1.0, /* exportOpts = */ true);
00117           break;
00118         case 5:  //The point in the center POINT 5
00119           addSubChan(makeSharedComp
00120                      (new MSTChannel(getManager(), itsOriChan,
00121                                           visualFeature(),
00122                                           0,0,0,1,0,0,0,0 )),
00123                      "", 1.0, /* exportOpts = */ true);
00124           break;
00125         case 6: //The point in the center POINT 6
00126           addSubChan(makeSharedComp
00127                      (new MSTChannel(getManager(), itsOriChan,
00128                                           visualFeature(),
00129                                           0,0,0,0,1,1,1,0 )),
00130                      "", 1.0, /* exportOpts = */ true);
00131           break;
00132         case 7: //The point in the center POINT 7
00133           addSubChan(makeSharedComp
00134                      (new MSTChannel(getManager(), itsOriChan,
00135                                           visualFeature(),
00136                                           0,1,0,0,0,0,1,0 )),
00137                      "", 1.0, /* exportOpts = */ true);
00138           break;
00139         case 8: //The point in the center POINT 8
00140           addSubChan(makeSharedComp
00141                      (new MSTChannel(getManager(), itsOriChan,
00142                                           visualFeature(),
00143                                           1,0,0,0,0,0,1,1 )),
00144                      "", 1.0, /* exportOpts = */ true);
00145           break;
00146 
00147         default:
00148           break;
00149         }
00150       ori += 8 / itsNumDirs.getVal();
00151     }
00152 }
00153 
00154 // ######################################################################
00155 void FoeMSTChannel::paramChanged(ModelParamBase* const param,
00156                                     const bool valueChanged,
00157                                     ParamClient::ChangeStatus* status)
00158 {
00159 GVX_TRACE(__PRETTY_FUNCTION__);
00160   ComplexChannel::paramChanged(param, valueChanged, status);
00161 
00162   // if the param is our number of orientations and it has become
00163   // different from our number of channels, let's reconfigure:
00164   if (param == &itsNumDirs &&
00165       numChans() != itsNumDirs.getVal())
00166     buildSubChans();
00167 }
00168 
00169 // ######################################################################
00170 void FoeMSTChannel::doInput(const InputFrame& inframe)
00171 {
00172 GVX_TRACE(__PRETTY_FUNCTION__);
00173   for (uint i = 0; i < numChans(); ++i)
00174     {
00175       subChan(i)->input(inframe);
00176       LINFO("FoeMST pyramid (%d/%d) ok.", i+1, numChans());
00177     }
00178 }
00179 
00180 // ######################################################################
00181 /* So things look consistent in everyone's emacs... */
00182 /* Local Variables: */
00183 /* indent-tabs-mode: nil */
00184 /* End: */
00185 
00186 #endif // FOEMSTCHANNEL_C_DEFINED
Generated on Sun May 8 08:40:21 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3