test-RankOrderBorder.C

00001 /*
00002  *  test-RankOrderBorder.cpp
00003  *
00004  *
00005  *  Created by Randolph Voorhies on 11/11/07.
00006  *
00007  */
00008 
00009 #define PI 3.14159265
00010 
00011 //#include "Util/Types.H"
00012 #include "Component/ModelManager.H"
00013 #include "Media/FrameSeries.H"
00014 #include "Transport/FrameIstream.H"
00015 #include "Media/MediaOpts.H"
00016 #include "Image/Image.H"
00017 #include "Image/Pixels.H"
00018 #include "Raster/Raster.H"
00019 #include "GUI/XWinManaged.H"
00020 #include "Image/ImageSet.H"
00021 #include "Image/DrawOps.H"
00022 #include "Image/PyrBuilder.H"
00023 #include "Image/PyramidOps.H"
00024 #include "Image/Kernels.H"
00025 #include "pix.H"
00026 #include "test-RankOrderBorder.H"
00027 #include "roRetina.H"
00028 #include "roUtil.H"
00029 #include <queue>
00030 
00031 using namespace std;
00032 
00033 
00034 
00035 
00036 
00037 int main(int argc, char* argv[]) {
00038 
00039         ModelManager manager("Rank Order Border Ownership");
00040         nub::soft_ref<InputFrameSeries> ifs(new InputFrameSeries(manager));
00041         manager.addSubComponent(ifs);
00042         manager.exportOptions(MC_RECURSE);
00043 
00044         //Parse command-line:
00045         if (manager.parseCommandLine(argc, argv,"[image {*.ppm}]", 0, 1) == false) return(1);
00046 
00047         //Start the model manager
00048         manager.start();
00049 
00050         rutz::shared_ptr < Image < float > > inputImage(new Image < float > (ifs->getWidth(), ifs->getHeight(), ZEROS));
00051         rutz::shared_ptr < Image < PixRGB<float> > > heatmap(new Image< PixRGB <float> >);
00052         heatmap->resize(ifs->getWidth(), ifs->getHeight());
00053 
00054         roRetina<float> retina;
00055 
00056         //Initialize the main display window
00057         int windowWidth = ifs->getWidth()*2;
00058         int windowHeight = ifs->getHeight()*2;
00059         rutz::shared_ptr<XWinManaged> window1;
00060         window1.reset(new XWinManaged(Dims(windowWidth,windowHeight), 0, 0, "Rank Order Border Ownership"));
00061 
00062         while(1) {
00063                 //Update the input frame series, and read the image as an array of floats
00064                 ifs->updateNext();
00065                 *inputImage = ifs->readFloat();
00066                 retina.update(inputImage);
00067                 makeHeatmap<float>(retina.getSpikeWave(), heatmap);
00068 
00069                 //Draw the output
00070                 window1->drawImage(*inputImage,0,0);
00071                 //drawCross<float>(centerSurroundImage, Point2D<int>(topPix.x, topPix.y), 100, 20);
00072                 window1->drawImage(Image<PixRGB <byte> > (*heatmap),inputImage->getWidth(), 0);
00073         }
00074 }
Generated on Sun May 8 08:42:14 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3