00001 // ---------------------------------------------------------------------------- 00002 // 00003 // $Id$ 00004 // 00005 // Copyright 2008, 2009, 2010, 2011, 2012 Antonio Franchi and Paolo Stegagno 00006 // 00007 // This file is part of MIP. 00008 // 00009 // MIP is free software: you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation, either version 3 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // MIP is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>. 00021 // 00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it 00023 // 00024 // ---------------------------------------------------------------------------- 00025 00026 #ifndef __VISUAL_TRACKING_ 00027 #define __VISUAL_TRACKING_ 00028 00029 //#include <opencv/cv.h> 00030 #include <opencv2/imgproc/imgproc.hpp> 00031 00032 00033 00034 #ifndef MIP_WIN 00035 #include <SE3.h> 00036 #include <baselib.h> 00037 #include <socketUDP.h> 00038 #else 00039 #include <mipDefinitions.h> 00040 #endif 00041 00042 using namespace MipBaselib; 00043 00044 namespace MipAlgorithms{ 00048 00052 00054 /* @{ */ 00055 00058 enum AlgoType{ 00059 CAMSHIFT, 00060 REMOTEUDP, 00061 NUM_ALGO_TYPE 00062 }; 00063 00066 static const char* AlgoTypeName[NUM_ALGO_TYPE] ={ 00067 "CAMSHIFT", 00068 "REMOTE UDP" 00069 }; 00070 00073 enum VisRefType{ 00074 BASE, 00075 VIS_REF_TYPE 00076 }; 00077 00080 static const char* VisRefTypeName[VIS_REF_TYPE] ={ 00081 "BASE" 00082 }; 00083 00085 typedef Decimal ImageMoment; 00086 00087 00088 00089 00093 class ImageFeature { 00094 public: 00095 MipBaselib::Time t; 00096 MipBaselib::Time diff_t; 00097 Decimal u; 00098 Decimal v; 00099 Decimal dotU; 00100 Decimal dotV; 00101 Decimal integU; 00102 Decimal integV; 00103 00104 ImageFeature(); 00105 void print(); 00106 }; 00107 00108 00112 class VisualReference { 00113 public: 00115 ImageFeature* _feat; 00116 00118 VisRefType vrType; 00119 00122 VisualReference(){} 00123 00127 VisualReference(IplImage* i, VisRefType t); 00128 }; 00129 00130 00134 class VisualTrackPar { 00135 public: 00136 int type; 00137 int udpPort; 00138 00139 VisualTrackPar(){} 00140 }; 00141 00145 class VisualTrackVar { 00146 public: 00147 }; 00148 00152 class VisualTracking { 00153 protected: 00154 VisualTrackPar* _par; 00155 VisualTrackVar* _var; 00156 public: 00158 VisualTracking(); 00159 00163 VisualTracking(int algoType, int udpPort = 0); 00164 00167 virtual void getEstPose(Pose3D *pose) = 0; 00168 00171 virtual void setEstPose(Pose3D *pose) = 0; 00172 00175 virtual bool displayTrack(int addInfo) = 0; 00176 00181 virtual bool getFeatureErr(IplImage* frame, MipBaselib::Time& newTime, ImageFeature& f) = 0; 00182 00186 virtual void setDisplay(int level) = 0; 00187 00189 VisualTrackVar* getVar() { 00190 return _var; 00191 } 00192 }; 00193 00194 /* @} */ 00195 };// end namespace MipAlgorithms 00196 00197 #endif 00198 00199 00200 00201