00001 /* Copyright (C) 2005 Pierre Moisan (Pierre.Moisan@USherbrooke.ca) 00002 00003 This library is free software; you can redistribute it and/or 00004 modify it under the terms of the GNU Lesser General Public 00005 License as published by the Free Software Foundation; either 00006 version 2.1 of the License, or (at your option) any later version. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Lesser General Public License for more details. 00012 00013 You should have received a copy of the GNU Lesser General Public 00014 License along with this library; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 */ 00017 00018 #ifndef _VISUALTRACKER_H_ 00019 #define _VISUALTRACKER_H_ 00020 00021 #include "BufferedNode.h" 00022 #include <iostream> 00023 #include "Image.h" 00024 #include "cv.h" 00025 #include "VisualTarget.h" 00026 #include <stdlib.h> 00027 #include <sys/timeb.h> 00028 00029 namespace RobotFlow { 00030 00031 class VisualTargetManager : public FD::BufferedNode 00032 { 00033 friend class FD::BufferedNode; 00034 public: 00035 VisualTargetManager(); 00036 00037 VisualTargetManager(std::string nodeName, FD::ParameterSet params); 00038 00039 virtual ~VisualTargetManager(); 00040 00041 // Default routine to print a VisualTargetManager object to an output stream 00042 void printOn(std::ostream &out) const 00043 { 00044 throw new FD::GeneralException("Exception in VisualTargetManager::printOn: method not yet implemented.",__FILE__,__LINE__); 00045 } 00046 00047 // Default routine to read a VisualTargetManager object from an input stream 00048 void readFrom(std::istream &in) 00049 { 00050 throw new FD::GeneralException("Exception in VisualTargetManager::printOn: method not yet implemented.",__FILE__,__LINE__); 00051 } 00052 00053 virtual void request(int output_id, const FD::ParameterSet &req); 00054 00055 void calculate(int output_id, int count, FD::Buffer &out); 00056 00057 private: 00058 // Input IDs (for BufferedNode) 00059 int m_imageInID; 00060 int m_roiInID; 00061 int m_featVecInID; 00062 int m_targetInID; 00063 int m_ppCompletedInID; 00064 00065 // Output IDs (for BufferedNode) 00066 int m_imageOutID; 00067 int m_roiOutID; 00068 int m_targetOutID; 00069 int m_targetProbOutID; 00070 int m_targetDXOutID; 00071 int m_targetDYOutID; 00072 int m_nameOutID; 00073 00074 int m_width; 00075 int m_height; 00076 int m_numChannels; 00077 int m_numPixels; 00078 int m_numBytesInFrame; 00079 float m_imgXCen; 00080 float m_imgYCen; 00081 unsigned char m_roiColor[3]; 00082 float m_lSigma; 00083 00084 struct timeb m_t1, m_t2; 00085 00086 int m_maxNumTargets; 00087 double m_targetMatchThres; 00088 double m_targetAdaptThres; 00089 double m_targetAdaptRate; 00090 double m_cueAdaptRate; 00091 bool m_ppCompleted; 00092 00093 FD::RCPtr<VisualTarget<double> > m_refTarget; 00094 //RCPtr<VisualROI> m_refROI; 00095 00096 // Temporary image copy 00097 IplImage *m_curImage; 00098 }; 00099 00100 } 00101 00102 #endif