00001 /*!@file Media/SceneGenerator.H generate test scenes */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00005 // 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: Lior Elazary 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Media/SceneGenerator.H $ 00035 // $Id: SceneGenerator.H 9412 2008-03-10 23:10:15Z farhan $ 00036 // 00037 00038 #ifndef SCENEGENERATOR_H 00039 #define SCENEGENERATOR_H 00040 00041 #include "Image/Image.H" 00042 #include "Image/Pixels.H" 00043 #include "Raster/Raster.H" 00044 #include "Media/TestImages.H" 00045 00046 #include <vector> 00047 #include <string> 00048 00049 class SceneGenerator 00050 { 00051 public : 00052 enum SceneType {SIMPLE_EDGES, SIMPLE_SHAPES, ALOI_OBJECTS, COIL_OBJECTS, SATELLITE_KATRINA, MIT_LABELME}; 00053 00054 struct ObjectInfo 00055 { 00056 Point2D<int> loc; 00057 int objId; 00058 00059 ObjectInfo(Point2D<int> l, int id): loc(l), objId(id) {} 00060 }; 00061 00062 //! Constructor 00063 SceneGenerator(SceneType sceneType, int width = 255, int height = 255); 00064 00065 00066 ~SceneGenerator(); 00067 00068 //! Get a generated scene 00069 Image<PixRGB<byte> > getScene(int nobj, int lum=-1, int col=-1, int rot=-1); 00070 00071 //! Check whether the target is in this position given a search window 00072 bool checkTargetPos(const Point2D<int> &pt, const Dims &searchWin); 00073 00074 //! get the obj in this position given a search window 00075 int getObjFromPos(const Point2D<int> &pt, const Dims &searchWin); 00076 00077 //! get the target position (first one) 00078 const Point2D<int> getTargetPos() const; 00079 00080 void setSceneType(SceneType sceneId); 00081 00082 //! set the target object 00083 void setTargetObject(int obj); 00084 00085 //! Set the object size 00086 void setObjectSize(int size); 00087 00088 //! set the target color 00089 void setTargetColor(PixRGB<byte> color); 00090 00091 //! set the objects illumination 00092 void setLum(int lum); 00093 00094 //! set the objects colors 00095 void setColor(PixRGB<byte> color); 00096 00097 //! set the noise 00098 void setNoise(int level); 00099 00100 //! set the rotation 00101 void setRotation(int rot); 00102 00103 //! Set the background color 00104 void setBackgroundColor(PixRGB<byte> color); 00105 00106 00107 //! get the target object 00108 int getTargetObject(); 00109 00110 //! get the object size 00111 int getObjectSize(); 00112 00113 //! get the target color 00114 PixRGB<byte> getTargetColor(); 00115 00116 //! get the objects illumination 00117 int getLum(); 00118 00119 //! get the objects colors 00120 PixRGB<byte> getColor(); 00121 00122 //! get the noise 00123 int getNoise(); 00124 00125 //! get the rotation 00126 int getRotation(); 00127 00128 //! get the background color 00129 PixRGB<byte> getBackgroundColor(); 00130 00131 //! get the scene type id 00132 SceneType getSceneType(); 00133 00134 //! get a label me scene 00135 Image<PixRGB<byte> > getLabelMeScene(); 00136 00137 //! get the object location (center of mass) 00138 Point2D<int> getObjLocation(uint objId); 00139 00140 //! get the object ID 00141 int getObjId(uint objId); 00142 00143 //! Get the number of objects in the array 00144 uint getNumObj(); 00145 00146 static const int numSceneTypeNames = 6; //set for the number of names 00147 00148 //! Get the name of a scene type 00149 const char * getSceneTypeNames(SceneType id){ 00150 ASSERT(id < numSceneTypeNames); 00151 static const char* SceneTypeNames[numSceneTypeNames] = { 00152 "Simple Edges", 00153 "Simple Shapes", 00154 "Aloi Objects", 00155 "Coil Objects", 00156 "Satellite: Katrina", 00157 "Mit LabelMe" 00158 }; 00159 00160 return SceneTypeNames[id]; 00161 } 00162 00163 uint getNumSceneTypes(); 00164 00165 private: 00166 00167 Image<PixRGB<byte> > generateAloiObjectsScene(int nobj, int lum, int col, int rot); 00168 Image<PixRGB<byte> > generateCoilObjectsScene(int nobj); 00169 Image<PixRGB<byte> > generateShapeScene(); 00170 Image<PixRGB<byte> > generateEdgeScene(); 00171 Image<PixRGB<byte> > getSceneFile(); 00172 00173 void readDirScenes(const char *path); //read a list of scenes from the file system 00174 00175 00176 00177 00178 SceneType itsSceneType; //The type of scene 00179 int itsWidth; //Width of scene 00180 int itsHeight; //Height of scene 00181 TestImages *itsALOIImages; //the Test ALOI Images class 00182 TestImages *itsCoilImages; //the Test Coil Images class 00183 TestImages *itsTestImages; //the Test images class 00184 std::vector<Point2D<int> > itsTargetsLoc; //the locations of the target in x,y 00185 std::vector<ObjectInfo> itsObjLocation; //the locations of the objext in the array 00186 int itsTargetObject; //the target object 00187 int itsObjectSize; //the size of the objects in the scene 00188 PixRGB<byte> itsTargetColor; //Target Color 00189 int itsLum; //Overall illumination per object 00190 int itsRot; //Overall illumination per object 00191 PixRGB<byte> itsColor; //Overall color illumination per object 00192 int itsNoise; //level of noise; 00193 PixRGB<byte> itsBackgroundColor; //background color; 00194 std::vector<std::string> sceneFilenames; //A list of scenes filenames 00195 00196 }; 00197 00198 #endif 00199 00200 // ###################################################################### 00201 /* So things look consistent in everyone's emacs... */ 00202 /* Local Variables: */ 00203 /* indent-tabs-mode: nil */ 00204 /* End: */