Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / colonet / server / vision / vision_driver.c @ 627

History | View | Annotate | Download (804 Bytes)

1
/**
2
 * Driver for testing vision library.
3
 */
4

    
5
#include <vision.h>
6
#include <stdio.h>
7
#include <stdlib.h>
8

    
9
int main(int argc, char** argv) {
10
  char* filename = (argc == 2) ? argv[1] : (char*)"colonet.jpg";
11

    
12
  printf("vision_init(%s)\n", filename);
13

    
14
  if (vision_init(filename) != 0) {
15
    fprintf(stderr, "init_vision failed.\n");
16
    return -1;
17
  } else {
18
    fprintf(stderr, "vision_init succeeded.\n");
19
  }
20

    
21
  VisionPosition* positions;
22
  int num_positions = vision_get_robot_positions(&positions);
23

    
24
  if (num_positions == -1) {
25
    fprintf(stderr, "vision_get_robot_positions failed.\n");
26
    return 1;
27
  }
28

    
29
  printf("Got %d positions.\n", num_positions);
30

    
31
  int i;
32
  for (i = 0; i < num_positions; i++) {
33
    printf("%d,%d\n", positions[i].x, positions[i].y);
34
  }
35

    
36
  free(positions);
37

    
38
  return 0;
39
}