Definition at line 381 of file ShotSegmenter.h. References Impala::Core::VideoSet::Mpeg7Doc::AddShot(), Impala::FileNameBase(), Impala::Core::Stream::RgbDataSrc::LastFrame(), Impala::MakeString(), Impala::Core::VideoSet::Mpeg7DocWrite(), mPredictions, mProbThresh, mShotNr, and Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::Value(). Referenced by HandleDoneFile(). 00382 { 00383 //IMPALA Segmentation and keyframes/////////////////////// 00384 String fileName = vs->GetFile(fileId); 00385 String id = FileNameBase(fileName); 00386 int lastFrame = src->LastFrame(); 00387 // todo: get fractions from RgbDataSrc 00388 //int fractions = 30000; 00389 int fractions = 25; 00390 Mpeg7Doc mp7(id, fileName, lastFrame + 1, fractions, true, "", ""); 00391 int firstFrameInShot=0; 00392 int frameAtSemiCut = -1; 00393 //for(int i=0;i<mPredictions->CW();i++) 00394 for (int i=0 ; i<=lastFrame ; i++) 00395 { 00396 //If the probability is >mProbThresh then there was a cut 00397 //between previous and current frame 00398 if ((mPredictions->Value(i,0) > mProbThresh) || 00399 (i == lastFrame)) 00400 { 00401 int realId = vs->GetFileId(fileId); 00402 //String shotName = "shot" + MakeString(fileId+1) + 00403 String shotName = "shot" + MakeString(realId+1) + 00404 "_" + MakeString(mShotNr+1); 00405 std::vector<String> keyNames; 00406 keyNames.push_back(shotName + "_RKF"); 00407 if (frameAtSemiCut != -1) 00408 keyNames.push_back(shotName + "_NRKF"); 00409 std::vector<int> keyFrames; 00410 if (frameAtSemiCut == -1) 00411 { 00412 keyFrames.push_back((firstFrameInShot+i) / 2); 00413 } 00414 else 00415 { 00416 keyFrames.push_back((firstFrameInShot+frameAtSemiCut) / 2); 00417 keyFrames.push_back((frameAtSemiCut+i) / 2); 00418 } 00419 mp7.AddShot(shotName, firstFrameInShot, i, keyNames, 00420 keyFrames); 00421 firstFrameInShot=i+1; 00422 frameAtSemiCut = -1; 00423 mShotNr++; 00424 } 00425 else if ((mPredictions->Value(i,0) > 0.8 * mProbThresh) && 00426 (i - firstFrameInShot > 25)) 00427 { 00428 frameAtSemiCut = i; 00429 } 00430 } 00431 Mpeg7DocWrite(&mp7, vs, fileId); 00432 }
Here is the call graph for this function:
|