summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/camera/test_camera.cc
blob: 1868ad55caea39a9f19c5448f3632b1adc095d8b (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
// test_camera.cc
// buzz - Programme du robot Efrei Robotique I1-I2 2003
// Copyright (C) 2003 Nicolas Schodet
//
#include "camera.h"

#include <fstream>

int
main (int argc, char **argv)
{
    Camera cam;
    ofstream o0 (argc >= 2 ? argv[1] : "camera0.raw");
    ofstream o1 (argc >= 3 ? argv[2] : "camera1.raw");
    ofstream o2 (argc == 4 ? argv[3] : "camera2.raw");
    int w, h;
    cam.getSize (w, h);
    unsigned char *image = new unsigned char[w * h * 3];
    cam.read (image);
    o0.write (image, w * h * 3);
    o0.close ();
    cam.read (image);
    o1.write (image, w * h * 3);
    o1.close ();
    cam.read (image);
    o2.write (image, w * h * 3);
    o2.close ();
}