CINNIC.H

Go to the documentation of this file.
00001 /*!@file CINNIC/CINNIC.H Test binary for CINNIC neuron */
00002 #include "CINNIC/contourRun.H"
00003 #include "Util/readConfig.H"
00004 #include "Util/log.H"
00005 #include "CINNIC/contourDefine.H"
00006 #include "CINNIC/CINNICstatsRun.H"
00007 
00008 // //////////////////////////////////////////////////////////////////// //
00009 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the //
00010 // University of Southern California (USC) and the iLab at USC.         //
00011 // See http://iLab.usc.edu for information about this project.          //
00012 // //////////////////////////////////////////////////////////////////// //
00013 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00014 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00015 // in Visual Environments, and Applications'' by Christof Koch and      //
00016 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00017 // pending; application number 09/912,225 filed July 23, 2001; see      //
00018 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00019 // //////////////////////////////////////////////////////////////////// //
00020 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00023 // redistribute it and/or modify it under the terms of the GNU General  //
00024 // Public License as published by the Free Software Foundation; either  //
00025 // version 2 of the License, or (at your option) any later version.     //
00026 //                                                                      //
00027 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00028 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00029 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00030 // PURPOSE.  See the GNU General Public License for more details.       //
00031 //                                                                      //
00032 // You should have received a copy of the GNU General Public License    //
00033 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00034 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00035 // Boston, MA 02111-1307 USA.                                           //
00036 // //////////////////////////////////////////////////////////////////// //
00037 //
00038 // Primary maintainer for this file: T Nathan Mundhenk <mundhenk@usc.edu>
00039 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/CINNIC/CINNIC.H $
00040 // $Id: CINNIC.H 9412 2008-03-10 23:10:15Z farhan $
00041 //
00042 
00043 #ifndef CINNIC_H_DEFINED
00044 #define CINNIC_H_DEFINED
00045 
00046 //this is a simple testing alg. for CINNIC
00047 
00048 
00049 // ############################################################
00050 // ############################################################
00051 // ##### ---CINNIC---
00052 // ##### CINNICtest:
00053 // ##### T. Nathan Mundhenk nathan@mundhenk.com
00054 // ############################################################
00055 // ############################################################
00056 //! Main class to run an image in CINNICtest for contours
00057 /*! This is the central class at this point for running CINNIC.
00058   It works by creating a CINNIC template for neuron connections
00059   in contourNeuron. It then imports an image as defines from
00060   the command line. The image is processed for orientations
00061   using the orientedFilter in Image as well as a few other
00062   processes. The image is then reduced and a 3D map of the
00063   image created and stored in ImageMap. This map and the
00064   neuron are then fed into contourRun which runs the 3D image
00065   against the template neuron. Output is produced in many ways
00066   including several raw data dumps and image dumps.
00067 */
00068 
00069 class CINNIC
00070 {
00071 private:
00072   const char* logto;
00073   const char* saveto;
00074   ContourNeuronCreate<float> *CINNICNeuronTemplate;
00075   int dumbchoice, SIZEX,SIZEY, lastIterOnly, doBias;
00076   float temp,min,max,avg,mean,std,thresh,GroupTop,compGain;
00077   //! use a gabor filter instead of oriented filter
00078   int doGaborFilter;
00079   //! Parameters for using the gabor filter
00080   float Gstddev,Gperiod,Gphase,Gtheta,GsigMod,Gamplitude;
00081   float scale1,scale2,scale3;
00082   contourRun* RN;
00083   CINNICstatsRun cinnicStats;
00084   std::vector<Image<float> > Finput;
00085   std::vector<Image<byte> > combinedSalMap;
00086   std::vector<Image<byte> > combinedSalMapMax;
00087   std::vector<Image<byte> > combinedSalMapMin;
00088   std::vector< std::vector< Image<float> > > VFinput;
00089   Image<float> Original;
00090   Image<float> floatImage;
00091   Image<float> orientComposite;
00092   Image<float> output[AnglesUsed][AnglesUsed];
00093   Image<PixRGB <float> >Poutput[AnglesUsed][AnglesUsed];
00094   PixRGB<byte> pixel;
00095   std::vector< Image<float> > group;
00096   std::vector<int> groupCount;
00097   std::vector<float> groupTopVec;
00098   const Point2D<int> *point;
00099   Point2D<int> *Toint;
00100   float dev;
00101   int SX,SY,edge,Amp,cheatVal,cheatNum;
00102   int dumpImage,redOrder,lPass,reduction,groupSize;
00103   int scalesNumber,iterations,addNoise;
00104   int doNerdCam,doTableOnly;
00105   int origX,origY; //The images original size
00106   long storeArraySize;
00107   float preOrientFilterNoise,Gnum;
00108   //! bias for angles (see polat,sagi Spat. Vis. 1994)
00109   float NeuralAnglesBias[AnglesUsed];
00110   //! The difference between the biases
00111   float BiasDiff;
00112   //! compensation for 45 degree angles on the grid
00113   float GridBias;
00114   //********************************************************
00115   // Private member functions
00116   //********************************************************
00117   //! Load config values for this class
00118   void configLoad(readConfig &config);
00119   //! Find bias towards angles (verticle/diagonal/horizontal)
00120   void findNeuralAnglesBias();
00121   //! pre-process image, do orientation filtereing
00122   void preProcessImage(ContourNeuronCreate<float> &NeuronTemplate
00123                       ,Image<byte> &input,readConfig &config);
00124   //! Set up to run a nested vector image in contourRun
00125   void preImage(std::vector< std::vector<Image<float> > > &input
00126                 ,readConfig &config, int sizeX, int sizeY);
00127   //! run the nested vector image in contourRun
00128   void runImage(ContourNeuronCreate<float> &NeuronTemplate,
00129                 std::vector< std::vector<Image<float> > > &input
00130                 ,readConfig &config, std::vector<float> &GTV);
00131   //! send the results to disk
00132   void getResults(readConfig &config);
00133 public:
00134   //********************************************************
00135   // Public stuff
00136   //********************************************************
00137   //! View the output visualy of the contour neuron templates
00138   void viewNeuronTemplate(ContourNeuronCreate<float> &NeuronTemplate
00139                           ,readConfig &config);
00140   //! Aux Image holder
00141   Image<byte> Ninput;
00142   //! Run an image (this is the important method)
00143   void RunSimpleImage(ContourNeuronCreate<float> &NeuronTemplate
00144                       ,Image<byte> &input,readConfig &config);
00145   //! test a simple image against itself to find the value of convolution
00146   void convolveTest(ContourNeuronCreate<float> &NeuronTemplate
00147                     ,readConfig &config, Image<float> &testImage);
00148   //! This is the file name as supplied by argv
00149   const char* filename;
00150   //! this is what to save output as
00151   const char* savefilename;
00152 };
00153 
00154 #endif
00155 
00156 // ######################################################################
00157 /* So things look consistent in everyone's emacs... */
00158 /* Local Variables: */
00159 /* indent-tabs-mode: nil */
00160 /* End: */
Generated on Sun May 8 08:04:41 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3