summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/magnifier.cc
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/ovision/see/magnifier.cc')
-rw-r--r--2005/i/robert/src/ovision/see/magnifier.cc47
1 files changed, 10 insertions, 37 deletions
diff --git a/2005/i/robert/src/ovision/see/magnifier.cc b/2005/i/robert/src/ovision/see/magnifier.cc
index c7d5dc0..e34cdd6 100644
--- a/2005/i/robert/src/ovision/see/magnifier.cc
+++ b/2005/i/robert/src/ovision/see/magnifier.cc
@@ -2,10 +2,12 @@
// robert - Programme du robot APBteam
// Copyright (C) 2005 Olivier Gaillard
+/// @file magnifier.cc Filtre la liste d'objets trouvées
+
#include <iostream>
#include "magnifier.hh"
-#include "hotelling.hh"
+#include "skittle.hh"
/// Constructeur
Magnifier::Magnifier (Img *img, Segm *segm)
@@ -75,8 +77,11 @@ Magnifier::analyse (const std::vector<Zone> &zoneList)
break;
}
}
- Zone &z = itemList_[Group::redSkittle][0];
- isSkittle (z);
+ if (itemList_[Group::redSkittle].size () != 0)
+ {
+ Zone &z = itemList_[Group::redSkittle][0];
+ isSkittle (z);
+ }
}
@@ -107,40 +112,8 @@ Magnifier::checkIsUnique (const Zone &zone)
bool
Magnifier::isSkittle (Zone &zone)
{
- // Agrandissement de la zone de recherche
- const int grow = 20;
- int ymin = (zone.ymin - grow);
- ymin = (ymin > 0) ? ymin : 0;
- int ymax = (zone.ymax + grow);
- ymax = (ymax < img_->height_) ? ymax : img_->height_;
- int xmin = (zone.xmin - grow);
- xmin = (xmin > 0) ? xmin : 0;
- int xmax = (zone.xmax + grow);
- xmax = (xmax < img_->width_) ? xmax : img_->width_;
- // Parcours d'une partie des pixels de l'image
- int tmpY;
- int jump = oconfig_->jumpPointDist/5;
- if (!jump) jump = 1;
- std::vector<Hpoint> l;
- for (int y = zone.ymin - grow; y < zone.ymax + grow; y += jump)
- {
- tmpY = y*img_->width_;
- for (int x=zone.xmin - grow; x < zone.xmax + grow; x += jump)
- if (segm_->giveColor (img_->tabData_ + ((tmpY + x) * 3), true, true) == zone.color)
- {
- Hpoint h (x, y);
- l.push_back (h);
- }
- }
- // Calcul de la composante principale
- for (std::vector<Hpoint>::iterator iter = l.begin (); iter != l.end (); ++iter)
- std::cout << (*iter)[0] << " " << (*iter)[1] << std::endl;
- Hotelling hote (l);
- hote.eigenVectors ();
- double i, j;
- hote.getPC (i, j);
- hote.show ();
- std::cout << "PC : " << i << " " << j << std::endl;
+ Skittle s (img_, segm_);
+ s.analyse (zone);
return true;
}