LoCorrFinder.C

00001 /**
00002    \file  Robots/LoBot/control/LoCorrFinder.C
00003    \brief This file defines the non-inline member functions of the
00004    lobot::CorrFinder class.
00005 */
00006 
00007 // //////////////////////////////////////////////////////////////////// //
00008 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00009 // by the University of Southern California (USC) and the iLab at USC.  //
00010 // See http://iLab.usc.edu for information about this project.          //
00011 // //////////////////////////////////////////////////////////////////// //
00012 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00013 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00014 // in Visual Environments, and Applications'' by Christof Koch and      //
00015 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00016 // pending; application number 09/912,225 filed July 23, 2001; see      //
00017 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00018 // //////////////////////////////////////////////////////////////////// //
00019 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00020 //                                                                      //
00021 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00022 // redistribute it and/or modify it under the terms of the GNU General  //
00023 // Public License as published by the Free Software Foundation; either  //
00024 // version 2 of the License, or (at your option) any later version.     //
00025 //                                                                      //
00026 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00027 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00028 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00029 // PURPOSE.  See the GNU General Public License for more details.       //
00030 //                                                                      //
00031 // You should have received a copy of the GNU General Public License    //
00032 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00033 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00034 // Boston, MA 02111-1307 USA.                                           //
00035 // //////////////////////////////////////////////////////////////////// //
00036 //
00037 // Primary maintainer for this file: mviswana usc edu
00038 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/metlog/LoCorrFinder.C $
00039 // $Id: LoCorrFinder.C 13935 2010-09-15 03:44:13Z mviswana $
00040 //
00041 
00042 //------------------------------ HEADERS --------------------------------
00043 
00044 // lobot headers
00045 #include "Robots/LoBot/metlog/LoCorrFinder.H"
00046 #include "Robots/LoBot/metlog/LoDataset.H"
00047 #include "Robots/LoBot/metlog/LoExperiment.H"
00048 #include "Robots/LoBot/metlog/LoPointMatrix.H"
00049 #include "Robots/LoBot/metlog/LoPointList.H"
00050 
00051 #include "Robots/LoBot/thread/LoMutex.H"
00052 #include "Robots/LoBot/util/LoString.H"
00053 
00054 // Standard C++ headers
00055 #include <string>
00056 
00057 //----------------------------- NAMESPACE -------------------------------
00058 
00059 namespace lobot {
00060 
00061 //-------------------------- INITIALIZATION -----------------------------
00062 
00063 CorrFinder*
00064 CorrFinder::
00065 create(const Experiment* R, const Dataset& D, PointListName L, PointMatrix* M)
00066 {
00067    return new CorrFinder(R, D, L, M) ;
00068 }
00069 
00070 CorrFinder::CorrFinder(const Experiment* R, const Dataset& D, PointListName L,
00071                        PointMatrix* M)
00072    : m_refexp(R), m_dataset(D), m_point_list(L), m_point_matrix(M)
00073 {
00074    static int n ;
00075    static Mutex m ;
00076 
00077    AutoMutex am(m) ;
00078    start(std::string("lomet_corr_finder_") + to_string(++n)) ;
00079 }
00080 
00081 //-------------------------- METLOG PARSING -----------------------------
00082 
00083 void CorrFinder::run()
00084 {
00085    try
00086    {
00087       const PointList& ref = m_refexp->point_list(m_point_list) ;
00088       for(;;)
00089       {
00090          const Experiment* E = m_dataset.next() ;
00091          if (E == m_refexp)
00092             continue ;
00093 
00094          const PointList& exp = E->point_list(m_point_list) ;
00095          if (exp.empty())
00096             continue ;
00097 
00098          m_point_matrix->add(ref.find_correspondences(exp)) ;
00099       }
00100    }
00101    catch (Dataset::eol&){}
00102 }
00103 
00104 //-----------------------------------------------------------------------
00105 
00106 } // end of namespace encapsulating this file's definitions
00107 
00108 /* So things look consistent in everyone's emacs... */
00109 /* Local Variables: */
00110 /* indent-tabs-mode: nil */
00111 /* End: */
Generated on Sun May 8 08:41:30 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3