The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ScalePyramid Class Reference

#include <mpiprobsearchaux.h>

List of all members.

Public Member Functions

void add_hypothesesPerScale (const double scale, const double shift, const int numX, const int numY, const int numhyp)
void compute_scales (const double scaleUp, const int minSize, const int minScaleUp)
void copy (ScalePyramid &copyto)
HypothesesPerScaleget_hypothesesPerScale (const int index)
int get_numhyp ()
int get_numScales ()
double get_shiftamount (const int minStride, const double stride, const double d)
void initPyramid (const double stride, const int minStride)
void makezero ()
 ScalePyramid (const int imageWidth, const int imageHeight)
 ScalePyramid ()
void set_imagedims (const int imageWidth, const int imageHeight)
void set_numhyp (const double stride, const int minStride)
 ~ScalePyramid ()

Private Attributes

int m_imageHeight
int m_imageWidth
int m_numhyp
int m_numscales
VHPS m_scale_pyramid
std::vector< double > m_scales


Constructor & Destructor Documentation

ScalePyramid  )  [inline]
 

Definition at line 46 of file mpiprobsearchaux.h.

00046 {};

ScalePyramid const int  imageWidth,
const int  imageHeight
 

Definition at line 39 of file mpiprobsearchaux.cpp.

References set_imagedims().

00039                                                                       {
00040         set_imagedims(imageWidth, imageHeight);
00041 }

Here is the call graph for this function:

~ScalePyramid  ) 
 

Definition at line 149 of file mpiprobsearchaux.cpp.

References m_scale_pyramid.

00149                             {
00150         for (VHPS::iterator it = m_scale_pyramid.begin(); it != m_scale_pyramid.end(); it++) 
00151                 delete *it;
00152 }


Member Function Documentation

void add_hypothesesPerScale const double  scale,
const double  shift,
const int  numX,
const int  numY,
const int  numhyp
 

Definition at line 114 of file mpiprobsearchaux.cpp.

References TIntegral::getImHeight(), TIntegral::getImWidth(), img, HypothesesPerScale::m_intimage, HypothesesPerScale::m_numX, HypothesesPerScale::m_numY, m_scale_pyramid, TIntegral::setImPixel(), HypothesesPerScale::setParams(), and y.

Referenced by initPyramid().

00114                                                                                                                                   {
00115         HypothesesPerScale* hps = new   HypothesesPerScale(numX, numY);
00116         hps->setParams(scale, shift, numX, numY);
00117         int numpix = hps->m_numX * hps->m_numY;
00118         TIntegral<double> &img = hps->m_intimage;
00119         const double normval = 1.0/static_cast<double>(numhyp);
00120         for (int y=0; y < img.getImHeight(); y++) {
00121                 for (int x=0; x < img.getImWidth(); x++)
00122                         img.setImPixel(x,y,normval);
00123         }
00124 //      img.integrate();
00125         m_scale_pyramid.push_back(hps);
00126 }

Here is the call graph for this function:

void compute_scales const double  scaleUp,
const int  minSize,
const int  minScaleUp
 

Definition at line 52 of file mpiprobsearchaux.cpp.

References d, m_numscales, m_scales, and max.

Referenced by MPColorFeatSearch::initPyramids().

00052                                                                                                {
00053         int scale_factor = minSize + 1;
00054         m_numscales = 0;
00055         while(scale_factor <= m_imageHeight)
00056         {
00057           double d = scale_factor; /* size of box */
00058                 m_scales.push_back(d);
00059                 m_numscales++;
00060                 double testd = d+minScaleUp;
00061                 scale_factor = max (testd, int(static_cast<double>(scale_factor * (1+scaleUp)))
00062                 );
00063         }
00064 }

void copy ScalePyramid copyto  ) 
 

Definition at line 154 of file mpiprobsearchaux.cpp.

References m_imageHeight, m_imageWidth, m_numhyp, m_numscales, m_scale_pyramid, and m_scales.

Referenced by MPColorFeatSearch::searchFeature().

00154                                             {
00155         copyto.m_numscales = m_numscales;
00156         copyto.m_numhyp = m_numhyp;
00157         copyto.m_imageWidth = m_imageWidth;
00158         copyto.m_imageHeight = m_imageHeight;
00159         copyto.m_scale_pyramid.reserve(m_scale_pyramid.size());
00160         copyto.m_scales.reserve(m_scales.size());
00161         std::copy(m_scale_pyramid.begin(), m_scale_pyramid.end(), copyto.m_scale_pyramid.begin());
00162         std::copy(m_scales.begin(), m_scales.end(), copyto.m_scales.begin());
00163 }

HypothesesPerScale & get_hypothesesPerScale const int  index  ) 
 

Definition at line 130 of file mpiprobsearchaux.cpp.

References m_scale_pyramid.

Referenced by MPColorFeatSearch::searchFeature().

00130                                                                         {
00131         return(*m_scale_pyramid[index]);
00132 }

int get_numhyp  ) 
 

Definition at line 136 of file mpiprobsearchaux.cpp.

Referenced by MPColorFeatSearch::searchFeature().

00136                              {
00137         return(m_numhyp);
00138 }

int get_numScales  ) 
 

Definition at line 108 of file mpiprobsearchaux.cpp.

References m_scale_pyramid.

Referenced by MPColorFeatSearch::searchFeature().

00108                                 {
00109         return (m_scale_pyramid.size());
00110 }

double get_shiftamount const int  minStride,
const double  stride,
const double  d
 

Definition at line 102 of file mpiprobsearchaux.cpp.

References d, and max.

Referenced by initPyramid(), and set_numhyp().

00102                                                                                              {
00103         return(max(minStride,d*stride));
00104 }

void initPyramid const double  stride,
const int  minStride
 

Definition at line 84 of file mpiprobsearchaux.cpp.

References add_hypothesesPerScale(), get_shiftamount(), i, m_imageHeight, m_imageWidth, m_numhyp, m_scales, s, and set_numhyp().

Referenced by MPColorFeatSearch::initPyramids().

00084                                                                        {
00085         int i;
00086         set_numhyp(stride, minStride);
00087 
00088         /* add hypotheses object for each scale, normalizing by the total number of hypotheses */
00089         for (i=0; i < m_numscales; i++) {
00090                 double s = get_shiftamount(minStride, stride, m_scales[i]);
00091 
00092                 /* formula for size of image given number of hypotheses is:
00093                                         width = (n - 1) * shift + scale */
00094                 const int numX = 1+(m_imageWidth-m_scales[i])/s;
00095                 const int numY = 1+(m_imageHeight-m_scales[i])/s;
00096                 add_hypothesesPerScale(m_scales[i], s, numX, numY, m_numhyp);
00097         }
00098 }

Here is the call graph for this function:

void makezero  ) 
 

Definition at line 142 of file mpiprobsearchaux.cpp.

References m_scale_pyramid, and HypothesesPerScale::makezero().

Referenced by MPColorFeatSearch::searchFeature(), and MPColorFeatSearch::zeroPyramids().

00142                             {
00143         for (VHPS::iterator it = m_scale_pyramid.begin(); it != m_scale_pyramid.end(); it++)
00144                 (*it)->makezero();
00145 }

Here is the call graph for this function:

void set_imagedims const int  imageWidth,
const int  imageHeight
 

Definition at line 45 of file mpiprobsearchaux.cpp.

References m_imageHeight, and m_imageWidth.

Referenced by MPColorFeatSearch::initPyramids(), and ScalePyramid().

00045                                                                             {
00046         m_imageWidth = imageWidth;
00047         m_imageHeight = imageHeight;
00048 }

void set_numhyp const double  stride,
const int  minStride
 

Definition at line 68 of file mpiprobsearchaux.cpp.

References get_shiftamount(), i, m_imageHeight, m_imageWidth, m_numhyp, m_scales, and s.

Referenced by initPyramid().

00068                                                                       {
00069         /* annoying loop to determine total number of hypotheses */
00070         m_numhyp = 0;
00071         for (int i=0; i < m_numscales; i++) {
00072                 double s = get_shiftamount(minStride, stride, m_scales[i]);
00073 
00074                 /* formula for size of image given number of hypotheses is: 
00075                                         width = (n - 1) * shift + scale */
00076                 const int numX = 1+(m_imageWidth-m_scales[i])/s;
00077                 const int numY = 1+(m_imageHeight-m_scales[i])/s;
00078                 m_numhyp += numX*numY;
00079         }
00080 }

Here is the call graph for this function:


Member Data Documentation

int m_imageHeight [private]
 

Definition at line 43 of file mpiprobsearchaux.h.

Referenced by copy(), initPyramid(), set_imagedims(), and set_numhyp().

int m_imageWidth [private]
 

Definition at line 42 of file mpiprobsearchaux.h.

Referenced by copy(), initPyramid(), set_imagedims(), and set_numhyp().

int m_numhyp [private]
 

Definition at line 41 of file mpiprobsearchaux.h.

Referenced by copy(), initPyramid(), and set_numhyp().

int m_numscales [private]
 

Definition at line 40 of file mpiprobsearchaux.h.

Referenced by compute_scales(), and copy().

VHPS m_scale_pyramid [private]
 

Definition at line 38 of file mpiprobsearchaux.h.

Referenced by add_hypothesesPerScale(), copy(), get_hypothesesPerScale(), get_numScales(), makezero(), and ~ScalePyramid().

std::vector<double> m_scales [private]
 

Definition at line 39 of file mpiprobsearchaux.h.

Referenced by compute_scales(), copy(), initPyramid(), and set_numhyp().


The documentation for this class was generated from the following files:
Generated on Mon Nov 8 17:08:42 2004 for MPT by  doxygen 1.3.9.1