summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/imgInterface.cc
diff options
context:
space:
mode:
authorgaillaro2005-05-01 16:51:56 +0000
committergaillaro2005-05-01 16:51:56 +0000
commit2cccac9a44079ad6d7d474ac39e40b8e2270ead7 (patch)
treedbc82e2031075bc136009477ce65ba4b9682aff1 /2005/i/robert/src/ovision/see/imgInterface.cc
parent45833f980001efc4ee7468187a4a37042776e12e (diff)
ajout des classes eraser pour tester la taille des quilles trouvées
Diffstat (limited to '2005/i/robert/src/ovision/see/imgInterface.cc')
-rw-r--r--2005/i/robert/src/ovision/see/imgInterface.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/2005/i/robert/src/ovision/see/imgInterface.cc b/2005/i/robert/src/ovision/see/imgInterface.cc
index bafe0b3..d41000d 100644
--- a/2005/i/robert/src/ovision/see/imgInterface.cc
+++ b/2005/i/robert/src/ovision/see/imgInterface.cc
@@ -15,6 +15,12 @@ ImgInterface::ImgInterface ()
: tabOut_ (0)
{}
+/// Destructeur
+ImgInterface::~ImgInterface ()
+{
+ delete [] tabOut_;
+}
+
/// Cree un tableau en RGB pour l'affichage a partir d'une image segmentee
/// @param *tabIn pointeur vers un tableau de donnees segmentees
/// @param *tabOut_ pointeur vers un tableau de donnees RGB
@@ -23,8 +29,8 @@ ImgInterface::doImg (const unsigned char *tabIn)
{
/// Initialise les données
if (!tabIn) tabIn = tabSegm_;
- delete [] tabOut_;
- tabOut_ = new unsigned char [nbPixels_ * 3];
+ if (!tabOut_)
+ tabOut_ = new unsigned char [nbPixels_ * 3];
/// Remplissage de tabOut
if (tabIn)
{
@@ -130,15 +136,14 @@ ImgInterface::doGroupImg (const std::vector<Zone> &zoneList, bool init)
// On verifie que des groupes ont ete trouve
if (zoneList.empty ()) {
std::cerr << "ImgInterface::doGroupImg: No group defined" << std::endl;
- delete [] tabSegm_;
- tabSegm_ = 0;
+ init = 1;
return;
}
if (init)
{
// Allocation de la memoire
- delete [] tabSegm_;
- tabSegm_ = new unsigned char[nbPixels_];
+ if (!tabSegm_)
+ tabSegm_ = new unsigned char[nbPixels_];
// On initialise le tableau pour une image noire
for (unsigned int i=0; i<nbPixels_; i++)
tabSegm_[i] = 0;