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

colortracker/windows/FilterSrc/FilterInterface.h

Go to the documentation of this file.
00001 /*
00002  *  FilterInterface.h
00003  *  
00004  *
00005  *  Created by Bret Fortenberry 2004.
00006  *  Copyright (c) 2003 Machine Perception Laboratory
00007  *  University of California San Diego.
00008  *  Please read the disclaimer and notes about redistribution
00009  *  at the end of this file.
00010  *
00011  *  Authors: Bret Fortenberry
00012  */
00013 #ifndef __FILTERINTERFACE_H__
00014 #define __FILTERINTERFACE_H__
00015 
00016 #include <windows.h>
00017 #include "MPColorTracker.h"
00018 #include "Images/color.h"
00019 #include "faceboxlist.h"
00020 
00021 
00022 class FilterInterface
00023 {
00024 public:
00025 
00026         FilterInterface();  // Constructor
00027         ~FilterInterface();     // Destructor
00028 
00029         int runInterface(BYTE *pData, int imgWidth, int imgHeight);
00030         void printFrame(RGBTRIPLE *prgb, int cxImage, int cyImage);
00031 
00032 
00033 private:
00034 
00035         MPColorTracker m_colortracker;
00036         MPColorTools colorT;
00037         long m_frameCount;
00038 
00039         // ================================================================
00040 
00041         inline void DrawBoxes(RGBTRIPLE *prgb, int cxImage, int cyImage)
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         }
00071 
00072 
00073 }; // FilterInterface
00074 
00075 #endif __FILTERINTERFACE_H__
00076 
00077 /*
00078  * 
00079  * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00080  * 
00081  *    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00082  *    2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
00083  *    3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
00084  * 
00085  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00086  * 
00087  */

Generated on Mon Nov 8 17:07:34 2004 for MPT by  doxygen 1.3.9.1