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

void Impala::Core::VideoSet::ShotSegmenter::ReadGroundTruth (  )  [inline, private]

Definition at line 1007 of file ShotSegmenter.h.

References Impala::atoi(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CW(), Impala::FileExists(), Impala::FileNameBase(), Impala::Persistency::XmlFileReader::FindElementsByName(), Impala::Persistency::XmlFileReader::GetAttributeValue(), Impala::Core::Stream::RgbDataSrc::GetName(), ILOG_INFO, mCUTs, mDISs, mFOIs, mGroundTruth, mOTHs, mRefDir, mRefPrefix, mShortGrad, mSrc, mVerbose, Impala::Persistency::XmlFileReader::Read(), Impala::Core::Vector::SetPart(), and Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::SetValue().

Referenced by HandleNewFile().

01008     {
01009 
01010         String XMLName=Impala::FileNameBase(mSrc->GetName());
01011         XMLName= mRefDir + mRefPrefix + XMLName + String(".xml");
01012 
01013         //Create a new xml reader
01014         Persistency::XmlFileReader* xfr = new Persistency::XmlFileReader;
01015         //If the file exists or not
01016         if(!FileExists(XMLName))
01017         {
01018             //there is no groundtruth data, so that means it is 
01019             //not one of the training videos.
01020             ILOG_INFO("File Does not exist "<<XMLName);
01021             return;
01022         }
01023         if(mVerbose>1)
01024             ILOG_INFO("Reading Ground truth from "<<XMLName);
01025 
01026         XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* doc=
01027         xfr->Read(XMLName);
01028 
01029         //Find all nodes named trans
01030         XERCES_CPP_NAMESPACE_QUALIFIER DOMNodeList* elems=
01031         xfr->FindElementsByName(doc,"trans");
01032 
01033         for (XMLSize_t i = 0; i< elems->getLength(); i++)
01034         {
01035             String type=xfr->GetAttributeValue(elems->item(i)->getAttributes(),"type");
01036             int col=0;
01037             if(type=="CUT")
01038                 col=0;
01039             if(type=="DIS")
01040                 col=1;
01041             if(type=="OTH")
01042                 col=2;
01043             if(type=="FOI")
01044                 col=3;
01045             int start=atoi(xfr->GetAttributeValue(elems->item(i)->getAttributes(),"preFNum").c_str());
01046             int end=atoi(xfr->GetAttributeValue(elems->item(i)->getAttributes(),"postFNum").c_str());
01047             //If the gradual transition is less than mShortGrad, add it as a CUT
01048             if(start-end<mShortGrad){
01049                 mGroundTruth->SetValue(1,(start+end)/2-1,0);
01050                 mGroundTruth->SetValue(1,(start+end)/2,0);
01051             }
01052             for(int i=start;i<=end;i++)
01053             {
01054                 mGroundTruth->SetValue(1,i,col);
01055             }
01056         }
01057         delete xfr;
01058 
01059         SetPart(mCUTs, mGroundTruth, 0,0, mGroundTruth->CW(), 1, 0, 0);
01060         SetPart(mDISs, mGroundTruth, 0,1, mGroundTruth->CW(), 1, 0, 0);
01061         SetPart(mOTHs, mGroundTruth, 0,2, mGroundTruth->CW(), 1, 0, 0);
01062         SetPart(mFOIs, mGroundTruth, 0,3, mGroundTruth->CW(), 1, 0, 0);
01063 
01064     } 

Here is the call graph for this function:


Generated on Fri Mar 19 11:32:23 2010 for ImpalaSrc by  doxygen 1.5.1