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

FeatureTable* Impala::Persistency::FeatureTableRepositoryInMonet::Get ( const FeatureLocator loc  )  [inline]

Definition at line 28 of file FeatureTableRepositoryInMonet.h.

References Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Add(), Impala::FileNameBase(), Impala::Persistency::RepositoryInMonetDB::GetConnection(), Impala::Persistency::FeatureLocator::GetContainer(), Impala::Persistency::Locator::GetDataSet(), Impala::Persistency::FeatureLocator::GetFeatureDef(), Impala::Persistency::FeatureLocator::GetFeatureString(), Impala::Core::Database::RawDataSet::GetFileId(), Impala::Persistency::FeatureLocator::GetIsIndex(), Impala::Core::VideoSet::VideoSet::GetQuidFrame(), Impala::Core::VideoSet::VideoSet::GetQuidVideo(), Impala::Persistency::FeatureLocator::GetWalkType(), Impala::Util::Hex2Bin(), ILOG_ERROR, Impala::MakeString(), and RepMonet().

00029     {
00030         if (loc.GetIsIndex())
00031         {
00032             ILOG_ERROR("Index not implemented (yet)");
00033             return 0;
00034         }
00035         if (loc.GetWalkType() != "Frames")
00036         {
00037             ILOG_ERROR("Only implemented for Frames");
00038             return 0;
00039         }
00040 
00041         Connection* conn = RepMonet().GetConnection(loc);
00042 
00043         String vidSetBase = FileNameBase(loc.GetDataSet());
00044         Core::Feature::FeatureDefinition def = loc.GetFeatureDef();
00045         Core::VideoSet::VideoSet* vidSet = VideoSetRepository().Get(loc);
00046         int fileIdx = vidSet->GetFileId(loc.GetContainer());
00047         Quid vidQuid = vidSet->GetQuidVideo(fileIdx, true);
00048 
00049         String query =
00050             "select fr.fragment_start, fv.vector \
00051              from feature_vector fv, fragment fr, file f, feature fe \
00052              where  f.quid = " + MakeString(vidQuid) + " and \
00053                     fr.media_id = f.media_id and \
00054                     fr.fragment_length = 1 and \
00055                     fr.keyframe = false and \
00056                     fe.feature_name = '" + loc.GetFeatureString() + "' and \
00057                     fe.feature_id = fv.feature_id and \
00058                     fv.fragment_id = fr.fragment_id and \
00059                     fv.file_id = f.file_id \
00060              order by fr.fragment_start;";
00061 
00062         MapiHdl hdl = conn->QueryPartStart(query);
00063         if (hdl == 0)
00064             return 0;
00065 
00066         int* start = 0;
00067         int startSize = 0;
00068         if (!conn->QueryPartFetchInt(hdl, 0, start, startSize))
00069             return 0;
00070 
00071         std::vector<String> strs;
00072         if (!conn->QueryPartFetchString(hdl, 1, strs))
00073             return 0;
00074 
00075         conn->QueryPartEnd(hdl);
00076 
00077         FeatureTable* res = 0;
00078         for (int i=0 ; i<startSize ; i++)
00079         {
00080             Quid q = vidSet->GetQuidFrame(fileIdx, start[i], true);
00081 
00082             size_t dataSize;
00083             UInt8* data = Util::Hex2Bin(strs[i], dataSize);        
00084             int n = dataSize / sizeof(Real64);
00085             Real64* realData = (Real64*) data;
00086             FeatureTable::VectorReal64 v(n, realData, true);
00087 
00088             if (res == 0)
00089                 res = new FeatureTable(loc.GetFeatureDef(), strs.size(), n);
00090             res->Add(q, v);
00091             delete data;
00092         }
00093 
00094         if (res == 0)
00095             ILOG_ERROR("No features found");
00096         delete start;
00097         return res;
00098     }

Here is the call graph for this function:


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