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

MPISearchObjectDetector Class Template Reference

#include <mpisearch.h>

Inheritance diagram for MPISearchObjectDetector:

Inheritance graph
[legend]
Collaboration diagram for MPISearchObjectDetector:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void AdjSearchWindow (TSquare< float > &Front)
void AdjSearchWindow (Square &Front)
void AdjSearchWindow (TSquare< float > &Front)
void AdjSearchWindow (Square &Front)
void AdjSearchWindow (TSquare< float > &Front)
void AdjSearchWindow (Square &Front)
void AdjSearchWindow (TSquare< float > &Front)
void AdjSearchWindow (Square &Front)
bool allocated ()
bool allocated ()
bool allocated ()
bool allocated ()
bool DataLoaded ()
bool DataLoaded ()
bool DataLoaded ()
bool DataLoaded ()
int FailedCycles ()
int FailedCycles ()
int FailedCycles ()
int FailedCycles ()
void initStream (const int width, const int height, double WINSHIFT=1.25)
void initStream (const int width, const int height, double WINSHIFT=1.25)
void initStream (const int width, const int height, double WINSHIFT=1.25)
void initStream (const int width, const int height, double WINSHIFT=1.25)
 MPISearchObjectDetector ()
 MPISearchObjectDetector ()
 MPISearchObjectDetector ()
 MPISearchObjectDetector ()
void releaseStream ()
void releaseStream ()
void releaseStream ()
void releaseStream ()
void resetStream (const int width, const int height, double WINSHIFT=1.25)
void resetStream (const int width, const int height, double WINSHIFT=1.25)
void resetStream (const int width, const int height, double WINSHIFT=1.25)
void resetStream (const int width, const int height, double WINSHIFT=1.25)
int search (const RImage< T > &pixels, FaceBoxList &faces, int USE_BLOCK_FLAGS=1, float WINSHIFT=1.25, double *index_flags=NULL, double *output_values=NULL, int box=1)
int search (const RImage< T > &pixels, FaceBoxList &faces, int USE_BLOCK_FLAGS=1, float WINSHIFT=1.25, double *index_flags=NULL, double *output_values=NULL, int box=1)
int search (const RImage< T > &pixels, FaceBoxList &faces, int USE_BLOCK_FLAGS=1, float WINSHIFT=1.25, double *index_flags=NULL, double *output_values=NULL, int box=1)
int search (const RImage< T > &pixels, FaceBoxList &faces, int USE_BLOCK_FLAGS=1, float WINSHIFT=1.25, double *index_flags=NULL, double *output_values=NULL, int box=1)
void setDebug (const bool val)
void setDebug (const bool val)
void setDebug (const bool val)
void setDebug (const bool val)
void setDebug2 (const bool val)
void setDebug2 (const bool val)
void setDebug2 (const bool val)
void setDebug2 (const bool val)
void setPixelMax (T maxpixval)
virtual ~MPISearchObjectDetector ()
virtual ~MPISearchObjectDetector ()
virtual ~MPISearchObjectDetector ()
virtual ~MPISearchObjectDetector ()

Protected Member Functions

double classifyWindow (typename MPIScaledImage< T >::const_iterator &window, FeatureData &thedata, CornerCache< T > **&corners, T *&fns, Corner norm_window[4], CornerCache< T > nw_c[4], T nw_fn, float scale_factor, T sf2, double *&activation)
double classifyWindow (typename MPIScaledImage< T >::const_iterator &window, FeatureData &thedata, CornerCache< T > **&corners, T *&fns, Corner norm_window[4], CornerCache< T > nw_c[4], T nw_fn, float scale_factor, T sf2, double *&activation)
double classifyWindow (typename MPIScaledImage< T >::const_iterator &window, FeatureData &thedata, CornerCache< T > **&corners, T *&fns, Corner norm_window[4], CornerCache< T > nw_c[4], T nw_fn, float scale_factor, T sf2, double *&activation)
double classifyWindow (typename MPIScaledImage< T >::const_iterator &window, FeatureData &thedata, CornerCache< T > **&corners, T *&fns, Corner norm_window[4], CornerCache< T > nw_c[4], T nw_fn, float scale_factor, T sf2, double *&activation)
void integrateImages (const RImage< T > &p, MPISearchStream< T > &stream)
void integrateImages (const RImage< T > &p, MPISearchStream< T > &stream)
void integrateImages (const RImage< T > &p, MPISearchStream< T > &stream)
void integrateImages (const RImage< T > &p, MPISearchStream< T > &stream)
void printData (FeatureData &thedata, int ind)
void printData (FeatureData &thedata, int ind)
void printData (FeatureData &thedata, int ind)
void printData (FeatureData &thedata, int ind)
virtual void processFace (typename MPIScaledImage< T >::const_iterator &window, const T &one_over__sf2_times_std, const T &mean_over_std, const int &numFaces)
virtual void processFace (typename MPIScaledImage< T >::const_iterator &window, const T &one_over__sf2_times_std, const T &mean_over_std, const int &numFaces)
virtual void processFace (typename MPIScaledImage< T >::const_iterator &window, const T &one_over__sf2_times_std, const T &mean_over_std, const int &numFaces)
virtual void processFace (typename MPIScaledImage< T >::const_iterator &window, const T &one_over__sf2_times_std, const T &mean_over_std, const int &numFaces)

Protected Attributes

FeatureData data
bool debug
bool debug2
minvariance
MPISearchStream< T > stream

template<class T>
class MPISearchObjectDetector< T >


Constructor & Destructor Documentation

MPISearchObjectDetector  ) 
 

Definition at line 161 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References debug().

00161 :debug(false),debug2(false) {}

Here is the call graph for this function:

~MPISearchObjectDetector  )  [virtual]
 

Definition at line 165 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

00165 {  }

MPISearchObjectDetector  ) 
 

virtual ~MPISearchObjectDetector  )  [virtual]
 

MPISearchObjectDetector  ) 
 

virtual ~MPISearchObjectDetector  )  [virtual]
 

MPISearchObjectDetector  ) 
 

virtual ~MPISearchObjectDetector  )  [virtual]
 


Member Function Documentation

void AdjSearchWindow TSquare< float > &  Front  ) 
 

void AdjSearchWindow Square Front  ) 
 

void AdjSearchWindow TSquare< float > &  Front  ) 
 

void AdjSearchWindow Square Front  ) 
 

void AdjSearchWindow TSquare< float > &  Front  ) 
 

void AdjSearchWindow Square Front  ) 
 

void AdjSearchWindow TSquare< float > &  Front  ) 
 

Definition at line 538 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References AdjSearchWindow(), F, TSquare::scale, TSquare::size, Square, TSquare::x, and TSquare::y.

00539 {
00540   Square S(static_cast<int>(F.size), static_cast<int>(F.x), static_cast<int>(F.y), static_cast<int>(F.scale));
00541   AdjSearchWindow(S);
00542 }

Here is the call graph for this function:

void AdjSearchWindow Square Front  ) 
 

Definition at line 544 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References TSquare::scale, TSquare::size, Square, stream, TSquare::x, and TSquare::y.

Referenced by AdjSearchWindow(), and main().

00545 {
00546   //std::cout << "MPISearchObjectDetector<T>::AdjSearchWindow" << stream.mpi->getROI() << endl;
00547         int midSize;
00548         int minX, maxX, minY, maxY, minscale, maxscale;
00549          static Square oldFront;
00550          
00551          //std::cout << Front << endl;
00552 
00553      // IMPORTANT NOTE:
00554      // stream.SetROI keeps itself consistent: i.e., it keeps the ROI within the bounds of the image pyramid.
00555      // Therefore, it is not necessary to do bounds checking yourself.
00556 
00557      if (!Front.size) //set up roi for next image, makes it smaller to speed up processing
00558          Front = oldFront;
00559      else
00560          oldFront = Front;
00561      
00562 
00563      if (stream.FailedCycles > 5)
00564      {
00565        ROI theroi;
00566        stream.SetROI(theroi);
00567      }
00568      else
00569      {
00570                 //each failed cycle roi increases by size of facebox in X and Y direction
00571                 //until it reaches size of image
00572                 midSize = static_cast<int>(ceil((float)Front.size/2.0f));
00573                 minX = Front.x - (midSize * (stream.FailedCycles+1));
00574                 maxX = Front.x + Front.size + (midSize * (stream.FailedCycles+1));
00575                 minY = Front.y - (midSize * (stream.FailedCycles+1));
00576                 maxY = Front.y + Front.size + (midSize * (stream.FailedCycles+1));
00577                 minscale = Front.scale-stream.FailedCycles;
00578                 maxscale = Front.scale+stream.FailedCycles+1;
00579                 stream.SetROI(minX,maxX,minY,maxY,minscale,maxscale);
00580      }
00581 }

bool allocated  ) 
 

bool allocated  ) 
 

bool allocated  ) 
 

bool allocated  ) 
 

Definition at line 533 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References stream.

00533 { return stream.allocated;}

double classifyWindow typename MPIScaledImage< T >::const_iterator &  window,
FeatureData thedata,
CornerCache< T > **&  corners,
T *&  fns,
Corner  norm_window[4],
CornerCache< T >  nw_c[4],
nw_fn,
float  scale_factor,
sf2,
double *&  activation
[protected]
 

double classifyWindow typename MPIScaledImage< T >::const_iterator &  window,
FeatureData thedata,
CornerCache< T > **&  corners,
T *&  fns,
Corner  norm_window[4],
CornerCache< T >  nw_c[4],
nw_fn,
float  scale_factor,
sf2,
double *&  activation
[protected]
 

double classifyWindow typename MPIScaledImage< T >::const_iterator &  window,
FeatureData thedata,
CornerCache< T > **&  corners,
T *&  fns,
Corner  norm_window[4],
CornerCache< T >  nw_c[4],
nw_fn,
float  scale_factor,
sf2,
double *&  activation
[protected]
 

double classifyWindow typename MPIScaledImage< T >::const_iterator &  window,
FeatureData thedata,
CornerCache< T > **&  corners,
T *&  fns,
Corner  norm_window[4],
CornerCache< T >  nw_c[4],
nw_fn,
float  scale_factor,
sf2,
double *&  activation
[protected]
 

Definition at line 303 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References Feature::abs, Feature::alpha, Feature::bias, c, cascade, FeatureData::cascades, corner, d, Cascade::end, f(), feature, FeatureData::features, FeatureData::nl, Feature::nl_over_range, FeatureData::numcascades, Feature::numcorners, FeatureData::plus_minus_one, FeatureData::preserve_aH, FeatureData::real_fun, Cascade::start, FeatureData::stdAdjusts, Cascade::thresh, Feature::tuning_curve, CornerCache::value, Corner::value, and Feature::weight.

Referenced by search().

00305                                                                                                           {
00306 
00307   T mean = 0.0, mean2 = 0.0, standard_deviation, one_over__sf2_times_std, mean_over_std, f, std2;
00308   
00309   //cout << "Classifying window" << endl;
00310   // calculate the statistics for this sub window
00311   for(int corner = 0; corner < 4; corner++) {
00312     mean  += window.getPixel0( nw_c[corner].scaledIndex) * norm_window[corner].value;
00313     mean2 += window.getPixel1( nw_c[corner].scaledIndex) * norm_window[corner].value;
00314   }
00315   mean /= nw_fn;
00316   mean2 /= nw_fn;
00317   std2 = mean2 - mean*mean;
00318 
00319   // if the std deviation is below some point then ignore
00320   //if(standard_deviation < 0.027)
00321   if(std2 < 0.000729f)
00322     return -99999; // special flag for std bailout
00323   standard_deviation = sqrt(std2)*thedata.stdAdjusts[static_cast<int>(scale_factor+0.5f)-1];
00324   // cout << "mean2 - mean*mean: " << (mean2 - mean*mean);
00325   //cout << ", mean: " << mean << ", mean2: " << mean2 << ", std: " << standard_deviation << endl;
00326 
00327   // cache a few values used in normalization
00328   // one_over__sf2_times_std = 1/(sf2*standard_deviation);
00329   one_over__sf2_times_std = 1.0/(sf2*standard_deviation);
00330   mean_over_std = mean/standard_deviation;
00331   T aH = 0.0f, a,b,c,d;
00332   
00334   // run through each stage in the cascade
00335   for (int cascade_iter = 0; cascade_iter < thedata.numcascades; cascade_iter++){
00336     Cascade &cascade = thedata.cascades[cascade_iter];
00337     if(!thedata.preserve_aH)
00338       aH = 0.0;
00339 
00340     if(!thedata.real_fun){
00341       // run through the features of each cascade stage
00342       for (int feature_iter = cascade.start; feature_iter <= cascade.end; feature_iter++){
00343         Feature &feature = thedata.features[feature_iter];
00344         f = 0.0f;
00345         // for each corner in the feature
00346         CornerCache< T > *feature_corners = corners[feature_iter];
00347         //for(int corner = 0; corner < feature.numcorners; corner++) {
00348         //  f+= window.getPixel0( feature_corners[corner].scaledIndex ) * feature.corners[corner].value;
00349         //}
00350         for(int corner = 0; corner < feature.numcorners; corner+=4) {
00351           a = window.getPixel0( feature_corners[corner].scaledIndex ) * feature_corners[corner].value;
00352           b = window.getPixel0( feature_corners[corner+1].scaledIndex ) * feature_corners[corner+1].value;
00353           c = window.getPixel0( feature_corners[corner+2].scaledIndex ) * feature_corners[corner+2].value;
00354           d = window.getPixel0( feature_corners[corner+3].scaledIndex ) * feature_corners[corner+3].value;
00355           f+= a + b + c + d;
00356         }
00357         // Note: if T is float, there is floating point roundoff error here, but that should be ok.
00358         
00359         // normalize..
00360         //f = (f/sf2 - fns[feature_iter] * mean) / standard_deviation;
00361         f = f*one_over__sf2_times_std - fns[feature_iter]*mean_over_std;
00362         
00364         // Threshold classifier, using AdaBoost
00365         // 1) maybe take absolute value if indicated
00366         // 2) Threshold (weight is in {-1, +1}, so its above *or below* thresh)
00367         if(f < 0) if(feature.abs) f = -f;
00368         if(thedata.plus_minus_one)
00369           if(feature.weight * f > feature.bias) aH += feature.alpha; else aH -= feature.alpha;
00370         else
00371           if(feature.weight * f > -feature.bias) aH += feature.alpha;
00373         //if(debug2){
00374         // cout << "f = " << f << endl;
00375         // cout << "aH = " << aH << endl;
00376         //}
00377       }
00378     } else {
00379       // run through the features of each cascade stage
00380       for (int feature_iter = cascade.start; feature_iter <= cascade.end; feature_iter++){
00381         Feature &feature = thedata.features[feature_iter];
00382         f = 0.0f;
00383         // for each corner in the feature
00384         CornerCache< T > *feature_corners = corners[feature_iter];
00385         //for(int corner = 0; corner < feature.numcorners; corner++) {
00386         //  f+= window.getPixel0( feature_corners[corner].scaledIndex ) * feature.corners[corner].value;
00387         //}
00388         for(int corner = 0; corner < feature.numcorners; corner+=4) {
00389           a = window.getPixel0( feature_corners[corner].scaledIndex ) * feature_corners[corner].value;
00390           b = window.getPixel0( feature_corners[corner+1].scaledIndex ) * feature_corners[corner+1].value;
00391           c = window.getPixel0( feature_corners[corner+2].scaledIndex ) * feature_corners[corner+2].value;
00392           d = window.getPixel0( feature_corners[corner+3].scaledIndex ) * feature_corners[corner+3].value;
00393           f+= a + b + c + d;
00394         }
00395         // Note: I think there is numerical error here because of floating point roundoff error.  But that realy should be ok.
00396         
00397         // normalize..
00398         //f = (f/sf2 - fns[feature_iter] * mean) / standard_deviation;
00399         //if(debug){
00400         //  cout << "f (before normalization): " << f << endl;
00401         //}
00402         f = f*one_over__sf2_times_std - fns[feature_iter]*mean_over_std;
00403         //if(debug){
00404         //  cout << "f (after normalization): " << f << endl;
00405         //}
00406         
00408         // Using some real-valued WeakLearner, perhaps learned via GentleBoost
00409         // 1) scale feature output to 1:nl
00410         // 2) round and use as index into tuning curve
00411         f = (f - feature.bias) * feature.nl_over_range;
00412         //if(debug){
00413         //  cout << "feature.nl_over_range: " << feature.nl_over_range << endl;
00414         //  cout << "f: " << f << endl;
00415         //  cout << "feature.tuning_curve: ";
00416         //  for(int tc =0; tc <= thedata.nl; ++tc)
00417         //    cout << feature.tuning_curve[tc] << " " ;
00418         //  cout << endl;
00419         //}
00420         if(f<1)
00421           aH += feature.tuning_curve[1];
00422         else if(f>thedata.nl)
00423           aH += feature.tuning_curve[thedata.nl];
00424         else
00425           aH += feature.tuning_curve[static_cast<int>(f+0.5f)];
00426         //if(debug){
00427         //  cout << "f: " << f << ", aH: " << aH << endl;
00428         //}
00429       }
00430     }
00431     
00433     if(aH < cascade.thresh){
00434       //cout << "exit the cascade, there is no face after cascade " << cascade_iter << endl;
00435       *activation = static_cast<double>(aH);
00436       //if(debug){
00437       // cout << "aH = " << aH << endl;
00438       // cout << "*activation = " << *activation << endl;
00439       //}
00440       return static_cast<double>(-cascade_iter);
00441     }
00442   }
00443   *activation = static_cast<double>(aH);
00444   //if(debug){
00445   //  cout << "aH = " << aH << endl;
00446   //  cout << "*activation = " << *activation << endl;
00447   //}
00448   return 1.0;
00449 }

Here is the call graph for this function:

bool DataLoaded  ) 
 

bool DataLoaded  ) 
 

bool DataLoaded  ) 
 

bool DataLoaded  ) 
 

Definition at line 530 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References data, and FeatureData::numfeatures.

00530 { return ( data.numfeatures > 0 );}

int FailedCycles  ) 
 

int FailedCycles  ) 
 

int FailedCycles  ) 
 

int FailedCycles  ) 
 

Definition at line 527 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References stream.

00527 { return stream.FailedCycles; };

void initStream const int  width,
const int  height,
double  WINSHIFT = 1.25
 

Reimplemented in MPEyeFinder.

void initStream const int  width,
const int  height,
double  WINSHIFT = 1.25
 

Reimplemented in MPEyeFinder.

void initStream const int  width,
const int  height,
double  WINSHIFT = 1.25
 

Reimplemented in MPEyeFinder.

void initStream const int  width,
const int  height,
double  WINSHIFT = 1.25
 

Reimplemented in MPEyeFinder.

Definition at line 172 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References data, MPISearchStream::init(), and stream.

Referenced by FindFacesInGWorld::InitializeStreamWithWidth:Height:, and main().

00172                                                                                              {
00173   stream.init(width, height, data, WINSHIFT);
00174 }

Here is the call graph for this function:

void integrateImages const RImage< T > &  p,
MPISearchStream< T > &  stream
[protected]
 

void integrateImages const RImage< T > &  p,
MPISearchStream< T > &  stream
[protected]
 

void integrateImages const RImage< T > &  p,
MPISearchStream< T > &  stream
[protected]
 

void integrateImages const RImage< T > &  p,
MPISearchStream< T > &  stream
[protected]
 

Definition at line 452 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References RImage::array, MPISearchStream::getROI(), MPISearchStream::images, ROI::m_max_x, ROI::m_max_y, ROI::m_min_x, ROI::m_min_y, MPISearchStream::mpi, p, MPISearchStream::pixels2, MPISearchStream::width, RImage::width, and y.

Referenced by search().

00452                                                                                                           {
00453    T  temp;
00454    T  *p, *q;
00455   ROI roi = thestream.mpi->getROI();
00456   // The ROI in the MPIImage Pyramid is too large by 1 because it is looking at integral images.
00457   roi.m_max_x -= 1;  roi.m_max_y -= 1; // sorry about this, I know its confusing
00458   for(int y = roi.m_min_y; y < roi.m_max_y; y++) {
00459     p = pixels.array + (pixels.width*y + roi.m_min_x);
00460     q = thestream.pixels2->array + (thestream.pixels2->width*y + roi.m_min_x);
00461     for(int x = roi.m_min_x; x < roi.m_max_x; x++) {
00462       //temp = pixels.getPixel(x,y);
00463       temp = *p++;
00464       //thestream.pixels2->setPixel(x, y, temp * temp);
00465       *q++ = temp*temp; 
00466     }
00467   }
00468   // create integral images
00469   static_cast<RIntegral< T  >* >(thestream.images[0])->integrate(pixels, roi);
00470   static_cast<RIntegral< T  >* >(thestream.images[1])->integrate(*(thestream.pixels2), roi);
00471 }

Here is the call graph for this function:

void printData FeatureData thedata,
int  ind
[protected]
 

void printData FeatureData thedata,
int  ind
[protected]
 

void printData FeatureData thedata,
int  ind
[protected]
 

void printData FeatureData thedata,
int  ind
[protected]
 

Definition at line 474 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References Feature::abs, Feature::alpha, Feature::bias, OffsetWindow::bottom, FeatureData::cascades, Feature::corners, Cascade::end, FeatureData::features, i, k, OffsetWindow::left, FeatureData::nl, FeatureData::normOffset, FeatureData::numcascades, Feature::numcorners, FeatureData::numfeatures, FeatureData::numStdAdjusts, FeatureData::patch_height, FeatureData::patch_width, FeatureData::patchsize, FeatureData::real_fun, OffsetWindow::right, Cascade::start, FeatureData::stdAdjusts, Cascade::thresh, OffsetWindow::top, Feature::tuning_curve, Corner::value, Feature::weight, Corner::x, and Corner::y.

00474                                                                          {
00475         std::cerr << "patchsize = " << thedata.patchsize << endl;
00476   std::cerr << "patch_width = " << thedata.patch_width << endl;
00477   std::cerr << "patch_height = " << thedata.patch_height << endl;
00478   std::cerr << "numfeatures = " << thedata.numfeatures << endl;
00479   std::cerr << "numcascades = " << thedata.numcascades << endl;
00480   std::cerr << "normOffset.top = " << thedata.normOffset.top << endl;
00481   std::cerr << "normOffset.left = " << thedata.normOffset.left << endl;
00482   std::cerr << "normOffset.right = " << thedata.normOffset.right << endl;
00483   std::cerr << "normOffset.bottom = " << thedata.normOffset.bottom << endl;
00484   std::cerr << "numStdAdjusts = " << thedata.numStdAdjusts << endl;
00485 
00486   std::cerr << "feature[" << ind << "]:" << endl;
00487   std::cerr << "numcorners = " << thedata.features[ind].numcorners << endl;
00488   std::cerr << "real_fun" << thedata.real_fun << endl;
00489   if(!thedata.real_fun){
00490     std::cerr << "alpha = " << thedata.features[ind].alpha << endl;
00491     std::cerr << "bias = " << thedata.features[ind].bias << endl;
00492     std::cerr << "weight = " << thedata.features[ind].weight << endl;
00493     std::cerr << "abs = " << thedata.features[ind].abs << endl;
00494   } else {
00495     std::cerr << "bias = " << thedata.features[ind].bias << endl;
00496     std::cout << "Weights:";
00497     for(int j = 0; j <= thedata.nl; ++j)
00498       std::cout << " " << thedata.features[ind].tuning_curve[j];
00499     std::cout << endl;
00500   }
00501   //cerr << "range = " << thedata.features[ind].range << endl;
00502   for (int i = 0; i<thedata.features[ind].numcorners; ++i) {
00503     std::cerr << "corners_x[" << i << "] = " << thedata.features[ind].corners[i].x << endl;
00504     std::cerr << "corners_y[" << i << "] = " << thedata.features[ind].corners[i].y << endl;
00505     std::cerr << "corners_value[" << i << "] = " << thedata.features[ind].corners[i].value << endl;
00506   }
00507 
00508   if(thedata.numStdAdjusts){
00509     std::cerr << "stdAdjusts:" << endl;
00510     for (int j = 0; j < thedata.numStdAdjusts; ++j)
00511       std::cerr << thedata.stdAdjusts[j] << " ";
00512     std::cerr << endl;
00513   }
00514 
00515   std::cerr << "Cascades:" << endl;
00516   for (int k = 0; k < thedata.numcascades; ++k) 
00517     std::cerr << thedata.cascades[k].start << "\t" << thedata.cascades[k].end << "\t" << thedata.cascades[k].thresh << endl; 
00518 }

virtual void processFace typename MPIScaledImage< T >::const_iterator &  window,
const T &  one_over__sf2_times_std,
const T &  mean_over_std,
const int &  numFaces
[protected, virtual]
 

Reimplemented in MPISearchMex.

virtual void processFace typename MPIScaledImage< T >::const_iterator &  window,
const T &  one_over__sf2_times_std,
const T &  mean_over_std,
const int &  numFaces
[protected, virtual]
 

Reimplemented in MPISearchMex.

virtual void processFace typename MPIScaledImage< T >::const_iterator &  window,
const T &  one_over__sf2_times_std,
const T &  mean_over_std,
const int &  numFaces
[protected, virtual]
 

Reimplemented in MPISearchMex.

void processFace typename MPIScaledImage< T >::const_iterator &  window,
const T &  one_over__sf2_times_std,
const T &  mean_over_std,
const int &  numFaces
[protected, virtual]
 

Reimplemented in MPISearchMex.

Definition at line 168 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

00169                                                                                           {}

void releaseStream  ) 
 

Reimplemented in MPEyeFinder.

void releaseStream  ) 
 

Reimplemented in MPEyeFinder.

void releaseStream  ) 
 

Reimplemented in MPEyeFinder.

void releaseStream  ) 
 

Reimplemented in MPEyeFinder.

Definition at line 180 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References MPISearchStream::release(), and stream.

00180                                               {
00181   stream.release();
00182 }

Here is the call graph for this function:

void resetStream const int  width,
const int  height,
double  WINSHIFT = 1.25
 

Reimplemented in MPEyeFinder.

void resetStream const int  width,
const int  height,
double  WINSHIFT = 1.25
 

Reimplemented in MPEyeFinder.

void resetStream const int  width,
const int  height,
double  WINSHIFT = 1.25
 

Reimplemented in MPEyeFinder.

void resetStream const int  width,
const int  height,
double  WINSHIFT = 1.25
 

Reimplemented in MPEyeFinder.

Definition at line 176 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References data, MPISearchStream::reset(), and stream.

Referenced by main(), and MPISearchThread::Search().

00176                                                                                               {
00177   stream.reset(width, height, data, WINSHIFT);
00178 }

Here is the call graph for this function:

int search const RImage< T > &  pixels,
FaceBoxList faces,
int  USE_BLOCK_FLAGS = 1,
float  WINSHIFT = 1.25,
double *  index_flags = NULL,
double *  output_values = NULL,
int  box = 1
 

int search const RImage< T > &  pixels,
FaceBoxList faces,
int  USE_BLOCK_FLAGS = 1,
float  WINSHIFT = 1.25,
double *  index_flags = NULL,
double *  output_values = NULL,
int  box = 1
 

int search const RImage< T > &  pixels,
FaceBoxList faces,
int  USE_BLOCK_FLAGS = 1,
float  WINSHIFT = 1.25,
double *  index_flags = NULL,
double *  output_values = NULL,
int  box = 1
 

int search const RImage< T > &  pixels,
FaceBoxList faces,
int  USE_BLOCK_FLAGS = 1,
float  WINSHIFT = 1.25,
double *  index_flags = NULL,
double *  output_values = NULL,
int  box = 1
 

Definition at line 186 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References MPIImagePyramid::begin(), classifyWindow(), data, ObjectList::empty(), MPIImagePyramid::end(), FaceBoxList, faces, RImage::height, index_flags, MPISearchStream::init(), integrateImages(), MPISearchStream::mpi, ObjectList::push_front(), stream, RImage::width, and y.

Referenced by FindFacesInGWorld::FindFaces:, main(), and MPISearchThread::Search().

00187 {
00188   if(!stream.allocated){
00189                 std::cout << "MPISearchObjectDetector<T>::search: stream not allocated. Allocating data" << endl;
00190     stream.init(pixels.width, pixels.height, data,  WINSHIFT);
00191   } else
00192     stream.mpi->m_stride = WINSHIFT;
00193   //cout << "mpisearch::search: " << stream.mpi->m_roi << endl;
00194   //cout << "MPISearchObjectDetector<T>::search: "<< stream.roi << endl;
00195   //cout << "About to enter integrateImages" << endl;
00196   integrateImages(pixels, stream);
00197   //if(debug){
00198     //cout << "num_cascades: " << data.numcascades << endl; 
00199     //printData(data, 1);
00200     //  cout << "thedata.real_fun: " << thedata.real_fun << endl;
00201   //}
00202 
00203   int numWindows = 0, scale_index;
00204   float scale_factor;
00205   bool check_it;
00206   double default_cascade = 1;
00207   double default_activation = 0;
00208   double *cascade_level = &default_cascade;
00209   double *activation = &default_activation;
00210   MPIImagePyramid<float>::const_iterator scale = stream.mpi->begin();
00211   MPIImagePyramid<float>::const_iterator last_scale = stream.mpi->end();
00212   //if(debug)
00213   //  stream.images[2]->print(20);
00214   for( ; scale != last_scale; ++scale){
00215     // get pointers to cached values for this scale
00216     scale_index = scale.getScale(scale_factor);
00217     //cout << "Scale number: " << scale_index << ", scale_factor = " << scale_factor << endl;
00218      T  sf2 = scale_factor * scale_factor;
00219     CornerCache< T > **corners = stream.corners[scale_index];
00220      T  *fns = stream.fns[scale_index];
00221     CornerCache< T > *nw_c = stream.nw_c[scale_index];
00222      T  nw_fn = stream.nw_fn[scale_index];
00223     typename MPIScaledImage< T >::const_iterator window = (*scale).begin(), last_window = (*scale).end();
00224     for( ; window != last_window; ++window, ++numWindows){
00225       //if(debug)
00226       //if( numWindows == (66052 - 1) ){
00227       //  cout << "Setting debug"<< endl;
00228       //  setDebug(true);
00229       //}
00230       //else
00231       //  setDebug(false);
00232       // A little logic here to skip a window for various reasons
00233       check_it = true;
00234       if(index_flags){
00235         //if(debug2)
00236         //  cout << "index_flags IS NOT NULL!!! " << endl;
00237         cascade_level = &(index_flags[numWindows]);
00238         if(*cascade_level != 1)
00239           check_it = false;
00240       }
00241       //if(debug2)
00242       //cout << "USE_BLOCK_FLAGS="<< USE_BLOCK_FLAGS << endl;
00243       if(USE_BLOCK_FLAGS){
00244         //if(debug2)
00245         //cout << "the BLOCK_FLAG ="<< window.getPixel(2,0) << endl;
00246         if( window.getPixel(2,0) )
00247           check_it = false;
00248       }
00249       int x, y;
00250       window.getCoords(x,y);
00251       //cout << "(" << x << ","<< y<< ") ";
00252       //if(debug2)
00253       //cout << "check_it = " << check_it << endl;
00254       if(check_it){
00255         if(output_values)
00256           activation = output_values + numWindows;
00257         *cascade_level = classifyWindow(window, data, corners, fns, stream.norm_window, nw_c, nw_fn, scale_factor, sf2, activation);
00258         //if(debug)
00259         //  cout << "activation: " << *activation << endl; 
00260         if(*cascade_level > 0) {
00261           //if(debug){
00262           //cout<< "Found a face" << endl;
00263           // cout << "numWindows = " << numWindows << endl;
00264           //}
00265           if(box){
00266             faces.push_front(window.getSquare());
00267             //cout << "Face at: (" << faces.front().x << ", " << faces.front().y << ", " << faces.front().scale << ")" << endl;
00268             if(USE_BLOCK_FLAGS){
00269               for(int by = 0; by < stream.block_height; ++by)
00270                 for(int bx = -stream.block_width; bx < stream.block_width; ++bx)
00271                   window.setShiftPixel(2, bx, by, 1);
00272               stream.block_windows.push_back(window);
00273             }
00274           }
00275         }
00276       }
00277     } // end window loop
00278     //cout << endl;
00279     if(USE_BLOCK_FLAGS){
00280       while(stream.block_windows.size() > 0){
00281         typename MPIScaledImage< T >::const_iterator window = stream.block_windows[0];
00282         for(int by = 0; by < stream.block_height; ++by)
00283           for(int bx = -stream.block_width; bx < stream.block_width; ++bx)
00284             window.setShiftPixel(2, bx, by, 0);
00285         stream.block_windows.pop_back();
00286       }
00287     }
00288 
00289   }  // end scale loop
00290 
00291   /**************added*****************/
00292   if (!faces.empty())
00293     stream.FailedCycles = 0;
00294   else{
00295     //cout << "Failed" << endl;
00296     stream.FailedCycles++;
00297   }
00298   /**************end*****************/
00299   return numWindows;
00300 }

Here is the call graph for this function:

void setDebug const bool  val  ) 
 

void setDebug const bool  val  ) 
 

void setDebug const bool  val  ) 
 

void setDebug const bool  val  ) 
 

Definition at line 521 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References debug.

00521 { debug = val; }

void setDebug2 const bool  val  ) 
 

void setDebug2 const bool  val  ) 
 

void setDebug2 const bool  val  ) 
 

void setDebug2 const bool  val  ) 
 

Definition at line 524 of file mac/build/mpisearch.framework/Headers/mpisearch.h.

References debug2.

00524 { debug2 = val; }

void setPixelMax maxpixval  ) 
 

Definition at line 192 of file src/mpisearch.h.

References minvariance, and sqr.

Referenced by FilterInterface::FilterInterface(), and MPISearchThread::MPISearchThread().

00192                                                        {
00193         minvariance = sqr(maxpixval * static_cast<T>(0.027));
00194 }


Member Data Documentation

FeatureData data [protected]
 

Definition at line 161 of file src/mpisearch.h.

Referenced by DataLoaded(), initStream(), resetStream(), and search().

bool debug [protected]
 

Definition at line 159 of file src/mpisearch.h.

Referenced by setDebug().

bool debug2 [protected]
 

Definition at line 159 of file src/mpisearch.h.

Referenced by setDebug2().

T minvariance [protected]
 

Definition at line 162 of file src/mpisearch.h.

Referenced by setPixelMax().

MPISearchStream< T > stream [protected]
 

Definition at line 160 of file src/mpisearch.h.

Referenced by AdjSearchWindow(), allocated(), FailedCycles(), initStream(), releaseStream(), resetStream(), and search().


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