| 22 | Followingly, we will build libpco (the hardware-dependent pco.edge "driver") and libuca. First of all, get the sources |
| 23 | {{{ |
| 24 | #!sh |
| 25 | cd some-empty-dir |
| 26 | bzr clone bzr+ssh://user@ufo.kit.edu/vogelgesang/pco-diag libpco |
| 27 | bzr clone bzr+ssh://user@ufo.kit.edu/vogelgesang/uca libuca |
| 28 | }}} |
| 29 | |
| 30 | Make sure, that you have installed the Silicon Software [http://www.silicon-software.de/download.html Runtime Environment]. Then build and install libpco using |
| 31 | {{{ |
| 32 | #!sh |
| 33 | mkdir build && cd build |
| 34 | cmake ../libpco |
| 35 | make && sudo make install |
| 36 | }}} |
| 37 | If everything went okay, you can try the `diagnose` program in the build directory. It tries to open the camera and frame grabber, prints out some information and stores one frame as `out.raw`. |
| 38 | |
| 39 | Finally, you can build libuca |
| 40 | {{{ |
| 41 | #!sh |
| 42 | rm -rf * |
| 43 | cmake ../libuca |
| 44 | make |
| 45 | }}} |
| 46 | |
| 47 | == Using libuca == |
| 48 | |
| 49 | The following test program is supplied with `libuca` and demonstrates the general functionality of the library: |
| 50 | |
| 51 | {{{ |
| 52 | #!c |
| 53 | #include <stdio.h> |
| 54 | #include "uca.h" |
| 55 | |
| 56 | int main(int argc, char *argv[]) |
| 57 | { |
| 58 | struct uca_t *uca = uca_init(); |
| 59 | if (uca == NULL) { |
| 60 | printf("Couldn't find a camera\n"); |
| 61 | return 1; |
| 62 | } |
| 63 | |
| 64 | uint32_t width = 800, height = 600; |
| 65 | uca->cam_set_property(uca, UCA_PROP_WIDTH, &width); |
| 66 | uca->cam_set_property(uca, UCA_PROP_HEIGHT, &height); |
| 67 | |
| 68 | char camera_name[256] = "foobar"; |
| 69 | uca->cam_get_property(uca, UCA_PROP_NAME, camera_name); |
| 70 | |
| 71 | printf("Camera name: %s\n", camera_name); |
| 72 | |
| 73 | uca_destroy(uca); |
| 74 | return 0; |
| 75 | } |
| 76 | }}} |