00001 /* 00002 * roRetina.h 00003 * 00004 * 00005 * Created by Randolph Voorhies on 11/13/07. 00006 * 00007 */ 00008 #ifndef RORETINA_H 00009 #define RORETINA_H 00010 00011 #include <queue> 00012 #include "pix.H" 00013 #include "Image/PyrBuilder.H" 00014 #include "Image/PyramidOps.H" 00015 #include "rutz/shared_ptr.h" 00016 #include "roUtil.H" 00017 00018 using namespace std; 00019 00020 //A rank order retina. 00021 template <class T> 00022 class roRetina { 00023 public: 00024 roRetina(); 00025 void update(rutz::shared_ptr< Image<T> > inputImage); 00026 rutz::shared_ptr <priority_queue <pix <T> > > getSpikeWave(); 00027 private: 00028 rutz::shared_ptr < GaussianPyrBuilder<T> > itsPyrBuilder; //A pyramid builder for computing the gaussian pyramids 00029 rutz::shared_ptr < ImageSet < T > > itsIPyramid; //Intensity pyramid 00030 rutz::shared_ptr < priority_queue < pix <T> > > itsSpikeWave; //A priority queue representing a single spike wave 00031 00032 rutz::shared_ptr < Image<T> > itsCenterSurroundImage; 00033 }; 00034 00035 00036 template <class T> 00037 roRetina<T>::roRetina() : 00038 itsPyrBuilder(new GaussianPyrBuilder<T>(5)), 00039 itsIPyramid(new ImageSet<T>(5)), 00040 itsSpikeWave(new priority_queue< pix <T> >), 00041 itsCenterSurroundImage(new Image<T>) 00042 { 00043 00044 } 00045 00046 template <class T> 00047 void roRetina<T>::update(rutz::shared_ptr< Image <T> > inputImage) { 00048 //Build the 9 level Gaussian Image Pyramid 00049 *itsIPyramid = itsPyrBuilder->build(*inputImage,0,8); 00050 00051 //Compute the center surround 00052 *itsCenterSurroundImage = centerSurround(*itsIPyramid,0,1); 00053 00054 //Generate the spike wave from the center surround image 00055 itsSpikeWave = makePriQueue<float>(itsCenterSurroundImage); 00056 } 00057 00058 00059 00060 template <class T> 00061 rutz::shared_ptr <priority_queue <pix <T> > > roRetina<T>::getSpikeWave() { 00062 return itsSpikeWave; 00063 } 00064 00065 00066 #endif