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 nrRows = mapi_get_row_count(hdl); 00067 00068 int* start = 0; 00069 int startSize = 0; 00070 if (!conn->QueryPartFetchInt(hdl, 0, start, startSize)) 00071 return 0; 00072 00073 std::vector<String> strs; 00074 if (!conn->QueryPartFetchString(hdl, 1, strs)) 00075 return 0; 00076 00077 00079 //int numFieldsUsed = 2; 00080 //int fieldNrs[] = {0, 1}; 00081 //int fieldTypes[] = {MAPI_INT, MAPI_VARCHAR}; 00082 //void* recvBuffers[2]; 00083 //if (!mCon->QueryPartFetchAll(hdl, numFieldsUsed, fieldNrs, fieldTypes, recvBuffers)) 00084 // return false; 00085 //int* theIntValues = recvBuffers[0]; 00086 //String* theStringValues = recvBuffers[1]; 00087 //int numRows = mapi_get_row_count(hdl); 00088 00089 00090 conn->QueryPartEnd(hdl); 00091 00092 FeatureTable* res = 0; 00093 for (int i=0 ; i<startSize ; i++) 00094 { 00095 Quid q = vidSet->GetQuidFrame(fileIdx, start[i], true); 00096 00097 size_t dataSize; 00098 UInt8* data = Util::Hex2Bin(strs[i], dataSize); 00099 int n = dataSize / sizeof(Real64); 00100 Real64* realData = (Real64*) data; 00101 FeatureTable::VectorReal64 v(n, realData, true); 00102 00103 if (res == 0) 00104 res = new FeatureTable(loc.GetFeatureDef(), strs.size(), n); 00105 res->Add(q, v); 00106 delete data; 00107 } 00108 00109 if (res == 0) 00110 ILOG_ERROR("No features found"); 00111 delete start; 00112 return res; 00113 }
Here is the call graph for this function: ![]()
|