summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschodet2003-05-26 14:04:31 +0000
committerschodet2003-05-26 14:04:31 +0000
commit27920f423dc38d443ed8fc600ca460ec57d853e7 (patch)
tree79b303cb0b0fdb3572a168a683f24b16c7eab8c7
parent6096a33b9be9f9fa175bda07475b9011a855203c (diff)
Utilisation de la camera.
-rw-r--r--2003/i/buzz/src/vision/Makefile.defs3
-rw-r--r--2003/i/buzz/src/vision/image.cc10
2 files changed, 11 insertions, 2 deletions
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