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

Mat* Impala::Core::Matrix::VectorQuantize ( Mat *  data,
Mat *  codebook 
)

Definition at line 52 of file VectorQuantize.h.

References MatE(), MatNrCol(), MatNrRow(), and VectorQuantizeX().

Referenced by KmeansClustering(), Impala::Core::Feature::InterestPointFeature::ProjectHardIndex(), and Impala::Core::Feature::InterestPointFeature::ProjectHardMatrix().

00053 {
00054     Timer vqTimer;
00055     int step = 10000;
00056     Mat* res = MatCreate<Mat>(MatNrRow(data), 2);
00057 // OpenMP support is possible, but do limit the step size or memory usage will explode
00058 //#pragma omp parallel for schedule(static)
00059     for(int i = 0; i < MatNrRow(data); i += step)
00060     {
00061         int s = MatNrRow(data) - i;
00062         if(step < s) s = step;
00063 
00064         Mat* partial = MatCreate<Mat>(s, MatNrCol(data), MatE(data, i, 0), true);
00065         //std::cout << "QuantizePart" << i << " start " << vqTimer.SplitTimeStr() << std::endl;
00066         Mat* temp = VectorQuantizeX(partial, codebook);
00067         //std::cout << "QuantizePart" << i << " vq'd " << vqTimer.SplitTimeStr() << std::endl;
00068         for(int j = 0; j < s; j++)
00069         {
00070             *MatE(res, i + j, 0) = *MatE(temp, j, 0);
00071             *MatE(res, i + j, 1) = *MatE(temp, j, 1);
00072         }
00073         delete temp;
00074         delete partial;
00075     }
00076     return res;
00077 }

Here is the call graph for this function:


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