00001
00002
00003 #ifndef Impala_Visualization_AllFramesTLineVideo_h
00004 #define Impala_Visualization_AllFramesTLineVideo_h
00005
00006 #include "Persistency/SimilarityTableSetRepository.h"
00007 #include "Persistency/AnnotationTableRepository.h"
00008 #include "OglGui/CheckBox.h"
00009 #include "OglGui/UpDownButton.h"
00010 #include "OglGui/FramesPerSecond.h"
00011 #include "Visualization/SimilarityTimeLineVideo.h"
00012 #include "Core/VideoSet/SegmentationDocument.h"
00013 #include "Core/Database/RawDataSet.h"
00014 #include "Core/Stream/RgbDataSrcRaw.h"
00015 #include "Visualization/AppControlDoc.h"
00016
00017
00018 namespace Impala {
00019 namespace Visualization {
00020
00021 class AllFramesTLineVideo : public OglGui::Window,
00022 public AppControlDoc,
00023 public OglGui::WindowListener,
00024 public OglGui::CheckBoxListener,
00025 public OglGui::ButtonListener,
00026 public OglGui::UpDownButtonListener,
00027 public Core::Database::DataDocumentListener
00028 {
00029 public:
00030 static const int SHOW_SHOT_BOUNDARIES = 1;
00031 static const int SHOW_VIEWSTRIP = 2;
00032 static const int NEXT_PREV_SHOT = 3;
00033 static const int NEXT_PREV_KEYFRAME = 4;
00034 static const int VIEWSTRIP_PRE = 5;
00035 static const int VIEWSTRIP_MIN = 6;
00036 static const int VIEWSTRIP_MAX = 7;
00037 static const int CENTER_NEEDLE = 8;
00038 static const int CENTER_NEEDLE_ONPLAY = 9;
00039 static const int EXTRA_TIMELINE = 10;
00040 static const int NEXT_PREV_POSITIVE = 11;
00041
00042 static const int VALIDATE = 31;
00043
00044 typedef OglGui::CheckBox CheckBox;
00045 typedef OglGui::StaticText StaticText;
00046 typedef OglGui::Button Button;
00047 typedef OglGui::UpDownButton UpDownButton;
00048
00049 typedef Core::VideoSet::SegmentationDocument SegmentationDocument;
00050 typedef Core::VideoSet::Segmentation Segmentation;
00051 typedef Core::VideoSet::Keyframes Keyframes;
00052 typedef Core::Table::SimilarityTableSet SimilarityTableSet;
00053 typedef SimilarityTableSet::SimTableType SimTableType;
00054
00055 typedef std::vector<int> IntVector;
00056 typedef std::vector<IntVector*> AnnoPositives;
00057 typedef std::vector<float> FloatVector;
00058 typedef std::vector<FloatVector*> Averages;
00059
00060 typedef Core::Table::AnnotationTable AnnotationTable;
00061
00062 typedef Core::Stream::RgbDataSrcRaw RgbDataSrcRaw;
00063 typedef Core::Stream::RgbDataSrcFactory RgbDataSrcFactory;
00064 typedef Core::Stream::RgbDataSrc RgbDataSrc;
00065 typedef Core::Database::RawDataSet RawDataSet;
00066
00067 AllFramesTLineVideo(OglGui::Window* parent,int wndW, int wndH,
00068 SegmentationDocument* segDoc, int controlId) :
00069 Window(parent,0,0,wndW, wndH, true),
00070 AppControlDoc(controlId, segDoc)
00071 {
00072 Init(wndW, wndH, segDoc);
00073 }
00074
00075 void HandleNewVideo()
00076 {
00077 RawDataSet* dataSet = mSegDoc->GetDataSet();
00078
00079
00080 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00081 std::string videoName = dataSet->GetFilePathVideoData(mCurFile,
00082 false, false);
00083
00084 std::string rawName = dataSet->GetFilePathFrames(mCurFile,
00085 "images_jpg.raw",
00086 false, false);
00087
00088 #else // REPOSITORY_USED
00089 ILOG_ERROR("Todo : HandleNewVideo");
00090 String videoName;
00091 String rawName;
00092 #endif // REPOSITORY_USED
00093 bool vidIsMpg, stripIsMpg;
00094
00095
00096 if (mTimeLineVideoRaw && !rawName.empty())
00097 {
00098 #ifndef REPOSITORY_USED
00099 mRgbDataSrcRaw = new RgbDataSrcRaw(rawName);
00100 #endif // REPOSITORY_USED
00101 mSimTLV->OpenVideo(mRgbDataSrcRaw,videoName);
00102 vidIsMpg = false;
00103 }
00104 else
00105 {
00106 if (FileExists(videoName + ".info"))
00107 mSimTLV->OpenVideo(videoName, "lavcwithidx");
00108 else
00109 mSimTLV->OpenVideo(videoName, "lavcwriteidx");
00110 vidIsMpg = true;
00111 }
00112
00113 SimilarityTimeLine* timeLine = mSimTLV->TimeLine();
00114 if (mShowViewStrip)
00115 {
00116 timeLine->ViewStripRgbDataSrc((RgbDataSrc*)0);
00117 timeLine->SetAxisY(mTLVAxisY);
00118 timeLine->ViewStripY(mViewStripY);
00119 timeLine->ViewStripFrameStep(mViewStripStep);
00120 timeLine->ViewStripMinViewWidth(mViewStripMinW);
00121 timeLine->SetNeedleColor(mNeedleColor);
00122 }
00123 if (mShowViewStrip && mViewStripVideoRaw && !rawName.empty())
00124 {
00125 timeLine->ViewStripOpenRawFile(rawName, mViewStripUseMem);
00126 stripIsMpg = false;
00127 }
00128 else if (mShowViewStrip)
00129 {
00130 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00131 RgbDataSrc* dataSrc = RgbDataSrcFactory::Instance().Construct
00132 (RgbDataSrcFactory::SRC_LAVC, videoName, dataSet->GetDatabase());
00133 #else // REPOSITORY_USED
00134 Persistency::RgbDataSrcLocator loc(dataSet->GetLocator(), videoName);
00135 RgbDataSrc* dataSrc = RgbDataSrcFactory::Instance().Construct
00136 (RgbDataSrcFactory::SRC_LAVC, loc);
00137 #endif // REPOSITORY_USED
00138 timeLine->ViewStripRgbDataSrc(dataSrc);
00139 stripIsMpg = true;
00140 }
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 timeLine->mBothMpg = (stripIsMpg && vidIsMpg);
00155
00156
00157 mSimTLV->Player()->GotoFrame(mSegDoc->CurFrame());
00158 ConstructPositives();
00159 }
00160
00161 void HandleNewSimSet()
00162 {
00163 bool doExtra = false;
00164 RawDataSet* dataSet = mSegDoc->GetDataSet();
00165
00166
00167 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00168 std::string simNames =
00169 dataSet->GetFilePathSimilarityData("Frames", mConceptSet, mConceptModel,
00170 mConceptFeature, mCurFile,
00171 "names.txt", false, false);
00172
00173 if (mSimSet)
00174 delete mSimSet;
00175 mSimSet = 0;
00176 if (!simNames.empty())
00177 mSimSet = SimilarityTableSet::MakeFromFile(simNames,
00178 dataSet->GetDatabase());
00179 #else // REPOSITORY_USED
00180 typedef Persistency::SimilarityTableSetLocator SimLoc;
00181 SimLoc loc(dataSet->GetLocator(), false, "Frames", mConceptSet,
00182 mConceptModel, mConceptFeature,
00183 dataSet->GetContainerFile(mCurFile));
00184 if (mSimSet)
00185 delete mSimSet;
00186 mSimSet = Persistency::SimilarityTableSetRepository().Get(loc);
00187 #endif // REPOSITORY_USED
00188
00189 if (!mSimTLV)
00190 {
00191 int m = 0;
00192 m |= mShowViewStrip ? 4 : 0;
00193 m |= mTimeLineVideo3D ? 16 : 0;
00194 mSimTLV = new SimilarityTimeLineVideo(this,0,30,W(),H()-30,
00195 mSimSet,m);
00196 SimilarityTimeLine* simTL = mSimTLV->TimeLine();
00197 simTL->SetWindowListener(this);
00198 simTL->FrameError(mFrameError);
00199 mSimTLV->ConnectTo(this);
00200 mSimTLV->ScaleChildren(0,0);
00201 doExtra = true;
00202 }
00203 else
00204 mSimTLV->SetSimilarityTableSet(mSimSet);
00205 HandleNewVideo();
00206 if (doExtra)
00207 HandleExtraTimeLines();
00208 }
00209
00210 virtual void
00211 HandleNewFile()
00212 {
00213 if (!mSegDoc->HasCursor())
00214 {
00215 mCurFile = -1;
00216 return;
00217 }
00218 int fileId = mSegDoc->CurFileId();
00219 if (fileId == mCurFile && mSimTLV)
00220 {
00221 mSimTLV->Player()->GotoFrame(mSegDoc->CurFrame()-mFrameError);
00222 return;
00223 }
00224 mCurFile = fileId;
00225 HandleNewSimSet();
00226 }
00227
00228 virtual void CheckBoxEvent(CheckBox *src, bool checked, void* vData)
00229 {
00230 int userData = (long long) vData;
00231 if (userData == SHOW_SHOT_BOUNDARIES)
00232 mShowBoundaries = checked;
00233 if (userData == SHOW_VIEWSTRIP)
00234 mSimTLV->TimeLine()->ViewStripShow(checked);
00235 if (userData == CENTER_NEEDLE_ONPLAY)
00236 mSimTLV->CenterNeedleOnPlay(checked);
00237 if (userData == CENTER_NEEDLE)
00238 mSimTLV->CenterNeedle(checked);
00239 }
00240
00241 int FindFrameShot(int frame)
00242 {
00243 Segmentation* seg = mSegDoc->GetSegmentation();
00244 int firstShot = seg->GetFirstShotVideo(mCurFile);
00245 int lastShot = firstShot+seg->GetNrShotsVideo(mCurFile);
00246 int i;
00247
00248 for (i=firstShot; i<lastShot; i++)
00249 if (seg->GetStart(i) > frame)
00250 break;
00251 return i-1;
00252 }
00253
00254 void GoToAdjacentShot(bool next)
00255 {
00256 Segmentation* seg = mSegDoc->GetSegmentation();
00257 int curFrame = mSimTLV->Player()->FrameNr();
00258 int nextShot = FindFrameShot(curFrame) + (next?1:-1);
00259 mSimTLV->TimeLine()->Current(seg->GetStart(nextShot)*40);
00260 }
00261
00262 int FindAdjacentKeyFrame(int frame, bool next)
00263 {
00264 Keyframes* keys = mSegDoc->GetKeyframes();
00265 int firstKeyFr = keys->GetFirstKeyframeVideo(mCurFile);
00266 int lastKeyFr = firstKeyFr+keys->GetNrKeyframesVideo(mCurFile);
00267 int i, k, prevK;
00268
00269
00270 frame += next ? 1 : 0;
00271 for (i=firstKeyFr; i<lastKeyFr; i++)
00272 {
00273 if ((k=keys->GetFrameNr(i))<frame)
00274 prevK = k;
00275 else
00276 break;
00277 }
00278 return (next ? k : prevK);
00279 }
00280
00281 void GoToAdjacentKeyFrame(bool next)
00282 {
00283 int curFrame = mSimTLV->Player()->FrameNr();
00284 int nFrame = FindAdjacentKeyFrame(curFrame,next);
00285 mSimTLV->TimeLine()->Current(nFrame*40);
00286 }
00287
00288 int FindAdjacentPositive(int id, int frame, bool next)
00289 {
00290 int i, k, prevK;
00291
00292 frame += next ? 1 : 0;
00293 IntVector* positiveVector = mAnnoPositives[id];
00294
00295 for (i=0; i<positiveVector->size(); i++)
00296 {
00297 if ((k=(*positiveVector)[i])<frame)
00298 prevK = k;
00299 else
00300 break;
00301 }
00302 return (next ? k : prevK);
00303 }
00304
00305 void GoToAdjacentPositive(int id, bool next)
00306 {
00307 int curFrame = mSimTLV->Player()->FrameNr();
00308 int nFrame = FindAdjacentPositive(id,curFrame,next);
00309 mSimTLV->TimeLine()->Current(nFrame*40);
00310 }
00311
00312 virtual void
00313 UpDownButtonSelectionEvent(UpDownButton *src, bool isUpBtn, void* vData)
00314 {
00315 int userData = (long long) vData;
00316 if (userData == NEXT_PREV_SHOT)
00317 GoToAdjacentShot(isUpBtn);
00318 if (userData==NEXT_PREV_KEYFRAME)
00319 GoToAdjacentKeyFrame(isUpBtn);
00320 if (userData>=NEXT_PREV_POSITIVE && userData<NEXT_PREV_POSITIVE+20)
00321 GoToAdjacentPositive(userData-NEXT_PREV_POSITIVE,isUpBtn);
00322 mSimTLV->TimeLine()->MakeCurrentVisible();
00323 }
00324
00325 virtual void ButtonSelectionEvent(Button *src, void* vData)
00326 {
00327 int userData = (long long) vData;
00328 if (userData==VIEWSTRIP_PRE)
00329 mSimTLV->TimeLine()->ViewStripZoomToShowViews(0);
00330 if (userData==VIEWSTRIP_MIN)
00331 mSimTLV->TimeLine()->ViewStripZoomToShowViews(1);
00332 if (userData==VIEWSTRIP_MAX)
00333 mSimTLV->TimeLine()->ViewStripZoomToShowViews(2);
00334 if (userData==EXTRA_TIMELINE)
00335 mSimTLV->ExtraTimeLine(mSimTLV, mSimTLV->TitledTimeLine()->X(),
00336 mSimTLV->H()-200,
00337 mSimTLV->TitledTimeLine()->W(),182,
00338 "Extra TimeLine");
00339 if (userData==VALIDATE)
00340 AnnoValidate();
00341 }
00342
00343 void AnnoValidate()
00344 {
00345 RawDataSet* dataSet = mSegDoc->GetDataSet();
00346 std::string dir = dataSet->GetFile(mCurFile);
00347
00348 printf("\n\nValidation %s\n--------------------------------------\n",
00349 dir.c_str());
00350 SimilarityTimeLine* timeLine = mSimTLV->TimeLine();
00351 for (int a=0; a<mAnnoTables.size(); a++)
00352 {
00353 AnnotationTable* anno = mAnnoTables[a];
00354 FloatVector* avgVector = (*mSimTLV->GetAverages())[a];
00355
00356 int nPosCorrect=0, nPosInCorrect = 0;
00357 int nFalseCorrect=0, nFalseInCorrect= 0;
00358 int n = 0;
00359 float maxim = (*mSimTLV->Maxima())[a];
00360 float mean = (*mSimTLV->Means())[a];
00361
00362 int sz = anno->Size();
00363 for (int i=0; i<sz; i++)
00364 {
00365 Quid quid = anno->Get1(i);
00366 float qual = anno->Get2(i);
00367 int vidId = QuidObject(quid);
00368 int frameId = QuidId(quid);
00369 if (vidId==mCurFile)
00370 {
00371 float sim = (*avgVector)[frameId];
00372 bool isConcept = timeLine->PassTest(sim,maxim,mean);
00373 if (qual > 0)
00374 {
00375 if (isConcept)
00376 nPosCorrect++;
00377 else
00378 nPosInCorrect++;
00379 }
00380 if (qual < 0)
00381 {
00382 if (isConcept)
00383 nFalseInCorrect++;
00384 else
00385 nFalseCorrect++;
00386 }
00387 n++;
00388 }
00389 }
00390 printf("%18s: %3d TruePos, %3d FalseNeg, TrueNeg %3d FalsePos %3d\n",
00391 mSimSet->GetNames()[a].c_str(), nPosCorrect, nPosInCorrect, nFalseCorrect, nFalseInCorrect);
00392 }
00393 }
00394
00395 void ReadAnnotations()
00396 {
00397 AnnotationTable *anno;
00398
00399 for (int i=0; i<mSegDoc->NrConcepts(); i++)
00400 {
00401 anno = 0;
00402 Core::VideoSet::VideoSet* vidSet = mSegDoc->GetVideoSet();
00403 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00404 std::string fName = vidSet->GetFilePathAnnotation
00405 (QUID_CLASS_FRAME, mConceptAnnotations,
00406 mSegDoc->GetConcept(i)+".tab", false, false);
00407 if (fName.empty())
00408 printf("No annotions for %s\n", mSegDoc->GetConcept(i).c_str());
00409 else
00410 anno = Core::Table::AnnotationTable::MakeFromFile
00411 (mSegDoc->GetConcept(i), fName, vidSet->GetDatabase());
00412 #else // REPOSITORY_USED
00413 typedef Persistency::AnnotationTableLocator AnnoLoc;
00414 AnnoLoc loc(vidSet->GetLocator(), QUID_CLASS_FRAME,
00415 mConceptAnnotations, mSegDoc->GetConcept(i));
00416 anno = Persistency::AnnotationTableRepository().Get(loc);
00417 #endif // REPOSITORY_USED
00418 if (anno)
00419 mAnnoTables.push_back(anno);
00420 }
00421 }
00422
00423 void ClearPositives()
00424 {
00425 for (int i=0; i<mAnnoPositives.size(); i++)
00426 delete mAnnoPositives[i];
00427 mAnnoPositives.clear();
00428 }
00429
00430 void ConstructPositives()
00431 {
00432 ClearPositives();
00433
00434 int sz = mAnnoTables.size();
00435 for (int a=0; a<sz; a++)
00436 {
00437 AnnotationTable* anno = mAnnoTables[a];
00438 IntVector* positiveVector = new IntVector;
00439
00440 for (int i=0; i<anno->Size(); i++)
00441 {
00442 Quid quid = anno->Get1(i);
00443 float qual = anno->Get2(i);
00444 int vidId = QuidObject(quid);
00445 int frameId = QuidId(quid);
00446
00447 if (vidId == mCurFile && qual > 0)
00448 positiveVector->push_back(frameId);
00449 }
00450 mAnnoPositives.push_back(positiveVector);
00451 }
00452 }
00453
00454 virtual void WindowDisplayEvent(OglGui::Window *src, void* userData)
00455 {
00456 ShowBoundaries((SimilarityTimeLine*) src);
00457 ShowPositives((SimilarityTimeLine*) src);
00458
00459 if (!mChBoxValueBars)
00460 {
00461 mChBoxValueBars = mSimTLV->ChBoxValueBars();
00462 OglGui::CheckBoxValueBar* chBoxVB;
00463 int item = 0;
00464 while( chBoxVB = mChBoxValueBars->GetItem(item) )
00465 {
00466 UpDownButton* upDownBtn
00467 = RightUpDownButton(chBoxVB,20,12,NEXT_PREV_POSITIVE+item);
00468 item++;
00469 }
00470 }
00471 }
00472
00473 void ShowBoundaries(SimilarityTimeLine* simTL)
00474 {
00475 if (!mShowBoundaries)
00476 return;
00477
00478 Segmentation* seg = mSegDoc->GetSegmentation();
00479 int firstShot = seg->GetFirstShotVideo(mCurFile);
00480 int nrShots = seg->GetNrShotsVideo(mCurFile);
00481 int frameErr = simTL->FrameError();
00482
00483 int y = simTL->GetAxisY();
00484
00485 int i, x, frame;
00486
00487 SetSolidLineColor(0xffff8050);
00488 for (i=firstShot; i<firstShot+nrShots; i++)
00489 {
00490 frame = seg->GetStart(i);
00491 x = simTL->Unit2Pixel((frame-frameErr)*40);
00492 DrawLine(x,y-16,x,y+200);
00493 }
00494
00495 Keyframes* keys = mSegDoc->GetKeyframes();
00496 int firstKeyfr = keys->GetFirstKeyframeVideo(mCurFile);
00497 int nrKeys = keys->GetNrKeyframesVideo(mCurFile);
00498
00499 int curFr = mSegDoc->CurFrame();
00500 for (i=firstKeyfr; i<firstKeyfr+nrKeys; i++)
00501 {
00502 frame = keys->GetFrameNr(i);
00503 ULONG col = keys->IsRKF(i) ? oglRED : oglBLUE;
00504 if (curFr == frame)
00505 col = oglGREEN;
00506 SetSolidLineColor(col);
00507 x = simTL->Unit2Pixel((frame-frameErr)*40);
00508
00509 DrawLine(x,y-16,x,y+100);
00510 }
00511 }
00512
00513 void ShowPositives(SimilarityTimeLine* simTL)
00514 {
00515 if (!mShowPositives)
00516 return;
00517
00518
00519
00520 int y = simTL->GetAxisY();
00521
00522 SetLineWidth(3);
00523 int nConcepts = mAnnoPositives.size();
00524 for (int i=0; i<nConcepts; i++)
00525 {
00526 if (!simTL->GetShowSim(i))
00527 continue;
00528
00529 ULONG col = simTL->GetSimColor(i);
00530 SetSolidLineColor(col);
00531 IntVector* positiveVector = mAnnoPositives[i];
00532 int sz = positiveVector->size();
00533 for (int p=0; p<sz; p++)
00534 {
00535 int posFrame = (*positiveVector)[p];
00536 int x = simTL->Unit2Pixel(posFrame*40);
00537 DrawLine(x,y-(i*2)-2,x,y-20);
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549 }
00550 }
00551 SetLineWidth(1);
00552 }
00553
00554 private:
00555 void HandleExtraTimeLines()
00556 {
00557 for (int i=0; i<mNrExtraTimeLines; i++)
00558 {
00559 int x,y,w,h,tlvH=mSimTLV->H();
00560 mSimTLV->TitledTimeLine()->GetDimensions(x,y,w,h);
00561 int nH = (tlvH - (y+h))/mNrExtraTimeLines;
00562 OglGui::TitledWindow* titledWnd =
00563 mSimTLV->ExtraTimeLine(mSimTLV,x,tlvH-(mNrExtraTimeLines-i)*nH,
00564 w,nH-2,"Extra TimeLine");
00565 titledWnd->ScaleTo(this);
00566 mSimTLV->TimeLineExtra(i)->DocX(30);
00567 int oldW = mSimTLV->TimeLineExtra(i)->DocW();
00568 int n = (mNrExtraTimeLines-i);
00569 mSimTLV->TimeLineExtra(i)->DocW((n*n*15)*oldW);
00570 }
00571 if (mNrExtraTimeLines>0)
00572 {
00573 int oldW = mSimTLV->TimeLine()->DocW();
00574 mSimTLV->TimeLine()->DocX(30);
00575 int n = (mNrExtraTimeLines+2);
00576 mSimTLV->TimeLine()->DocW(n*n*15*oldW);
00577 }
00578 }
00579
00580 void HandleOptions()
00581 {
00582 CmdOptions& options = CmdOptions::GetInstance();
00583
00584 mFrameError = options.GetInt("timeLineVideoFrameError");
00585 mTimeLineVideoRaw = options.GetBool("timeLineVideoRaw");
00586 mViewStripVideoRaw = options.GetBool("viewStripVideoRaw");
00587
00588
00589
00590 mConceptSet = options.GetString("conceptSet");
00591 mConceptModel = options.GetString("conceptModel");
00592 mConceptFeature = options.GetString("conceptFeature");
00593 mConceptAnnotations = options.GetString("conceptAnnotations");
00594 mTimeLineVideo3D = options.GetBool("timeLineVideo3D");
00595 mTLVAxisY = options.GetInt("timeLineVideoAxisY");
00596
00597
00598 mShowViewStrip = options.GetBool("viewStrip");
00599 mViewStripUseMem = options.GetBool("viewStripUseMemory");
00600 mViewStripY = options.GetInt("viewStripY");
00601 mViewStripStep = options.GetInt("viewStripStep");
00602 mViewStripMinW = options.GetInt("viewStripMinWidth");
00603
00604 std::string needleColS = options.GetString("timeLineNeedleColor");
00605 mNrExtraTimeLines = options.GetInt("timeLineExtra");
00606
00607 if (mFrameError == -1)
00608 mFrameError = 0;
00609
00610
00611
00612
00613 if (mConceptFeature.empty())
00614 mConceptFeature = "combined";
00615 if (mTLVAxisY == -1)
00616 mTLVAxisY = 20;
00617 if (mViewStripY == -1)
00618 mViewStripY = 24;
00619 if (mViewStripStep == -1)
00620 mViewStripStep = 1;
00621 if (mViewStripMinW < 4)
00622 mViewStripMinW = 4;
00623 if (!needleColS.empty())
00624 mNeedleColor = OglColorStr(needleColS.c_str());
00625 }
00626
00627 CheckBox*
00628 ScaledCheckBox(Window* parent, int x, int y, int w, int h,
00629 strconst str, bool checked, int userData)
00630 {
00631 CheckBox* cb =
00632 new CheckBox(parent,x,y,w,h,str,checked,BEV_ETCHED);
00633
00634 cb->ScaleTo(parent);
00635 cb->SetCheckBoxListener(this,(void*)userData);
00636 cb->SetBorderFillShaded(0);
00637 cb->SetAllowScaling(false);
00638 return cb;
00639 }
00640
00641 UpDownButton*
00642 RightUpDownButton(Window* parent, int w, int h, int userData)
00643 {
00644 int y = (parent->H()-h)/2;
00645 int x = parent->W()-w-2;
00646 UpDownButton* upDownBtn = new UpDownButton(parent,x,y,w,h,true);
00647
00648 upDownBtn->ScaleTo(parent);
00649 upDownBtn->SetUpDownButtonListener(this,(void*)userData);
00650 upDownBtn->SetRepeatMode(true);
00651 upDownBtn->SetAllowScaling(false);
00652 return upDownBtn;
00653 }
00654
00655 Button*
00656 ViewStripButton(Window* parent, int x, int w, strconst str, int lData)
00657 {
00658 Button *btn = new Button(parent,x,2,w,parent->H()-4,str,BEV_ETCHED,true);
00659
00660 btn->ScaleTo(parent);
00661 btn->SetButtonListener(this, (void*)lData);
00662 btn->SetAllowScaling(false);
00663 return btn;
00664 }
00665
00666 void Init(int w, int h, SegmentationDocument* segDoc)
00667 {
00668 mSegDoc = segDoc;
00669 mCurFile = 0;
00670 mSimTLV = 0;
00671 mSimSet = 0;
00672 mNeedleColor = 0xffC0C0C0;
00673 mShowBoundaries = false;
00674 mShowPositives = true;
00675 AddDocListener(this);
00676
00677 HandleOptions();
00678 ReadAnnotations();
00679 SetBorderType(-1);
00680 SetBorderBackground(0x80808080);
00681
00682
00683 new OglGui::FramesPerSecond(this,W()-76,4,70,28);
00684
00685 CheckBox* cb = ScaledCheckBox(this,4,4,130,24,"Boundaries",false,
00686 SHOW_SHOT_BOUNDARIES);
00687 UpDownButton* upDownBtn = RightUpDownButton(cb,30,20,NEXT_PREV_SHOT);
00688
00689 StaticText* txt = new StaticText(this,140,4,96,24,"keyframe");
00690 txt->SetAlign(oglLeftAlign,oglCenterAlign);
00691 txt->SetBorderType(BEV_ETCHED);
00692 upDownBtn = RightUpDownButton(txt,30,20,NEXT_PREV_KEYFRAME);
00693
00694 if (!mShowViewStrip)
00695 return;
00696 cb = ScaledCheckBox(this,250,4,184,24,"ViewStrip",true,SHOW_VIEWSTRIP);
00697
00698 Button* btn;
00699 btn = ViewStripButton(cb, 84,32,"Pre",VIEWSTRIP_PRE);
00700 btn = ViewStripButton(cb,116,32,"Min",VIEWSTRIP_MIN);
00701 btn = ViewStripButton(cb,148,32,"Max",VIEWSTRIP_MAX);
00702
00703 cb = ScaledCheckBox(this,438,4,200,24,"Center Needle",true,
00704 CENTER_NEEDLE);
00705
00706 ScaledCheckBox(cb,116,0,84,24,"On Play",
00707 true, CENTER_NEEDLE_ONPLAY);
00708
00709 btn = new Button(this,cb->X()+cb->W()+4,4,140,24,"Extra TimeLine",
00710 BEV_ETCHED,true);
00711 btn->SetButtonListener(this, EXTRA_TIMELINE);
00712
00713 btn = new Button(this,btn->X()+btn->W()+6,4,80,24,"Validate",
00714 BEV_ETCHED,true);
00715 btn->SetButtonListener(this, VALIDATE);
00716 mChBoxValueBars = 0;
00717 }
00718
00719 SegmentationDocument* mSegDoc;
00720 SimilarityTableSet* mSimSet;
00721 SimilarityTimeLineVideo* mSimTLV;
00722
00723 std::vector<AnnotationTable*> mAnnoTables;
00724 AnnoPositives mAnnoPositives;
00725 OglGui::CheckBoxValueBars* mChBoxValueBars;
00726
00727 RgbDataSrcRaw* mRgbDataSrcRaw;
00728
00729
00730
00731
00732
00733 std::string mConceptSet;
00734 std::string mConceptModel;
00735 std::string mConceptFeature;
00736 std::string mConceptAnnotations;
00737 bool mTimeLineVideo3D;
00738 bool mViewStripUseMem;
00739
00740 bool mViewStripVideoRaw;
00741 bool mTimeLineVideoRaw;
00742
00743 bool mShowBoundaries;
00744 bool mShowPositives;
00745
00746
00747 bool mShowViewStrip;
00748 int mViewStripY;
00749 int mViewStripStep;
00750 int mViewStripMinW;
00751 int mTLVAxisY;
00752 ULONG mNeedleColor;
00753 int mCurFile;
00754 int mFrameError;
00755 int mNrExtraTimeLines;
00756
00757 bool mOldNoKeyListening;
00758
00759 ILOG_VAR_DEC;
00760 };
00761
00762 ILOG_VAR_INIT(AllFramesTLineVideo, Visualization);
00763
00764 }
00765 }
00766
00767 #endif