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

HistogramIntersection.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Vector_HistogramIntersection_h
00002 #define Impala_Core_Vector_HistogramIntersection_h
00003 
00004 #include "Core/Vector/VectorTem.h"
00005 
00006 namespace Impala
00007 {
00008 namespace Core
00009 {
00010 namespace Vector
00011 {
00012 
00013 
00014 template <class ElemT>
00015 inline ElemT
00016 HistogramIntersection(const VectorTem<ElemT>& v1, const VectorTem<ElemT>& v2)
00017 {
00018     ElemT score = 0;
00019     for (int i=0 ; i<v1.Size() ; i++)
00020         score += Impala::Min(v1[i], v2[i]);
00021     return score;
00022 }
00023 
00024 template <class ElemT>
00025 class HistogramIntersectionFtor
00026 {
00027 public:
00028 
00029     ElemT
00030     DoIt(const VectorTem<ElemT>& v1, const VectorTem<ElemT>& v2)
00031     {
00032         ElemT score = 0;
00033         for (int i=0 ; i<v1.Size() ; i++)
00034             score += Impala::Min(v1[i], v2[i]);
00035         return score;
00036     }
00037 };
00038 
00039 
00040 } // namespace Vector
00041 } // namespace Core
00042 } // namespace Impala
00043 
00044 #endif

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