From 2cccac9a44079ad6d7d474ac39e40b8e2270ead7 Mon Sep 17 00:00:00 2001 From: gaillaro Date: Sun, 1 May 2005 16:51:56 +0000 Subject: ajout des classes eraser pour tester la taille des quilles trouvées --- 2005/i/robert/src/ovision/see/imgInterface.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to '2005/i/robert/src/ovision/see/imgInterface.cc') 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 &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