Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

Impala::Core::Feature::InterestPointFeature::InterestPointFeature ( CmdOptions options  )  [inline]

Definition at line 71 of file InterestPointFeature.h.

References Impala::Core::Feature::FeatureDefinition::AddParameter(), Impala::CmdOptions::GetBool(), Impala::Util::StringParser::GetDouble(), Impala::Core::Feature::GetDSurfOptions(), Impala::Util::RandomGenerator::GetInstance(), Impala::CmdOptions::GetInt(), Impala::Util::StringParser::GetString(), Impala::CmdOptions::GetString(), Impala::MakeString(), mClusterInput, mDenseSamplingScales, mDescriptorReduceFilename, mDynamicPointSelector, mDynamicPointSelectorConfig, mFeatureDefinition, mKeepLimited, mName, mOutputFormat, mPointSelector, mStripBorder, mSurfParams, mUseRecGauss, mVerbose, Impala::StringReplace(), Impala::StringReplaceAll(), Impala::StringStartsWith(), and Impala::Util::StringParser::TheEnd().

00071                                               :
00072         mVerbose(0),
00073         mStripBorder(0),
00074         mUseRecGauss(false),
00075         mKeepLimited(0),
00076         mCodebook(0),
00077         mDescriptorReduce(0),
00078         mClusterInput(false),
00079         mClusterInputData(0),
00080         mDynamicPointSelector(false),
00081         mDatabase(0)
00082     {
00083         mVerbose     = options.GetInt("verb");
00084         mUseRecGauss = options.GetBool("recGauss");
00085         mStripBorder = options.GetInt("borderWidth");
00086         mOutputFormat = options.GetString("outputFormat");
00087 
00088         mClusterInput = options.GetBool("clusterInput");
00089         mKeepLimited = options.GetInt("keepLimited");
00090         if (!options.GetBool("noRandomizeSeed"))
00091             Util::RandomGenerator::GetInstance().RandomizeSeed();
00092 
00093         String detector    = options.GetString("detector");
00094         mName              = detector + "-" + options.GetString("descriptor");
00095         mFeatureDefinition = FeatureDefinition(mName);
00096 
00097         String descriptor = options.GetString("descriptor");
00098         if((descriptor.size() >= 4) &&
00099            (descriptor.substr(descriptor.size()-4,4) == "surf"))
00100         {
00101             Core::Feature::GetDSurfOptions(options, mSurfParams[0],
00102                                            mSurfParams[1], mSurfParams[2]);
00103             mFeatureDefinition.AddParameter
00104                 ("sc", MakeString(mSurfParams[0]) + "-" +
00105                  MakeString(mSurfParams[1]) + "-" + MakeString(mSurfParams[2]));
00106         }
00107         if((detector == "harrislaplace") || (detector == "harrislaplace2"))
00108         {
00109             if(options.GetString("harrisThreshold") != "1e-9")
00110             {
00111                 mFeatureDefinition.AddParameter
00112                     ("ht", options.GetString("harrisThreshold"));
00113             }
00114         }
00115         if((detector == "densesampling") || (detector == "denseall"))
00116         {
00117             // detector config
00118             int spacing = options.GetInt("ds_spacing");
00119             String scales = options.GetString("ds_scales");
00120 
00121             Util::StringParser sp(scales);
00122             while(!sp.TheEnd())
00123             {
00124                 Real64 scale = sp.GetDouble('+', false, true);
00125                 mDenseSamplingScales.push_back(scale);
00126             }
00127             if(mDenseSamplingScales.size() == 0)
00128             {
00129                 // fallback to estimate
00130                 Real64 scale = Real64(spacing) / 5;
00131                 // Most computation code uses 4*scale for the circular region size.
00132                 // Therefore, it makes sense to not provide the 'actual' region of
00133                 // interest here, but something smaller.
00134                 mDenseSamplingScales.push_back(scale);
00135             }
00136             String name = MakeString(spacing);
00137             for(int i = 0; i < mDenseSamplingScales.size(); i++)
00138             {
00139                 name += "-" + MakeString(mDenseSamplingScales[i]);
00140             }
00141             mFeatureDefinition.AddParameter("ds", name);
00142         }
00143 
00144         mDescriptorReduceFilename = options.GetString("descriptorReduce");
00145         if(!mDescriptorReduceFilename.empty()) mFeatureDefinition.AddParameter("red", "1");
00146 
00147         if(!options.GetString("descriptorOpponentWeight").empty())
00148         {
00149             mFeatureDefinition.AddParameter
00150                 ("ow", options.GetString("descriptorOpponentWeight"));
00151         }
00152         if(StringStartsWith(options.GetString("pointSelector"), "dynamic-"))
00153         {
00154             // keep mPointSelector empty: we load it on-demand
00155             mDynamicPointSelector = true;
00156             String config = options.GetString("pointSelector");
00157             mFeatureDefinition.AddParameter("ps", config);
00158             config = StringReplace(config, "dynamic-", "");
00159             mDynamicPointSelectorConfig = config;
00160         }
00161         else if(options.GetString("pointSelector").size() != 0)
00162         {
00163             // filter on location (spatial pyramid)
00164             String config = options.GetString("pointSelector");
00165             String configName = config;
00166             if(config == "pyramid-1x1-2x2")
00167             {
00168                 config = "P1x1#0+P2x2#0+P2x2#1+P2x2#2+P2x2#3";
00169             }
00170             if(config == "pyramid-1x1-2x2-3x1")
00171             {   // this is vertical (!)
00172                 config = "P1x1#0+P2x2#0+P2x2#1+P2x2#2+P2x2#3+P3x1#0+P3x1#1+P3x1#2";
00173             }
00174             if(config == "pyramid-1x1-2x2-1x3")
00175             {
00176                 // this is division into three horizontal bars
00177                 config = "P1x1#0+P2x2#0+P2x2#1+P2x2#2+P2x2#3+P1x3#0+P1x3#1+P1x3#2";
00178             }
00179             Util::StringParser sp(config);
00180             while(!sp.TheEnd())
00181             {
00182                 String selectorConfig = sp.GetString('+', false);
00183                 if(selectorConfig.size() == 0) break;
00184                 InterestPointSelector* selector =
00185                     new InterestPointSelector(selectorConfig, mStripBorder);
00186                 mPointSelector.push_back(selector);
00187             }
00188             configName = StringReplaceAll(configName, "+", "");
00189             configName = StringReplaceAll(configName, "#", "x");
00190             mFeatureDefinition.AddParameter("ps", configName);
00191         }
00192         else
00193         {
00194             // default: a filter spanning the complete image
00195             InterestPointSelector* selector =
00196                 new InterestPointSelector("P1x1#0", mStripBorder);
00197             mPointSelector.push_back(selector);
00198         }
00199     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:09:51 2010 for ImpalaSrc by  doxygen 1.5.1