Attentionator.C

00001 #include "SeaBee/Attentionator.H"
00002 
00003 Attentionator::Attentionator(ModelManager& mgr,
00004         const std::string& descrName,
00005         const std::string& tagName) :
00006         ModelComponent(mgr, descrName, tagName),
00007         itsImage(0, 0, NO_INIT)
00008         {
00009 
00010         itsEVC = nub::soft_ref<EnvVisualCortex>(new EnvVisualCortex(mgr));
00011         addSubComponent(itsEVC);
00012 }
00013 
00014 Attentionator::~Attentionator() {
00015 }
00016 
00017 void Attentionator::updateImage(Image< PixRGB<byte> > image) {
00018         itsImage = image;
00019 }
00020 
00021 Point2D<int> Attentionator::getSalientPoint() {
00022         Point2D<int> mostSalientPoint;
00023         Image<float> salFloatMap;
00024         float salientValue;
00025         int mapLevel;
00026 
00027         LINFO("Dims: %s", convertToString(itsImage.getDims()).c_str());
00028 
00029         itsEVC->input(itsImage);
00030         salFloatMap = itsEVC->getVCXmap();
00031         mapLevel = itsEVC->getMapLevel();
00032         findMax(salFloatMap, mostSalientPoint, salientValue);
00033         mostSalientPoint.i = mostSalientPoint.i << mapLevel;
00034         mostSalientPoint.j = mostSalientPoint.j << mapLevel;
00035 
00036         return mostSalientPoint;
00037 }
00038 
00039 Image<PixRGB<byte> > Attentionator::getSaliencyMap() {
00040         Image<PixRGB<byte> > salMap = itsEVC->getVCXmap();
00041         if(salMap.initialized())
00042                 return rescaleBilinear(salMap, itsImage.getDims());
00043         else {
00044                 LINFO("DIDNT WORK\n");
00045                 return Image<PixRGB<byte> >();
00046                 }
00047 }
00048 
Generated on Sun May 8 08:42:14 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3