summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/ui/live.cc
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/ovision/ui/live.cc')
-rw-r--r--2005/i/robert/src/ovision/ui/live.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/2005/i/robert/src/ovision/ui/live.cc b/2005/i/robert/src/ovision/ui/live.cc
index 5bc87ac..caa4e1b 100644
--- a/2005/i/robert/src/ovision/ui/live.cc
+++ b/2005/i/robert/src/ovision/ui/live.cc
@@ -20,14 +20,17 @@
/// Constructeur
/// @param *filename nom de l'image a utiliser
Live::Live (const unsigned nbImg, const ImageInput imgInput)
- : group (0), imgInput_ (imgInput)
+ : colorToFind_ (-1), group (0), imgInput_ (imgInput)
{
if (nbImg < 6) nbImg_ = 6;
else nbImg_ = nbImg;
}
+
+/// Initialisation
void
-Live::init (const char *filename)
+Live::init (const char *filename, const Image::PixelFormat pf,
+ const unsigned width, const unsigned height)
{
tex = new unsigned[nbImg_];
data = new unsigned char*[nbImg_];
@@ -36,7 +39,6 @@ Live::init (const char *filename)
// Création de l'image
img = new ImgInterface;
// Ouverture de l'image pilote et stockage
- Image::PixelFormat pf = Image::rgb;
switch (imgInput_)
{
case file:
@@ -46,7 +48,7 @@ Live::init (const char *filename)
std::string f (fname);
DataInputFile *dif = new DataInputFile (f);
DataInput *di = reinterpret_cast<DataInput*> (dif);
- reader_ = new RawReader (*di, 360, 296, pf);
+ reader_ = new RawReader (*di, width, height, pf);
}
break;
case cam:
@@ -68,6 +70,7 @@ Live::init (const char *filename)
tex[0] = loadImage(img->width_, img->height_, data[0], tex[0]);
// Initialisation de la segmentation
segm = new SegmLearn;
+ segm->setMode (pf);
segm->buildNN (oconfig->nnNbColor, Segm::loadFromFile);
mag = new Magnifier (img, segm);
segmAndGroup ();
@@ -85,20 +88,22 @@ Live::init (const char *filename)
/// Mis à jour de l'image
void
-Live::updateImg (const char *filename)
+Live::updateImg (const char *filename, const Image::PixelFormat pf,
+ const unsigned width, const unsigned height)
{
- Image::PixelFormat pf = Image::rgb;
+ segm->setMode (pf);
switch (imgInput_)
{
case file:
{
+ std::cout << "<Live::updateImg> Changement d'image : " << filename << std::endl;
// Copie du nom de l'image courante
strcpy (fname, filename);
std::string f (filename);
DataInputFile *dif = new DataInputFile (f);
DataInput *di = reinterpret_cast<DataInput*> (dif);
delete reader_;
- reader_ = new RawReader (*di, 360, 296, pf);
+ reader_ = new RawReader (*di, width, height, pf);
}
break;
case cam:
@@ -108,7 +113,7 @@ Live::updateImg (const char *filename)
img->load (*reader_);
memcpy(data[0], img->tabData_, sizeof(char) * img->nbPixels_ * 3);
tex[0] = loadImage(img->width_, img->height_, data[0], tex[0]);
- segmAndGroup ();
+ segmAndGroup (colorToFind_);
rootPics ();
}
@@ -145,6 +150,7 @@ Live::reloadConfig (const char *filename)
void
Live::segmAndGroup (const int numColorToShow)
{
+ std::cout << numColorToShow << std::endl;
// Création des groupes
delete group;
group = new Group(img, segm);
@@ -177,4 +183,3 @@ Live::segmAndGroup (const int numColorToShow)
tex[2] = loadImage(img->width_, img->height_, data[2], tex[2]);
tex[5] = loadImage(img->width_, img->height_, data[5], tex[5]);
}
-