root / trunk / code / projects / colonet / vision / vision_driver.c @ 466
History | View | Annotate | Download (722 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 |
const 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 |
printf("Got %d positions.\n", num_positions);
|
25 |
|
26 |
int i;
|
27 |
for (i = 0; i < num_positions; i++) { |
28 |
printf("%d,%d\n", positions[i].x, positions[i].y);
|
29 |
} |
30 |
|
31 |
free(positions); |
32 |
|
33 |
vision_destroy(); |
34 |
|
35 |
return 0; |
36 |
} |