00001 /*!@file Psycho/StimAnalyzer.H make different kind of visual test stimuli 00002 */ 00003 00004 // //////////////////////////////////////////////////////////////////// // 00005 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00006 // University of Southern California (USC) and the iLab at USC. // 00007 // See http://iLab.usc.edu for information about this project. // 00008 // //////////////////////////////////////////////////////////////////// // 00009 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00010 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00011 // in Visual Environments, and Applications'' by Christof Koch and // 00012 // Laurent Itti, California Institute of Technology, 2001 (patent // 00013 // pending; application number 09/912,225 filed July 23, 2001; see // 00014 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00015 // //////////////////////////////////////////////////////////////////// // 00016 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00017 // // 00018 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00019 // redistribute it and/or modify it under the terms of the GNU General // 00020 // Public License as published by the Free Software Foundation; either // 00021 // version 2 of the License, or (at your option) any later version. // 00022 // // 00023 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00024 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00025 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00026 // PURPOSE. See the GNU General Public License for more details. // 00027 // // 00028 // You should have received a copy of the GNU General Public License // 00029 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00030 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00031 // Boston, MA 02111-1307 USA. // 00032 // //////////////////////////////////////////////////////////////////// // 00033 // 00034 // Primary maintainer for this file: T. Nathan Mundhenk <mundhenk@usc.edu> 00035 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Psycho/StimAnalyzer.H $ 00036 // $Id: StimAnalyzer.H 6795 2006-06-29 20:45:32Z rjpeters $ 00037 00038 00039 #ifndef STIM_ANALYZER_H_DEFINED 00040 #define STIM_ANALYZER_H_DEFINED 00041 00042 #include <string> 00043 #include <vector> 00044 #include "Image/Image.H" 00045 #include "Image/Pixels.H" 00046 00047 using namespace std; 00048 00049 //! analize stats from stim maker and surprise 00050 class StimAnalyzer 00051 { 00052 public: 00053 StimAnalyzer(const int frames, const ushort conditions); 00054 ~StimAnalyzer(); 00055 //! initalize SA with number of frames and conditions 00056 void SAinit(const int frames, const ushort conditions); 00057 //! upload a frame, salmap and gound truth with condition 00058 void SAinputImages(const Image<double> salmap, 00059 const Image<PixRGB<double> > groundTruth, 00060 const uint frame, 00061 const ushort condition); 00062 //! called from SAinputImages, runs stats per frame 00063 void SAcompImages(); 00064 //! after all frames are run, find final stats 00065 void SAfinalStats(); 00066 //! dump the stats "per frame" 00067 void SAdumpFrameStats(string fileName, string sample, 00068 bool printHeader); 00069 //! dunp the stats "per condition" 00070 void SAdumpConditionStats(string fileName, string sample, 00071 bool printHeader); 00072 00073 //! is this item "on" durring this frame? 00074 std::vector<bool> itsTargetFrameOn; 00075 //! is this item "on" durring this frame? 00076 std::vector<bool> itsDistFrameOn; 00077 //! is this item "on" durring this frame? 00078 std::vector<bool> itsOtherFrameOn; 00079 00080 //! Pixel count of items in frame 00081 std::vector<uint> itsTargetFrameNumber; 00082 //! Pixel count of items in frame 00083 std::vector<uint> itsDistFrameNumber; 00084 //! Pixel count of items in frame 00085 std::vector<uint> itsOtherFrameNumber; 00086 00087 //! Pixel count of items when they are "on" per condition 00088 std::vector<uint> itsTargetFrameTotalONNumber; 00089 //! Pixel count of items when they are "on" per condition 00090 std::vector<uint> itsDistFrameTotalONNumber; 00091 //! Pixel count of items when they are "on" per condition 00092 std::vector<uint> itsOtherFrameTotalONNumber; 00093 00094 //! Sum saliency value per frame over each item 00095 std::vector<double> itsTargetFrameSum; 00096 //! Sum saliency value per frame over each item 00097 std::vector<double> itsDistFrameSum; 00098 //! Sum saliency value per frame over each item 00099 std::vector<double> itsOtherFrameSum; 00100 00101 //! Sum of Squares saliency value per frame over each item 00102 std::vector<double> itsTargetFrameSS; 00103 //! Sum of Squares saliency value per frame over each item 00104 std::vector<double> itsDistFrameSS; 00105 //! Sum of Squares saliency value per frame over each item 00106 std::vector<double> itsOtherFrameSS; 00107 00108 //! Min value of item per frame 00109 std::vector<double> itsTargetFrameMin; 00110 //! Min value of item per frame 00111 std::vector<double> itsDistFrameMin; 00112 //! Min value of item per frame 00113 std::vector<double> itsOtherFrameMin; 00114 00115 //! Max value of item per frame 00116 std::vector<double> itsTargetFrameMax; 00117 //! Max value of item per frame 00118 std::vector<double> itsDistFrameMax; 00119 //! Max value of item per frame 00120 std::vector<double> itsOtherFrameMax; 00121 00122 //! Mean value of item per frame 00123 std::vector<double> itsTargetFrameMean; 00124 //! Mean value of item per frame 00125 std::vector<double> itsDistFrameMean; 00126 //! Mean value of item per frame 00127 std::vector<double> itsOtherFrameMean; 00128 00129 //! Std value of item per frame 00130 std::vector<double> itsTargetFrameStd; 00131 //! Std value of item per frame 00132 std::vector<double> itsDistFrameStd; 00133 //! Std value of item per frame 00134 std::vector<double> itsOtherFrameStd; 00135 00136 //! Sum saliency value over each item per condition 00137 std::vector<double> itsTargetFrameTotalONSum; 00138 //! Sum saliency value over each item per condition 00139 std::vector<double> itsDistFrameTotalONSum; 00140 //! Sum saliency value over each item per condition 00141 std::vector<double> itsOtherFrameTotalONSum; 00142 00143 //! Sum of Squares saliency value over each item per condition 00144 std::vector<double> itsTargetFrameTotalONSS; 00145 //! Sum of Squares saliency value over each item per condition 00146 std::vector<double> itsDistFrameTotalONSS; 00147 //! Sum of Squares saliency value over each item per condition 00148 std::vector<double> itsOtherFrameTotalONSS; 00149 00150 //! Min pixel saliency value over each item per condition 00151 std::vector<double> itsTargetFrameTotalONMin; 00152 //! Min pixel saliency value over each item per condition 00153 std::vector<double> itsDistFrameTotalONMin; 00154 //! Min pixel saliency value over each item per condition 00155 std::vector<double> itsOtherFrameTotalONMin; 00156 00157 //! Max pixel saliency value over each item per condition 00158 std::vector<double> itsTargetFrameTotalONMax; 00159 //! Max pixel saliency value over each item per condition 00160 std::vector<double> itsDistFrameTotalONMax; 00161 //! Max pixel saliency value over each item per condition 00162 std::vector<double> itsOtherFrameTotalONMax; 00163 00164 //! Mean pixel saliency value over each item per condition 00165 std::vector<double> itsTargetFrameTotalONMean; 00166 //! Mean pixel saliency value over each item per condition 00167 std::vector<double> itsDistFrameTotalONMean; 00168 //! Mean pixel saliency value over each item per condition 00169 std::vector<double> itsOtherFrameTotalONMean; 00170 00171 //! Std pixel saliency value over each item per condition 00172 std::vector<double> itsTargetFrameTotalONStd; 00173 //! Std pixel saliency value over each item per condition 00174 std::vector<double> itsDistFrameTotalONStd; 00175 //! Std pixel saliency value over each item per condition 00176 std::vector<double> itsOtherFrameTotalONStd; 00177 00178 private: 00179 //! this frames "ground truth" image 00180 Image<PixRGB<double> > itsGroundTruth; 00181 //! this frames Saliency Map 00182 Image<double> itsSalMap; 00183 00184 //! Ground truth Target Color 00185 PixRGB<double> itsGTtargetColor; 00186 //! Ground truth Target Color for patch 00187 PixRGB<double> itsGTtargetColorPatch1; 00188 //! Ground truth Target Color for large patch 00189 PixRGB<double> itsGTtargetColorPatch2; 00190 //! Ground truth Target Color for patch if target is off 00191 PixRGB<double> itsGTtargetColorPatch1off; 00192 //! Ground truth Target Color for patch if target is off 00193 PixRGB<double> itsGTtargetColorPatch2off; 00194 //! Ground truth Distractor Color 00195 PixRGB<double> itsGTdistColor; 00196 00197 //! Total number of frames 00198 uint itsFrames; 00199 //! The current frame 00200 uint itsFrame; 00201 //! Total number of conditions 00202 ushort itsConditions; 00203 //! The current condition for this frame 00204 ushort itsCondition; 00205 }; 00206 00207 #endif // STIM_ANALYZER_H_DEFINED