19 #ifndef __VISUO_THREAD__
20 #define __VISUO_THREAD__
24 #include <yarp/os/PeriodicThread.h>
25 #include <yarp/os/ResourceFinder.h>
26 #include <yarp/os/BufferedPort.h>
28 #include <yarp/sig/Vector.h>
29 #include <yarp/sig/Image.h>
31 #include <opencv2/core/core_c.h>
38 #include <iCub/utils.h>
40 #define PARAM_FIXATION yarp::os::createVocab32('f','i','x','a')
41 #define PARAM_MOTION yarp::os::createVocab32('m','o','t','i')
42 #define PARAM_TRACK yarp::os::createVocab32('t','r','a','c')
43 #define PARAM_RAW yarp::os::createVocab32('r','a','w')
45 #define MODE_TRACK_TEMPLATE 0
46 #define MODE_TRACK_MOTION 1
49 using namespace yarp::os;
50 using namespace yarp::sig;
75 BufferedPort<ImageOf<PixelRgb> > imgPort[2];
76 BufferedPort<Bottle> mCUTPort[2];
77 BufferedPort<Bottle> rawInPort[2];
78 BufferedPort<Vector> pftInPort;
87 BufferedPort<Bottle> recMILPort;
91 BufferedPort<Bottle> recMSRPort;
98 unsigned int minMotionBufSize;
99 unsigned int minTrackBufSize;
100 unsigned int maxTrackBufSize;
102 double motionStdThresh;
103 double speedStdThresh;
104 double stereoDistThresh;
106 double rawWaitThresh;
107 double motionWaitThresh;
108 double objectWaitThresh;
111 ImageOf<PixelRgb> *img[2];
112 ImageOf<PixelBgr> tpl;
115 deque<Vector> trackBuffer;
130 deque<Item> buffer[2];
132 map<string,CvPoint> locations;
135 bool getFixation(Bottle &bStereo);
136 bool getMotion(Bottle &bStereo);
137 bool getTrack(Bottle &bStereo);
138 bool getRaw(Bottle &bStereo);
139 bool getObject(
const string &object_name, Bottle &bStereo);
144 void updateLocationsMIL();
145 void updateMotionCUT();
146 void updatePFTracker();
150 virtual bool threadInit();
152 virtual void threadRelease();
157 lock_guard<mutex> lck(trackMutex);
161 bool checkTracker(Vector *vec);
163 void startTracker(
const Vector &stereo,
const int &side);
164 void restartTracker();
173 bool getTarget(Value &type, Bottle &target);
175 Bottle recogMSR(
string &obj_name);
185 bool startLearningMIL(
const string &obj_name);
186 bool suspendLearningMIL();
187 bool resumeLearningMIL();
#define MODE_TRACK_MOTION
bool startLearningMSR(const string &obj_name, const int &arm)
bool startRecogMSR(const int &arm)
bool suspendLearningMSR()
void checkDoneMSR(bool &done)