createFaceCircle.C

Go to the documentation of this file.
00001 /*!@file AppPsycho/createFaceCircle.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/createFaceCircle.C $
00034 // $Id: createFaceCircle.C 10794 2009-02-08 06:21:09Z itti $
00035 //
00036 //loads a set of files with faces and arranges them in a circle with each face appearing an even number of times.
00037 
00038 #include "Component/ModelManager.H"
00039 #include "GUI/XWinManaged.H"
00040 #include "Image/Image.H"
00041 #include "Image/CutPaste.H"
00042 #include "Image/Kernels.H"     // for gaborFilter()
00043 #include "Image/MathOps.H"
00044 #include "Image/Transforms.H"
00045 #include "Image/ShapeOps.H"
00046 #include "Image/DrawOps.H"
00047 #include "Util/log.H"
00048 #include "Raster/Raster.H"
00049 #include "Raster/PngWriter.H"
00050 #include <stdio.h>
00051 #include <algorithm>
00052 #include <time.h>
00053 
00054 int main(int argc, char** argv)
00055 {
00056 
00057   //instantiate a model manager
00058   ModelManager manager("AppPsycho: gabor search stimuli");
00059 
00060   //dimensions of window
00061   Dims dims(1920,1080);
00062   char filename[255],fname[255];
00063   if (manager.parseCommandLine(argc, argv,"<name>", 1, 1) == false)
00064     return(1);
00065 
00066   manager.start();
00067 
00068   // get command line parameters
00069   sscanf(argv[1],"%s",fname);
00070 
00071   int numFaces =16;
00072 
00073   XWinManaged *imgWin;
00074   CloseButtonListener wList;
00075   imgWin  = new XWinManaged(dims,    0,    0, manager.getExtraArg(0).c_str());
00076   wList.add(imgWin);
00077 
00078   //lets create some positions in circular fashion;
00079 
00080   std::vector<Point2D> pos(360);
00081   int posCnt =0,radius=300;
00082   int centerX = 1960/2;
00083   int centerY = 1080/2;
00084 
00085 
00086   pos[0] = Point2D((int)(radius*cos(0) + centerX), (int)(radius*sin(0) + centerY));
00087   pos[1] = Point2D((int)(radius*cos(M_PI/4) + centerX), (int)(radius*sin(M_PI/4) + centerY));
00088   pos[2] = Point2D((int)(radius*cos(M_PI/2) + centerX), (int)(radius*sin(M_PI/2) + centerY));
00089   pos[3] = Point2D((int)(radius*cos(3*M_PI/4) + centerX), (int)(radius*sin(3*M_PI/4) + centerY));
00090   pos[4] = Point2D((int)(radius*cos(M_PI) + centerX), (int)(radius*sin(M_PI) + centerY));
00091   pos[5] = Point2D((int)(radius*cos(5*M_PI/4) + centerX), (int)(radius*sin(5*M_PI/4) + centerY));
00092   pos[6] = Point2D((int)(radius*cos(3*M_PI/2) + centerX), (int)(radius*sin(3*M_PI/2) + centerY));
00093   pos[7] = Point2D((int)(radius*cos(7*M_PI/4) + centerX), (int)(radius*sin(7*M_PI/4) + centerY));
00094 
00095   posCnt = 7;
00096 
00097   std::vector< Image<PixRGB<byte> > > ivector(numFaces);
00098   Image<PixRGB<byte> > dispImg(dims,NO_INIT);
00099   Dims standardDims(200,200);
00100 
00101    Image<PixRGB<byte> >::iterator aptr= dispImg.beginw();
00102 
00103   while(aptr!=dispImg.endw())
00104     *aptr++ = PixRGB<byte>(127,127,127);
00105 
00106   imgWin->drawImage(dispImg);
00107 
00108   for(int i=1;i<=posCnt+1;i++)
00109     {
00110       sprintf(filename, "%s/slide%d.jpg",fname,i);
00111       ivector[i] = Raster::ReadRGB(filename);
00112        imgWin->drawImage(rescale(ivector[i],standardDims),pos[i-1].i,pos[i-1].j);
00113     //imgWin->drawImage(rescale(ivector[i],standardDims),i*10,i*10);
00114     }
00115 
00116   Raster::waitForKey();
00117   //finish all
00118   manager.stop();
00119 
00120   return 0;
00121 
00122 }
00123 
00124 // ######################################################################
00125 /* So things look consistent in everyone's emacs... */
00126 /* Local Variables: */
00127 /* indent-tabs-mode: nil */
00128 /* End: */
00129 
00130 
00131 
00132 
00133 
Generated on Sun May 8 08:40:08 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3