www.pudn.com > colortracker.rar > mpiprobsearchaux.h


#ifndef __MPIPROBSEARCHAUX__H__ 
#define __MPIPROBSEARCHAUX__H__ 
 
#include "integralimage.h" 
#include "box.h" 
#include  
 
using namespace std; 
 
/* ================================================================ */ 
 
struct XYPair { 
	int x, y; 
	XYPair(int _x = 0, int _y = 0) : x(_x), y(_y) {}; 
}; 
 
/* ================================================================ */ 
 
struct HypothesesPerScale { 
	double m_scale; 
	double m_shift; 
	int m_numX; 
	int m_numY; 
	TIntegral m_intimage; 
	TIntegral m_intones; 
 
	HypothesesPerScale(const int numX, const int numY) : m_intimage(numX, numY), m_intones(numX, numY) {}; 
	void setParams (const double scale, const double shift, const int numX, const int numY); 
	void makezero(); 
}; 
 
/* ================================================================ */ 
 
typedef std::vector VHPS; 
 
class ScalePyramid { 
private: 
	VHPS m_scale_pyramid; 
	std::vector m_scales; 
	int m_numscales; 
	int m_numhyp; 
	int m_imageWidth; 
	int m_imageHeight; 
 
public: 
	ScalePyramid() {}; 
	ScalePyramid(const int imageWidth, const int imageHeight); 
	void set_imagedims(const int imageWidth, const int imageHeight); 
	void compute_scales(const double scaleUp, const int minSize, const int minScaleUp); 
	void set_numhyp(const double stride, const int minStride); 
	void initPyramid(const double stride, const int minStride); 
	double get_shiftamount(const int minStride, const double stride, const double d); 
	int get_numScales(); 
	void add_hypothesesPerScale(const double scale, const double shift, const int numX, const int numY, const int numhyp); 
	HypothesesPerScale &get_hypothesesPerScale(const int index); 
	int get_numhyp(); 
	void makezero(); 
	void copy(ScalePyramid ©to); 
	~ScalePyramid(); 
}; 
 
/* ================================================================ */ 
 
struct UniformWindow { 
	double m_curhypscale; 
	double m_shiftpct; 
	double m_minstride; 
 
	/* for scale deviations proportional to current scale */ 
	double m_scaledev; 
	double m_scaleboundup; 
	double m_scalebounddown; 
 
	/* for scale deviations in number of scales */ 
	int m_intscaledev; 
	int m_numscales; 
	int m_intscaleboundup; 
	int m_intscalebounddown; 
 
	/* constructors  - first one for scale deviations proportional to current state 
		and second one for deviations defined as number of scales	*/ 
	UniformWindow(const double s) : m_scaledev(s) {}; 
	UniformWindow(const int s, const int ns) : m_intscaledev(s), m_numscales(ns) {}; 
 
	void set_scalebounds(const double s); 
	void set_scalebounds(const int s); 
	bool is_validscale(const double scale); 
	bool is_validscale(const int scale); 
	void get_location_window(const double s, TBox &lw, const double hr, const int hx, const int hy, const double shiftPct, const int minStride, const int numx, const int numy ); 
}; 
 
/* ================================================================ */ 
 
#endif  __MPIPROBSEARCHAUX__H__