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

KfrDiffExtractor.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_VideoSet_KfrDiffExtractor_h
00002 #define Impala_Core_VideoSet_KfrDiffExtractor_h
00003 
00004 #include "Core/VideoSet/KfrMotionExtractor.h"
00005 #include "Core/Vector/DivAssign.h"
00006 
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace VideoSet
00012 {
00013 
00014 class KfrDiffExtractor : public KfrMotionExtractor
00015 {
00016 
00017 public:
00018 
00019     KfrDiffExtractor(Reporter* reporter, CmdOptions& options) :
00020       //KfrMotionExtractor(reporter, options, "rkfmotion", 3 * BINS_PER_CHANNEL)
00021       KfrMotionExtractor(reporter, options, "rkfmotion", 3 * 2)
00022     {
00023     }
00024 
00025     virtual 
00026     ~KfrDiffExtractor()
00027     {
00028     }
00029 
00030 protected:
00031 
00032     virtual VectorReal64
00033     ComputeHistogram(Array::Array2dVec3UInt8* image)
00034     {
00035         UInt8* data = image->CPB(0, 0);
00036         const int nPix = image->CW() * image->CH();
00037 
00038         VectorReal64 histogram(GetBinCount());
00039         Real64* histR = histogram.GetData();
00040         Real64* histG = histR + BINS_PER_CHANNEL;
00041         Real64* histB = histG + BINS_PER_CHANNEL;
00042 
00043         for (int i = 0; i < GetBinCount(); i++)
00044             histR[i] = 0;
00045 
00046         for (int j = 0; j < nPix; j++) 
00047         {
00048             const int r = ComputeBin((int) data[0], 0, 255, BINS_PER_CHANNEL);
00049             histR[r] += 1;
00050 
00051             const int g = ComputeBin((int) data[1], 0, 255, BINS_PER_CHANNEL);
00052             histG[g] += 1;
00053 
00054             const int b = ComputeBin((int) data[2], 0, 255, BINS_PER_CHANNEL);
00055             histB[b] += 1;
00056 
00057             data += 3;
00058         }
00059 
00060         const Real64 factor = nPix;
00061         Vector::DivAssign(histogram, factor);
00062 
00063         return histogram;
00064     }
00065 
00066 
00067 private:
00068 
00069     static const int BINS_PER_CHANNEL = 32;
00070 
00071     ILOG_VAR_DECL;
00072 };
00073 
00074 ILOG_VAR_INIT(KfrDiffExtractor, Impala.Core.VideoSet);
00075 
00076 } // namespace VideoSet
00077 } // namespace Core
00078 } // namespace Impala
00079 
00080 #endif

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