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

MPBlink Class Reference

#include <blink.h>

Inheritance diagram for MPBlink:

Inheritance graph
[legend]
Collaboration diagram for MPBlink:

Collaboration graph
[legend]
List of all members.

Public Member Functions

double findBlinks (const RImage< float > &pixels, VisualObject &faces, float WINSHIFT=1.25, combine_mode mode=none)
 MPBlink ()
 ~MPBlink ()

Public Attributes

double activation
BlinkValue bVal

Protected Member Functions

void DisplayDecay (double actp)
double eucDistance (int x, int y)
void get_eyes (const RImage< float > &pixels, VisualObject &faces)
void get_eyes (const RImage< float > &pixels, Square &face)

Protected Attributes

Cluster cluster
MPEyeFindereyefinder
RImage< float > * eyes
int imgCount
int previousHeight
int previousWidth

Constructor & Destructor Documentation

MPBlink  ) 
 

Definition at line 34 of file blink.cc.

References activation, blink_wts::assignData(), BlinkValue::blinkTotal, bVal, eyefinder, eyes, imgCount, and BlinkValue::openTotal.

00034                   {
00035   blink_wts::assignData(data);
00036   activation = 0;
00037   bVal.openTotal = 0;
00038   bVal.blinkTotal = 0;
00039   imgCount = 0;
00040         eyefinder = new MPEyeFinderBinary();
00041         //eyefinder->initStream(640, 480); 
00042   eyes = new RImage<float>(eye_preWidth, eye_preHeight);
00043 }

Here is the call graph for this function:

~MPBlink  ) 
 

Definition at line 45 of file blink.cc.

References eyefinder, and MPEyeFinder::releaseStream().

00045                    {
00046         eyefinder->releaseStream();
00047         delete eyes;
00048 }

Here is the call graph for this function:


Member Function Documentation

void DisplayDecay double  actp  )  [protected]
 

double eucDistance int  x,
int  y
[protected]
 

double findBlinks const RImage< float > &  pixels,
VisualObject faces,
float  WINSHIFT = 1.25,
combine_mode  mode = none
 

Definition at line 50 of file blink.cc.

References eyefinder, faces, MPEyeFinder::findEyes(), get_eyes(), RImage::height, MPEyeFinder::resetStream(), ObjectList::size(), and RImage::width.

Referenced by main(), and FilterInterface::runInterface().

00051                                                   {
00052   // First, find the faces
00053         static int lastimgWidth = 0, lastimgHeight = 0;
00054         if (pixels.width != lastimgWidth || pixels.height != lastimgHeight) {
00055                 eyefinder->resetStream(pixels.width, pixels.height);
00056                 lastimgWidth = pixels.width;
00057                 lastimgHeight = pixels.height;
00058         }
00059 
00060         eyefinder->findEyes(pixels, faces, WINSHIFT, mode);
00061         if(!faces.size())
00062                 return 0;
00063 
00064         get_eyes(pixels, faces);
00065 
00066         
00067   return 1; 
00068 }

Here is the call graph for this function:

void get_eyes const RImage< float > &  pixels,
VisualObject faces
[protected]
 

Definition at line 87 of file blink.cc.

References VisualObject::activation, RImage::array, ObjectList::begin(), ObjectList::end(), eye_dest_height, eye_dest_width, eye_dist, eyes, FaceObject::eyes, f(), FaceBoxList, faces, RImage::getPixel(), h_eye_factor, h_off_pct, i, bEyesObject::leftEye, max, p, bEyesObject::rightEye, MPISearchObjectDetector< float >::search(), v_eye_factor, v_off_pct, bEyesObject::xLeft, xoff, bEyesObject::xRight, y, bEyesObject::yLeft, yoff, and bEyesObject::yRight.

00087                                                                       {
00088         list<VisualObject *>::iterator it = faces.begin();
00089   FaceBoxList face;
00090         for (; it != faces.end(); ++it) {
00091                 FaceObject * f = static_cast<FaceObject*>(*it);
00092                 if (f->eyes.rightEye && f->eyes.leftEye){
00093 
00094                         double xd = f->eyes.xLeft - f->eyes.xRight;
00095                         double yd = f->eyes.yLeft - f->eyes.yRight;
00096                         float eye_dist = sqrt((xd*xd +yd*yd));
00097                         float sin_d = -yd/xd;
00098                         float cos_d = eye_dist/xd;
00099 
00100                         float h_eye_zero = max(0.0f,f->eyes.xRight-eye_dist*(h_eye_factor+h_off_pct));
00101                         float v_eye_zero = max(0.0f,f->eyes.yRight-eye_dist*(v_eye_factor+v_off_pct));
00102                         float xwidth = eye_dist*(1 + 2*h_eye_factor);
00103                         float ywidth = eye_dist*(2*v_eye_factor);
00104 
00105                         int xedges;
00106                         int yedges;
00107                         float xfrac;
00108                         float yfrac;
00109                         float xoff[eye_dest_width];
00110                         float yoff[eye_dest_height];
00111                         double xstep = xwidth/static_cast<double>(eye_dest_width-1);
00112                         double ystep = ywidth/static_cast<double>(eye_dest_height-1);
00113 
00114                         float j;
00115                         int i;
00116                         for(i = 0, j = 0; i < eye_dest_width; ++i, j+=xstep){
00117                                 xoff[i] = cos_d * j;
00118                                 yoff[i] = -sin_d * j;
00119                         }
00120   
00121                         float tempx, tempy;
00122                         float *p = eyes->array;
00123                         float f00, f01, f11, f10, fx0, fx1;
00124                         for(int y=0; y < eye_dest_height; ++y){ 
00125                                 float xinit = (sin_d * ystep*y)+h_eye_zero;
00126                                 float yinit = v_eye_zero + ystep*y;
00127                                 for(int x=0; x < eye_dest_width; ++x){
00128                                         tempx = xinit + xstep*x;
00129                                         tempy = yinit + yoff[x];
00130                                         xedges = static_cast<int>(tempx);
00131                                         yedges = static_cast<int>(tempy);
00132                                         xfrac = tempx - xedges;
00133                                         yfrac = tempy - yedges;
00134                                                         
00135                                         f00 = pixels.getPixel(xedges,yedges);
00136                                         f01 = pixels.getPixel(xedges,yedges + 1);
00137                                         f10 = pixels.getPixel(xedges + 1,yedges);
00138                                         f11 = pixels.getPixel(xedges + 1,yedges + 1);
00139       
00140                                         // xfrac and y frac are the remainders
00141                                         fx0 = f00 + xfrac*(f10-f00);
00142                                         fx1 = f01 + xfrac*(f11-f01);
00143                                         *(p++) = (fx0 + yfrac*(fx1-fx0)); 
00144                                 }
00145                         }
00146                         int num_blink_windows = search(*eyes, face, 0, 1.0f, 0, &f->activation,0);
00147                         //f->activation = cluster.UpdateCluster(f->activation) - f->activation;
00148                 }
00149                 else
00150                         f->activation = 0.0f;
00151         }
00152 }

Here is the call graph for this function:

void get_eyes const RImage< float > &  pixels,
Square face
[protected]
 

Referenced by findBlinks().


Member Data Documentation

double activation
 

Definition at line 43 of file blink.h.

Referenced by MPBlink().

BlinkValue bVal
 

Definition at line 42 of file blink.h.

Referenced by MPBlink().

Cluster cluster [protected]
 

Definition at line 57 of file blink.h.

MPEyeFinder* eyefinder [protected]
 

Definition at line 53 of file blink.h.

Referenced by findBlinks(), MPBlink(), and ~MPBlink().

RImage<float>* eyes [protected]
 

Definition at line 56 of file blink.h.

Referenced by get_eyes(), and MPBlink().

int imgCount [protected]
 

Definition at line 55 of file blink.h.

Referenced by MPBlink().

int previousHeight [protected]
 

Definition at line 54 of file blink.h.

int previousWidth [protected]
 

Definition at line 54 of file blink.h.


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