00001
00002 #ifndef Impala_Visualization_SegmentationDocumentGuiAnno_h
00003 #define Impala_Visualization_SegmentationDocumentGuiAnno_h
00004
00005
00006
00007 #include "Persistency/Mpeg7DocRepository.h"
00008 #include "Persistency/SimilarityTableSetRepository.h"
00009 #include "Core/VideoSet/SegmentationDocument.h"
00010 #include "Core/VideoSet/Mpeg7DocWrite.h"
00011 #include "Core/Stream/RgbDataSrcFactory.h"
00012 #include "Core/Stream/RgbDataSrcRaw.h"
00013 #include "Core/Table/SimilarityTableSet.h"
00014
00015 #include "Visualization/SimilarityTimeLineVideo.h"
00016 #include "Visualization/ImageStrip.h"
00017 #include "Visualization/ImageSet.h"
00018 #include "Visualization/DataDocumentGui.h"
00019
00020 #include "OglGui/TextArea.h"
00021 #include "OglGui/Strut.h"
00022 #include "OglGui/Button.h"
00023 #include "OglGui/ValueScrollBar.h"
00024 #include "OglGui/UpDownNumber.h"
00025
00026 namespace Impala {
00027 namespace Visualization {
00028
00029 class SegmentationDocumentGuiAnno :
00030 public DataDocumentGui<Core::VideoSet::SegmentationDocument>,
00031 public ImagesListener,
00032 public OglGui::ViewListener,
00033 public OglGui::WindowListener,
00034 public OglGui::CheckBoxListener,
00035 public OglGui::ValueScrollBarListener,
00036 public OglGui::UpDownButtonListener,
00037 public OglGui::UpDownNumberListener
00038 {
00039 static const int BUT_POSITIVE = 100;
00040 static const int BUT_SKIP = 101;
00041 static const int BUT_NEGATIVE = 102;
00042 static const int BUT_SAVE = 103;
00043 static const int BUT_BACK = 104;
00044 static const int BUT_FORW = 105;
00045 static const int BUT_SHOT_POS = 106;
00046 static const int BUT_SHOT_NEG = 107;
00047 static const int BUT_LEFT_SHOT = 108;
00048 static const int BUT_RIGHT_SHOT = 109;
00049 static const int BUT_SYNC = 110;
00050 static const int VIEWSTRIP_PRE = 111;
00051 static const int VIEWSTRIP_MIN = 112;
00052 static const int VIEWSTRIP_MAX = 113;
00053 static const int BUT_NAV_MODE = 114;
00054 static const int BUT_NAV_BEGIN = 115;
00055 static const int BUT_NAV_END = 116;
00056 static const int BUT_RANK_ALL = 117;
00057 static const int BUT_RANK_NOT_ANN = 118;
00058
00059 static const int UPDOWNBUT_POSITIVE = 130;
00060 static const int UPDOWNBUT_SKIPPED = 131;
00061 static const int UPDOWNBUT_NEGATIVE = 132;
00062 static const int UPDOWNBUT_UNKNOWN = 133;
00063
00064 static const int CHBOX_RANK_MODE = 203;
00065 static const int CHBOX_SHOW_THRESH_SHOTS = 204;
00066 static const int CHBOX_SHOW_SEG_SHOTS = 205;
00067 static const int CHBOX_PN_IN_VIDEO = 206;
00068
00069 static const int UNKNOWN_BIT = 1;
00070 static const int POSITIVE_BIT = 2;
00071 static const int SKIPPED_BIT = 4;
00072 static const int NEGATIVE_BIT = 8;
00073
00074 public:
00075
00076 typedef std::vector<UCHAR> VideoAnnotation;
00077 typedef std::vector<VideoAnnotation*> VideoAnnotations;
00078
00079 typedef Core::VideoSet::SegmentationDocument SegmentationDocument;
00080 typedef Core::VideoSet::Segmentation Segmentation;
00081 typedef Core::Array::Array2dVec3UInt8 Array2dVec3UInt8;
00082 typedef Core::VideoSet::Mpeg7Doc Mpeg7Doc;
00083 typedef Core::Stream::RgbDataSrc RgbDataSrc;
00084 typedef Core::Stream::RgbDataSrcRaw RgbDataSrcRaw;
00085 typedef Core::Stream::RgbDataSrcFactory RgbDataSrcFactory;
00086 typedef Core::Table::SimilarityTableSet SimilarityTableSet;
00087
00088 typedef Visualization::SimilarityTimeLineVideo SimilarityTimeLineVideo;
00089
00090 typedef SimilarityTableSet::SimTableType SimTableType;
00091 typedef SimilarityTableSet::RankTableType RankTableType;
00092
00093 typedef OglGui::TitledWindow TitledWindow;
00094 typedef OglGui::Button Button;
00095 typedef OglGui::StaticText StaticText;
00096 typedef OglGui::TextArea TextArea;
00097 typedef OglGui::CheckBox CheckBox;
00098 typedef OglGui::UpDownButton UpDownButton;
00099 typedef OglGui::UpDownNumber UpDownNumber;
00100 typedef OglGui::ValueScrollBar ValueScrollBar;
00101 typedef OglGui::Strut Strut;
00102
00103 struct AnnoHistory {
00104 int fileIdx;
00105 int frameIdx;
00106 int rankIdx;
00107 };
00108
00109 SegmentationDocumentGuiAnno(OglGui::Window* parent, int wndWidth,
00110 int wndHeight, SegmentationDocument* segDoc,
00111 String conceptSet, int maxAnnoPerVideo,
00112 int controlId) :
00113 DataDocumentGui<SegmentationDocument>(parent, wndWidth, wndHeight,
00114 segDoc, controlId, true,
00115 false, false, 2, 4, true,
00116 false)
00117 {
00118 Init(segDoc, conceptSet, maxAnnoPerVideo);
00119 }
00120
00121 virtual void HandleActivate()
00122 {
00123 mNoAutoNextAnno = true;
00124 AppControlDoc::HandleActivate();
00125 mNoAutoNextAnno = false;
00126 }
00127
00128 virtual void
00129 HandleNewFile()
00130 {
00131 DataDocumentGui<SegmentationDocument>::HandleNewFile();
00132 int oldCurFile = mCurFile;
00133 CheckLoadMpeg7();
00134
00135 if (mAnnoSearching)
00136 return;
00137
00138
00139 CheckNewVideo(oldCurFile);
00140 HandleNewShot();
00141 if (mRankingMode)
00142 CheckAnnoMax();
00143 }
00144
00145 virtual void
00146 HandleNewShot()
00147 {
00148 if (mAnnoSearching)
00149 return;
00150 mImWnd->RemoveImages();
00151 mImShotWnd->RemoveImages();
00152 mCurShotFrames.clear();
00153
00154 mFrameText->SetText("");
00155 if (!(mKeyframes && mKeyframeSet))
00156 return;
00157 int shot = mSegDoc->CurShot();
00158 if (shot == -1)
00159 return;
00160
00161
00162
00163
00164 mCurKey = mKeyframes->GetShotRKF(shot);
00165 mImWnd->AddImage(mCurKey, mKeyframeSet);
00166
00167 int frame = mKeyframes->GetFrameNr(mCurKey);
00168 int firstFrame = -1, lastFrame = -1;
00169 int idx = -1;
00170 if (mCurMpeg7)
00171 {
00172 idx = mCurMpeg7->FindShot(frame);
00173 if (idx != -1)
00174 {
00175 firstFrame = mCurMpeg7->StartFrame(idx);
00176 lastFrame = mCurMpeg7->EndFrame(idx);
00177 }
00178 }
00179 if (firstFrame == lastFrame)
00180 {
00181 if ((shot = FindFrameShot(frame))==-1)
00182 return;
00183 firstFrame = mShots[shot]+1;
00184 lastFrame = mShots[shot+((shot<mShots.size()-1) ? 1 : 0)];
00185 }
00186 FillShotSample(firstFrame, lastFrame, frame);
00187 UpdateRelevance();
00188 if (mSimTLV)
00189 {
00190 if (mAllowSlidingChBox)
00191 mFrameSliding = mAllowSlidingChBox->GetSelected();
00192 if (mFrameSliding)
00193 mSimTLV->Player()->MoveToFrame(frame);
00194 else
00195 mSimTLV->Player()->GotoFrame(frame);
00196 }
00197 }
00198
00199 void FillShotSample(int firstFrame, int lastFrame, int curFrame)
00200 {
00201 if (firstFrame > curFrame)
00202 firstFrame = curFrame;
00203 if (lastFrame < curFrame)
00204 lastFrame = curFrame;
00205 if (firstFrame > lastFrame)
00206 {
00207 int tmp = lastFrame;
00208 lastFrame = firstFrame;
00209 firstFrame = tmp;
00210 }
00211 mImShotWnd->RemoveImages();
00212 mCurShotFrames.clear();
00213 if (mRgbDataSrc && firstFrame < lastFrame)
00214 {
00215 if (mShotValueSB)
00216 {
00217 mShotValueSB->SetVisible(true);
00218 mShotValueSB->SetMinMaxValue(firstFrame, lastFrame);
00219 }
00220
00221 int nrShotFrames = lastFrame-firstFrame;
00222 if (nrShotFrames > 1)
00223 {
00224 float step = (nrShotFrames<5)? 1.f : nrShotFrames/4.f;
00225 for (float i=firstFrame; i<=lastFrame; i += step)
00226 ToShotWindow(i,((int)i)==curFrame);
00227 }
00228 }
00229 }
00230
00231 void ToShotWindow(int idx, bool isKeyFrame=false)
00232 {
00233 char buf[60];
00234 sprintf(buf,isKeyFrame?"%d (*)" : "%d", idx);
00235 Array2dVec3UInt8* arrIm = GetFrameArrIm(idx);
00236 mImShotWnd->AddImage(arrIm,"Direct",buf,true,false);
00237 mCurShotFrames.push_back(idx);
00238 }
00239
00240
00241 VideoAnnotations* GetVideoAnnotations()
00242 {
00243 return &mVideoAnnotations;
00244 }
00245
00246
00247 Array2dVec3UInt8* GetFrameArrIm(int frameNr)
00248 {
00249 if (!mRgbDataSrc)
00250 return 0;
00251
00252 int imW = mRgbDataSrc->FrameWidth();
00253 int imH = mRgbDataSrc->FrameHeight();
00254 Array2dVec3UInt8* ar =
00255 new Array2dVec3UInt8(imW, imH, 0, 0, 0, false);
00256 mRgbDataSrc->GotoFrame(frameNr);
00257 memcpy( (void *) ar->CPB(0, 0), mRgbDataSrc->DataPtr(), imW*imH*3 );
00258 return ar;
00259 }
00260
00261 virtual void
00262 HandleNewConcept()
00263 {
00264 mNrAnnotated = 0;
00265 mNrPositive = 0;
00266 mNrSkip = 0;
00267 mNrNegative = 0;
00268
00269 CheckLoadVideoAnnotations();
00270 CheckLoadMpeg7();
00271 ConstructShotRanking(!mRankAll);
00272 HandleNewShot();
00273 }
00274
00275 virtual void
00276 HandleLoadConcepts(String fileName, bool handleNew=true)
00277 {
00278 mConceptSet = fileName;
00279 if (mConceptSet.empty())
00280 return;
00281 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00282 String fName = mSegDoc->GetVideoSet()->GetFilePath("Annotations",
00283 mConceptSet,
00284 false, false);
00285 if (fName.empty())
00286 {
00287 ILOG_ERROR("Can't load concept file");
00288 return;
00289 }
00290 mSegDoc->LoadConcepts(fName);
00291 #else // REPOSITORY_USED
00292 mSegDoc->LoadConcepts(fileName);
00293 #endif // REPOSITORY_USED
00294 if (mSegDoc->HasConcepts())
00295 {
00296 mSegDoc->SetConcept(0);
00297 mConceptField->SetText(mSegDoc->GetConcept());
00298 if (handleNew)
00299 HandleNewConcept();
00300 }
00301 }
00302
00303 virtual void
00304 HandleSaveConcepts(String fileName)
00305 {
00306 mConceptSet = fileName;
00307 if (mConceptSet.empty())
00308 return;
00309 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00310 String fName = mSegDoc->GetVideoSet()->GetFilePath("Annotations",
00311 mConceptSet,
00312 true, false);
00313 if (fName.empty())
00314 {
00315 ILOG_ERROR("Can't save concept file");
00316 return;
00317 }
00318 ILOG_INFO("Saving concepts in " << fileName);
00319 mSegDoc->SaveConcepts(fName);
00320 #else // REPOSITORY_USED
00321 mSegDoc->SaveConcepts(fileName);
00322 #endif // REPOSITORY_USED
00323 }
00324
00325
00326 int FindFrameShot(int frame)
00327 {
00328 int i;
00329 for (i=0; i<mShots.size(); i++)
00330 if (mShots[i] >= frame)
00331 return i==0 ? 0 : i-1;
00332 return -1;
00333 }
00334
00335
00336 int FindSegFrameShot(int frame)
00337 {
00338 Segmentation* seg = mSegDoc->GetSegmentation();
00339 int firstShot = seg->GetFirstShotVideo(mCurFile);
00340 int lastShot = firstShot+seg->GetNrShotsVideo(mCurFile);
00341 int i;
00342
00343 for (i=firstShot; i<lastShot; i++)
00344 if (seg->GetStart(i) > frame)
00345 break;
00346 return i==firstShot ? i : i-1;
00347 }
00348
00349 int FindAdjacentAnnoShot(int curFile, int bit, int shotIdx, bool next)
00350 {
00351 if (curFile == -1) return -1;
00352
00353 Segmentation* seg = mSegDoc->GetSegmentation();
00354 int firstShot = seg->GetFirstShotVideo(curFile);
00355 int sz = seg->GetNrShotsVideo(curFile);
00356 int lastShot = firstShot+sz;
00357 int foundShotNr = -1;
00358
00359 for (int i=firstShot; i<lastShot; i++)
00360 {
00361 int kFrame = mKeyframes->GetShotRKF(i);
00362 int frame = mKeyframes->GetFrameNr(kFrame);
00363 int val = (*mVideoAnnotations[curFile])[i-firstShot];
00364 bool unknown = (val == 0);
00365 bool skipped = (val == SKIPPED_BIT);
00366 bool positive = (val == POSITIVE_BIT);
00367 bool negative = (val == NEGATIVE_BIT);
00368 bool passTest = ((bit==POSITIVE_BIT) && positive ||
00369 (bit==NEGATIVE_BIT) && negative ||
00370 (bit==SKIPPED_BIT) && skipped ||
00371 (bit==UNKNOWN_BIT) && unknown);
00372 if (passTest && next && i > shotIdx)
00373 return i;
00374 if (i!=shotIdx && passTest && !next)
00375 foundShotNr = i;
00376 if (!next && i>=shotIdx)
00377 return foundShotNr;
00378 }
00379 return foundShotNr;
00380 }
00381
00382 int FindAdjacentAnnoShot(int bit, int shotIdx, bool next)
00383 {
00384 return FindAdjacentAnnoShot(mCurFile,bit,shotIdx,next);
00385 }
00386
00387 bool GoToAdjacentAnnoShot(int bit, int shotIdx, bool next)
00388 {
00389 int shot;
00390 if ((shot=FindAdjacentAnnoShot(bit,shotIdx,next))==-1)
00391 return false;
00392 mSegDoc->GotoShot(shot);
00393 AllHandleNewCursor(Core::Database::LEVEL_SHOT, false);
00394 return true;
00395 }
00396
00397 int FindNextAnno(int bit, bool next, bool stayInVideo)
00398 {
00399 Segmentation* seg = mSegDoc->GetSegmentation();
00400 int nrVideos = seg->GetNrVideos();
00401 int curShot = mSegDoc->CurShot();
00402 int curFile = mCurFile;
00403 curFile = mSegDoc->CurFileId();
00404 int shot;
00405
00406 if ((shot=FindAdjacentAnnoShot(curFile,bit,curShot,next))!=-1)
00407 return curFile * 100000 + shot;
00408 if (stayInVideo)
00409 return -1;
00410
00411 if (next) while (++curFile < nrVideos)
00412 {
00413 int firstShot = seg->GetFirstShotVideo(curFile);
00414 if ((shot = FindAdjacentAnnoShot(curFile,bit,firstShot-1,true))!=-1)
00415 return curFile * 100000 + shot;
00416 }
00417 else while(--curFile >= 0)
00418 {
00419 int firstShot = seg->GetFirstShotVideo(curFile);
00420 int lastShot = firstShot+seg->GetNrShotsVideo(curFile);
00421 if ((shot = FindAdjacentAnnoShot(curFile,bit,lastShot,false))!=-1)
00422 return curFile * 100000 + shot;
00423 }
00424 return -1;
00425 }
00426
00427 void GoToNextAnno(int bit, bool next, bool stayInVideo)
00428 {
00429 int res = FindNextAnno(bit,next,stayInVideo);
00430 if (res != -1)
00431 {
00432 AllHandleNewCursor(mSegDoc->CursorToFile(res/100000),false);
00433 mSegDoc->GotoShot(res%100000);
00434 AllHandleNewCursor(Core::Database::LEVEL_SHOT,false);
00435 }
00436 }
00437
00438
00439 void Synchronize(int kf=-1)
00440 {
00441 if (kf==-1) kf = 0;
00442 int frame = mSimTLV ? mSimTLV->Player()->FrameNr() : kf;
00443 int shot = FindSegFrameShot(frame);
00444 int kFrame = mKeyframes->GetShotRKF(shot);
00445 mSegDoc->GotoKeyfr(kFrame);
00446 AllHandleNewCursor(Core::Database::LEVEL_SHOT, false);
00447 }
00448
00449
00450 void AdjustAnnoBoundary(int lData)
00451 {
00452 int frame = mSimTLV->Player()->FrameNr();
00453 int lFrame, rFrame;
00454 int kFrame = ((mCurKey!=-1) ? mKeyframes->GetFrameNr(mCurKey) : 0);
00455
00456 mShotValueSB->GetMinMaxValue(lFrame, rFrame);
00457 if (lData==BUT_LEFT_SHOT)
00458 FillShotSample(frame, rFrame, kFrame);
00459 else
00460 FillShotSample(lFrame, frame, kFrame);
00461 }
00462
00463 void SetRankingMode(bool mode)
00464 {
00465 mRankingMode = mSimSet ? mode : false;
00466 mNavModeBtn->SetText(mRankingMode ? "R" : "S");
00467 PrevNextAnnoControlFeedBack();
00468 }
00469
00470 void GoToCurrentRank()
00471 {
00472 if (mRankedShots.size())
00473 {
00474 mSegDoc->GotoShot(mRankedShots[mCurRankShot]);
00475 AllHandleNewCursor(Core::Database::LEVEL_SHOT, false);
00476 }
00477 }
00478
00479 void ToggleNavigationMode()
00480 {
00481 SetRankingMode(mNavModeBtn->GetText() == "S");
00482 if (mRankingMode)
00483 GoToCurrentRank();
00484 }
00485
00486 void NavigateExtremes(bool toStart)
00487 {
00488 int shot = 0;
00489
00490 if (mRankingMode && mRankedShots.size())
00491 {
00492 if ((mCurRankShot = toStart ? 0 : mRankedShots.size()-1)!=-1)
00493 shot = mRankedShots[mCurRankShot];
00494 }
00495 else
00496 {
00497 Segmentation* seg = mSegDoc->GetSegmentation();
00498 shot = seg->GetFirstShotVideo(mCurFile);
00499 if (!toStart)
00500 shot += seg->GetNrShotsVideo(mCurFile)-1;
00501 }
00502 mSegDoc->GotoShot(shot);
00503 AllHandleNewCursor(Core::Database::LEVEL_SHOT, false);
00504 }
00505
00507
00508 virtual void
00509 ButtonSelectionEvent(Button* src, void* vData)
00510 {
00511 DataDocumentGui<SegmentationDocument>::ButtonSelectionEvent(src, vData);
00512 int lData = (int)((long long) vData);
00513 switch (lData)
00514 {
00515 case BUT_POSITIVE:
00516 DoAnno(1,false);
00517 break;
00518 case BUT_SKIP:
00519 DoAnno(0.5,false);
00520 break;
00521 case BUT_NEGATIVE:
00522 DoAnno(0,false);
00523 break;
00524 case BUT_SHOT_POS:
00525 DoAnno(1,true);
00526 break;
00527 case BUT_SHOT_NEG:
00528 DoAnno(0,true);
00529 break;
00530 case BUT_NAV_MODE:
00531 ToggleNavigationMode();
00532 break;
00533 case BUT_NAV_BEGIN:
00534 case BUT_NAV_END:
00535 NavigateExtremes(lData==BUT_NAV_BEGIN);
00536 break;
00537 case BUT_BACK:
00538 GoBack();
00539 break;
00540 case BUT_FORW:
00541 GoForw(true);
00542 break;
00543 case BUT_SAVE:
00544 CheckSaveMpeg7(false);
00545 break;
00546 case BUT_SYNC:
00547 Synchronize();
00548 break;
00549 case BUT_LEFT_SHOT:
00550 case BUT_RIGHT_SHOT:
00551 AdjustAnnoBoundary(lData);
00552 break;
00553 case VIEWSTRIP_PRE:
00554 case VIEWSTRIP_MIN:
00555 case VIEWSTRIP_MAX:
00556 mSimTLV->TimeLine()->ViewStripZoomToShowViews(lData-VIEWSTRIP_PRE);
00557 break;
00558 case BUT_RANK_ALL:
00559 case BUT_RANK_NOT_ANN:
00560 ConstructShotRanking(lData==BUT_RANK_NOT_ANN);
00561 SetRankingMode(true);
00562 if (mRankingMode)
00563 GoToCurrentRank();
00564 break;
00565
00566
00567
00568
00569
00570 }
00571
00572 }
00573 virtual void
00574 HandleNewKey(int c, int state)
00575 {
00576 ILOG_DEBUG("HandleNewKey: " << c);
00577 if (CheckBinding("annoPositive",c,state))
00578 DoAnno(1,false);
00579 if (CheckBinding("annoSkip",c,state))
00580 DoAnno(0.5,false);
00581 if (CheckBinding("annoNegative",c,state))
00582 DoAnno(0,false);
00583 if (CheckBinding("annoShotPositive",c,state))
00584 DoAnno(1,true);
00585 if (CheckBinding("annoShotNegative",c,state))
00586 DoAnno(0,true);
00587 if (CheckBinding("annoBackward",c,state) || (mRankingMode && c==oglLEFT))
00588 GoBack();
00589 if (CheckBinding("annoForward",c,state) || (mRankingMode && c==oglRIGHT))
00590 GoForw(true);
00591 if (c == oglHOME || c == oglEND)
00592 NavigateExtremes(c==oglHOME);
00593 if (CheckBinding("annoTogglePlay",c,state) && mSimTLV)
00594 {
00595 if (mSimTLV->Player()->Playing())
00596 mSimTLV->Player()->Stop();
00597 else
00598 mSimTLV->Player()->Play();
00599 }
00600 if (c == 8 || c == 127)
00601 {
00602 if (mAnnoHistoryVSB)
00603 mAnnoHistoryVSB->SBar()->ChangePos((state&oglControl)?1:-1);
00604 else
00605 OnAnnoHistoryVSB(mAnnoHistoryPos + ((c==8) ? -1 : 1));
00606 }
00607 }
00608
00609 void OnAnnoHistoryVSB(int value)
00610 {
00611 int sz = mAnnoHistory.size();
00612 if (value < 0 || value > sz || sz==0)
00613 return;
00614 bool goForward = (value == sz);
00615 mAnnoHistoryPos = value -= goForward ? 1 : 0;
00616 mDataDoc->CursorToFile(mAnnoHistory[value].fileIdx);
00617 AllHandleNewCursor(Core::Database::LEVEL_FILE, false);
00618 if (mSimTLV)
00619 mSimTLV->Player()->GotoFrame(mAnnoHistory[value].frameIdx);
00620 mCurRankShot = mAnnoHistory[value].rankIdx;
00621 Synchronize(mAnnoHistory[value].frameIdx);
00622 if (goForward)
00623 GoForw(false);
00624 }
00625
00626 virtual void
00627 UpDownButtonSelectionEvent(UpDownButton *src, bool isUpBtn, void* userData)
00628 {
00629 int updownBut = (long long) userData;
00630 int bit = 0;
00631 if (updownBut == UPDOWNBUT_POSITIVE)
00632 bit = POSITIVE_BIT;
00633 else if (updownBut == UPDOWNBUT_SKIPPED)
00634 bit = SKIPPED_BIT;
00635 else if (updownBut == UPDOWNBUT_NEGATIVE)
00636 bit = NEGATIVE_BIT;
00637 else if (updownBut == UPDOWNBUT_UNKNOWN)
00638 bit = UNKNOWN_BIT;
00639 if (bit)
00640 GoToNextAnno(bit, isUpBtn, mPrevNextAnnoStayInVideo);
00641 }
00642
00643 virtual void
00644 UpDownNumberChangedEvent(UpDownNumber *src, void* userData)
00645 {
00646 if (src == mStepUpDown)
00647 mStepSize = src->GetValue();
00648 if (src == mShotThresholdUDNr)
00649 {
00650 mShotThreshold = src->Value();
00651 ConstructShots(mShotThreshold);
00652 HandleNewShot();
00653 }
00654 }
00655
00656 virtual void
00657 OnValueChanged(ValueScrollBar *src, int value, void* userData)
00658 {
00659 if (mSimTLV && src == mShotValueSB && !mShotValueSBAdjusting)
00660 mSimTLV->Player()->GotoFrame(value);
00661 if (src == mRankVSB && !mRankVSBAdjusting)
00662 {
00663 mCurRankShot = value;
00664 GoToCurrentRank();
00665 }
00666 if (src == mAnnoHistoryVSB && !mAnnoHistoryVSBAdjusting)
00667 OnAnnoHistoryVSB(value);
00668 }
00669
00670 virtual void
00671 CheckBoxEvent(CheckBox *src, bool checked, void* vData)
00672 {
00673 int userData = (long long) vData;
00674
00675 if (userData == CHBOX_RANK_MODE)
00676 {
00677 SetRankingMode(checked);
00678 GoToCurrentRank();
00679 }
00680 if (userData == CHBOX_SHOW_THRESH_SHOTS)
00681 mShowThreshShots = checked;
00682 if (userData == CHBOX_SHOW_SEG_SHOTS)
00683 mShowSegShots = checked;
00684 if (userData == CHBOX_PN_IN_VIDEO)
00685 mPrevNextAnnoStayInVideo = checked;
00686 }
00687
00689
00691
00692 void DrawFramesLine(SimilarityTimeLine* sTL, int f1,int f2, int w,
00693 int y1, int y2, ULONG col)
00694 {
00695 if (!sTL)
00696 return;
00697 int fPix = sTL->Unit2Pixel(f1*40);
00698 int lPix = sTL->Unit2Pixel(f2*40);
00699 if (fPix == lPix && y1 == y2)
00700 lPix += 1;
00701 SetLineWidth(w);
00702 SetSolidLineColor(col);
00703 DrawLine(fPix, y1, lPix, y2);
00704 SetLineWidth(1);
00705 }
00706
00707 void
00708 DisplayThreshShots(SimilarityTimeLine* sTL, int y, ULONG col1, ULONG col2)
00709 {
00710 if (!sTL)
00711 return;
00712 int fVisFr = sTL->FirstVisibleFrame();
00713 int lVisFr = sTL->LastVisibleFrame();
00714 int fVisShot = FindFrameShot(fVisFr);
00715 int lVisShot = FindFrameShot(lVisFr);
00716 for (int i = fVisShot; i<lVisShot+1 && i<mShots.size()-1; i++)
00717 {
00718 int fFrame = mShots[i]+1;
00719 int lFrame = mShots[i+1];
00720 DrawFramesLine(sTL,fFrame,lFrame,2,y,y,(i%2) ? col1 : col2);
00721 }
00722 }
00723
00724 void
00725 DisplaySegShots(SimilarityTimeLine* sTL, int y, ULONG col1, ULONG col2)
00726 {
00727 Segmentation* seg = mSegDoc->GetSegmentation();
00728 if (!seg || !sTL)
00729 return;
00730
00731 int fVisFr = sTL->FirstVisibleFrame();
00732 int lVisFr = sTL->LastVisibleFrame();
00733 int firstShot = seg->GetFirstShotVideo(mCurFile);
00734 int lastShot = firstShot+seg->GetNrShotsVideo(mCurFile);
00735 int fVisShot = FindSegFrameShot(fVisFr);
00736 int lVisShot = FindSegFrameShot(lVisFr);
00737
00738 for (int i = fVisShot; i<lVisShot+1 && i<lastShot; i++)
00739 {
00740 int fFrame = seg->GetStart(i);
00741 int lFrame = seg->GetEnd(i);
00742 DrawFramesLine(sTL,fFrame,lFrame,2,y,y,(i%2) ? col1 : col2);
00743 }
00744 }
00745
00746 void
00747 DisplayShotRelevances(SimilarityTimeLine* sTL, int y)
00748 {
00749 Segmentation* seg = mSegDoc->GetSegmentation();
00750 if (!seg || !sTL || !mCurMpeg7)
00751 return;
00752
00753 int fVisFr = sTL->FirstVisibleFrame();
00754 int lVisFr = sTL->LastVisibleFrame();
00755 int firstShot = seg->GetFirstShotVideo(mCurFile);
00756 int lastShot = firstShot+seg->GetNrShotsVideo(mCurFile);
00757 int fVisShot = FindSegFrameShot(fVisFr);
00758 int lVisShot = FindSegFrameShot(lVisFr);
00759
00760 for (int i = fVisShot; i<lVisShot+1 && i<lastShot-1; i++)
00761 {
00762 int fFrame = seg->GetStart(i);
00763 int idx = mCurMpeg7->FindShot(fFrame+1);
00764 DrawShotRelevance(sTL, idx, -1, y);
00765 }
00766 }
00767
00768 void ShotControlFeedback(int fFrame, int lFrame, int kFrame)
00769 {
00770 if (!mSimTLV || !mShotValueSB)
00771 return;
00772
00773 int playFrame = mSimTLV->Player()->FrameNr();
00774 mShotValueSBAdjusting = true;
00775 mShotValueSB->SetValue(playFrame);
00776 mShotValueSBAdjusting = false;
00777 mShotValueSB->SBar()->ButDecr()
00778 ->SetBorderBackground((playFrame<fFrame) ? oglRED : 0);
00779 mShotValueSB->SBar()->ButIncr()
00780 ->SetBorderBackground((playFrame>lFrame) ? oglRED : 0);
00781
00782 if (!mNoShotEditing)
00783 {
00784 mShotLeftBtn ->SetState(((playFrame<kFrame) && mSimTLV) ? 1 : 0);
00785 mShotRightBtn->SetState(((playFrame>kFrame) && mSimTLV) ? 1 : 0);
00786 }
00787 }
00788
00789
00790 void RankingControlFeedback()
00791 {
00792 if (mRankVSB)
00793 {
00794 if (mRankingMode)
00795 {
00796 mRankVSBAdjusting = true;
00797 mRankVSB->SetValue(mCurRankShot);
00798 mRankVSBAdjusting = false;
00799 }
00800 mRankVSB->SBar()->SetState(mRankingMode ? 1 : 0);
00801 mRankVSB->ValText()->SetState(mRankingMode ? 1 : 0);
00802 }
00803 mRankChBox->SetState(mSimSet?1:0);
00804 mRankChBox->SetSelected(mRankingMode);
00805 mRankAllBtn->SetBorderBackground(mRankAll?oglTrLIGHTGREEN:0);
00806 mRankNotAnnoBtn->SetBorderBackground(mRankAll?0:oglTrLIGHTGREEN);
00807 }
00808
00809 void HandleUpDownState(UpDownButton* udBtn, int state, bool doParent=false)
00810 {
00811 udBtn->UpButton()->SetState(state);
00812 udBtn->DownButton()->SetState(state);
00813 udBtn->SetState(state);
00814 if (doParent)
00815 udBtn->GetParent()->SetState(state);
00816 }
00817
00818 void PrevNextAnnoControlFeedBack()
00819 {
00820 if (mNoPrevNextControl)
00821 return;
00822 int state = !mRankingMode;
00823 HandleUpDownState(mPositiveUDBtn,state,true);
00824 HandleUpDownState(mSkippedUDBtn,state,true);
00825 HandleUpDownState(mNegativeUDBtn,state,true);
00826 HandleUpDownState(mUnknownUDBtn,state,true);
00827 }
00828
00829 void DrawShotRelevance(SimilarityTimeLine* sTL, int idx, int kFrame, int y)
00830 {
00831 if (idx == -1 || !mCurMpeg7)
00832 return;
00833 float relevance = mCurMpeg7->Relevance(idx);
00834 ULONG col = RelevanceColor(relevance);
00835 int fFrame = mCurMpeg7->StartFrame(idx);
00836 int lFrame = mCurMpeg7->EndFrame(idx);
00837 DrawFramesLine(sTL, fFrame, lFrame, 2, y, y, col);
00838 if (kFrame != -1)
00839 DrawFramesLine(sTL, kFrame, kFrame, 1, y, y-6, col);
00840 }
00841
00842
00843 virtual void WindowDisplayEvent(OglGui::Window *src, void* userData)
00844 {
00845 SimilarityTimeLine* sTL = (SimilarityTimeLine*) src;
00846 int y = sTL->GetAxisY();
00847 int kFrame = mKeyframes->GetFrameNr(mCurKey);
00848 int fFrame = -1;
00849 int lFrame = -1;
00850
00851
00852 if (!mCurShotFrames.empty())
00853 {
00854 fFrame = mCurShotFrames[0];
00855 lFrame = mCurShotFrames[mCurShotFrames.size()-1];
00856 DrawFramesLine(sTL, fFrame, lFrame, 2, y-18, y-18, 0xffffff00);
00857 }
00858
00859 ShotControlFeedback(fFrame,lFrame,kFrame);
00860 if (mShowThreshShots)
00861 DisplayThreshShots(sTL, y-24,0xff808000, 0xffb0b000);
00862 if (mShowSegShots)
00863 DisplaySegShots(sTL,y-27,0xffb0b0ff,0xff8080ff);
00864 if (mCurMpeg7)
00865 {
00866 int idx = mCurMpeg7->FindShot(kFrame);
00867 DrawShotRelevance(sTL, idx, kFrame, y-20);
00868 }
00869 }
00870
00871 virtual void DisplayFunc()
00872 {
00873 DataDocumentGui<Core::VideoSet::SegmentationDocument>::DisplayFunc();
00874
00875 char buf[100];
00876 sprintf(buf, "NrAnno: %d Pos %d Skip %d Neg %d V(%d)", mNrAnnotated,
00877 mNrPositive, mNrSkip, mNrNegative, mNrAnnoPerVideo);
00878 mNrAnnoTxt->SetText(buf);
00879 RankingControlFeedback();
00880 }
00881
00883
00884 private:
00885
00886 int Relevance2Bit(float rel)
00887 {
00888 if (rel < 0.01)
00889 return NEGATIVE_BIT;
00890 if (rel > 0.99)
00891 return POSITIVE_BIT;
00892 else
00893 return SKIPPED_BIT;
00894 }
00895
00896 void RelevanceStats(double rel, int delta)
00897 {
00898 if (rel < 0.01)
00899 mNrNegative += delta;
00900 else if (rel > 0.99)
00901 mNrPositive += delta;
00902 else
00903 mNrSkip += delta;
00904 }
00905
00906 void AnnoStats(int idx, double relevance)
00907 {
00908 if (idx == -1)
00909 {
00910 mNrAnnoPerVideo++;
00911 mNrAnnotated++;
00912 }
00913 RelevanceStats(relevance,1);
00914 }
00915
00916 bool InAnnoHistory(AnnoHistory* aH)
00917 {
00918 for (int i=0; i<mAnnoHistory.size(); i++)
00919 {
00920 AnnoHistory *annoH = &mAnnoHistory[i];
00921 if (annoH->fileIdx == aH->fileIdx &&
00922 annoH->frameIdx == aH->frameIdx &&
00923 annoH->rankIdx == aH->rankIdx
00924 )
00925 return true;
00926 }
00927 return false;
00928 }
00929
00930 void ToAnnoHistory(int fileIdx, int frameIdx, int rankIdx)
00931 {
00932 AnnoHistory annoHist = {fileIdx, frameIdx, rankIdx};
00933 if (!InAnnoHistory(&annoHist))
00934 {
00935 mAnnoHistory.push_back(annoHist);
00936 mAnnoHistoryPos = mAnnoHistory.size();
00937 if (!mAnnoHistoryVSB)
00938 return;
00939 mAnnoHistoryVSBAdjusting = true;
00940 mAnnoHistoryVSB->SetMinMaxValue(0,mAnnoHistoryPos);
00941 mAnnoHistoryVSB->SetValue(mAnnoHistoryPos);
00942 mAnnoHistoryVSBAdjusting = false;
00943 }
00944 }
00945
00946 bool CheckAnnoMax()
00947 {
00948 Segmentation* seg = mSegDoc->GetSegmentation();
00949 int firstShot = seg->GetFirstShotVideo(mCurFile);
00950
00951 bool annoMax = mNrAnnoPerVideo >= mMaxAnnoPerVideo ||
00952 FindAdjacentAnnoShot(UNKNOWN_BIT,firstShot-1,true)==-1;
00953 if (annoMax && mRankingMode && !mNoAutoNextAnno)
00954 {
00955 mCurFile;
00956 if (!mSegDoc->GotoNextVideo())
00957 return true;
00958 mCurFile;
00959
00960 int res = FindNextAnno(UNKNOWN_BIT, true, false);
00961 if (res != -1)
00962 AllHandleNewCursor(mSegDoc->CursorToFile(res/100000),false);
00963 }
00964 return annoMax;
00965 }
00966
00967 void DoAnno(double relevance, bool isShot)
00968 {
00969 if (!mSegDoc->HasCurShot() || !mCurMpeg7)
00970 return;
00971 String name = FileNameBase(mKeyframes->GetName(mCurKey));
00972 int frameNr = mKeyframes->GetFrameNr(mCurKey);
00973 bool empty = mCurShotFrames.empty();
00974 int sz = mCurShotFrames.size();
00975 int shotStart = (empty||!isShot) ? frameNr : mCurShotFrames[0];
00976 int shotEnd = (empty||!isShot) ? frameNr : mCurShotFrames[sz-1];
00977
00978 int oldIdx = mCurMpeg7->FindShot(frameNr);
00979 if (oldIdx!=-1)
00980 RelevanceStats(mCurMpeg7->Relevance(oldIdx),-1);
00981
00982 char buf[80];
00983 sprintf(buf, "%s_frame%d_%d", name.c_str(),shotStart,shotEnd);
00984 int idx = mCurMpeg7->ReplaceAnnotationEx(mSegDoc->GetConcept(),
00985 isShot?buf:name,
00986 frameNr,shotStart,
00987 shotEnd,relevance,1);
00988
00989 Segmentation* seg = mSegDoc->GetSegmentation();
00990 int shot = FindSegFrameShot(frameNr) - seg->GetFirstShotVideo(mCurFile);
00991 (*mVideoAnnotations[mCurFile])[shot] = Relevance2Bit(relevance);
00992
00993 mCurMpeg7Changed = true;
00994 ToAnnoHistory(mCurFile, frameNr, mCurRankShot);
00995 AnnoStats(idx, relevance);
00996 UpdateRelevance();
00997 if (!CheckAnnoMax() || !mRankingMode)
00998 GoForw(false);
00999 }
01000
01001 void
01002 GoBack()
01003 {
01004 if (mRankingMode)
01005 {
01006 if (!mRankedShots.size())
01007 return;
01008 if ((mCurRankShot-=mStepSize) < 0)
01009 mCurRankShot = 0;
01010 int newShot = mRankedShots[mCurRankShot];
01011 if (newShot != mSegDoc->CurShot())
01012 {
01013 mSegDoc->GotoShot(newShot);
01014 return AllHandleNewCursor(Core::Database::LEVEL_SHOT, false);
01015 }
01016 }
01017 else if (mSegDoc->GotoPrevShot(mStepSize))
01018 return AllHandleNewCursor(Core::Database::LEVEL_SHOT, false);
01019 }
01020
01021 void
01022 GoForw(bool withinVideo)
01023 {
01024 if (mRankingMode)
01025 {
01026 int sz = mRankedShots.size();
01027 mCurRankShot += mStepSize;
01028 if (mCurRankShot > sz-1)
01029 {
01030 mCurRankShot = sz ? sz-1 : 0;
01031 if (!withinVideo && mSegDoc->GotoNextVideo())
01032 return AllHandleNewCursor(Core::Database::LEVEL_FILE,false);
01033 }
01034 if (mCurRankShot >= 0 && mCurRankShot < sz)
01035 {
01036 int newShot = mRankedShots[mCurRankShot];
01037 if (newShot != mSegDoc->CurShot())
01038 {
01039 mSegDoc->GotoShot(newShot);
01040 return AllHandleNewCursor(Core::Database::LEVEL_SHOT, false);
01041 }
01042 }
01043 CheckSaveMpeg7(false);
01044 return;
01045 }
01046 if (mSegDoc->GotoNextShot(mStepSize))
01047 return AllHandleNewCursor(Core::Database::LEVEL_SHOT, false);
01048 if (withinVideo)
01049 return;
01050 if (mSegDoc->GotoNextVideo())
01051 return AllHandleNewCursor(Core::Database::LEVEL_FILE, false);
01052 CheckSaveMpeg7(false);
01053 }
01054
01055 void
01056 UpdateRelevance()
01057 {
01058 if (!mCurMpeg7)
01059 return;
01060 int frame = mKeyframes->GetFrameNr(mCurKey);
01061 int idx = mCurMpeg7->FindShot(frame);
01062 mCurRelevance = (idx == -1) ? 0.5 : mCurMpeg7->Relevance(idx);
01063 String typeString;
01064 if (mCurRelevance < 0.01)
01065 typeString = "negative";
01066 else if (mCurRelevance > 0.99)
01067 typeString = "positive";
01068 else
01069 typeString = "skip";
01070 if (idx == -1)
01071 typeString = "unknown";
01072
01073 bool isShot = false;
01074 if (idx != -1 && mCurShotFrames.size() != 0)
01075 {
01076 int fFrame = mCurMpeg7->StartFrame(idx);
01077 int lFrame = mCurMpeg7->EndFrame(idx);
01078 if (fFrame != lFrame)
01079 isShot = true;
01080 }
01081 mShotText->SetTextColor(isShot?RelevanceColor(mCurRelevance):oglBLACK);
01082 mImShotWnd->SetBorderBackground(isShot?RelevanceColor(mCurRelevance):0);
01083 mFrameText->SetTextColor(RelevanceColor(mCurRelevance));
01084 mShotText->SetText("shot " + (isShot ? typeString : "unknown"));
01085 mFrameText->SetText(isShot ? "" : ("fr " + typeString));
01086 }
01087
01088 ULONG RelevanceColor(float relevance)
01089 {
01090 if (relevance < 0.01)
01091 return oglTrRED;
01092 if (relevance > 0.99)
01093 return oglTrDARKGREEN;
01094 return oglBLACK;
01095 }
01096
01097 void
01098 CheckLoadMpeg7()
01099 {
01100 if ((mCurFile == mSegDoc->CurFileId()) &&
01101 (mCurConcept == mSegDoc->GetConceptIdx()))
01102 {
01103 return;
01104 }
01105 CheckSaveMpeg7(true);
01106 mCurFile = mSegDoc->CurFileId();
01107 mCurConcept = mSegDoc->GetConceptIdx();
01108 if ((mCurFile == -1) || (mCurConcept == -1))
01109 return;
01110 String vidName = mVidSet->GetFile(mCurFile);
01111 String concept = mSegDoc->GetConcept();
01112
01113 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
01114 String fName = mVidSet->GetFilePathMpeg7Anno(mCurFile,mConceptSet,
01115 concept+".xml",false,true);
01116 if (fName.empty())
01117 {
01118 int nrFr = mSegDoc->GetSegmentation()->GetNrFramesVideo(mCurFile);
01119 int fractions = 25;
01120 mConceptSet;
01121 mCurMpeg7 = new Mpeg7Doc(vidName, vidName, nrFr, fractions, false,
01122 mConceptSet, concept);
01123 }
01124 else
01125 {
01126 mCurMpeg7 = new Mpeg7Doc(fName, mVidSet->GetDatabase());
01127 mCurMpeg7->SetConceptSet(mConceptSet);
01128 }
01129 #else // REPOSITORY_USED
01130 String container = mConceptSet + "/" + mVidSet->GetContainerFile(mCurFile);
01131 typedef Persistency::Mpeg7DocLocator MP7Loc;
01132 MP7Loc loc(mVidSet->GetLocator(), MP7Loc::MPEG7_ANNOTATION, container,
01133 concept + ".xml");
01134 if (!Persistency::Mpeg7DocRepository().Exists(loc))
01135 {
01136 int nrFr = mSegDoc->GetSegmentation()->GetNrFramesVideo(mCurFile);
01137 int fractions = 25;
01138 mConceptSet;
01139 mCurMpeg7 = new Mpeg7Doc(vidName, vidName, nrFr, fractions, false,
01140 mConceptSet, concept);
01141 }
01142 else
01143 {
01144 mCurMpeg7 = Persistency::Mpeg7DocRepository().Get(loc);
01145 mCurMpeg7->SetConceptSet(mConceptSet);
01146 }
01147 #endif // REPOSITORY_USED
01148 }
01149
01150 void
01151 CheckSaveMpeg7(bool doDelete)
01152 {
01153 if (mCurMpeg7 && mCurMpeg7Changed)
01154 {
01155 ILOG_INFO("Saving " << mSegDoc->GetConcept(mCurConcept) << " for "
01156 << mVidSet->GetFile(mCurFile));
01157 Core::VideoSet::Mpeg7DocWrite(mCurMpeg7, mSegDoc->GetVideoSet(),
01158 mCurFile);
01159 if (doDelete)
01160 {
01161 delete mCurMpeg7;
01162 mCurMpeg7 = 0;
01163 }
01164 }
01165 mCurMpeg7Changed = false;
01166 }
01167
01168 void ClearVideoAnnotations()
01169 {
01170 for (int i = mVideoAnnotations.size()-1; i>=0; i--)
01171 delete mVideoAnnotations[i];
01172 mVideoAnnotations.clear();
01173 }
01174
01175 void CheckLoadVideoAnnotations()
01176 {
01177 int oldCurFile = mCurFile;
01178 int conceptIdx = mSegDoc->GetConceptIdx();
01179
01180 if (conceptIdx == -1 || conceptIdx == mCurConcept)
01181 return;
01182 ClearVideoAnnotations();
01183 Segmentation* seg = mSegDoc->GetSegmentation();
01184 int nrVideos = seg->GetNrVideos();
01185
01186 ILOG_INFO("Reading Mpeg7 video annotations for concept "
01187 + mSegDoc->GetConcept(conceptIdx));
01188 mSegDoc->CursorToDir(0);
01189 do {
01190 CheckLoadMpeg7();
01191 printf("Video annotation %d of %d \r",mCurFile,nrVideos);
01192 int firstShot = seg->GetFirstShotVideo(mCurFile);
01193 int sz = seg->GetNrShotsVideo(mCurFile);
01194 int lastShot = firstShot+sz;
01195 VideoAnnotation* vidAnno = new VideoAnnotation(sz);
01196 mVideoAnnotations.push_back(vidAnno);
01197 for (int i=firstShot; i<lastShot; i++)
01198 {
01199 int kFrame = mKeyframes->GetShotRKF(i);
01200 int frame = mKeyframes->GetFrameNr(kFrame);
01201 int idx = mCurMpeg7->FindShot(frame);
01202 bool unknown = (idx==-1);
01203 float rel = unknown ? 0.5 : mCurMpeg7->Relevance(idx);
01204 bool positive = rel > 0.99;
01205 bool negative = rel < 0.01;
01206 bool skipped = !unknown && !positive && !negative;
01207 if (skipped)
01208 (*vidAnno)[i-firstShot] = SKIPPED_BIT;
01209 if (positive)
01210 (*vidAnno)[i-firstShot] = POSITIVE_BIT;
01211 if (negative)
01212 (*vidAnno)[i-firstShot] = NEGATIVE_BIT;
01213 }
01214 } while (mSegDoc->CursorNextFile());
01215 mCurFile = -1;
01216 AllHandleNewCursor(mSegDoc->CursorToFile(oldCurFile), false);
01217 }
01218
01219 void CheckNewVideo(int oldCurFile)
01220 {
01221 if (mRgbDataSrc && oldCurFile == mSegDoc->CurFileId())
01222 return;
01223
01224 mNrAnnoPerVideo = 0;
01225 mCurFile = mSegDoc->CurFileId();
01226
01227 ConstructNewVideoSimSet();
01228
01229 if (mRgbDataSrc)
01230 delete mRgbDataSrc;
01231 mRgbDataSrc = 0;
01232
01233 Core::Database::RawDataSet* dataSet = mSegDoc->GetDataSet();
01234 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
01235 String videoName =
01236 dataSet->GetFilePathVideoData(mCurFile,false,false);
01237 String rawName =
01238 dataSet->GetFilePathFrames(mCurFile,"images_jpg.raw",false,false);
01239 mRgbDataSrc = OpenRgbDataSrc(rawName, videoName);
01240 #else // REPOSITORY_USED
01241 ILOG_ERROR("Todo : CheckNewVideo");
01242 String videoName;
01243 String rawName;
01244 #endif // REPOSITORY_USED
01245
01246 if (!mSimTLV && !mNoSimTLV && mShotSimSet)
01247 CreateSimTLV();
01248
01249 if (mSimTLV && mShotSimSet)
01250 {
01251 RgbDataSrc *rgbDataSrc = OpenRgbDataSrc(rawName, videoName);
01252 mSimTLV->OpenVideo(rgbDataSrc, videoName);
01253 mSimTLV->TimeLine()->DocW(4*rgbDataSrc->LastFrame());
01254 mSimTLV->SetSimilarityTableSet(mShotSimSet);
01255 rgbDataSrc = OpenRgbDataSrc(rawName, videoName);
01256 mSimTLV->TimeLine()->ViewStripRgbDataSrc(rgbDataSrc);
01257 mSimTLV->TimeLine()->ViewStripShow(true);
01258 }
01259 ConstructShots(mShotThreshold);
01260 mCurRankShot = 0;
01261 if (mRankingMode && !mNoAutoNextAnno)
01262 GoToCurrentRank();
01263 else
01264 HandleNewShot();
01265 }
01266
01267 RgbDataSrc* OpenRgbDataSrc(String rawName, String videoName)
01268 {
01269 RgbDataSrc *rgbDataSrc = 0;
01270 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
01271 if (!rawName.empty())
01272 rgbDataSrc = new RgbDataSrcRaw(rawName);
01273 else if (!videoName.empty())
01274 {
01275 RgbDataSrcFactory& f = RgbDataSrcFactory::Instance();
01276 rgbDataSrc = f.Construct(RgbDataSrcFactory::SRC_LAVC_WITHIDX,
01277 videoName, mVidSet->GetDatabase());
01278 }
01279 #else // REPOSITORY_USED
01280 ILOG_ERROR("Todo : OpenRgbDataSrc");
01281 #endif // REPOSITORY_USED
01282
01283 if (!rgbDataSrc || !rgbDataSrc->Valid())
01284 {
01285 ILOG_ERROR("Opening RgbDataSrc failed");
01286 if (rgbDataSrc)
01287 delete rgbDataSrc;
01288 return 0;
01289 }
01290 return rgbDataSrc;
01291 }
01292
01293 void ConstructShots(float threshold)
01294 {
01295 mShots.clear();
01296 mShots.push_back(-1);
01297 SimTableType* simTable = mShotSimSet->GetSimTable(0);
01298 int sz = simTable->Size();
01299 for (int i=0; i<sz; i++)
01300 {
01301 if (simTable->Get1(i) > threshold)
01302 mShots.push_back(i);
01303 }
01304 if (mShots[mShots.size()-1] != sz-1)
01305 mShots.push_back(sz-1);
01306 }
01307
01308 void CreateSimTLV()
01309 {
01310 OglGui::TitledWindow*
01311 tWnd = new TitledWindow(this,2,0,W()-4,396,"TimeLineVideo");
01312 mSimTLV = new SimilarityTimeLineVideo(tWnd->ContentPane(),0,0,
01313 W()-10,364, mShotSimSet,15);
01314 mSimTLV->TimeLine()->SetWindowListener(this);
01315 mSimTLV->TimeLine()->ShowClassify(false);
01316 mSimTLV->TimeLine()->SetSimColor(0,0xffffff00);
01317 mSimTLV->TimeLine()->CurrentViewOnTop(2);
01318 mSimTLV->TimeLine()->ViewStripMinViewWidth(12);
01319 mSimTLV->ScaleChildren();
01320 tWnd->ContentPane()->ScaleChildren();
01321
01322 StaticText* TBar = mSimTLV->TitledTimeLine()->TitleText();
01323 new Strut(TBar,160,1);
01324
01325 mSyncBtn = new Button(TBar, 50, 21, "Sync", 4, true);
01326 mSyncBtn->SetButtonListener(this, BUT_SYNC);
01327
01328 mAllowSlidingChBox =
01329 new CheckBox( TBar, 70, 21, "Sliding", true, 4);
01330 if (!mNoViewStripControl)
01331 {
01332
01333 StaticText* vStripTxt =
01334 new StaticText(TBar,160,21,"ViewStrip",false,true);
01335 vStripTxt->SetBorderType(BEV_ETCHED);
01336 InBoxButton(vStripTxt,62,32,"Pre",VIEWSTRIP_PRE);
01337 InBoxButton(vStripTxt,94,32,"Min",VIEWSTRIP_MIN);
01338 InBoxButton(vStripTxt,126,32,"Max",VIEWSTRIP_MAX);
01339 }
01340 new Strut(TBar,10,1);
01341 RectCheckBox(TBar,150,21,"Show Seg Shots",
01342 CHBOX_SHOW_SEG_SHOTS);
01343 RectCheckBox(TBar,160,21,"Show Thresh Shots",
01344 CHBOX_SHOW_THRESH_SHOTS);
01345 }
01346
01347 void ConstructNewVideoSimSet()
01348 {
01349 Core::Database::RawDataSet* dataSet = mSegDoc->GetDataSet();
01350 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
01351 Util::Database* db = dataSet->GetDatabase();
01352
01353 String simNames =
01354 dataSet->GetFilePathSimilarityData("Frames", "streamConcepts.txt",
01355 "no_model", "direct", mCurFile,
01356 "names.txt", false, false);
01357 if (mShotSimSet)
01358 delete mShotSimSet;
01359 mShotSimSet = SimilarityTableSet::MakeFromFile(simNames, db);
01360
01361
01362 simNames = dataSet->GetFilePathSimilarityData
01363 ("Keyframes",mRankSet,mRankModel,mRankFeature,mCurFile,
01364 "names.txt",false,false);
01365 if (mSimSet)
01366 delete mSimSet;
01367 mSimSet = 0;
01368 if (!simNames.empty())
01369 mSimSet = SimilarityTableSet::MakeFromFile(simNames, db);
01370 #else // REPOSITORY_USED
01371 typedef Persistency::SimilarityTableSetLocator SimLoc;
01372 SimLoc loc(dataSet->GetLocator(), false, "Frames", "streamConcepts.txt",
01373 "no_model", "direct", dataSet->GetContainerFile(mCurFile));
01374 if (mShotSimSet)
01375 delete mShotSimSet;
01376 mShotSimSet = Persistency::SimilarityTableSetRepository().Get(loc);
01377
01378
01379 loc = SimLoc(dataSet->GetLocator(), false, "Keyframes", mRankSet,
01380 mRankModel, mRankFeature,
01381 dataSet->GetContainerFile(mCurFile));
01382 if (mSimSet)
01383 delete mSimSet;
01384 mSimSet = 0;
01385 mSimSet = Persistency::SimilarityTableSetRepository().Get(loc);
01386 #endif // REPOSITORY_USED
01387 ConstructShotRanking(!mRankAll);
01388 }
01389
01390 int FindRankedShot(int shot)
01391 {
01392 int sz = mRankedShots.size();
01393 for (int i=0; i<sz; i++)
01394 if (mRankedShots[i] == shot)
01395 return i;
01396 return -1;
01397 }
01398
01399 bool PassTest(int filter, bool unKnown, bool pos, bool neg, bool skip)
01400 {
01401 if ( ((filter & UNKNOWN_BIT) && unKnown) ||
01402 ((filter & POSITIVE_BIT) && pos) ||
01403 ((filter & NEGATIVE_BIT) && neg) ||
01404 ((filter & SKIPPED_BIT) && skip)
01405 )
01406 return true;
01407 return false;
01408 }
01409
01410 bool ToRankedShots(RankTableType* rankTable, int i, int filter)
01411 {
01412 int frame = QuidId(rankTable->Get1(i));
01413 int shot = FindSegFrameShot(frame);
01414 int firstKey = mKeyframes->GetFirstKeyframeShot(shot);
01415 int lastKey = firstKey + mKeyframes->GetNrKeyframesShot(shot);
01416 int keyfr = mKeyframes->GetFrameId(frame, firstKey, lastKey);
01417 if (keyfr==-1 || !mKeyframes->IsRKF(keyfr))
01418 return false;
01419
01420 int firstFrame = -1, lastFrame = -1;
01421 int idx = mCurMpeg7->FindShot(frame);
01422 if (idx != -1)
01423 {
01424 firstFrame = mCurMpeg7->StartFrame(idx);
01425 lastFrame = mCurMpeg7->EndFrame(idx);
01426 }
01427 bool unKnown = (idx == -1);
01428 float relevance = unKnown ? 0.5 : mCurMpeg7->Relevance(idx);
01429 bool positive = relevance > 0.99;
01430 bool negative = relevance < 0.01;
01431 bool skipped = !unKnown && !positive && !negative;
01432 if (PassTest(filter,unKnown,positive,negative,skipped))
01433 {
01434 if (FindRankedShot(shot) == -1){
01435 mRankedShots.push_back(shot);
01436 return true;
01437 }
01438 }
01439 return false;
01440 }
01441
01442 void ConstructShotRanking(bool exclAnnotatedMode)
01443 {
01444 mRankedShots.clear();
01445 mCurRankShot = 0;
01446 mRankAll = !exclAnnotatedMode;
01447
01448 if (!mSimSet)
01449 return;
01450
01451 int tableNr = (mSimSet->NrTables()==1) ? 0 : mCurConcept;
01452 RankTableType* rankTable = mSimSet->GetRankTable(tableNr);
01453
01454 int nShots = 0;
01455 int sz = mSimSet->TableSize();
01456 for (int i=0; i<sz; i++)
01457 {
01458 int filter = exclAnnotatedMode ? UNKNOWN_BIT :
01459 UNKNOWN_BIT|POSITIVE_BIT|NEGATIVE_BIT|SKIPPED_BIT;
01460 if (ToRankedShots(rankTable, i, filter))
01461 nShots++;
01462 }
01463 if (mRankVSB)
01464 mRankVSB->SetMinMaxValue(0,nShots-1);
01465 }
01466
01467 void HandleConceptsFromFile()
01468 {
01469 mConceptFileField->SetText(mConceptSet);
01470 HandleLoadConcepts(mConceptSet, false);
01471
01472 CmdOptions& options = CmdOptions::GetInstance();
01473 String conceptStr = options.GetString("concept");
01474 if (!conceptStr.empty())
01475 {
01476 for (int i=0 ; i<mDataDoc->NrConcepts() ; i++)
01477 {
01478 if (conceptStr == mDataDoc->GetConcept(i))
01479 {
01480 mDataDoc->SetConcept(i);
01481 mConceptField->SetText(mDataDoc->GetConcept());
01482 mConceptField->ResetCaret();
01483 break;
01484 }
01485 }
01486 }
01487 if (mDataDoc->GetConceptIdx() != -1)
01488 HandleNewConcept();
01489 }
01490
01491 Button* KbButton(char* str, int w, int h, String keyStr, int userData)
01492 {
01493 char buf[40];
01494 sprintf(buf, "%s (%s)", str, mKeyBindings[keyStr].c_str());
01495
01496 Button* but = new Button(this,w,h,buf,4,true);
01497 but->SetButtonListener(this,userData);
01498 return but;
01499 }
01500
01501 UpDownButton*
01502 PrevNextAnnoShot(OglGui::Window* parent, strconst str, int userData)
01503 {
01504 StaticText* txt = new StaticText(parent,50,24,str);
01505 txt->SetAlign(oglLeftAlign);
01506 UpDownButton* upDownBtn = new UpDownButton(txt,15,2,36,22,true,2);
01507 upDownBtn->SetUpDownButtonListener(this, userData);
01508 upDownBtn->SetBorderType(0);
01509 upDownBtn->SetRepeatMode(false);
01510 return upDownBtn;
01511 }
01512
01513 Button*
01514 InBoxButton(OglGui::Window* parent, int x, int w, strconst str, int lData)
01515 {
01516 Button *btn
01517 = new Button(parent,x,2,w,parent->H()-4,str,BEV_ETCHED,true);
01518 btn->SetButtonListener(this,lData);
01519 btn->ScaleTo(parent);
01520 btn->SetAllowScaling(false);
01521 return btn;
01522 }
01523
01524 CheckBox*
01525 RectCheckBox(OglGui::Window* parent, int w, int h,String str,int lData)
01526 {
01527 int pW = parent->W();
01528 int pH = parent->H();
01529 CheckBox* cb = new CheckBox(parent,w,h,str,false,1);
01530 cb->SetCheckBoxListener(this,lData);
01531 cb->SetBoxFrameType(4);
01532 cb->SetRoundedCheck(false);
01533 return cb;
01534 }
01535
01536 void GuiNavigation()
01537 {
01538 Button* but;
01539 char buf[40];
01540
01541 OglGui::Window* navWnd = new OglGui::Window(this,270,24);
01542
01543 mNavModeBtn = new Button(navWnd,0,0,18,24,"R",4,true);
01544 mNavModeBtn->SetButtonListener(this,BUT_NAV_MODE);
01545
01546 but = new Button(navWnd,20,0,14, 24,"[",4,true);
01547 but->SetButtonListener(this,BUT_NAV_BEGIN);
01548
01549 sprintf(buf,"Backward (%s)", mKeyBindings["annoBackward"].c_str());
01550 but = new Button(navWnd,34,0,94,24,buf,4,true);
01551 but->SetButtonListener(this, BUT_BACK);
01552 but->SetRepeatMode(true);
01553
01554 mStepUpDown = new OglGui::UpDownNumber(navWnd,128,0,34,24,1,12,false,0);
01555 mStepUpDown->SetUpDownNumberListener(this);
01556 mStepUpDown->SetBorderType(BEV_ETCHED);
01557 mStepUpDown->SetRange(1,999);
01558
01559 sprintf(buf,"Forward (%s)", mKeyBindings["annoForward"].c_str());
01560 but = new Button(navWnd,162,0,94,24,buf,4,true);
01561 but->SetButtonListener(this, BUT_FORW);
01562 but->SetRepeatMode(true);
01563
01564 but = new Button(navWnd,256,0,14,24,"]",4,true);
01565 but->SetButtonListener(this,BUT_NAV_END);
01566 }
01567
01568 void GuiVideoShotControl()
01569 {
01570 if (mNoSimTLV || mNoShotControl)
01571 return;
01572
01573
01574 if (!mNoShotEditing)
01575 {
01576 mShotLeftBtn = new Button(this,12,24,"|",4,true);
01577 mShotLeftBtn->SetButtonListener(this, BUT_LEFT_SHOT);
01578 }
01579
01580 mShotValueSB = new ValueScrollBar(this,160,24,0,100,50,2);
01581 mShotValueSB->SetValueScrollBarListener(this);
01582
01583 if (!mNoShotEditing)
01584 {
01585 mShotRightBtn = new Button(this,12,24,"|",4,true);
01586 mShotRightBtn->SetButtonListener(this, BUT_RIGHT_SHOT);
01587 }
01588 if (!mNoShotThreshold)
01589 {
01590
01591 StaticText* sTxt = new StaticText(this, 70, 24, "thr:");
01592 sTxt->SetAlign(oglLeftAlign);
01593 mShotThresholdUDNr =
01594 new UpDownNumber(sTxt,22,0,48,24,0.2f,12,false,0);
01595 mShotThresholdUDNr->SetUpDownNumberListener(this);
01596 mShotThresholdUDNr->SetIncrement(0.01f);
01597 mShotThresholdUDNr->SetBorderType(4);
01598 mShotThresholdUDNr->SetRange(0.1f,0.6f);
01599 }
01600 }
01601
01602 void GuiRankingControl()
01603 {
01604 int sz = mNoRankSlider ? 160 : 290;
01605 OglGui::Window* rankWnd = new OglGui::Window(this,sz,24);
01606
01607 mRankChBox = new CheckBox(rankWnd,0,0,130,24,"Rank",false,4);
01608 mRankChBox->SetCheckBoxListener(this, CHBOX_RANK_MODE);
01609
01610 mRankAllBtn = InBoxButton(mRankChBox,60,32,"All",BUT_RANK_ALL);
01611
01612 mRankNotAnnoBtn = InBoxButton(mRankChBox,92,36,"!Ann",BUT_RANK_NOT_ANN);
01613 if (!mNoRankSlider)
01614 {
01615 mRankVSB = new ValueScrollBar(rankWnd,130,0,160,24,0,100,0);
01616 mRankVSB->SetValueScrollBarListener(this);
01617 }
01618 }
01619
01620 void GuiAnnotationControl()
01621 {
01622 Button* but;
01623 but = new Button(this, 140, 24, "Save Annotation",4,true);
01624 but->SetButtonListener(this, BUT_SAVE);
01625
01626 new Strut(this, 4000, 1);
01627 KbButton("Positive",110,24,"annoPositive",BUT_POSITIVE);
01628 KbButton("Skip",110,24,"annoSkip",BUT_SKIP);
01629 KbButton("Negative",110,24,"annoNegative",BUT_NEGATIVE);
01630 new Strut(this, 100, 1);
01631
01632 new Strut(this, 16, 1);
01633 KbButton("Shot Positive",160,24,"annoShotPositive",BUT_SHOT_POS);
01634 KbButton("Shot Negative",160,24,"annoShotNegative",BUT_SHOT_NEG);
01635 }
01636
01637 void GuiAnnoHistoryControl()
01638 {
01639 mAnnoHistoryVSB = 0;
01640 mAnnoHistoryPos = 0;
01641 if (mNoAnnoHistoryControl)
01642 return;
01643 StaticText* txt = new StaticText(this,210,24,"AnnoHistory:");
01644 txt->SetAlign(oglLeftAlign);
01645 mAnnoHistoryVSB = new ValueScrollBar(txt,90,0,120,24,0,1,0);
01646 mAnnoHistoryVSB->SetValueScrollBarListener(this);
01647 }
01648
01649 void GuiPrevNextAnnotatedControl()
01650 {
01651 if (mNoPrevNextControl)
01652 return;
01653
01654 OglGui::Window* prevNextWnd = new OglGui::Window(this,340,24);
01655 prevNextWnd->SetBorderType(BEV_ETCHED);
01656 mPNInVideoCB
01657 = new CheckBox(prevNextWnd,108,22,"StayInVideo",true,0);
01658 mPNInVideoCB->SetCheckBoxListener(this, CHBOX_PN_IN_VIDEO);
01659 mPositiveUDBtn = PrevNextAnnoShot(prevNextWnd,"P", UPDOWNBUT_POSITIVE);
01660 mSkippedUDBtn = PrevNextAnnoShot(prevNextWnd,"S", UPDOWNBUT_SKIPPED);
01661 mNegativeUDBtn = PrevNextAnnoShot(prevNextWnd,"N", UPDOWNBUT_NEGATIVE);
01662 mUnknownUDBtn = PrevNextAnnoShot(prevNextWnd,"U", UPDOWNBUT_UNKNOWN);
01663 PrevNextAnnoControlFeedBack();
01664 }
01665
01666 void InitGUI()
01667 {
01668 GuiName("AnnoControl");
01669 mNrAnnoTxt = new StaticText(this,340,22,"NrAnno: ");
01670
01671 mImWnd = new ImagesWindow(this, 360, 290, true);
01672 mImWnd->SetViewSize(352,280);
01673
01674 mImShotWnd = new ImagesWindow(this, W()-380, 290, true);
01675 mImShotWnd->SetBorderType(BEV_ETCHED);
01676 mImShotWnd->SetViewSize(176,140);
01677
01678 GuiNavigation();
01679
01680
01681 mFrameText = new TextArea(this, 100, 24, "<empty>",false);
01682 mShotText = new TextArea(this, 100, 24, "<empty>",false);
01683
01684 new Strut(this,1,1);
01685 GuiVideoShotControl();
01686 new Strut(this,15,1);
01687 GuiRankingControl();
01688 new Strut(this, 20, 1);
01689 GuiAnnotationControl();
01690 GuiAnnoHistoryControl();
01691 GuiPrevNextAnnotatedControl();
01692
01693
01694 HandleConceptsFromFile();
01695 }
01696
01697 void ReadKeyBindings()
01698 {
01699 InitKeyBinding("annoForward","0");
01700 InitKeyBinding("annoBackward", "9");
01701 InitKeyBinding("annoPositive", "1");
01702 InitKeyBinding("annoSkip", "2");
01703 InitKeyBinding("annoNegative", "3");
01704 InitKeyBinding("annoShotPositive", "6");
01705 InitKeyBinding("annoShotNegative", "7");
01706 InitKeyBinding("annoTogglePlay", " ");
01707 }
01708
01709 void HandleCmdOptions()
01710 {
01711 CmdOptions& options = CmdOptions::GetInstance();
01712 mConceptFeature = options.GetString("conceptFeature");
01713 mConceptModel = options.GetString("conceptModel");
01714 mRankSet = options.GetString("rankSet");
01715 mRankFeature = options.GetString("rankFeature");
01716 mRankModel = options.GetString("rankModel");
01717 mFrameSliding = options.GetBool("annoFrameSliding",false);
01718 mNoSimTLV = options.GetBool("annoNoTimeLineVideo", false);
01719 mNoShotControl = options.GetBool("annoNoShotControl", false);
01720 mNoShotEditing = options.GetBool("annoNoShotEditing", false);
01721 mNoShotThreshold = options.GetBool("annoNoShotThreshold", false);
01722 mNoRankSlider = options.GetBool("annoNoRankSlider", false);
01723 mNoAnnoHistoryControl = options.GetBool("annoNoHistoryControl", false);
01724 mNoPrevNextControl = options.GetBool("annoNoPrevNextControl", false);
01725 mNoViewStripControl = options.GetBool("annoNoViewStripControl",false);
01726
01727 }
01728
01729 void
01730 InitVars(SegmentationDocument* segDoc, String conceptSet, int annoPerVideo)
01731 {
01732 mSegDoc = segDoc;
01733 mConceptSet = conceptSet;
01734 mMaxAnnoPerVideo = annoPerVideo;
01735
01736 mVidSet = mSegDoc->GetVideoSet();
01737 mKeyframes = mSegDoc->GetKeyframes();
01738 mKeyframeSet = mSegDoc->GetImSetKeyframes(false);
01739
01740 if (!mKeyframeSet)
01741 mKeyframeSet = mSegDoc->GetImSetKeyframes(true);
01742
01743 mNrAnnoPerVideo = 0;
01744 mNrAnnotated = 0;
01745 mNrPositive = 0;
01746 mNrSkip = 0;
01747 mNrNegative = 0;
01748 mStepSize = 1;
01749
01750 mCurFile = -1;
01751 mCurConcept = -1;
01752 mCurMpeg7 = 0;
01753 mCurKey = 0;
01754
01755 mRgbDataSrc = 0;
01756 mShotSimSet = 0;
01757 mSimSet = 0;
01758 mSimTLV = 0;
01759
01760 mCurRankShot = 0;
01761 mRankingMode = true;
01762 mRankAll = false;
01763 mRankFilterBits = UNKNOWN_BIT;
01764
01765 mShotThreshold = 0.2f;
01766 mShotValueSB = 0;
01767 mAnnoSearchRecursLevel = 0;
01768
01769
01770
01771 mRankVSB = 0;
01772 mRankVSBAdjusting = false;
01773 mAnnoHistoryVSBAdjusting = false;
01774 mPrevNextAnnoStayInVideo = true;
01775 mAnnoSearching = false;
01776 mShowSegShots = false;
01777 mShowThreshShots = false;
01778 mCurMpeg7Changed = false;
01779 mNoAutoNextAnno = false;
01780 }
01781
01782
01783 void
01784 Init(SegmentationDocument* segDoc, String conceptSet, int maxAnnoPerVideo)
01785 {
01786 HandleCmdOptions();
01787 ReadKeyBindings();
01788 InitVars(segDoc,conceptSet,maxAnnoPerVideo);
01789 mNoAutoNextAnno = true;
01790 InitGUI();
01791 AllHandleNewCursor(segDoc->CursorToDir(0),false);
01792 mNoAutoNextAnno = false;
01793 }
01794
01795 VideoAnnotations mVideoAnnotations;
01796 std::vector<AnnoHistory> mAnnoHistory;
01797 std::vector<int> mShots;
01798 std::vector<int> mCurShotFrames;
01799 std::vector<int> mRankedShots;
01800
01801 SegmentationDocument* mSegDoc;
01802 Core::VideoSet::VideoSet* mVidSet;
01803 Core::VideoSet::Keyframes* mKeyframes;
01804 Core::ImageSet::ImageSet* mKeyframeSet;
01805 Core::VideoSet::Mpeg7Doc* mCurMpeg7;
01806 SimilarityTableSet* mShotSimSet;
01807 SimilarityTableSet* mSimSet;
01808 RgbDataSrc* mRgbDataSrc;
01809
01810 ImagesWindow* mImWnd;
01811 ImagesWindow* mImShotWnd;
01812 StaticText* mNrAnnoTxt;
01813 TextArea* mFrameText;
01814 TextArea* mShotText;
01815 CheckBox* mAllowSlidingChBox;
01816 CheckBox* mPNInVideoCB;
01817 CheckBox* mRankChBox;
01818
01819 SimilarityTimeLineVideo* mSimTLV;
01820 ValueScrollBar* mRankVSB;
01821 ValueScrollBar* mShotValueSB;
01822 ValueScrollBar* mAnnoHistoryVSB;
01823 UpDownNumber* mStepUpDown;
01824 UpDownNumber* mShotThresholdUDNr;
01825 UpDownButton* mPositiveUDBtn;
01826 UpDownButton* mNegativeUDBtn;
01827 UpDownButton* mSkippedUDBtn;
01828 UpDownButton* mUnknownUDBtn;
01829
01830 Button* mNavModeBtn;
01831 Button* mRankAllBtn;
01832 Button* mRankNotAnnoBtn;
01833 Button* mShotLeftBtn;
01834 Button* mShotRightBtn;
01835 Button* mSyncBtn;
01836
01837 String mRankSet;
01838 String mRankFeature;
01839 String mRankModel;
01840 String mConceptModel;
01841 String mConceptFeature;
01842 String mConceptSet;
01843
01844 double mCurRelevance;
01845 float mShotThreshold;
01846
01847 int mCurFile;
01848 int mCurConcept;
01849 int mCurKey;
01850 int mCurRankShot;
01851 int mMaxAnnoPerVideo;
01852 int mStepSize;
01853 int mNrAnnoPerVideo;
01854 int mNrAnnotated;
01855 int mNrPositive;
01856 int mNrSkip;
01857 int mNrNegative;
01858 int mAnnoSearchRecursLevel;
01859 int mRankFilterBits;
01860 int mAnnoHistoryPos;
01861
01862 bool mRankAll;
01863 bool mShotValueSBAdjusting;
01864 bool mRankVSBAdjusting;
01865 bool mAnnoHistoryVSBAdjusting;
01866
01867 bool mNoSimTLV;
01868 bool mNoShotControl;
01869 bool mNoShotEditing;
01870 bool mNoShotThreshold;
01871 bool mNoRankSlider;
01872 bool mNoAnnoHistoryControl;
01873 bool mNoPrevNextControl;
01874 bool mNoViewStripControl;
01875
01876
01877 bool mRankingMode;
01878 bool mShowSegShots;
01879 bool mShowThreshShots;
01880 bool mPrevNextAnnoStayInVideo;
01881 bool mAnnoSearching;
01882 bool mNextAnnoFound;
01883 bool mCurMpeg7Changed;
01884 bool mFrameSliding;
01885 bool mNoAutoNextAnno;
01886
01887 ILOG_VAR_DEC;
01888 };
01889
01890 ILOG_VAR_INIT(SegmentationDocumentGuiAnno, Visualization);
01891
01892 }
01893 }
01894
01895 #endif