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

Libraries/colortracker/src/convhmm/main.cpp File Reference

#include "pp_preprocessor.h"
#include "colorfeatsearch.h"
#include <ctime>
#include "mainutil.h"
#include <limits>
#include <direct.h>
#include <process.h>

Include dependency graph for Libraries/colortracker/src/convhmm/main.cpp:

Include dependency graph

Go to the source code of this file.

Functions

int main ()


Function Documentation

int main  ) 
 

Definition at line 14 of file Libraries/colortracker/src/convhmm/main.cpp.

References Timeline::addEntry(), drawBack(), drawROI(), f(), TIntegral::getImHeight(), TIntegral::getImWidth(), TIntegral::getIntHeight(), TIntegral::getIntPixel(), TIntegral::getIntWidth(), ROISequence::getnext(), Timeline::getROISequences(), MPColorFeatSearch::initPyramids(), TIntegral::integrate(), Timeline::numframes, TIntegral::printImBin(), s, TBox::scale, MPColorFeatSearch::searchFeature(), TIntegral::setImPixel(), TIntegral::setIntPixel(), TIntegral::setSize(), TBox::size, sprintf(), TBox::x, y, and TBox::y.

00014            {
00015 
00016         system("rmdir temp");
00017         _mkdir("temp");
00018 
00019         int imageWidth = 25;
00020         int imageHeight = 25;
00021         double scaleUpPct = 0;//0.1;//0.1;// 0;//0.1;
00022         double shiftPct = .1;//0.05;//0.05;// 0;//0.5;
00023         double minSizePct = .1;//0.1;
00024         int minScaleUp = 1;//3;
00025         int minStride = 1;//1;//3;      
00026 
00027         int scaledev = 1; /* window over valid scales is cur +/- scaledev */
00028         double hr = .75; /* window over location is in units of current face scale */
00029                 
00030         TIntegral<double> likratimage, backimage;
00031         likratimage.setSize(imageWidth, imageHeight);
00032         backimage.setSize(imageWidth, imageHeight);
00033 
00034 //      drawBack(backimage, 0, 0);
00035 //      drawBack(backimage, -9.3777f, 1.1774f);
00036 
00037         TBox<double> besthyp;
00038         
00039         MPColorFeatSearch *colorFeatSearchptr = new MPColorFeatSearch;
00040         MPColorFeatSearch &colorFeatSearch = *colorFeatSearchptr;
00041 
00042         colorFeatSearch.initPyramids(imageWidth, imageHeight, scaleUpPct, minSizePct, minScaleUp, shiftPct, minStride);
00043         
00044         TBox<float> roi;
00045         list<ROISequence *> ROIs;
00046 
00047         Timeline timeline;
00048         
00049 #ifdef SPIKETEST
00050         timeline.addEntry(0, 0, 0, 0, 0, 0, 0, 20);
00051 #else
00052         timeline.addEntry(0, 4, 20, 4, 4, 5, 5, 20);
00053         timeline.addEntry(0, 20, 4, 18, 18, 5, 5, 20);  
00054         timeline.addEntry(21, -1, -1, -1, -1, 0, 0, 10);
00055 #endif
00056 //      FILE *fid2 = fopen("temp/results.txt", "w"); fclose(fid2);
00057 
00058         for (int trial = 0; trial < timeline.numframes; trial++) {
00059                 drawBack(likratimage, -6.f, 0.f);               
00060 
00061                 timeline.getROISequences(trial, ROIs);
00062 
00063                 for (list<ROISequence *>::iterator it = ROIs.begin(); it != ROIs.end(); it++) {
00064                         ROISequence *s = *it;
00065                         s->getnext(roi.x, roi.y, roi.size);
00066                         drawROI(likratimage, roi, 10.f, 0.f);
00067                 }
00068 
00069                 TIntegral<double> likimg;
00070                 likimg.setSize(likratimage.getImWidth(), likratimage.getImHeight());
00071                 for (int y = 0; y < likratimage.getIntHeight(); y++) {
00072                         for (int x = 0; x < likratimage.getIntWidth(); x++) {
00073                                 likimg.setIntPixel(x, y, likratimage.getIntPixel(x, y));
00074                         }
00075                 }
00076 
00077                 likratimage.integrate();
00078 
00079                 besthyp.x = 0; besthyp.y = 0; besthyp.size = 1; besthyp.scale = 1;
00080                 
00081                 double start_time = (double)clock()/CLOCKS_PER_SEC;
00082                 double likrat = colorFeatSearch.searchFeature(likratimage, NULL, besthyp, scaledev, hr, shiftPct, scaleUpPct, minSizePct, minScaleUp, minStride);
00083                 double elapsed = (double)clock()/CLOCKS_PER_SEC - start_time;
00084 
00085                 for (y = besthyp.y; y < besthyp.y+besthyp.size; y++) {
00086                         for (int x = besthyp.x; x < besthyp.x+besthyp.size; x++) {
00087                                 if (x == besthyp.x || x == besthyp.x + besthyp.size-1)
00088                                         likimg.setImPixel(x, y, 0);
00089                                 else if (y == besthyp.y || y == besthyp.y + besthyp.size-1)
00090                                         likimg.setImPixel(x, y, 0);
00091                         }
00092                 }
00093 
00094                 char filename[100];
00095                 sprintf(filename, "temp/image_%d.bin", trial);
00096                 likimg.printImBin(filename, true);
00097 
00098 //              FILE *fid2 = fopen("temp/results.txt", "a");
00099 //              fprintf(fid2, "%f\t%f\t%f\n", besthyp.x, besthyp.y, besthyp.size);
00100 //              fclose(fid2);
00101 
00102                 printf("trial %d\telapsed time %g\n",trial, elapsed);
00103         }
00104 
00105         return (0);
00106 }

Here is the call graph for this function:


Generated on Mon Nov 8 17:08:11 2004 for MPT by  doxygen 1.3.9.1