00001 /*!@file CINNIC/CINNICinteract.C Interactive CINNIC */ 00002 00003 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/CINNIC/CINNICinteract.C $ 00004 // $Id: CINNICinteract.C 12074 2009-11-24 07:51:51Z itti $ 00005 00006 // ############################################################ 00007 // ############################################################ 00008 // ##### ---CINNIC--- 00009 // ##### Contour Integration: 00010 // ##### T. Nathan Mundhenk nathan@mundhenk.com 00011 // ############################################################ 00012 // ############################################################ 00013 00014 //This is the start of the execution path for the CINNIC test alg. 00015 #include "CINNIC/CINNIC.H" 00016 #include "CINNIC/cascadeHold.H" 00017 #include "Util/log.H" 00018 #include "Util/readConfig.H" 00019 #include <iostream> 00020 #include <sstream> 00021 #include <stdlib.h> 00022 #include <sys/types.h> 00023 #include <time.h> 00024 #include <cstdio> 00025 00026 00027 00028 00029 //! Create a CINNIC neuron, use float 00030 ContourNeuronCreate<float> CINNICreate; 00031 //! Standard CINNIC test object 00032 CINNIC skeptic; 00033 //! pointer to command line argument stream 00034 std::istream* argInput; 00035 //! This is the configFile name 00036 const char* configFile; 00037 //! This is the configFile object 00038 readConfig configIn(25); 00039 //! This is the main function for CINNIC 00040 /*! to use this you must have a config file called contour.conf 00041 you should run this file by running it from src2 and executing it 00042 as such "../bin/CINNICtest ../image_in/imagefile outputname" where 00043 imagefile is a ppm file (do not include extention) and outputname 00044 is the name you would like attached to all the output files. 00045 */ 00046 00047 int main(int argc, char* argv[]) 00048 { 00049 time_t t1,t2; 00050 (void) time(&t1); 00051 00052 if(argc > 3) 00053 { 00054 configFile = argv[3]; 00055 } 00056 else 00057 { 00058 configFile = "contour.conf"; 00059 } 00060 skeptic.filename = "noName"; 00061 LINFO("LOADING CONFIG FILE"); 00062 configIn.openFile(configFile); 00063 for(int i = 0; configIn.readFileTrue(i); i++) 00064 { 00065 std::cout << configIn.readFileValueName(i) << ":" << configIn.readFileValueF(i) << "\n"; 00066 } 00067 LINFO("Starting CINNIC interaction\n"); 00068 CINNICreate.CreateNeuron(configIn); 00069 LINFO("CINNIC template Neuron copied, ready for use"); 00070 00071 if(argc > 2) 00072 { 00073 skeptic.savefilename = argv[2]; 00074 } 00075 else 00076 { 00077 skeptic.savefilename = "noname"; 00078 } 00079 00080 LINFO("argc %d", argc); 00081 argInput = new std::istringstream(argv[1]); 00082 skeptic.Ninput = Image<byte>(100,100, NO_INIT); 00083 skeptic.Ninput = Raster::ReadGray(argv[1], RASFMT_PNM); 00084 skeptic.filename = argv[1]; 00085 LINFO("Image Loaded"); 00086 Image<float> temp; 00087 temp = skeptic.Ninput; 00088 LINFO("RUNNING TEST"); 00089 skeptic.convolveTest(CINNICreate,configIn,temp); 00090 LINFO("done!"); 00091 (void) time(&t2); 00092 long int tl = (long int) t2-t1; 00093 printf("\n*************************************\n"); 00094 printf("Time to execute, %ld seconds\n",tl); 00095 printf("*************************************\n\n"); 00096 return 1; 00097 } 00098 00099 // ###################################################################### 00100 /* So things look consistent in everyone's emacs... */ 00101 /* Local Variables: */ 00102 /* indent-tabs-mode: nil */ 00103 /* End: */