From 27920f423dc38d443ed8fc600ca460ec57d853e7 Mon Sep 17 00:00:00 2001 From: schodet Date: Mon, 26 May 2003 14:04:31 +0000 Subject: Utilisation de la camera. --- 2003/i/buzz/src/vision/Makefile.defs | 3 ++- 2003/i/buzz/src/vision/image.cc | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to '2003/i') diff --git a/2003/i/buzz/src/vision/Makefile.defs b/2003/i/buzz/src/vision/Makefile.defs index d90037e..fd6bae9 100644 --- a/2003/i/buzz/src/vision/Makefile.defs +++ b/2003/i/buzz/src/vision/Makefile.defs @@ -1,5 +1,6 @@ TARGETS += test_image -test_image_SOURCES = test_image.cc image.cc thresholds.cc camera.a erreur.a -lppm +LIBS += vision.a +test_image_SOURCES = test_image.cc image.cc thresholds.cc camera.a erreur.a config.a $(LIBPPM) vision_a_SOURCES = image.cc thresholds.cc test_image: $(test_image_SOURCES:%.cc=%.o) diff --git a/2003/i/buzz/src/vision/image.cc b/2003/i/buzz/src/vision/image.cc index 159d5ef..24c6140 100644 --- a/2003/i/buzz/src/vision/image.cc +++ b/2003/i/buzz/src/vision/image.cc @@ -74,8 +74,16 @@ Image::Image (const Camera &camera, const Thresholds *thresholds) // Allocate memory... camera.getSize (m_width, m_height); m_image = new unsigned char [m_width * m_height * 3]; + unsigned char *image = new unsigned char [m_width * m_height]; // Lit l'image. - camera.read (m_image); + camera.read (image); + // Décode les couleurs. + for (int i = 0; i < m_width * m_height; ++i) + { + m_image[i * 3] = image[i]; + m_image[i * 3 + 1] = image[i]; + m_image[i * 3 + 2] = image[i]; + } // Alloue de la memoire pour les zones. m_zones = new unsigned char [m_width * m_height]; // Initalisation -- cgit v1.2.3