DirectionOpticalFlowChannel.H

Go to the documentation of this file.
00001 /*!@file Channels/DirectionOpticalFlowChannel.H */
00002 // //////////////////////////////////////////////////////////////////// //
00003 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00004 // by the University of Southern California (USC) and the iLab at USC.  //
00005 // See http://iLab.usc.edu for information about this project.          //
00006 // //////////////////////////////////////////////////////////////////// //
00007 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00008 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00009 // in Visual Environments, and Applications'' by Christof Koch and      //
00010 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00011 // pending; application number 09/912,225 filed July 23, 2001; see      //
00012 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00013 // //////////////////////////////////////////////////////////////////// //
00014 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00015 //                                                                      //
00016 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00017 // redistribute it and/or modify it under the terms of the GNU General  //
00018 // Public License as published by the Free Software Foundation; either  //
00019 // version 2 of the License, or (at your option) any later version.     //
00020 //                                                                      //
00021 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00022 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00023 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00024 // PURPOSE.  See the GNU General Public License for more details.       //
00025 //                                                                      //
00026 // You should have received a copy of the GNU General Public License    //
00027 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00028 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00029 // Boston, MA 02111-1307 USA.                                           //
00030 // //////////////////////////////////////////////////////////////////// //
00031 //
00032 // Primary maintainer for this file:
00033 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Channels/DirectionOpticalFlowChannel.H $
00034 // $Id: $
00035 //
00036 
00037 #ifndef DIRECTION_OPTICALFLOW_CHANNEL_H_DEFINED
00038 #define DIRECTION_OPTICALFLOW_CHANNEL_H_DEFINED
00039 
00040 #include "Channels/SingleChannel.H"
00041 
00042 #include "Robots/Beobot2/Navigation/FOE_Navigation/MotionOps.H"
00043 
00044 // ######################################################################
00045 //! a motion sensitive channel with direction selectivity
00046 //! using various optical flow algorithms
00047 class DirectionOpticalFlowChannel : public SingleChannel
00048 {
00049 public:
00050   //! Constructor with some parameteres
00051   /*! @param dirIndex is the channel's index, used in Param and Jet access
00052     @param direction is the preferred direction in degrees (0..360)
00053     @param type the type of optical flow algorithm fed */
00054   DirectionOpticalFlowChannel
00055   (OptionManager& mgr,
00056    const uint dirIndex, const double direction, 
00057    const OpticalFlowType type);
00058 
00059   //! Destructor
00060   virtual ~DirectionOpticalFlowChannel();
00061 
00062   //! overload
00063   virtual bool outputAvailable() const;
00064 
00065   //! different ways to input different optical flow algorithms
00066   void setLucasKanadeOpticalFlow(rutz::shared_ptr<OpticalFlow> flow);
00067   //void setHornSchunckOpticalFlow();
00068 
00069   //! get the Optical flow for this direction
00070   Image<float> getDirectionalOpticalFlow();
00071 
00072 protected:
00073 
00074   //! DirectionOpticalFlowChannel requires only luminance input.
00075   virtual void doInput(const InputFrame& inframe);
00076 
00077   void start1(); //!< get started
00078   void start2(); //!< get started
00079 
00080 private:
00081 
00082   //! compute the Optical flow (whole map) for this direction
00083   void computeDirectionalOpticalFlow();
00084 
00085   //! compute the Optical flow (whole map) for this direction
00086   void computeDirectionalOpticalFlow
00087   (uint i, uint j, float val);
00088 
00089   //! compute the response difference between
00090   //! the inputed angle and the preferred direction
00091   float getResponseValue(float angle);
00092 
00093   NModelParam<uint> itsDirIndex;
00094   NModelParam<double> itsDirection;
00095 
00096   //! the optical flow algorithm that it uses
00097   OpticalFlowType itsOpticalFlowType;
00098  
00099   //! optical flow of the image
00100   rutz::shared_ptr<OpticalFlow> itsOpticalFlow;
00101 
00102   //! the resulting directional optical flow 
00103   //! that will be used for conspicuity map computation
00104   Image<float> itsDirectionalOpticalFlow;
00105 };
00106 
00107 // ######################################################################
00108 /* So things look consistent in everyone's emacs... */
00109 /* Local Variables: */
00110 /* indent-tabs-mode: nil */
00111 /* End: */
00112 
00113 #endif // DIRECTION_OPTICALFLOW_CHANNEL_H_DEFINED
Generated on Sun May 8 08:40:21 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3