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

FilterInterface Class Reference

#include <FilterInterface.h>

Collaboration diagram for FilterInterface:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FilterInterface ()
 FilterInterface ()
 FilterInterface ()
 FilterInterface ()
void printFrame (RGBTRIPLE *prgb, int cxImage, int cyImage)
void printFrame (RGBTRIPLE *prgb, int cxImage, int cyImage)
void printFrame (RGBTRIPLE *prgb, int cxImage, int cyImage)
void printFrame (RGBTRIPLE *prgb, int cxImage, int cyImage)
int runInterface (BYTE *pData, int imgWidth, int imgHeight)
int runInterface (BYTE *pData, int imgWidth, int imgHeight)
int runInterface (BYTE *pData, int imgWidth, int imgHeight)
int runInterface (BYTE *pData, int imgWidth, int imgHeight)
 ~FilterInterface ()
 ~FilterInterface ()
 ~FilterInterface ()
 ~FilterInterface ()

Private Member Functions

void DrawBoxes (RGBTRIPLE *prgb, int cxImage, int cyImage)
void DrawBoxes (RGBTRIPLE *prgb, int cxImage, int cyImage)
void DrawBoxes (RGBTRIPLE *prgb, int cxImage, int cyImage)
void DrawBoxes (RGBTRIPLE *prgb, int cxImage, int cyImage)
void GreyScaleFlipVideo (int width, int height, RGBTRIPLE *rgbpix, RImage< float > &pixels)
void GreyScaleFlipVideo (int width, int height, RGBTRIPLE *rgbpix, RImage< float > &pixels)
void GreyScaleFlipVideo (int width, int height, RGBTRIPLE *rgbpix, RImage< float > &pixels)
void ShowBlinkResults (RGBTRIPLE *prgb, int cxImage, int cyImage)

Private Attributes

MPBlink blink
MPColorTools colorT
MPColorTracker m_colortracker
MPISearchFaceDetector m_Detector
MPEyeFinderm_eyefinder
MPEyeFinderm_eyefinder
FaceBoxList m_faces
VisualObject m_faces
int m_failedCycles
bool m_failedSearch
long m_frameCount
FaceBoxList m_lastFace
VisualObject m_lastFace
RImage< float > m_pixels
RImage< float > m_pixels
RImage< float > m_pixels

Constructor & Destructor Documentation

FilterInterface  ) 
 

Definition at line 7 of file blinkDetector/windows/FilterSrc/FilterInterface.cpp.

References blink, and MPISearchObjectDetector::setPixelMax().

00007                                 {
00008         //set max posibility of pixel value of m_pixels
00009         blink.setPixelMax(2560);
00010 }   // Constructor

Here is the call graph for this function:

~FilterInterface  ) 
 

Definition at line 13 of file blinkDetector/windows/FilterSrc/FilterInterface.cpp.

References VisualObject::clear(), and m_faces.

00014 {
00015         m_faces.clear();
00016 }       // Destructor

Here is the call graph for this function:

FilterInterface  ) 
 

~FilterInterface  ) 
 

FilterInterface  ) 
 

~FilterInterface  ) 
 

FilterInterface  ) 
 

~FilterInterface  ) 
 


Member Function Documentation

void DrawBoxes RGBTRIPLE *  prgb,
int  cxImage,
int  cyImage
[inline, private]
 

Definition at line 53 of file mpisearch/windows/FilterSrc/FilterInterface.h.

References ObjectList::begin(), color, MPColorTools::DrawRGBBox(), ObjectList::end(), RGBCOLOR, TSquare::size, Square, TSquare::x, and TSquare::y.

00054         {  
00055                 bool firstface = true;
00056                 RGBCOLOR color;
00057                 double alpha;
00058                 FFImage<RGBTRIPLE> rgbimage(prgb, cxImage, cyImage);
00059 
00060                 if(m_failedSearch) alpha = exp(-m_failedCycles*0.25);
00061                 else alpha = 1;
00062                 list<Square>::iterator face = m_lastFace.begin();
00063                 list<Square>::iterator last_face = m_lastFace.end();
00064                 for ( ; face != last_face; ++face) {
00065                         //print face box
00066                         if(firstface) color = RGBRED;
00067                         else color = RGBBLUE;
00068                         Square fa = (*face);
00069                         colorT.DrawRGBBox(rgbimage, fa.x, fa.y, fa.size, fa.size, color, alpha);
00070 
00071                         firstface = false;
00072                 }
00073         }

Here is the call graph for this function:

void DrawBoxes RGBTRIPLE *  prgb,
int  cxImage,
int  cyImage
[inline, private]
 

Definition at line 52 of file eyefinder/windows/FilterSrc/FilterInterface.h.

References VisualObject::begin(), color, MPColorTools::DrawRGBBox(), VisualObject::end(), FaceObject::eyes, RGBCOLOR, VisualObject::x, bEyesObject::xLeft, bEyesObject::xRight, VisualObject::xSize, VisualObject::y, bEyesObject::yLeft, bEyesObject::yRight, and VisualObject::ySize.

00053         {  
00054                 bool firstface = true;
00055                 RGBCOLOR color;
00056                 double alpha;
00057                 FFImage<RGBTRIPLE> rgbimage(prgb, cxImage, cyImage);
00058 
00059                 if(m_failedSearch) alpha = exp(-m_failedCycles*0.25);
00060                 else alpha = 1;
00061                 list<VisualObject *>::iterator face = m_lastFace.begin();
00062                 list<VisualObject *>::iterator last_face = m_lastFace.end();
00063                 for ( ; face != last_face; ++face) {
00064                         //print face box
00065                         if(firstface) color = RGBRED;
00066                         else color = RGBBLUE;
00067                         FaceObject *fo = static_cast<FaceObject*>(*face);
00068                         colorT.DrawRGBBox(rgbimage, fo->x, fo->y, fo->xSize, fo->ySize, color, alpha);
00069 
00070                         //print eye boxes
00071                         color = RGBWHITE;
00072                         float eyeSize = fo->xSize * 0.1;
00073                         //left eye
00074                         colorT.DrawRGBBox(rgbimage, static_cast<int>(fo->eyes.xLeft-eyeSize), static_cast<int>(fo->eyes.yLeft-eyeSize), 
00075                                                 static_cast<int>(eyeSize*2), static_cast<int>(eyeSize*2), color, alpha);
00076                         
00077                         //right eye
00078                         colorT.DrawRGBBox(rgbimage, static_cast<int>(fo->eyes.xRight-eyeSize), static_cast<int>(fo->eyes.yRight-eyeSize), 
00079                                                 static_cast<int>(eyeSize*2), static_cast<int>(eyeSize*2), color, alpha);
00080                         firstface = false;
00081                 }
00082         }

Here is the call graph for this function:

void DrawBoxes RGBTRIPLE *  prgb,
int  cxImage,
int  cyImage
[inline, private]
 

Definition at line 41 of file colortracker/windows/FilterSrc/FilterInterface.h.

References ObjectList::begin(), color, MPColorTools::DrawRGBBox(), ObjectList::end(), FaceBoxList, faces, MPColorTracker::getActivation(), MPColorTracker::GetColorBox(), MPColorTracker::GetLastFaces(), MPColorTracker::GetMissedFrames(), RGBCOLOR, TSquare::size, Square, TSquare::x, and TSquare::y.

00042         {  
00043                 bool firstface = true;
00044                 RGBCOLOR color;
00045                 double act;
00046                 int missedFrames = m_colortracker.GetMissedFrames();
00047                 double alpha = exp(-missedFrames*0.25);;
00048                 FFImage<RGBTRIPLE> rgbimage(prgb, cxImage, cyImage);
00049 
00050                 FaceBoxList faces;
00051                 TSquare<double> box;
00052 
00053                 m_colortracker.GetLastFaces(faces);
00054                 m_colortracker.GetColorBox(box);
00055                 list<Square>::iterator face = faces.begin();
00056                 list<Square>::iterator last_face = faces.end();
00057                 for ( ; face != last_face; ++face) {
00058                         //print face box
00059                         if(firstface) color = RGBRED;
00060                         else color = RGBBLUE;
00061                         Square fa = *(face);
00062                         colorT.DrawRGBBox(rgbimage, fa.x, fa.y, fa.size, fa.size, color, alpha);
00063                         firstface = false;
00064                 }
00065                 m_colortracker.getActivation(act);
00066                 if(act > 0) color = RGBYELLOW;
00067                 else color = RGBTURQ;
00068                 colorT.DrawRGBBox(rgbimage, box.x, box.y, box.size, box.size, color, 1);
00069 
00070         }

Here is the call graph for this function:

void DrawBoxes RGBTRIPLE *  prgb,
int  cxImage,
int  cyImage
[inline, private]
 

Definition at line 59 of file blinkDetector/windows/FilterSrc/FilterInterface.h.

References VisualObject::begin(), color, MPColorTools::DrawRGBBox(), VisualObject::end(), FaceObject::eyes, RGBCOLOR, VisualObject::x, bEyesObject::xLeft, bEyesObject::xRight, VisualObject::xSize, VisualObject::y, bEyesObject::yLeft, bEyesObject::yRight, and VisualObject::ySize.

Referenced by printFrame().

00060         {  
00061                 bool firstface = true;
00062                 RGBCOLOR color;
00063                 double alpha;
00064                 FFImage<RGBTRIPLE> rgbimage(prgb, cxImage, cyImage);
00065 
00066                 if(m_failedSearch) alpha = exp(-m_failedCycles*0.25);
00067                 else alpha = 1;
00068                 list<VisualObject *>::iterator face = m_lastFace.begin();
00069                 list<VisualObject *>::iterator last_face = m_lastFace.end();
00070                 for ( ; face != last_face; ++face) {
00071                         //print face box
00072                         if(firstface) color = RGBRED;
00073                         else color = RGBBLUE;
00074                         FaceObject *fo = static_cast<FaceObject*>(*face);
00075                         colorT.DrawRGBBox(rgbimage, fo->x, fo->y, fo->xSize, fo->ySize, color, alpha);
00076 
00077                         //print eye boxes
00078                         color = RGBWHITE;
00079                         float eyeSize = fo->xSize * 0.1;
00080                         //left eye
00081                         colorT.DrawRGBBox(rgbimage, static_cast<int>(fo->eyes.xLeft-eyeSize), static_cast<int>(fo->eyes.yLeft-eyeSize), 
00082                                                 static_cast<int>(eyeSize*2), static_cast<int>(eyeSize*2), color, alpha);
00083                         
00084                         //right eye
00085                         colorT.DrawRGBBox(rgbimage, static_cast<int>(fo->eyes.xRight-eyeSize), static_cast<int>(fo->eyes.yRight-eyeSize), 
00086                                                 static_cast<int>(eyeSize*2), static_cast<int>(eyeSize*2), color, alpha);
00087                         firstface = false;
00088                 }
00089         }

Here is the call graph for this function:

void GreyScaleFlipVideo int  width,
int  height,
RGBTRIPLE *  rgbpix,
RImage< float > &  pixels
[inline, private]
 

Definition at line 32 of file mpisearch/windows/FilterSrc/FilterInterface.h.

References RImage::array, RGBTRIPLE, and y.

00033         {
00034                 RGBTRIPLE *source;
00035                 unsigned char *sp;
00036                 float *dest;
00037 
00038                 // convert image to grayscale and out of directshow coordinates 
00039                 for (int y=0; y < height; y++) {
00040                         source = rgbpix + width * ((height-1) - y);
00041                         sp = (unsigned char *) source;
00042                         dest = pixels.array + width*y;
00043                         for (int x = 0; x < width; x++) {
00044                                 *dest++ = (float)(sp[2] + sp[1]*6 + sp[0]*3);
00045                                 sp += 3;
00046                         }
00047                 }
00048 
00049         } 

void GreyScaleFlipVideo int  width,
int  height,
RGBTRIPLE *  rgbpix,
RImage< float > &  pixels
[inline, private]
 

Definition at line 31 of file eyefinder/windows/FilterSrc/FilterInterface.h.

References RImage::array, RGBTRIPLE, and y.

00032         {
00033                 RGBTRIPLE *source;
00034                 unsigned char *sp;
00035                 float *dest;
00036 
00037                 // convert image to grayscale and out of directshow coordinates 
00038                 for (int y=0; y < height; y++) {
00039                         source = rgbpix + width * ((height-1) - y);
00040                         sp = (unsigned char *) source;
00041                         dest = pixels.array + width*y;
00042                         for (int x = 0; x < width; x++) {
00043                                 *dest++ = (float)(sp[2] + sp[1]*6 + sp[0]*3);
00044                                 sp += 3;
00045                         }
00046                 }
00047 
00048         } 

void GreyScaleFlipVideo int  width,
int  height,
RGBTRIPLE *  rgbpix,
RImage< float > &  pixels
[inline, private]
 

Definition at line 38 of file blinkDetector/windows/FilterSrc/FilterInterface.h.

References RImage::array, RGBTRIPLE, and y.

Referenced by runInterface().

00039         {
00040                 RGBTRIPLE *source;
00041                 unsigned char *sp;
00042                 float *dest;
00043 
00044                 // convert image to grayscale and out of directshow coordinates 
00045                 for (int y=0; y < height; y++) {
00046                         source = rgbpix + width * ((height-1) - y);
00047                         sp = (unsigned char *) source;
00048                         dest = pixels.array + width*y;
00049                         for (int x = 0; x < width; x++) {
00050                                 *dest++ = (float)(sp[2] + sp[1]*6 + sp[0]*3);
00051                                 sp += 3;
00052                         }
00053                 }
00054 
00055         } 

void printFrame RGBTRIPLE *  prgb,
int  cxImage,
int  cyImage
 

void printFrame RGBTRIPLE *  prgb,
int  cxImage,
int  cyImage
 

void printFrame RGBTRIPLE *  prgb,
int  cxImage,
int  cyImage
 

void printFrame RGBTRIPLE *  prgb,
int  cxImage,
int  cyImage
 

Definition at line 44 of file blinkDetector/windows/FilterSrc/FilterInterface.cpp.

References DrawBoxes(), m_failedCycles, and ShowBlinkResults().

Referenced by MPFaceDetectorFilter::Copy(), MPEyeFinderFilter::Copy(), MPColorTrackerFilter::Copy(), and MPBlinkDetectorFilter::Copy().

00044                                                                           {
00045                 DrawBoxes(prgb, cxImage, cyImage);
00046                 ShowBlinkResults(prgb, cxImage, cyImage);
00047                 m_failedCycles++;
00048 }

Here is the call graph for this function:

int runInterface BYTE *  pData,
int  imgWidth,
int  imgHeight
 

int runInterface BYTE *  pData,
int  imgWidth,
int  imgHeight
 

int runInterface BYTE *  pData,
int  imgWidth,
int  imgHeight
 

int runInterface BYTE *  pData,
int  imgWidth,
int  imgHeight
 

Definition at line 20 of file blinkDetector/windows/FilterSrc/FilterInterface.cpp.

References blink, MPBlink::findBlinks(), GreyScaleFlipVideo(), m_faces, m_failedCycles, m_failedSearch, m_lastFace, m_pixels, RGBTRIPLE, RImage::setSize(), VisualObject::size(), and wt_avg.

Referenced by MPFaceDetectorFilter::Transform(), MPEyeFinderFilter::Transform(), MPColorTrackerFilter::Transform(), and MPBlinkDetectorFilter::Transform().

00021 {
00022 
00023         static int lastimgWidth = 0, lastimgHeight = 0;
00024         if (imgWidth != lastimgWidth || imgHeight != lastimgHeight) {
00025                 m_pixels.setSize(imgWidth, imgHeight);
00026                 lastimgWidth = imgWidth;
00027                 lastimgHeight = imgHeight;
00028         }
00029         // convert image to grayscale and out of directshow coordinates
00030         GreyScaleFlipVideo(imgWidth, imgHeight, (RGBTRIPLE *)pData, m_pixels);
00031 
00032         blink.findBlinks(m_pixels, m_faces, 1.25, wt_avg);          
00033 
00034         if (m_faces.size()) {
00035                 m_failedCycles = 0;
00036                 m_failedSearch = false;
00037                 m_lastFace = m_faces;
00038         }
00039         else m_failedSearch = true;
00040 
00041         return 0;
00042 }

Here is the call graph for this function:

void ShowBlinkResults RGBTRIPLE *  prgb,
int  cxImage,
int  cyImage
[inline, private]
 

Definition at line 93 of file blinkDetector/windows/FilterSrc/FilterInterface.h.

References VisualObject::activation, VisualObject::begin(), i, max, min(), RGBBLUE, RGBRED, RGBTRIPLE, MPColorTools::setRGBColor(), VisualObject::size(), VisualObject::xSize, and y.

Referenced by printFrame().

00093                                                                                {
00094 
00095                 double bResults;
00096                 static int beeped = 0;
00097                 double alpha;
00098                 if(m_failedSearch) alpha = exp(-m_failedCycles*0.25);
00099                 else alpha = 1;
00100                 int startX = 5;
00101                 RGBTRIPLE *tmpPtr;
00102                 if (m_lastFace.size()) {
00103                         FaceObject *fo = static_cast<FaceObject*>(*m_lastFace.begin());
00104                         if (fo->xSize > 0) {
00105                                 bResults = -fo->activation;//cluster.UpdateCluster(fo->activation) - fo->activation;
00106                                 if(bResults > 0){
00107                                         if (!beeped) {
00108                                                 for (int i = 1000; i > 800; i-=100)
00109                                                         Beep(i, 100);
00110                                                 beeped = 1;
00111                                         }
00112                                         int maxRes = static_cast<int>(bResults+cyImage*0.5);
00113                                         maxRes = min(maxRes, cyImage-1);
00114                                         for(int y = cyImage*0.5; y < maxRes; y++){
00115                                                 tmpPtr = prgb + startX + cxImage*((cyImage-1) - y);
00116                                                 for(int w = 0; w < 15; w++, *tmpPtr++)
00117                                                         colorT.setRGBColor(*tmpPtr, RGBBLUE, alpha);
00118                                         }
00119                                 }
00120                                 else{
00121                                         beeped = 0;
00122                                         int minRes = static_cast<int>(bResults+cyImage/2);
00123                                         minRes = max(minRes, 0);
00124                                         for(int y = cyImage*0.5; y > minRes; y--){
00125                                                 tmpPtr = prgb + startX + cxImage*((cyImage-1) - y);
00126                                                 for(int w = 0; w < 15; w++, *tmpPtr++)
00127                                                         colorT.setRGBColor(*tmpPtr, RGBRED, alpha);
00128                                         }
00129                                 }
00130                         }
00131                 }
00132         }

Here is the call graph for this function:


Member Data Documentation

MPBlink blink [private]
 

Definition at line 24 of file blinkDetector/windows/FilterSrc/FilterInterface.h.

Referenced by FilterInterface(), and runInterface().

MPColorTools colorT [private]
 

Definition at line 26 of file mpisearch/windows/FilterSrc/FilterInterface.h.

MPColorTracker m_colortracker [private]
 

Definition at line 35 of file colortracker/windows/FilterSrc/FilterInterface.h.

MPISearchFaceDetector m_Detector [private]
 

Definition at line 21 of file mpisearch/windows/FilterSrc/FilterInterface.h.

MPEyeFinder* m_eyefinder [private]
 

Definition at line 21 of file eyefinder/windows/FilterSrc/FilterInterface.h.

MPEyeFinder* m_eyefinder [private]
 

Definition at line 25 of file blinkDetector/windows/FilterSrc/FilterInterface.h.

FaceBoxList m_faces [private]
 

Definition at line 23 of file mpisearch/windows/FilterSrc/FilterInterface.h.

VisualObject m_faces [private]
 

Definition at line 22 of file eyefinder/windows/FilterSrc/FilterInterface.h.

Referenced by runInterface(), and ~FilterInterface().

int m_failedCycles [private]
 

Definition at line 27 of file mpisearch/windows/FilterSrc/FilterInterface.h.

Referenced by printFrame(), and runInterface().

bool m_failedSearch [private]
 

Definition at line 28 of file mpisearch/windows/FilterSrc/FilterInterface.h.

Referenced by runInterface().

long m_frameCount [private]
 

Definition at line 37 of file colortracker/windows/FilterSrc/FilterInterface.h.

FaceBoxList m_lastFace [private]
 

Definition at line 24 of file mpisearch/windows/FilterSrc/FilterInterface.h.

VisualObject m_lastFace [private]
 

Definition at line 23 of file eyefinder/windows/FilterSrc/FilterInterface.h.

Referenced by runInterface().

RImage<float> m_pixels [private]
 

Definition at line 25 of file mpisearch/windows/FilterSrc/FilterInterface.h.

RImage<float> m_pixels [private]
 

Definition at line 24 of file eyefinder/windows/FilterSrc/FilterInterface.h.

RImage<float> m_pixels [private]
 

Definition at line 28 of file blinkDetector/windows/FilterSrc/FilterInterface.h.

Referenced by runInterface().


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