116 std::string inputPortName;
117 std::string outputPortName;
118 std::string outputPortNameBlob;
120 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > imageIn;
121 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelBgr> > imageOut;
122 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelMono> > imageOutBlob;
124 CvPoint minloc, maxloc;
125 double minval, maxval;
128 bool getImage, getTemplate, gotTemplate, sendTarget;
129 yarp::sig::ImageOf<yarp::sig::PixelRgb> *iCubImage;
131 IplImage *temp, *res_left, *res_right, *res;
132 yarp::sig::ImageOf<yarp::sig::PixelRgb> *tpl;
134 IplImage* frame, *frame_blob;
135 int width, height, tpl_width, tpl_height, res_width, res_height;
144 int i, j, k, w, h, x, y;
146 yarp::sig::Vector targetTemp;
148 std::string moduleName;
149 std::mutex targetMutex, averageMutex, templateMutex;
151 std::deque< TemplateStruct > tempList;
155 yarp::os::Stamp targetStamp;
157 typedef struct params
170 histogram** ref_histos;
171 particle* particles, * new_particles;
173 void free_histos( histogram** histo,
int n );
174 void free_regions( CvRect** regions,
int n);
176 histogram** compute_ref_histos( IplImage* img, CvRect* rect,
int n );
177 histogram* calc_histogram( IplImage** imgs,
int n );
178 particle transition(
const particle &
p,
int w,
int h, gsl_rng* rng );
179 particle* init_distribution( CvRect* regions, histogram** histos,
int n,
int p);
180 IplImage* bgr2hsv( IplImage* bgr );
181 float likelihood( IplImage* img,
int r,
int c,
int w,
int h, histogram* ref_histo );
182 void normalize_weights( particle* particles,
int n );
183 float histo_dist_sq( histogram* h1, histogram* h2 );
184 int histo_bin(
float h,
float s,
float v );
185 float pixval32f(IplImage* img,
int r,
int c);
186 void setpix32f(IplImage* img,
int r,
int c,
float val);
187 int get_regions( IplImage* frame, CvRect** regions );
188 int get_regionsImage( IplImage* frame, CvRect** regions );
189 particle* resample( particle* particles,
int n );
190 void display_particle( IplImage* img,
const particle &
p, CvScalar color, yarp::sig::Vector& target );
191 void display_particleBlob( IplImage* img,
const particle &
p, yarp::sig::Vector& target );
192 void trace_template( IplImage* img,
const particle &
p );
193 void normalize_histogram( histogram* histo );
195 void runAll(IplImage *img);
206 void setName(std::string module);
207 void setTemplate(yarp::sig::ImageOf<yarp::sig::PixelRgb> *tpl);
208 void pushTarget(yarp::sig::Vector &target, yarp::os::Stamp &stamp);
void setName(std::string module)
bool respond(const yarp::os::Bottle &command, yarp::os::Bottle &reply)
bool configure(yarp::os::ResourceFinder &rf)
TemplateStruct getBestTemplate()
void setName(std::string module)
void setTemplate(yarp::sig::ImageOf< yarp::sig::PixelRgb > *tpl)
void pushTarget(yarp::sig::Vector &target, yarp::os::Stamp &stamp)
int particle_cmp(const void *p1, const void *p2)