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

virtual VectorReal64 Impala::Core::VideoSet::RgbHistExtractor::ComputeHistogram ( Array::Array2dVec3UInt8 image  )  [inline, protected, virtual]

Implements Impala::Core::VideoSet::HistogramExtractor.

Definition at line 32 of file RgbHistExtractor.h.

References BINS_PER_CHANNEL, Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CH(), Impala::Core::VideoSet::HistogramExtractor::ComputeBin(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CPB(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CW(), Impala::Core::Vector::DivAssign(), Impala::Core::VideoSet::HistogramExtractor::GetBinCount(), and Impala::Core::Vector::VectorTem< ElemT >::GetData().

00033     {
00034         UInt8* data = image->CPB(0, 0);
00035         const int nPix = image->CW() * image->CH();
00036 
00037         VectorReal64 histogram(GetBinCount());
00038         Real64* histR = histogram.GetData();
00039         Real64* histG = histR + BINS_PER_CHANNEL;
00040         Real64* histB = histG + BINS_PER_CHANNEL;
00041 
00042         for (int i = 0; i < GetBinCount(); i++)
00043             histR[i] = 0;
00044 
00045         for (int j = 0; j < nPix; j++) 
00046         {
00047             const int r = ComputeBin((int) data[0], 0, 255, BINS_PER_CHANNEL);
00048             histR[r] += 1;
00049 
00050             const int g = ComputeBin((int) data[1], 0, 255, BINS_PER_CHANNEL);
00051             histG[g] += 1;
00052 
00053             const int b = ComputeBin((int) data[2], 0, 255, BINS_PER_CHANNEL);
00054             histB[b] += 1;
00055 
00056             data += 3;
00057         }
00058 
00059         const Real64 factor = nPix;
00060         Vector::DivAssign(histogram, factor);
00061 
00062         return histogram;
00063     }

Here is the call graph for this function:


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