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

bool Impala::Core::Table::Bayes::LoadMatrixConceptConditionalProbability ( String  name,
double **  matrix,
int &  nRow,
int &  nCol,
bool  bAnnoSet = true 
) [inline]

Definition at line 479 of file Bayes.h.

References Impala::Core::Database::RawDataSet::GetFilePathAnnotation(), mAnnoVidSet, and mVidSet.

Referenced by LoadMatrix().

00480     {
00481         // mMatrixFile, mProb_c_g, mConceptNum, mGenreNum
00482 
00483         std::string fName;
00484 
00485         if (bAnnoSet)
00486         {
00487             // loading from annotation set (training set)
00488 
00489             fName = mAnnoVidSet->GetFilePathAnnotation(name,false,false);
00490 
00491             /*String strAnnoSetName = mAnnoSetName;
00492             strAnnoSetName.resize(strAnnoSetName.size() - 4);
00493             fName = String("../") + strAnnoSetName + "/Annotations/" + name;*/
00494        }
00495         else
00496         {
00497             // loading from test set itself.
00498 
00499             if (NULL != mVidSet)
00500             {
00501                 fName = mVidSet->GetFilePathAnnotation(name,false,false);
00502 
00503                 /*String strSetName = mSetName;
00504                 strSetName.resize(strSetName.size()-4);
00505                 fName = String("../") + strSetName + "/Annotations/" + name;*/
00506 
00507             }
00508             else
00509             {
00510                 std::cout << "mVidSet: Not initialized." << std::endl;
00511                 return false;
00512             }
00513         }
00514 
00515         FILE* fp = fopen(fName.c_str(),"rb");
00516 
00517         if (NULL == fp)
00518         {
00519             std::cout << "File does NOT exist: [" << fName << "]" << std::endl;
00520             return false;
00521         }
00522 
00523         int nLocalRow, nLocalCol;
00524 
00525         fread(&nLocalRow, sizeof(int), 1, fp);  //mConceptNum
00526         fread(&nLocalCol, sizeof(int), 1, fp);  //mGenreNum
00527 
00528         // verify the dimension of matrix
00529         if ( nRow == nLocalRow && nCol == nLocalCol)
00530         {
00531             // verification success
00532 
00533             for (int i=0; i<nRow; i++)
00534             {
00535                 for (int j=0; j<nCol; j++)
00536                 {
00537                     //printf("%.3f ", matrix[i][j]);
00538                     fread( &(matrix[i][j]), sizeof(double), 1, fp);
00539                 }
00540                 //std::cout << std::endl;
00541 
00542             }
00543 
00544             fclose(fp);
00545             return true;
00546 
00547         } else {
00548 
00549             // verification fails
00550             std::cout << "Loaded Matrix dimension is not the same as Annotation" << std::endl;
00551 
00552             fclose(fp);
00553             return false;
00554         }
00555 
00556         //fclose(fp);
00557 
00558     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:20:17 2010 for ImpalaSrc by  doxygen 1.5.1