summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/group.cc
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/ovision/see/group.cc')
-rw-r--r--2005/i/robert/src/ovision/see/group.cc20
1 files changed, 7 insertions, 13 deletions
diff --git a/2005/i/robert/src/ovision/see/group.cc b/2005/i/robert/src/ovision/see/group.cc
index eee05bb..104427f 100644
--- a/2005/i/robert/src/ovision/see/group.cc
+++ b/2005/i/robert/src/ovision/see/group.cc
@@ -12,8 +12,8 @@
/// Constructeur
/// @param *img classe image
/// @param *segm classe segm
-Group::Group (Img *img, Segm *segm)
- : segm_ (segm), img_ (img)
+Group::Group (Img *img, Segm *segm, Eraser *eraser)
+ : segm_ (segm), img_ (img), eraser_ (eraser)
{
oconfig_ = OConfig::getInstance ();
}
@@ -40,15 +40,7 @@ Group::addZone (const int idColor, const int xmin, const int xmax, const int ymi
for (std::vector<ObjectColor>::iterator iter = oconfig_->groupColor.begin ();
iter != oconfig_->groupColor.end (); ++iter)
if (idColor == iter->color)
- {
- if (iter->label == "redSkittle") zone.id = redSkittle;
- else if (iter->label == "greenSkittle") zone.id = greenSkittle;
- else if (iter->label == "border") zone.id = border;
- else if (iter->label == "base") zone.id = base;
- else if (iter->label == "gap") zone.id = gap;
- else if (iter->label == "reflectBand") zone.id = reflectBand;
- break;
- }
+ zone.id = iter->type;
zoneList_.push_back (zone);
}
@@ -66,9 +58,11 @@ void Group::plague (const unsigned char numColor, const int x, const int y)
int tmpY = img_->tabY_[y];
// Parcours de l'objet trouve de haut en bas et de gauche à droite
const int j = 2;
- while ((xmax < img_->width_-1)&& (segm_->giveColor(img_->tabData_ + ((xmax)+tmpY)*3, true, true) == numColor)) {xmax += j;}
+ const int wMinus1 = img_->width_-1;
+ const int hMinus1 = img_->height_-1;
+ while ((xmax < wMinus1)&& (segm_->giveColor(img_->tabData_ + ((xmax)+tmpY)*3, true, true) == numColor)) {xmax += j;}
while ((xmin > 0) && (segm_->giveColor(img_->tabData_ + ((xmin)+tmpY)*3, true, true) == numColor)) {xmin -= j;}
- while ((ymax < img_->height_-1) && (segm_->giveColor(img_->tabData_ + (img_->tabY_[ymax] + x)*3, true, true) == numColor)) {ymax +=j;}
+ while ((ymax < hMinus1) && (segm_->giveColor(img_->tabData_ + (img_->tabY_[ymax] + x)*3, true, true) == numColor)) {ymax +=j;}
while ((ymin > 0) && (segm_->giveColor(img_->tabData_ + (img_->tabY_[ymin]+x)*3, true, true) == numColor)) {ymin -= j;}
// Ajout de la zone