00001 /*!@file BeoSub/ColorTracker.H A class for simple color tracking */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2003 // 00005 // by the 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: Zack Gossman <gossman@usc.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/BeoSub/ColorTracker.H $ 00035 // $Id: ColorTracker.H 6990 2006-08-11 18:13:51Z rjpeters $ 00036 // 00037 00038 #ifndef COLORTRACKER_H_DEFINED 00039 #define COLORTRACKER_H_DEFINED 00040 #include "GUI/XWindow.H" 00041 #include "Image/Image.H" 00042 #include "Image/ColorOps.H" 00043 #include "Raster/Raster.H" 00044 #include "VFAT/segmentImageTrackMC.H" 00045 #include "Component/ModelManager.H" 00046 #include "Util/Types.H" 00047 #include "Util/log.H" 00048 #include "rutz/shared_ptr.h" 00049 00050 #include <cstdio> 00051 #include <cstdlib> 00052 #include <math.h> 00053 #include <stdio.h> 00054 #include <stdlib.h> 00055 00056 00057 //! Definition and access functions for ColorTracker class 00058 /*! ColorTracker is the color tracking module for the BeoSub. It simply checks for the existence of a color within an image and returns the position of the largest "blob" of that color if found*/ 00059 class ColorTracker : public ModelComponent 00060 { 00061 public: 00062 // ###################################################################### 00063 /*! @name Constructors and Destructors */ 00064 //@{ 00065 00066 //! Constructor 00067 ColorTracker(OptionManager& mgr, 00068 const std::string& descrName = "ColorTracker", 00069 const std::string& tagName = "ColorTracker"); 00070 00071 //! Destructor 00072 ~ColorTracker(); 00073 00074 //@} 00075 00076 // ###################################################################### 00077 /*! @name member functions */ 00078 //@{ 00079 void setupTracker(const char* colorArg, Image< PixRGB<byte> > image, bool debug); 00080 bool runTracker(float threshold, float &xpos, float &ypos, float &mass); 00081 //@} 00082 00083 private: 00084 00085 bool debugmode; //determines screen output 00086 00087 rutz::shared_ptr<XWindow> xwin1, xwin2; 00088 00089 Image< PixRGB<byte> > colorImg; 00090 Image< PixRGB<byte> > outputImg; 00091 00092 std::vector<float> color; 00093 00094 segmentImageTrackMC<float,unsigned int, 4> *segmenter; 00095 00096 bool hasSetup; 00097 bool hasRun; 00098 }; 00099 00100 #endif