SaliencyMapFeatureExtractor.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef TIGS_SALIENCYMAPFEATUREEXTRACTOR_C_DEFINED
00039 #define TIGS_SALIENCYMAPFEATUREEXTRACTOR_C_DEFINED
00040
00041 #include "TIGS/SaliencyMapFeatureExtractor.H"
00042
00043 #include "Component/ModelOptionDef.H"
00044 #include "Image/fancynorm.H"
00045 #include "Neuro/VisualCortex.H"
00046 #include "Neuro/VisualCortexConfigurator.H"
00047 #include "TIGS/TigsOpts.H"
00048 #include "rutz/trace.h"
00049
00050
00051 static const ModelOptionDef OPT_SmfxVcType =
00052 { MODOPT_ARG_STRING, "SmfxVcType", &MOC_TIGS, OPTEXP_CORE,
00053 "VisualCortex type for the saliency-map feature extractor",
00054 "smfx-vc-type", '\0', "<string>", "Std" };
00055
00056
00057 static const ModelOptionDef OPT_SmfxNormType =
00058 { MODOPT_ARG(MaxNormType), "SmfxNormType", &MOC_TIGS, OPTEXP_CORE,
00059 "Normalization type for the saliency-map feature extractor",
00060 "smfx-norm-type", '\0', "<string>", "Fancy" };
00061
00062
00063 static const ModelOptionDef OPT_SmfxRescale512 =
00064 { MODOPT_FLAG, "SmfxRescale512", &MOC_TIGS, OPTEXP_CORE,
00065 "Whether to rescale smfx to 512x512 before computing the saliency map",
00066 "smfx-rescale-512", '\0', "", "true" };
00067
00068
00069 SaliencyMapFeatureExtractor::
00070 SaliencyMapFeatureExtractor(OptionManager& mgr)
00071 :
00072 FeatureExtractor(mgr, "uninitialized"),
00073 itsNormType(&OPT_SmfxNormType, this),
00074 itsVcType(&OPT_SmfxVcType, this),
00075 itsRescale512(&OPT_SmfxRescale512, this),
00076 itsVCC(new VisualCortexConfigurator(mgr))
00077 {
00078 this->addSubComponent(itsVCC);
00079
00080 this->setCheckFrequency(0);
00081 }
00082
00083
00084 SaliencyMapFeatureExtractor::
00085 ~SaliencyMapFeatureExtractor() {}
00086
00087
00088 void SaliencyMapFeatureExtractor::
00089 paramChanged(ModelParamBase* const param,
00090 const bool valueChanged,
00091 ParamClient::ChangeStatus* status)
00092 {
00093 FeatureExtractor::paramChanged(param, valueChanged, status);
00094
00095 if (param == &itsVcType)
00096 {
00097 itsVCC->setModelParamString("VisualCortexType",
00098 itsVcType.getVal());
00099
00100 itsVCC->getVC()->setModelParamVal
00101 ("MaxNormType", itsNormType.getVal(), MC_RECURSE);
00102
00103 LINFO("set SaliencyMapFeatureExtractor to vctype=%s",
00104 itsVcType.getVal().c_str());
00105 }
00106
00107 const char* pfx = itsRescale512.getVal() ? "smfx" : "smofx";
00108
00109 if (itsVcType.getValString() == "Std")
00110 this->changeFxName(pfx + itsNormType.getValString());
00111 else
00112 this->changeFxName(pfx + itsNormType.getValString()
00113 + itsVcType.getValString());
00114 }
00115
00116
00117 Dims SaliencyMapFeatureExtractor::smDims() const
00118 {
00119 if (itsRescale512.getVal())
00120 {
00121 return Dims(512,512);
00122 }
00123 else
00124 {
00125 return Dims(640,480);
00126 }
00127 }
00128
00129
00130 Image<float> SaliencyMapFeatureExtractor::
00131 doExtract(const TigsInputFrame& fin)
00132 {
00133 GVX_TRACE(__PRETTY_FUNCTION__);
00134
00135 if (fin.isGhost())
00136 LFATAL("SaliencyMapFeatureExtractor needs non-ghost frames");
00137
00138 LFATAL("FIXME");
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156 return Image<float>();
00157 }
00158
00159
00160 void SaliencyMapFeatureExtractor::start1()
00161 {
00162 itsVCC->getVC()->setModelParamVal
00163 ("MaxNormType", itsNormType.getVal(), MC_RECURSE);
00164 }
00165
00166
00167
00168
00169
00170
00171
00172
00173 #endif // TIGS_SALIENCYMAPFEATUREEXTRACTOR_C_DEFINED