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

FeatureTable* Impala::Samples::MonetTest::MakeFeatureTableMapi ( VideoSet *  vidSet,
int  fileIdx,
FeatureDefinition  def,
Connection *  conn 
)

Definition at line 325 of file mainMonetTest.cpp.

References Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Add(), Impala::Core::Feature::FeatureDefinition::AsString(), Impala::Core::VideoSet::VideoSet::GetQuidFrame(), Impala::Core::VideoSet::VideoSet::GetQuidVideo(), Impala::Util::Hex2Bin(), ILOG_ERROR, ILOG_VAR, and Impala::MakeString().

Referenced by DoCheckFeatures().

00327 {
00328     ILOG_VAR(Impala.Samples.MonetTest.MakeFeatureTableMapi);
00329 
00330     Quid vidQuid = vidSet->GetQuidVideo(fileIdx, true);
00331     String query =
00332         "select fr.fragment_start, fv.vector \
00333          from feature_vector fv, fragment fr, file f, feature fe \
00334          where  f.quid = " + MakeString(vidQuid) + " and \
00335                 fr.media_id = f.media_id and \
00336                 fr.fragment_length = 1 and \
00337                 fr.keyframe = false and \
00338                 fe.feature_name = '" + def.AsString() + "' and \
00339                 fe.feature_id = fv.feature_id and \
00340                 fv.fragment_id = fr.fragment_id and \
00341                 fv.file_id = f.file_id \
00342          order by fr.fragment_start;";
00343 
00344     MapiHdl hdl = conn->QueryPartStart(query);
00345     if (hdl == 0)
00346         return 0;
00347 
00348     int* start = 0;
00349     int startSize = 0;
00350     if (!conn->QueryPartFetchInt(hdl, 0, start, startSize))
00351         return 0;
00352 
00353     std::vector<String> res;
00354     if (!conn->QueryPartFetchString(hdl, 1, res))
00355         return 0;
00356 
00357     conn->QueryPartEnd(hdl);
00358 
00359     FeatureTable* feat = 0;
00360     for (int i=0 ; i<startSize ; i++)
00361     {
00362         Quid q = vidSet->GetQuidFrame(fileIdx, start[i], true);
00363 
00364         size_t dataSize;
00365         UInt8* data = Util::Hex2Bin(res[i], dataSize);        
00366         int n = dataSize / sizeof(Real64);
00367         Real64* realData = (Real64*) data;
00368         FeatureTable::VectorReal64 v(n, realData, true);
00369 
00370         if (feat == 0)
00371             feat = new FeatureTable(def, res.size(), n);
00372         feat->Add(q, v);
00373         delete data;
00374     }
00375 
00376     if (feat == 0)
00377         ILOG_ERROR("No features found");
00378     delete start;
00379     return feat;
00380 }

Here is the call graph for this function:


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