00001 /*!@file Beobot/Landmark.H Landmark class for localization */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00005 // University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: Christian Siagian <siagian@usc.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Beobot/Landmark.H $ 00035 // $Id: Landmark.H 9412 2008-03-10 23:10:15Z farhan $ 00036 // 00037 00038 #ifndef BEOBOT_LANDMARK_DEFINED 00039 #define BEOBOT_LANDMARK_DEFINED 00040 00041 #include "SIFT/VisualObjectDB.H" 00042 #include "GUI/XWinManaged.H" 00043 #include "Beobot/KeypointTracker.H" 00044 #include "SIFT/CameraIntrinsicParam.H" 00045 00046 //! a Visual object-base Landmark class 00047 00048 /* Work done to take into account temporal info available 00049 Can be used to prune out bad keypoints 00050 */ 00051 class Landmark 00052 { 00053 public: 00054 // ###################################################################### 00055 //! @name Constructor, assigment and destructor 00056 //@{ 00057 00058 //! Constructor assuming precomputed Visual object 00059 /*! @param obj initial Visual object of landmark 00060 @param objOffset the coordinate of the topleft corner of the image 00061 used by the visual object 00062 @param fNum the initial frame number of the object it came from 00063 @param name name of the landmark 00064 */ 00065 Landmark(rutz::shared_ptr<VisualObject>& obj, 00066 Point2D<int> objOffset, 00067 uint fNum, 00068 const std::string& name = ""); 00069 00070 //! blank constructor with an optional name entry 00071 Landmark(const std::string& name = ""); 00072 00073 //! function to populate the initial landmark evidence 00074 void init(rutz::shared_ptr<VisualObject>& obj, 00075 Point2D<int> objOffset, uint fNum); 00076 00077 //! function to load an existing landmark file 00078 bool loadFrom(const std::string& fname); 00079 00080 //! function to save the current landmark 00081 bool saveTo(const std::string& fname); 00082 00083 //! Destructor 00084 ~Landmark(); 00085 00086 //@} 00087 00088 // ###################################################################### 00089 //! @name Access functions 00090 //@{ 00091 00092 //! name getter 00093 inline const std::string& getName() const; 00094 00095 //! name setter 00096 inline void setName(const std::string name); 00097 00098 //! set the match window to view the matching 00099 inline void setMatchWin(rutz::shared_ptr<XWinManaged> matchWin); 00100 00101 //! get the match window to view the matching 00102 inline rutz::shared_ptr<XWinManaged> getMatchWin(); 00103 00104 //! number of visual objects in DB 00105 inline const uint numObjects() const; 00106 00107 //! number of visual objects in Temp 00108 inline const uint numTempObjects() const; 00109 00110 //! latest frame number on DB list 00111 inline const uint getLatestVisualObjectFNum() const; 00112 00113 //! latest frame number on temp list 00114 inline const uint getLatestTempVisualObjectFNum() const; 00115 00116 //! latest frame number on either list (temp or DB) 00117 inline const uint getLatestFNum() const; 00118 00119 //! latest offset coordinates on either list (temp or DB) 00120 inline const Point2D<int> getLatestOffsetCoords() const; 00121 00122 //! get the latest visualObject 00123 inline const rutz::shared_ptr<VisualObject>& 00124 getLatestObject(bool& indb, bool& intdb, int& tindex) const; 00125 00126 //! object getter 00127 inline const rutz::shared_ptr<VisualObject>& 00128 getObject(const uint index) const; 00129 00130 //! get the frame Number of object[index] 00131 inline const uint getVisualObjectFNum(uint index) const; 00132 00133 //! get the offset coordinates of object[index] 00134 inline const Point2D<int> getOffsetCoords(uint index) const; 00135 00136 //! check whether object[index] is salient 00137 inline const bool isVisualObjectSal(uint index) const; 00138 00139 //! temp object getter 00140 inline const rutz::shared_ptr<VisualObject>& 00141 getTempObject(const uint index) const; 00142 00143 //! get the frame Number of temp object[index] 00144 inline const uint getTempVisualObjectFNum(uint index) const; 00145 00146 //! get the offset coordinates of temp object[index] 00147 inline const Point2D<int> getTempOffsetCoords(uint index) const; 00148 00149 //! get the visual object database 00150 inline rutz::shared_ptr<VisualObjectDB> getVisualObjectDB() const; 00151 00152 //! get the bounding box rectangle for the object[index] 00153 Rectangle getObjectRect(uint index); 00154 00155 //! does the landmark have evidence VO from this session 00156 inline bool haveSessionVO(std::string session); 00157 00158 //! get the number of sessions it has 00159 inline uint getNumSession(); 00160 00161 //! get a session name of the passed in index 00162 inline std::string getSession(const uint index); 00163 00164 //! get the session index range 00165 inline std::pair<uint,uint> getSessionIndexRange(const uint index); 00166 //@} 00167 00168 // ###################################################################### 00169 //! @name Compute functions 00170 //@{ 00171 00172 //! check if visual object(index) is salient 00173 inline const bool isSalVisualObject(uint index) const; 00174 00175 //! build the landmark by adding a new salient Visual Object 00176 rutz::shared_ptr<VisualObjectMatch> 00177 build(rutz::shared_ptr<VisualObject> obj, 00178 Point2D<int> objOffset, uint fNum); 00179 00180 //! build the landmark by adding visual object with no salient point 00181 //! (usually whole frame) -> will crop out the non-overlapping area 00182 rutz::shared_ptr<VisualObjectMatch> 00183 build(rutz::shared_ptr<VisualObject> obj, uint fNum); 00184 00185 //! just like build except it does not add the object 00186 //! only return where it would have been placed (in DB or Temp DB) 00187 //! or if it is rejected altogether 00188 rutz::shared_ptr<VisualObjectMatch> 00189 buildCheck(rutz::shared_ptr<VisualObject> obj, 00190 Point2D<int> objOffset, uint fNum, 00191 bool &inDB, bool &inTDB, int &tIndex); 00192 00193 //! corresponding non salient object input 00194 rutz::shared_ptr<VisualObjectMatch> 00195 buildCheck(rutz::shared_ptr<VisualObject> obj, uint fNum, 00196 bool &inDB, bool &inTDB, int &tIndex); 00197 00198 //! build the landmark using salient object 00199 //! based on information passed by build check 00200 rutz::shared_ptr<VisualObjectMatch> 00201 build(rutz::shared_ptr<VisualObject> obj, 00202 Point2D<int> objOffset, uint fNum, 00203 bool inDB, bool inTDB, int tIndex, 00204 rutz::shared_ptr<VisualObjectMatch> cmatch); 00205 00206 //! build the landmark using non-salient object 00207 //! based on information passed by build check 00208 rutz::shared_ptr<VisualObjectMatch> 00209 build(rutz::shared_ptr<VisualObject> obj, uint fNum, 00210 bool inDB, bool inTDB, int tIndex, 00211 rutz::shared_ptr<VisualObjectMatch> cmatch); 00212 00213 //! get the current velocity of the landmark 00214 Point2D<int> getVelocity(); 00215 // ===> USE VELOCITY LATER 00216 00217 //! get the position of the landmark 00218 Point2D<int> getPosition(); 00219 00220 //! get the keypoints in the current frames that are likely to be 00221 //! as determined using the trackers 00222 std::vector<rutz::shared_ptr<Keypoint> > getActiveKeypoints(); 00223 00224 //! get current active tracker with the longest chain 00225 rutz::shared_ptr<KeypointTracker> getFittestKPtr(); 00226 00227 //! set the camera intrinsic param value 00228 inline void setCameraIntrinsicParam 00229 (rutz::shared_ptr<CameraIntrinsicParam> cip); 00230 00231 //! move the last object on the temp DB to the store DB 00232 void moveLatestTempVisualObjectToDB(); 00233 00234 //! find number of object matches between the two landmarks 00235 uint numMatch(rutz::shared_ptr<Landmark> lmk, 00236 float maxPixDist = 10.0F, float minfsim = .75F, 00237 float minscore = 2.5F, uint minmatch = 4); 00238 00239 //! combine the two landmarks 00240 void combine(rutz::shared_ptr<Landmark> lmk1, 00241 rutz::shared_ptr<Landmark> lmk2); 00242 00243 //! append the input landmark to the DB 00244 void append(rutz::shared_ptr<Landmark> lmk); 00245 00246 //! match the visual object to the objects in the landmark 00247 int match(rutz::shared_ptr<VisualObject> obj, 00248 rutz::shared_ptr<VisualObjectMatch> &cmatch, 00249 int start = -1, int end = -1, 00250 float maxPixDist = 10.0F, 00251 float minfsim = .75F, 00252 float minscore = 2.5F, 00253 uint minmatch = 4, 00254 float maxRotate = M_PI/4, 00255 float maxScale = 5.0F, 00256 float maxShear = 0.25F); 00257 00258 //! transfer evidence from landmark2 to here 00259 void transferEvidence 00260 ( rutz::shared_ptr<Landmark> landmark2, 00261 bool indb2, bool intdb2, int tIndex2, 00262 rutz::shared_ptr<VisualObjectMatch> cmatch); 00263 00264 //! match the salient features 00265 //! return a normalized [ 0.0 ... 1.0 ] 00266 float matchSalientFeatures(rutz::shared_ptr<VisualObject> object); 00267 00268 //! sort the objects in the landmark using the passed in session order 00269 void sort(std::vector<std::string> sessionNames); 00270 00271 //! reset the session related information 00272 void setSessionInfo(); 00273 00274 //@} 00275 00276 private: 00277 00278 //! name of the landmark 00279 std::string itsName; 00280 00281 //! TAKE OUT: for display purposes 00282 rutz::shared_ptr<XWinManaged> itsMatchWin; 00283 00284 //! for calculating match 00285 rutz::shared_ptr<VisualObjectMatchAlgo> itsVoma; 00286 00287 //! list of objects as evidence of its exitance 00288 rutz::shared_ptr<VisualObjectDB> itsVisualObjectDB; 00289 00290 //! offset from the origin of the scene frame 00291 std::vector<Point2D<int> > itsOffsetCoords; 00292 00293 //! frame number of object 00294 std::vector<uint> itsVisualObjectFNum; 00295 00296 //! temporary storage for list of objects 00297 //! to limit actual number of objects stored 00298 rutz::shared_ptr<VisualObjectDB> itsTempVisualObjectDB; 00299 00300 //! offset from the origin of the scene frame 00301 std::vector<Point2D<int> > itsTempOffsetCoords; 00302 00303 //! frame number of temp object 00304 std::vector<uint> itsTempVisualObjectFNum; 00305 00306 //! NOTE: not used for beobot-GSnav 00307 //! set of keypoints extracted from the objects 00308 std::vector<rutz::shared_ptr<KeypointTracker> > itsKPtrackers; 00309 00310 //! camera intrinsic param calibration values 00311 rutz::shared_ptr<CameraIntrinsicParam> itsCip; 00312 00313 //! latest frame number in both DB list 00314 uint itsLatestVisualObjectFNum; 00315 00316 //! latest frame number in both temp list 00317 uint itsLatestTempVisualObjectFNum; 00318 00319 //! summarizing salient features of the visual objects in the landmark 00320 //! first value is the average of the feature values 00321 //! second value is standard deviation of the feature values 00322 std::vector<std::pair<double,double> > itsSalientFeatures; 00323 00324 //! the sessions that make up the landmark 00325 std::vector<std::string> itsSession; 00326 std::vector<std::pair<uint,uint> > itsSessionIndexRange; 00327 00328 //! the range locations of the landmarkDB 00329 //! this is the min and max for all session 00330 //! if need individual, it can be accessed through itsSessionIndexRange 00331 //! NOTE: not available as it need session information 00332 //std::pair<float,float> itsLandmarkLocation; 00333 00334 // ###################################################################### 00335 //! @name Compute functions (all the inner-working functions) 00336 //@{ 00337 00338 //! match visual object a and b 00339 //! return all the computed statistics 00340 rutz::shared_ptr<VisualObjectMatch> 00341 match(rutz::shared_ptr<VisualObject> a, 00342 rutz::shared_ptr<VisualObject> b, bool &isFit, 00343 float maxPixDist = 10.0F, 00344 float minfsim = .75F, 00345 float minscore = 2.5F, 00346 uint minmatch = 4, 00347 float maxRotate = M_PI/4, 00348 float maxScale = 5.0F, 00349 float maxShear = 0.25F, 00350 bool showMatch = false); 00351 00352 //! track the landmark using the new Visual Object 00353 rutz::shared_ptr<VisualObjectMatch> 00354 input(rutz::shared_ptr<VisualObject> obj, 00355 Point2D<int> objOffset, uint fNum); 00356 00357 //! track check the landmark using the new Visual Object 00358 rutz::shared_ptr<VisualObjectMatch> 00359 inputCheck(rutz::shared_ptr<VisualObject> obj, 00360 Point2D<int> objOffset, uint fNum, 00361 bool &inDB, bool &inTDB, int &tIndex); 00362 00363 // track the landmark using the new Visual Object 00364 // with the information passed by buildcheck 00365 rutz::shared_ptr<VisualObjectMatch> 00366 input(rutz::shared_ptr<VisualObject> obj, 00367 Point2D<int> objOffset, uint fNum, 00368 bool inDB, bool inTDB, int tIndex, 00369 rutz::shared_ptr<VisualObjectMatch> cmatch); 00370 00371 //! crop the input image so that the parts 00372 //! not included by the landmark reference object 00373 rutz::shared_ptr<VisualObjectMatch> 00374 cropInputImage(rutz::shared_ptr<VisualObject> &obj, Point2D<int> &objOffset, 00375 int mInd, rutz::shared_ptr<VisualObjectMatch> cmatch); 00376 00377 //! track the keypoints 00378 void trackKeypoints(rutz::shared_ptr<VisualObjectMatch> match, int mInd); 00379 00380 //! prune the keypoints 00381 void temporalPrune(uint index); 00382 00383 //! get the index of object with this FNum 00384 int getFNumIndex(uint fNum); 00385 00386 //! add the visual object to the VisualObjectDB 00387 void addObject(rutz::shared_ptr<VisualObject> obj, 00388 Point2D<int> objOffset, uint fNum); 00389 00390 //! add the visual object to the TempVisualObjectDB 00391 void tAddObject(rutz::shared_ptr<VisualObject> obj, 00392 Point2D<int> objOffset, uint fNum); 00393 00394 //! find a match between object and the Visual Object DB 00395 int findDBmatch(rutz::shared_ptr<VisualObject> obj, 00396 rutz::shared_ptr<VisualObjectMatch> &cmatch, 00397 uint nFrames, 00398 bool isForward = false, int start = -1, 00399 float maxPixDist = 10.0F, float minfsim = .75F, 00400 float minscore = 2.5F, uint minmatch = 4, 00401 float maxRotate = M_PI/4, 00402 float maxScale = 5.0F, 00403 float maxShear = 0.25F); 00404 00405 //! find a match between object and the Temp Visual Object DB 00406 int findTempDBmatch(rutz::shared_ptr<VisualObject> obj, 00407 rutz::shared_ptr<VisualObjectMatch> &cmatch, 00408 uint nFrames, 00409 float maxPixDist = 10.0F, float minfsim = .75F, 00410 float minscore = 2.5F, uint minmatch = 4); 00411 00412 //! move the Temp DB object of index 00413 //! to the back of the Visual Object DB 00414 void moveTempVisualObjectToDB(int index); 00415 00416 //! delete object/fnum/objOffset and cleanly relink everything else 00417 void cleanDelete(bool indb, bool intdb, int tIndex); 00418 00419 //! erase object at the passed in index 00420 inline void eraseObject(const uint index); 00421 00422 //! erase temp object at the passed in index 00423 inline void eraseTempObject(const uint index); 00424 00425 //! erase offset coordinate at the passed in index 00426 inline void eraseOffsetCoords(const uint index); 00427 00428 //! erase temp offset coordinate at the passed in index 00429 inline void eraseTempOffsetCoords(const uint index); 00430 00431 //! erase VO frame number at the passed in index 00432 inline void eraseVisualObjectFNum(const uint index); 00433 00434 //! erase temp VO frame number at the passed in index 00435 inline void eraseTempVisualObjectFNum(const uint index); 00436 00437 //! compute a summarizing landmark salient features 00438 void computeSalientFeatures(); 00439 00440 //@} 00441 }; 00442 00443 // ###################################################################### 00444 // Implementation for Landmark inline functions 00445 // ###################################################################### 00446 inline const std::string& Landmark::getName() const 00447 { return itsName; } 00448 00449 inline void Landmark::setName(const std::string name) 00450 { itsName = name; } 00451 00452 inline void Landmark::setMatchWin(rutz::shared_ptr<XWinManaged> matchWin) 00453 { itsMatchWin = matchWin; } 00454 00455 inline rutz::shared_ptr<XWinManaged> Landmark::getMatchWin() 00456 { return itsMatchWin; } 00457 00458 inline const uint Landmark::numObjects() const 00459 { return itsVisualObjectDB->numObjects(); } 00460 00461 inline const uint Landmark::numTempObjects() const 00462 { return itsTempVisualObjectDB->numObjects(); } 00463 00464 inline const uint Landmark::getLatestVisualObjectFNum() const 00465 { return itsLatestVisualObjectFNum; } 00466 00467 inline const uint Landmark::getLatestTempVisualObjectFNum() const 00468 { return itsLatestTempVisualObjectFNum; } 00469 00470 inline const uint Landmark::getLatestFNum() const 00471 { 00472 if(itsLatestVisualObjectFNum > itsLatestTempVisualObjectFNum) 00473 return itsLatestVisualObjectFNum; 00474 else 00475 return itsLatestTempVisualObjectFNum; 00476 } 00477 00478 inline const rutz::shared_ptr<VisualObject>& 00479 Landmark::getLatestObject(bool &indb, bool &intdb, int &tindex) const 00480 { 00481 if(itsLatestVisualObjectFNum >= itsLatestTempVisualObjectFNum) 00482 { 00483 indb = true; 00484 intdb = false; 00485 for(int i = numObjects()-1; i >= 0; i--) 00486 { 00487 if(itsVisualObjectFNum[i] == itsLatestVisualObjectFNum) 00488 { 00489 tindex = i; 00490 return itsVisualObjectDB->getObject(i); 00491 } 00492 } 00493 } 00494 else 00495 { 00496 indb = false; 00497 intdb = true; 00498 for(int i = numTempObjects()-1; i >= 0; i--) 00499 { 00500 if(itsTempVisualObjectFNum[i] == itsLatestTempVisualObjectFNum) 00501 { 00502 tindex = i; 00503 return itsTempVisualObjectDB->getObject(i); 00504 } 00505 } 00506 } 00507 00508 LFATAL("latest object not found; something is wrong"); 00509 return itsVisualObjectDB->getObject(0); 00510 } 00511 00512 //! latest offset coordinates on either list (temp or DB) 00513 inline const Point2D<int> Landmark::getLatestOffsetCoords() const 00514 { 00515 if(itsLatestVisualObjectFNum >= itsLatestTempVisualObjectFNum) 00516 { 00517 for(int i = numObjects()-1; i >= 0; i--) 00518 if(itsVisualObjectFNum[i] == itsLatestVisualObjectFNum) 00519 return itsOffsetCoords[i]; 00520 } 00521 else 00522 { 00523 for(int i = numTempObjects()-1; i >= 0; i--) 00524 if(itsTempVisualObjectFNum[i] == itsLatestTempVisualObjectFNum) 00525 return itsTempOffsetCoords[i]; 00526 } 00527 00528 LFATAL("latest object not found; something is wrong"); 00529 return Point2D<int>(-1,-1); 00530 } 00531 00532 //! object getter 00533 inline const rutz::shared_ptr<VisualObject>& 00534 Landmark::getObject(const uint index) const 00535 { 00536 ASSERT(index < numObjects()); 00537 return itsVisualObjectDB->getObject(index); 00538 } 00539 00540 //! get the frame Number of object[index] 00541 inline const uint Landmark::getVisualObjectFNum(uint index) const 00542 { 00543 ASSERT(index < itsVisualObjectFNum.size()); 00544 return itsVisualObjectFNum[index]; 00545 } 00546 00547 //! get offset coordinates of object[index] 00548 inline const Point2D<int> Landmark::getOffsetCoords(uint index) const 00549 { 00550 ASSERT(index < itsOffsetCoords.size()); 00551 return itsOffsetCoords[index]; 00552 } 00553 00554 //! check whether object[index] is salient 00555 inline const bool Landmark::isSalVisualObject(uint index) const 00556 { 00557 ASSERT(index < numObjects()); 00558 return (itsVisualObjectDB->getObject(index)->getSalPoint().i != -1); 00559 } 00560 00561 //! temp object getter 00562 inline const rutz::shared_ptr<VisualObject>& 00563 Landmark::getTempObject(const uint index) const 00564 { 00565 ASSERT(index < numTempObjects()); 00566 return itsTempVisualObjectDB->getObject(index); 00567 } 00568 00569 //! get the frame Number of temp object[index] 00570 inline const uint Landmark::getTempVisualObjectFNum(uint index) const 00571 { 00572 ASSERT(index < itsTempVisualObjectFNum.size()); 00573 return itsTempVisualObjectFNum[index]; 00574 } 00575 00576 //! get offset coordinates of temp object[index] 00577 inline const Point2D<int> Landmark::getTempOffsetCoords(uint index) const 00578 { 00579 ASSERT(index < itsTempOffsetCoords.size()); 00580 return itsTempOffsetCoords[index]; 00581 } 00582 00583 //! return a pointer to the visual object DB 00584 inline rutz::shared_ptr<VisualObjectDB> 00585 Landmark::getVisualObjectDB() const 00586 { return itsVisualObjectDB; } 00587 00588 //! erase object at the passed in index 00589 inline void Landmark::eraseObject(const uint index) 00590 { 00591 ASSERT(index < numObjects()); 00592 itsVisualObjectDB->eraseObject(index); 00593 } 00594 00595 //! erase temp object at the passed in index 00596 inline void Landmark::eraseTempObject(const uint index) 00597 { 00598 ASSERT(index < numTempObjects()); 00599 itsTempVisualObjectDB->eraseObject(index); 00600 } 00601 00602 //! erase offset coordinate at the passed in index 00603 inline void Landmark::eraseOffsetCoords(const uint index) 00604 { 00605 ASSERT(index < itsOffsetCoords.size()); 00606 std::vector<Point2D<int> >::iterator begin 00607 = itsOffsetCoords.begin(); 00608 itsOffsetCoords.erase(begin + index); 00609 } 00610 00611 //! erase temp offset coordinate at the passed in index 00612 inline void Landmark::eraseTempOffsetCoords(const uint index) 00613 { 00614 ASSERT(index < itsTempOffsetCoords.size()); 00615 std::vector<Point2D<int> >::iterator begin 00616 = itsTempOffsetCoords.begin(); 00617 itsTempOffsetCoords.erase(begin + index); 00618 } 00619 00620 //! erase VO frame number at the passed in index 00621 inline void Landmark::eraseVisualObjectFNum(const uint index) 00622 { 00623 ASSERT(index < itsVisualObjectFNum.size()); 00624 std::vector<uint>::iterator begin 00625 = itsVisualObjectFNum.begin(); 00626 itsVisualObjectFNum.erase(begin + index); 00627 } 00628 00629 //! erase temp VO frame number at the passed in index 00630 inline void Landmark::eraseTempVisualObjectFNum(const uint index) 00631 { 00632 ASSERT(index < itsTempVisualObjectFNum.size()); 00633 std::vector<uint>::iterator begin 00634 = itsTempVisualObjectFNum.begin(); 00635 itsTempVisualObjectFNum.erase(begin + index); 00636 } 00637 00638 //! set the camera intrinsic parameters 00639 inline void Landmark::setCameraIntrinsicParam 00640 (rutz::shared_ptr<CameraIntrinsicParam> cip) 00641 { itsCip = cip; } 00642 00643 //! check whether it has the passed in session 00644 inline bool Landmark::haveSessionVO(std::string session) 00645 { 00646 for(uint i = 0; i < itsSession.size(); i++) 00647 if(!itsSession[i].compare(session)) return true; 00648 return false; 00649 } 00650 00651 //! get the session index range 00652 inline std::pair<uint,uint> Landmark::getSessionIndexRange(const uint index) 00653 { 00654 ASSERT(index < itsSessionIndexRange.size()); 00655 return itsSessionIndexRange[index]; 00656 } 00657 00658 //! get the number of sessions it has 00659 inline uint Landmark::getNumSession() 00660 { 00661 return itsSession.size(); 00662 } 00663 00664 //! get a session name of the passed in index 00665 inline std::string Landmark::getSession(const uint index) 00666 { 00667 ASSERT(index < itsSession.size()); 00668 return itsSession[index]; 00669 } 00670 00671 00672 #endif 00673 00674 // ###################################################################### 00675 /* So things look consistent in everyone's emacs... */ 00676 /* Local Variables: */ 00677 /* indent-tabs-mode: nil */ 00678 /* End: */