Version 2 (modified by 14 years ago) (diff) | ,
---|
Unified Camera Access
libuca
is a thin wrapper to make the different cameras (via CameraLink or PCIe) accessible in an easy way.
Specification
Properties of cameras are accessed in a vendor-neutral way by specifying the property names as defined in uca.h
. The following list is the definite specification of basic properties that all devices must implement:
Property Name | Property String | Unit | Access | Meaning |
---|---|---|---|---|
UCA_PROP_NAME | name | null-terminated C string | r | Name of camera |
UCA_PROP_WIDTH | width | pixels | r/w | Width of image to be taken |
UCA_PROP_HEIGHT | height | pixels | r/w | Height of image to be taken |
UCA_PROP_MAX_WIDTH | max-width | pixels | r | Maximum possible width |
UCA_PROP_MAX_HEIGHT | max-height | pixels | r | Maximum possible height |
UCA_PROP_BITDEPTH | bit-depth | number of bits | r | Bits per pixel |
UCA_PROP_EXPOSURE | exposure | microseconds | r/w | Duration of image capture |
UCA_PROP_FRAMERATE | frame-rate | frames per second | r | Current number of frames per second |
Code
Followingly, we will build libpco (the hardware-dependent pco.edge "driver") and libuca. First of all, get the sources
cd some-empty-dir
bzr clone bzr+ssh://user@ufo.kit.edu/vogelgesang/pco-diag libpco
bzr clone bzr+ssh://user@ufo.kit.edu/vogelgesang/uca libuca
Make sure, that you have installed the Silicon Software Runtime Environment. Then build and install libpco using
mkdir build && cd build cmake ../libpco make && sudo make install
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
.
Finally, you can build libuca
rm -rf * cmake ../libuca make
Using libuca
The following test program is supplied with libuca
and demonstrates the general functionality of the library:
#include <stdio.h> #include "uca.h" int main(int argc, char *argv[]) { struct uca_t *uca = uca_init(); if (uca == NULL) { printf("Couldn't find a camera\n"); return 1; } uint32_t width = 800, height = 600; uca->cam_set_property(uca, UCA_PROP_WIDTH, &width); uca->cam_set_property(uca, UCA_PROP_HEIGHT, &height); char camera_name[256] = "foobar"; uca->cam_get_property(uca, UCA_PROP_NAME, camera_name); printf("Camera name: %s\n", camera_name); uca_destroy(uca); return 0; }