|
Camera API Technical Report:
Camera Access |
#include <camera.h> int CameraStatus( init_str, cam_class ) char *init_str; CameraClass cam_class; Camera CameraInit( init_str, cam_class ) char *init_str; CameraClass cam_class; int CameraClose( cam ) Camera cam; Camera CameraCopy( cam ) Camera cam; int CameraGetList( camera_list ) CameraList **camera_list;
CameraStatus( init_str, cam_class ) returns zero if the specified
camera is present, 1 otherwise. The cam_class is obtained from the
camera specific header file or from the camera list (see below). The
initialisation string is camera/machine specific and for the iim camera
type is the unix device name.
CameraInit( init_str, cam_class ) opens and initialises a camera,
initialises a hidden camera structure and
returns the Camera pointer. On failure NULL is returned.
CameraClose( cam ) closes the camera and releases any allocated
resources. If the camera has been copied using CameraCopy() then
the copy will remain valid. Only the last close operation will actually
close the device.
CameraCopy( cam ) copies an existing camera structure and
attributes. Each copy can have different attribute settings and
the library will reset the camera as required when the image is grabbed.
Note the camera library also keeps a record in shared memory of which
process and which camera attributes are set in the device and so multiple
processes can access the camera safely and attributes will be reset
if necessary.
CameraGetList( camera_list ) returns the length of the camera
record list returned via the camera_list argument. The camera
record list is defined:
/* a camera list to enable querying of available cameras */
typedef struct {
char *name;
CameraType type;
CameraType interface_type;
CameraType colour_type;
CameraClass class;
char *def_init_str;
} CameraRec, *CameraList;
In each camera record the name and type of camera, camera class pointer
and default initialisation string are available. This record and camera
class pointer are also available in specific camera header files (see below).