00001 /*!@file Neuro/SimulationViewerEyeRegion.H comparison between region data from an ObjRec object (from an XML file) and human eye movements */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2003 // 00005 // by the 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: Laurent Itti <itti@usc.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Neuro/SimulationViewerEyeRegion.H $ 00035 // $Id: SimulationViewerEyeRegion.H 13644 2010-07-06 17:07:43Z jshen $ 00036 // 00037 00038 #ifndef SIMULATIONVIEWEREYEREGION_H_DEFINED 00039 #define SIMULATIONVIEWEREYEREGION_H_DEFINED 00040 00041 #include "Component/ModelParam.H" 00042 //#include "Image/ImageCache.H" 00043 //#include "Image/ImageSet.H" 00044 //#include "Image/LevelSpec.H" 00045 #include "Neuro/SimulationViewerEyeMvt.H" 00046 #include "Simulation/SimEvents.H" 00047 00048 // add class definitions for Object Recognition 00049 class TestImages; 00050 00051 typedef TestImages::SceneData Scene; 00052 typedef TestImages::ObjData Object; 00053 //! Measure salience at human eye positions 00054 00055 const uint NULL_OBJ = -1; 00056 00057 class SimulationViewerEyeRegion : public SimulationViewerEyeMvt { 00058 public: 00059 // ###################################################################### 00060 /*! @name Constructors and destructors */ 00061 //@{ 00062 00063 //! Constructor. See ModelComponent.H. 00064 SimulationViewerEyeRegion(OptionManager& mgr, 00065 const std::string& descrName = 00066 "EyeRegion Simulation Viewer", 00067 const std::string& tagName = 00068 "SimulationViewerEyeRegion"); 00069 00070 //! Destructor 00071 virtual ~SimulationViewerEyeRegion(); 00072 //@} 00073 00074 // returns the XML id of the object 00075 uint findHitRegion(const Point2D<int> pt, uint frameNum); 00076 uint findHitRegion(const Point2D<int> pt) 00077 {return findHitRegion(pt, itsFrameNumber);} 00078 00079 std::string listAllRegionsHit(const Point2D<int> pt, uint frameNum); //uses default 00080 std::string listAllRegionsHit(const Point2D<int> pt) 00081 {return listAllRegionsHit(pt, itsFrameNumber);} 00082 00083 double rankForeground(Object obj); 00084 protected: 00085 //! Callback for every clock tick 00086 //SIMCALLBACK_DECLARE(SimulationViewerEyeRegion, SimEventClockTick); 00087 00088 //! Callback for every time we should save our outputs 00089 //SIMCALLBACK_DECLARE(SimulationViewerEyeRegion, SimEventSaveOutput); 00090 00091 //! Save our various results 00092 //virtual void save1(const ModelComponentSaveInfo& sinfo); 00093 00094 //! Get the attention/eye/head trajectory image 00095 Image< PixRGB<byte> > getTraj(SimEventQueue& q); 00096 void extraSampleProcessing(const rutz::shared_ptr<EyeData> data); 00097 void writeROIOutput(Point2D<int> pos); 00098 void drawEye(const rutz::shared_ptr<EyeData> data, const uint trackerNum); 00099 void drawFOA(const Point2D<int> target, const uint trackerNum); 00100 void drawRegions(Object obj); 00101 void drawRegions() {drawRegions(getSceneObj(NULL_OBJ));} 00102 00103 Object getSceneObj(uint objID, uint FrameNum); //uses default 00104 Object getSceneObj(uint objID) {return getSceneObj(objID,itsFrameNumber);} 00105 std::string getObjName(uint objID); 00106 00107 std::string craftSVEMOutput(const std::string tfn, 00108 const rutz::shared_ptr<EyeData> data); 00109 std::string craftRegionOutput(const rutz::shared_ptr<EyeData> data); 00110 00111 void start1(); //!< get started 00112 void stop1(); //!< get stopped 00113 00114 OModelParam<std::string> itsRegionOutFname; //!< Our results file 00115 OModelParam<std::string> itsXMLFname; 00116 OModelParam<std::string> itsSelectedObjects; 00117 OModelParam<std::string> itsObjectDrawMode; 00118 OModelParam<std::string> itsHighlightMode; 00119 OModelParam<bool> itsPrependHeader; // Setup for when we reincorporate the two files together 00120 NModelParam<uint> itsLineThickness; 00121 NModelParam<double> itsHitTransparency; 00122 NModelParam<bool> itsRandomColoring; 00123 00124 rutz::shared_ptr<TestImages> itsObjectsInfo; 00125 00126 std::ofstream *itsRegionOutFile; 00127 Image< PixRGB<byte> > itsRegions; 00128 Image< PixRGB<byte> > itsTargetsMask; // used for transparency/highlighting 00129 00130 uint itsNumObjects; 00131 uint itsCurrRegionID; 00132 rutz::shared_ptr<EyeData> itsObjectEntry; 00133 SimTime itsObjectOnset; 00134 uint itsObjectFrameOnset; 00135 00136 std::vector<PixRGB<byte> > itsRandColors; 00137 std::vector<std::string> itsObjectsNames; 00138 bool itsRegHeaderWritten; 00139 private: 00140 00141 }; 00142 00143 #endif 00144 00145 // ###################################################################### 00146 /* So things look consistent in everyone's emacs... */ 00147 /* Local Variables: */ 00148 /* indent-tabs-mode: nil */ 00149 /* End: */