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

template<class ArrayT>
void Impala::Core::Vector::Avg ( typename VectorSet< ArrayT >::VectorT *  dst,
VectorSet< ArrayT > *  src,
int  size,
bool *  filter 
) [inline]

Definition at line 43 of file Avg.h.

References AddAssign(), DivAssign(), Impala::Core::Vector::VectorSet< ArrayT >::GetVector(), Impala::Core::Vector::VectorSet< ArrayT >::GetVectorLength(), and Impala::Core::Vector::VectorSet< ArrayT >::HasConstVectorSize().

Referenced by Impala::Core::Feature::VisSem::ComputeFeaturesPixelSet().

00045 {
00046     typedef typename VectorSet<ArrayT>::VectorT VectorT;
00047 
00048     if (!src->HasConstVectorSize())
00049     {
00050         std::cout << "Vector::Avg: works for constant vector size only" << std::endl;
00051         return;
00052     }
00053     VectorT res(src->GetVectorLength(0));
00054     res = 0;
00055     typename VectorSet<ArrayT>::ElemT factor = 0;
00056     for (int i=0 ; i<size ; i++)
00057     {
00058         if (!filter || filter[i])
00059         {
00060             AddAssign(res, src->GetVector(i, true));
00061             factor++;
00062         }
00063     }
00064     DivAssign(res, factor);
00065     if (!dst)
00066         dst = new VectorT(res);
00067     else
00068         *dst = res;
00069 }

Here is the call graph for this function:


Generated on Thu Jan 13 09:21:35 2011 for ImpalaSrc by  doxygen 1.5.1