summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/camera/dumpimage.cc
blob: 90909af96499430049600535269650aa6ba8e7c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// dumpimage.cc
// buzz - Programme du robot Efrei Robotique I1-I2 2003
// Copyright (C) 2003 Nicolas Schodet
//
#include "camera.h"
#include "date/date.h"

#include <iomanip>
#include <unistd.h>

int
main (int argc, char **argv)
{
    Camera cam;
    Date date;
    int w, h, d;
    cam.getSize (w, h, d);
    unsigned char *image = new unsigned char[w * h * d];
    cout << hex;
    int j = 0;
    int pixel;
    while (1)
      {
	cout << dec << "\n- " << j++ << hex << " ---------";
	while (cam.read (image) == 0);
	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;
}