summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/ovision/see')
-rw-r--r--2005/i/robert/src/ovision/see/magnifier.cc8
-rw-r--r--2005/i/robert/src/ovision/see/ovision.cc21
-rw-r--r--2005/i/robert/src/ovision/see/skittle.cc2
-rw-r--r--2005/i/robert/src/ovision/see/space.cc26
-rw-r--r--2005/i/robert/src/ovision/see/space.hh4
5 files changed, 36 insertions, 25 deletions
diff --git a/2005/i/robert/src/ovision/see/magnifier.cc b/2005/i/robert/src/ovision/see/magnifier.cc
index b61b260..8ac1eb4 100644
--- a/2005/i/robert/src/ovision/see/magnifier.cc
+++ b/2005/i/robert/src/ovision/see/magnifier.cc
@@ -69,7 +69,7 @@ Magnifier::analyse (std::vector<Zone> &zoneList)
iter->alone = !eraser_->isTooBig (*iter);
iter->small = eraser_->isTooSmall (*iter);
if (iter->partial) getPosOut (*iter);
- showZone (*iter);
+ //showZone (*iter);
//s->show ();
delete s;
find = true;
@@ -352,14 +352,14 @@ void
Magnifier::showZone (const Zone &z) const
{
std::cout << "------------------------------------------------------------------\n";
- std::cout << "<Magnifier::showZone> position : " << z.xmin << ", " << z.xmax << ", " << z.ymin << ", " << z.ymax << "\n";
+ std::cout << "<Magnifier::showZone> position image : " << z.xmin << ", " << z.xmax << ", " << z.ymin << ", " << z.ymax << "\n";
std::cout << "<Magnifier::showZone> area : " << z.area << "\n";
std::cout << "<Magnifier::showZone> small : " << z.small << "\n";
std::cout << "<Magnifier::showZone> alone : " << z.alone << "\n";
// std::cout << "<Magnifier::showZone> density: " << z.density << "\n";
// std::cout << "<Magnifier::showZone> circleUp: " << z.circleUp << "\n";
std::cout << "<Magnifier::showZone> ratio/vertical: " << z.ratio << " " << (z.vertical?"vertical":"") << "\n";
-// std::cout << "<Magnifier::showZone> orientation : " << z.pcX_ << ", " << z.pcY_ << "\n";
+ std::cout << "<Magnifier::showZone> orientation : " << z.pcX << ", " << z.pcY << "\n";
std::cout << "<Magnifier::showZone> partial : " << z.partial << "\n";
std::cout << "<Magnifier::showZone> posOut : " << z.posOut << "\n";
-}
+
diff --git a/2005/i/robert/src/ovision/see/ovision.cc b/2005/i/robert/src/ovision/see/ovision.cc
index 2cbb4a1..c66d64a 100644
--- a/2005/i/robert/src/ovision/see/ovision.cc
+++ b/2005/i/robert/src/ovision/see/ovision.cc
@@ -120,26 +120,7 @@ OVision::showInfo () const
void
OVision::getLoc (Zone &zone, int &x, int &y, int &angle, int &dist)
{
- space_->getLoc (zone.ymax, zone.centerx, x, y);
- double newPcX, newPcY;
- if (zone.pcY > 0)
- {
- newPcY = - zone.pcY;
- newPcX = - zone.pcX;
- }
- else
- {
- newPcX = zone.pcX;
- newPcY = zone.pcY;
- }
- int tmpX = (int)((zone.xmax - zone.centerx) * newPcX + zone.centerx);
- int tmpY = (int)((zone.ymax - zone.centery) * newPcY + zone.centery);
- int newX, newY;
- space_->getLoc (tmpX, tmpY, newX, newY);
- angle = (int)(atan ((double)newX / ((double)newY + 90)));
- x = newX; y = newY;
- dist = (int)sqrt (y*y + x*x);
- std::cout << "<OVision::getLoc> " << " " << newX << " " << newY << " " << angle << " " << dist << "\n";
+ space_->getRealLoc (zone, x, y, angle, dist);
}
/// Renvoie la liste des quilles
diff --git a/2005/i/robert/src/ovision/see/skittle.cc b/2005/i/robert/src/ovision/see/skittle.cc
index 602f77a..22ba407 100644
--- a/2005/i/robert/src/ovision/see/skittle.cc
+++ b/2005/i/robert/src/ovision/see/skittle.cc
@@ -170,6 +170,8 @@ Skittle::analyse (Zone &zone, const std::vector<Zone> &listReflectBand)
if ((pcY_ > 0.95) || (pcY_ < -0.95))
zone.vertical = true;
else zone.vertical = false;
+ zone.pcX = pcX_;
+ zone.pcY = pcY_;
// if ((zone.centery > 140) && (pcX_ > 0.98) && (zone.density > 0.7)
// && (zone.density < 0.85) && (zone.ratio > 0.6) && (zone.ratio < 0.8))
// return false;
diff --git a/2005/i/robert/src/ovision/see/space.cc b/2005/i/robert/src/ovision/see/space.cc
index c58268d..efba67b 100644
--- a/2005/i/robert/src/ovision/see/space.cc
+++ b/2005/i/robert/src/ovision/see/space.cc
@@ -161,3 +161,29 @@ Space::getPos (const double locX, const double locY, const double posRobotX, con
posY = posRobotY + locX*sinus + locY*cosinus;
}
+/// Give Real Location dist and angle
+void
+Space::getRealLoc (Zone &zone, int &x, int &y, int &angle, int &dist)
+{
+ // we want a pcY positive to sub it to centery
+ double newPcX, newPcY;
+ if (zone.pcY < 0)
+ {
+ newPcY = - zone.pcY;
+ newPcX = - zone.pcX;
+ }
+ else
+ {
+ newPcX = zone.pcX;
+ newPcY = zone.pcY;
+ }
+ // we are looking for the bottom of the object
+ int tmpX = (int)((zone.xmax - zone.centerx) * newPcX + zone.centerx);
+ int tmpY = (int)((zone.ymax - zone.centery) * newPcY + zone.centery);
+ std::cout << "<Space::getRealLoc> : "<< tmpX << " " << tmpY << "\n";
+ int newX, newY;
+ getLoc (tmpX, tmpY, newX, newY);
+ angle = (int)(atan ((double)newX / ((double)newY + 90)));
+ x = newX; y = newY;
+ dist = (int)sqrt (y*y + x*x);
+}
diff --git a/2005/i/robert/src/ovision/see/space.hh b/2005/i/robert/src/ovision/see/space.hh
index d848979..7e9f7e8 100644
--- a/2005/i/robert/src/ovision/see/space.hh
+++ b/2005/i/robert/src/ovision/see/space.hh
@@ -54,8 +54,10 @@ class Space
void getLoc (const int locImgX, const int locImgY, int &locX, int &locY_);
void getLoc (const int locImgX, const int locImgY, double &locX, double &locY_);
/// Donne la position reelle sur la table de la balle
- void getPos (const double locX, const double locY_, const double posRobotX,
+ void getPos (const double locX, const double locY, const double posRobotX,
const double posRobotY, const double angleRobot, double &posX, double &posY);
+ /// Give Real Location dist and angle
+ void getRealLoc (Zone &zone, int &x, int &y, int &angle, int &dist);
/// Ajoute un point pour l'etalonnage
void addSetupPoint (const int x, const int y, const int distx, const int disty);
/// Chargement des points a partir d'un fichier