summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/camera/dumpimage.cc
blob: e617c6a2a6f290b7f1bed65860d09a6e4c45acdb (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
// 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 * 3];
    cout << hex;
    int j = 0;
    int pixel;
    while (1)
      {
	cout << dec << "\n- " << j++ << hex << " ---------";
	while (cam.read (image) == 0) sleep (1);
	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;
}