summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/imgInterface.cc
diff options
context:
space:
mode:
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;