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

ClusterorFactory.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Feature_ClusterorFactory_h
00002 #define Impala_Core_Feature_ClusterorFactory_h
00003 
00004 #include "Basis/StringList.h"
00005 #include "Core/Vector/WeibullSim.h"
00006 #include "Core/Vector/HistogramIntersection.h"
00007 #include "Core/Feature/RadiusClusteror.h"
00008 
00009 namespace Impala
00010 {
00011 namespace Core
00012 {
00013 namespace Feature
00014 {
00015 
00016 
00017 class ClusterorFactory
00018 {
00019 public:
00020 
00021     ~ClusterorFactory()
00022     {
00023     }
00024 
00025     static ClusterorFactory&
00026     Instance()
00027     {
00028         static ClusterorFactory theFactory;
00029         return theFactory;
00030     }
00031 
00032     void
00033     Construct(std::vector<Clusteror*>& clusList, int imageFeatureSet,
00034               int regionFeatureSet, int nrWantedClusters, int nrSamplesAtime,
00035               int minElemsInCluster, String clusteror, CmdOptions& options)
00036     {
00037         StringList sList(clusteror, ';');
00038         StringListCI it = sList.begin();
00039         String clusType = *it++;
00040         if (clusType == "radius")
00041         {
00042             if (it == sList.end())
00043             {
00044                 ILOG_ERROR("need similarity functor");
00045                 return;
00046             }
00047             String simFtor = *it++;
00048             if (it == sList.end())
00049             {
00050                 ILOG_ERROR("need radius");
00051                 return;
00052             }
00053             double radiusStart = atof(*it++);
00054             double radiusEnd = radiusStart;
00055             if (it != sList.end())
00056                 radiusEnd = atof(*it++);
00057             double radiusStep = 1.0;
00058             if (it != sList.end())
00059                 radiusStep = atof(*it++);
00060             double r = radiusStart;
00061             do
00062             {
00063                 if (simFtor == "histint")
00064                 {
00065                     typedef Core::Vector::HistogramIntersectionFtor<Real64> SimFtorT;
00066                     clusList.push_back
00067                         (new RadiusClusteror<SimFtorT>(imageFeatureSet, 
00068                                                        regionFeatureSet, r,
00069                                                        nrSamplesAtime,
00070                                                        nrWantedClusters,
00071                                                        minElemsInCluster,
00072                                                        SimFtorT()));
00073                 }
00074                 if (simFtor == "weisim")
00075                 {
00076                     typedef Core::Vector::WeibullSimFtor<Real64> SimFtorT;
00077                     clusList.push_back
00078                         (new RadiusClusteror<SimFtorT>(imageFeatureSet, 
00079                                                        regionFeatureSet, r,
00080                                                        nrSamplesAtime,
00081                                                        nrWantedClusters,
00082                                                        minElemsInCluster,
00083                                                        SimFtorT()));
00084                 }
00085                 r += radiusStep;
00086             }
00087             while (r <= radiusEnd);
00088             return;
00089         }
00090         ILOG_ERROR("Unknown clusteror type " << clusType << "!");
00091     }
00092 
00093 private:
00094 
00095     ClusterorFactory()
00096     {
00097     }
00098 
00099     ClusterorFactory(const ClusterorFactory&)
00100     {
00101     }
00102 
00103     ClusterorFactory&
00104     operator=(const ClusterorFactory&);
00105 
00106     ILOG_VAR_DEC;
00107 };
00108 
00109 ILOG_VAR_INIT(ClusterorFactory, Impala.Core.Feature);
00110 
00111 } // namespace Feature
00112 } // namespace Core
00113 } // namespace Impala
00114 
00115 #endif

Generated on Fri Mar 19 09:31:05 2010 for ImpalaSrc by  doxygen 1.5.1