# cp main.cpp main_test.cpp # patch main_test.cpp main_test.diffs *** main.cpp Thu Nov 29 14:50:59 2007 --- main_test.cpp Thu Nov 29 15:06:18 2007 *************** *** 21,26 **** --- 21,27 ---- #include #include // For basename and extension namespace bf = boost::filesystem; + #include #include "rimage.h" #include "rimage_ser.h" *************** *** 65,70 **** --- 66,72 ---- std::string getimagepath(); void processPath( CERT_CLASS &cert, CERT::ImageLoader &loader, RImage &pixels, const std::string &path, int argc, bool tabDelim ); bool processImage( CERT_CLASS &cert, CERT::ImageLoader &loader, RImage &pixels, const std::string &path, int argc, bool tabDelim ); + bool processImageMultipleTimes( CERT_CLASS &cert, CERT::ImageLoader &loader, RImage &pixels, const std::string &path, int argc, bool tabDelim ); void processDir( CERT_CLASS &cert, CERT::ImageLoader &loader, RImage &pixels, const std::string &path, int argc, bool tabDelim ); bool processArgs( int argc, char *argv[], std::vector< std::string > &paths, bool &tabDelim ); *************** *** 177,183 **** if( bf::is_directory( bfPath ) ) processDir( cert, loader, pixels, path, argc, tabDelim ); else ! processImage( cert, loader, pixels, path, argc, tabDelim ); } } --- 179,185 ---- if( bf::is_directory( bfPath ) ) processDir( cert, loader, pixels, path, argc, tabDelim ); else ! processImageMultipleTimes( cert, loader, pixels, path, argc, tabDelim ); } } *************** *** 189,195 **** { std::string fileName = *images; std::cout << fileName << '\t'; ! processImage( cert, loader, pixels, fileName, argc, tabDelim ); std::cout << std::endl; } } --- 191,197 ---- { std::string fileName = *images; std::cout << fileName << '\t'; ! processImageMultipleTimes( cert, loader, pixels, fileName, argc, tabDelim ); std::cout << std::endl; } } *************** *** 291,296 **** --- 293,351 ---- return false; } + bool processImageMultipleTimes( CERT_CLASS &cert, CERT::ImageLoader &loader, RImage &pixels, const std::string &path, int argc, bool tabDelim ) + { + if( loader.loadRImage(pixels, path ) ) // handles loading an image from file into an RImage + { + boost::posix_time::ptime startTime(boost::posix_time::microsec_clock::local_time()); + int maxCnt = 100; + for( int cnt = 1; cnt <= maxCnt; ++cnt ) + { + std::vector aus; + + if( inputIsFaces ) + aus = cert.calcAUsFromFace( pixels ); + else + aus = cert.calcAUs( pixels ); + + if( cert.didFindFace() ) + { + #ifdef USE_MLR + std::map< std::string, mp_AUResults > freqs = cert.getFrequencies(); + + if( mlr ) + { + try { + mlr->MLR( freqs ); + } + catch( std::logic_error &err ) + { + } + } + + if( mlr2 ) + { + try { + mlr2->MLR( freqs ); + } + catch( std::logic_error &err ) + { + } + } + #endif + } // End cert.didFindFace + else + { + } + } // End of maxCnt loop + boost::posix_time::ptime endTime(boost::posix_time::microsec_clock::local_time()); + std::cout << "Ran " << maxCnt << " times in " << (endTime - startTime) << " seconds. start = " << startTime << ", end = " << endTime << std::endl; + return true; + } // End loadRImage + + return false; + } + /*************************************************************/ std::string getsvmweightspath() {