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.cc29
1 files changed, 12 insertions, 17 deletions
diff --git a/2005/i/robert/src/ovision/ui/live.cc b/2005/i/robert/src/ovision/ui/live.cc
index 62bd1ad..60918ac 100644
--- a/2005/i/robert/src/ovision/ui/live.cc
+++ b/2005/i/robert/src/ovision/ui/live.cc
@@ -20,7 +20,8 @@
/// Constructeur
/// @param *filename nom de l'image a utiliser
Live::Live (const unsigned nbImg, const ImageInput imgInput)
- : colorToFind_ (-1), group (0), imgInput_ (imgInput)
+ : colorToFind_ (-1), group (0), width_ (640), height_ (480),
+ imgInput_ (imgInput)
{
if (nbImg < 6) nbImg_ = 6;
else nbImg_ = nbImg;
@@ -29,13 +30,14 @@ Live::Live (const unsigned nbImg, const ImageInput imgInput)
/// Initialisation
void
-Live::init (const Image::PixelFormat pf, const char *filename,
- const unsigned width, const unsigned height)
+Live::init (const Image::PixelFormat pf, const char *filename)
{
tex = new unsigned[nbImg_];
data = new unsigned char*[nbImg_];
// Creation de oconfig
oconfig = new OConfig ();
+ width_ = oconfig->width;
+ height_ = oconfig->height;
// Création de l'image
img = new ImgInterface;
// Ouverture de l'image pilote et stockage
@@ -48,15 +50,14 @@ Live::init (const Image::PixelFormat pf, const char *filename,
std::string f (fname);
DataInputFile *dif = new DataInputFile (f);
DataInput *di = reinterpret_cast<DataInput*> (dif);
- reader_ = new RawReader (*di, width, height, pf);
+ reader_ = new RawReader (*di, width_, height_, pf);
}
break;
case cam:
{
Video4Linux *r;
- r = new Video4Linux ("/dev/video", pf, oconfig_->brightness);
+ r = new Video4Linux ("/dev/video", width_, height_, pf, oconfig->brightness);
r->calibrate ();
- r->setAdaptive (0);
reader_ = reinterpret_cast<ImageReader*> (r);
}
break;
@@ -77,20 +78,12 @@ Live::init (const Image::PixelFormat pf, const char *filename,
segmAndGroup ();
// Affichage de l'image pilote avec la couleur d'aquisition et en RGB
tex[1] = loadImage (img->width_, img->height_, data[0], tex[1]);
- /*if (img->colorMode_ != Image::rgb)
- {
- ConvertImg conv;
- conv.ConvertToRGB (*img);
- tex[3] = loadImage (img->width_, img->height_, data[0], tex[4]);
- img->loadRaw (fname, Image::rgb, 360, 296);
- }*/
rootPics ();
}
/// Mis à jour de l'image
void
-Live::updateImg (const Image::PixelFormat pf, const char *filename,
- const unsigned width, const unsigned height)
+Live::updateImg (const Image::PixelFormat pf, const char *filename)
{
segm->setMode (pf);
switch (imgInput_)
@@ -104,7 +97,7 @@ Live::updateImg (const Image::PixelFormat pf, const char *filename,
DataInputFile *dif = new DataInputFile (f);
DataInput *di = reinterpret_cast<DataInput*> (dif);
delete reader_;
- reader_ = new RawReader (*di, width, height, pf);
+ reader_ = new RawReader (*di, width_, height_, pf);
}
break;
case cam:
@@ -171,6 +164,7 @@ Live::segmAndGroup (const int numColorToShow)
list = mag->getItemList ((Group::ZoneType)oconfig->uiGroupToDisplay);
}
// Création de l'image des groupes
+ segm->segmImg (img);
img->doGroupImg (list);
img->doImg (img->getTabSegm ());
memcpy (data[5], img->getTabOut (), sizeof (char)*img->nbPixels_*3);
@@ -182,7 +176,8 @@ Live::segmAndGroup (const int numColorToShow)
segm->segmImg (img);
img->addGroupToDisplay (img->getTabSegm (), list);
}
- img->doImg (img->getTabSegm ());
+ // Création de l'image segmentée
+ img->doImg ();
memcpy (data[2], img->getTabOut (), sizeof (char)*img->nbPixels_*3);
tex[2] = loadImage(img->width_, img->height_, data[2], tex[2]);
tex[5] = loadImage(img->width_, img->height_, data[5], tex[5]);