InferotemporalCortexI.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef InferotemporalCortex_H_DEFINED
00039 #define InferotemporalCortex_H_DEFINED
00040
00041 #include "Component/ModelComponent.H"
00042 #include "Component/ModelParam.H"
00043 #include "Media/FrameSeries.H"
00044 #include "Transport/FrameInfo.H"
00045 #include "Raster/GenericFrame.H"
00046 #include "Image/Image.H"
00047 #include "GUI/XWinManaged.H"
00048 #include "GUI/ImageDisplayStream.H"
00049 #include "Image/Image.H"
00050 #include "Image/Pixels.H"
00051 #include "SIFT/ScaleSpace.H"
00052 #include "SIFT/VisualObject.H"
00053 #include "SIFT/Keypoint.H"
00054 #include "SIFT/VisualObjectDB.H"
00055
00056 #include "Ice/RobotBrainObjects.ice.H"
00057 #include "Ice/RobotSimEvents.ice.H"
00058 #include "Ice/IceImageUtils.H"
00059 #include "Ice/SimEventsUtils.H"
00060 #include <IceUtil/Thread.h>
00061
00062 #include <iostream>
00063 #include <fstream>
00064
00065 class InferotemporalCortexI : public ModelComponent, public RobotBrainObjects::InferotemporalCortex, public IceUtil::Thread
00066 {
00067 public:
00068
00069 struct CameraParam
00070 {
00071 Dims dims;
00072 float focalLength;
00073 float yaw;
00074 };
00075
00076 InferotemporalCortexI(OptionManager& mgr,
00077 const std::string& descrName = "InferotemporalCortex",
00078 const std::string& tagName = "InferotemporalCortex");
00079 ~InferotemporalCortexI();
00080
00081 virtual void run();
00082
00083
00084
00085 virtual void updateMessage(const RobotSimEvents::EventMessagePtr& eMsg,
00086 const Ice::Current&);
00087
00088
00089 void init(Ice::CommunicatorPtr ic, Ice::ObjectAdapterPtr adapter);
00090
00091
00092 bool initVDB();
00093
00094
00095 void evolve();
00096
00097
00098 RobotSimEvents::LandmarkInfo getLandmarkInfo(rutz::shared_ptr<Keypoint> keyPoint);
00099 int findKeypointID(rutz::shared_ptr<Keypoint> keyPoint, float &prob);
00100
00101 private:
00102 RobotSimEvents::EventsPrx itsEventsPub;
00103 std::vector<SimEventsUtils::TopicInfo> itsTopicsSubscriptions;
00104 Ice::ObjectPrx itsObjectPrx;
00105 RobotSimEvents::ObjectMessagePtr itsObjectMessage;
00106 RobotSimEvents::AttendedRegionMessagePtr itsAttendedRegionMessage;
00107 RobotSimEvents::AttendedRegionMessagePtr itsTrainingRegionMessage;
00108 IceUtil::Mutex itsARMutex;
00109 bool itsUseColor;
00110 std::string itsVDBFile;
00111 VisualObjectDB itsVDB;
00112 nub::soft_ref<OutputFrameSeries> itsOfs;
00113 std::string itsNextObjectName;
00114 bool itsTrainingMode;
00115
00116 std::vector<rutz::shared_ptr<Keypoint> > itsKeypointsDB;
00117 std::map<std::string, Dims> itsObjectSizeDB;
00118
00119
00120 CameraParam itsCurrentCameraParam;
00121 uint itsMatchThresh;
00122
00123 void learnObject(rutz::shared_ptr<VisualObject> vo, const int objId, const std::string name, const Dims objSize );
00124 void findObjects(const rutz::shared_ptr<VisualObject> vo);
00125
00126
00127 };
00128
00129 #endif