singleGaborTest_elno.C

00001 /*!@file AppPsycho/singleGaborTest.C                       */
00002 // //////////////////////////////////////////////////////////////////// //
00003 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the //
00004 // 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: Farhan Baluch <fbaluch@usc.edu>
00033 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/AppPsycho/singleGaborTest_elno.C $
00034 // $Id: singleGaborTest_elno.C 12962 2010-03-06 02:13:53Z irock $
00035 //
00036 
00037 
00038 //test funky color gabor function by displaying a single patch.
00039 
00040 #include "Component/ModelManager.H"
00041 #include "GUI/XWinManaged.H"
00042 #include "Image/Image.H"
00043 #include "Image/CutPaste.H"
00044 #include "Image/Kernels.H"     // for gaborFilter()
00045 #include "Image/MathOps.H"
00046 #include "Image/Transforms.H"
00047 #include "Image/ShapeOps.H"
00048 #include "Util/log.H"
00049 #include "Raster/Raster.H"
00050 #include "Raster/PngWriter.H"
00051 
00052 #include <stdio.h>
00053 #include <vector>
00054 
00055 
00056 int main(int argc, char** argv)
00057 {
00058 
00059   //instantiate a model manager
00060   ModelManager manager("AppPsycho: gabor search stimuli");
00061 
00062   LINFO("Gabor search the new version");
00063 
00064   //dimensions of window
00065   Dims dims(1000,1000);
00066 
00067    float stddev = 50.0;
00068    float freq = 5.0;
00069    float theta = 10;
00070    float hueShift = 50;
00071 
00072    Image<PixRGB<byte> > finalImage;
00073 
00074  // Parse command-line:
00075   if (manager.parseCommandLine(argc, argv, "<stddev>" "<freq>" "<theta>" "<hueShift>", 4, 4) == false)
00076     return(1);
00077 
00078 
00079   manager.start();
00080 
00081 
00082   LINFO("hello locust");
00083 
00084   // get command line parameters
00085 
00086   sscanf(argv[1],"%g",&stddev);
00087   sscanf(argv[2],"%g",&freq);
00088   sscanf(argv[3],"%g",&theta);
00089   sscanf(argv[4],"%g",&hueShift);
00090   LINFO("stddev = %g; freq = %g; theta = %g; hueShift = %g",stddev,freq,theta,hueShift);
00091 
00092 
00093   XWinManaged *imgWin;
00094   CloseButtonListener wList;
00095   imgWin  = new XWinManaged(dims,    0,    0, manager.getExtraArg(0).c_str());
00096   wList.add(imgWin);
00097 
00098 
00099   Dims standardDims(500,500);
00100  finalImage = rescale(gaborFilterRGB(stddev, freq, theta,hueShift),standardDims);
00101 
00102  //finalImage = gaborFilterRGB(stddev, freq, theta, hueShift);
00103 
00104  LINFO("final image size width  %d, height %d", finalImage.getDims().w(), finalImage.getDims().h());
00105   imgWin->drawImage(finalImage,0,0);
00106 
00107 
00108   Raster::waitForKey();
00109 
00110  //finish all
00111    manager.stop();
00112   return 0;
00113 
00114 }
00115 
00116 // ######################################################################
00117 /* So things look consistent in everyone's emacs... */
00118 /* Local Variables: */
00119 /* indent-tabs-mode: nil */
00120 /* End: */
Generated on Sun May 8 08:40:11 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3