summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/camera/dumpimage.cc
diff options
context:
space:
mode:
Diffstat (limited to '2003/i/buzz/src/camera/dumpimage.cc')
-rw-r--r--2003/i/buzz/src/camera/dumpimage.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/2003/i/buzz/src/camera/dumpimage.cc b/2003/i/buzz/src/camera/dumpimage.cc
new file mode 100644
index 0000000..6692c26
--- /dev/null
+++ b/2003/i/buzz/src/camera/dumpimage.cc
@@ -0,0 +1,34 @@
+// dumpimage.cc
+// buzz - Programme du robot Efrei Robotique I1-I2 2003
+// Copyright (C) 2003 Nicolas Schodet
+//
+#include "camera.h"
+
+#include <iomanip>
+#include <unistd.h>
+
+int
+main (int argc, char **argv)
+{
+ Camera cam;
+ int w, h;
+ cam.getSize (w, h);
+ unsigned char *image = new unsigned char[w * h];
+ cout << hex;
+ int j = 0;
+ int pixel;
+ while (1)
+ {
+ cout << dec << "\n- " << j++ << hex << " ---------";
+ cam.read (image);
+ for (int i = 0; i < 256; ++i)
+ {
+ if (!(i % 16))
+ cout << endl;
+ pixel = image[i];
+ cout << setw (2) << setfill ('0') << pixel << ' ';
+ }
+ }
+ delete image;
+ return 0;
+}