Introduction to CL Eye Multicam C++ APIAuthor: AlexPDate: 12-31-2009
The CL-Eye Multicam C++ API provides users with multiple camera support in a range of application including high performance tracking and computer vision. Included is a number of code samples in various programming languages to jumpstart users into...
CL-Eye Multicam API
This latest version of the CL-Eye Platform SDK contains the updated CL-Eye Multicam API provides developers the ability to individually and independently create and control each camera on their system. The framework is built around modularized approach. The CL-Eye Multicam exposes a simple C stype API for ease of using and porting to other programming languages.
Without further ado lets take a look at the CLEyeMulticam.h header file:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// This library is part of CL-Eye Platform SDK
// It allows the use of multiple CL-Eye cameras in your own applications
//
// For updates and file downloads go to: codelaboratories.com/downloads
//
// Copyright 2008-2010 (c) Code Laboratories, Inc. All rights reserved.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <windows.h>
#define CLEYEMULTICAM_API extern "C" __declspec(dllimport)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CLEyeMulticam Camera API
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// camera instance
typedef void *CLEyeCameraInstance;
// camera color mode
typedef enum
{
CLEYE_GRAYSCALE,
CLEYE_COLOR
}CLEyeCameraColorMode;
// camera resolution
typedef enum
{
CLEYE_QVGA, // Allowed frame rates: 15, 30, 60, 75, 100, 125
CLEYE_VGA // Allowed frame rates: 15, 30, 40, 50, 60, 75
}CLEyeCameraResolution;
// camera parameters
typedef enum
{
// camera sensor parameters
CLEYE_AUTO_GAIN, // [false, true]
CLEYE_GAIN, // [0, 79]
CLEYE_AUTO_EXPOSURE, // [false, true]
CLEYE_EXPOSURE, // [0, 511]
CLEYE_AUTO_WHITEBALANCE, // [false, true]
CLEYE_WHITEBALANCE_RED, // [0, 255]
CLEYE_WHITEBALANCE_GREEN, // [0, 255]
CLEYE_WHITEBALANCE_BLUE, // [0, 255]
// camera linear transform parameters
CLEYE_HFLIP, // [false, true]
CLEYE_VFLIP, // [false, true]
CLEYE_HKEYSTONE, // [-500, 500]
CLEYE_VKEYSTONE, // [-500, 500]
CLEYE_XOFFSET, // [-500, 500]
CLEYE_YOFFSET, // [-500, 500]
CLEYE_ROTATION, // [-500, 500]
CLEYE_ZOOM, // [-500, 500]
// camera non-linear transform parameters
CLEYE_LENSCORRECTION1, // [-500, 500]
CLEYE_LENSCORRECTION2, // [-500, 500]
CLEYE_LENSCORRECTION3, // [-500, 500]
CLEYE_LENSBRIGHTNESS // [-500, 500]
}CLEyeCameraParameter;
// Camera information
CLEYEMULTICAM_API int CLEyeGetCameraCount();
CLEYEMULTICAM_API GUID CLEyeGetCameraUUID(int camId);
// Library initialization
CLEYEMULTICAM_API CLEyeCameraInstance CLEyeCreateCamera(GUID camUUID, CLEyeCameraColorMode mode, CLEyeCameraResolution res, int frameRate);
CLEYEMULTICAM_API bool CLEyeDestroyCamera(CLEyeCameraInstance cam);
// Camera capture control
CLEYEMULTICAM_API bool CLEyeCameraStart(CLEyeCameraInstance cam);
CLEYEMULTICAM_API bool CLEyeCameraStop(CLEyeCameraInstance cam);
// Camera settings control
CLEYEMULTICAM_API bool CLEyeSetCameraParameter(CLEyeCameraInstance cam, CLEyeCameraParameter param, int val);
CLEYEMULTICAM_API int CLEyeGetCameraParameter(CLEyeCameraInstance cam, CLEyeCameraParameter param);
// Camera video frame image data retrieval
CLEYEMULTICAM_API bool CLEyeCameraGetFrameDimensions(CLEyeCameraInstance cam, int &width, int &height);
CLEYEMULTICAM_API bool CLEyeCameraGetFrame(CLEyeCameraInstance cam, PBYTE pData, int waitTimeout = 2000);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
CL-Eye Multicam Variables CLEyeCameraInstance Represents the camera instance. This value should be used throughout the API once it is initialized by calling CLEyeCreateCamera.
CLEyeCameraColorMode - Enumeration of possible color modes: CLEYE_GRAYSCALE - 8 bit per pixel grayscale image CLEYE_COLOR - 32bit per pixel RGBA image
CLEyeCameraResolution - Enumeration of possible resolution modes: CLEYE_QVGA - 320x240 image resolurion CLEYE_VGA - 640x480 image resolution
Camera Framerate - Depending on the selected resolution modes here is the list of allowed framerate values: CLEYE_QVGA - 15, 30, 60, 75, 100, 125 CLEYE_VGA - 15, 30, 40, 50, 60, 75
CLEyeCameraUIID
The unique camera UUID. This represents the unique identifier for a given camera that stays with that camera no matter if it gets plugged in to another USB port or another system. This allows allows developers to uniquely track cameras by saving the camera UUID values in their application configuration file. This value can be retrieved by calling CLEyeGetCameraUUID function.
CLEyeCameraParameter
Various camera sensor and filter properties, see below for full parameter description.
CL-Eye Multicam Camera Parameters CLEYE_AUTO_GAIN [false, true] Automatically determines best gain value.
CLEYE_GAIN [0, 79] Controls the camera signal gain (when auto gain is false).
CLEYE_AUTO_EXPOSURE [false, true] Automatically determines best exposure value.
CLEYE_EXPOSURE [0, 511] Controls the sensor exposure time (when auto exposure is false).
CLEYE_AUTO_WHITEBALANCE [false, true] Automatically determines best color settings.
CLEYE_WHITEBALANCE_RED [0, 255] Controls the red color gain (when auto white balance is false).
CLEYE_WHITEBALANCE_GREEN [0, 255] Controls the green color gain (when auto white balance is false).
CLEYE_WHITEBALANCE_BLUE [0, 255] Controls the blue color gain (when auto white balance is false).
CLEYE_HFLIP [false, true] Flip video horizontally.
CLEYE_VFLIP [false, true] Flip video vertically.
CLEYE_HKEYSTONE [-500, 500] Adjust horizontal video keystone.
CLEYE_VKEYSTONE [-500, 500] Adjust vertical video keystone.
CLEYE_XOFFSET [-500, 500] Translate video on X axis by an offset.
CLEYE_YOFFSET [-500, 500] Translate video on Y axis by an offset.
CLEYE_ROTATION [-500, 500] Rotate video image around center point.
CLEYE_ZOOM [-500, 500] Scale video to simulate digital zoom.
CLEYE_LENSCORRECTION1 [-500, 500] Correction transforms to correct lens distortion.
CLEYE_LENSCORRECTION2 [-500, 500] Correction transforms to correct lens distortion.
CLEYE_LENSCORRECTION3 [-500, 500] Correction transforms to correct lens distortion.
CLEYE_LENSBRIGHTNESS [-500, 500] Correction of image brightness due to lens distortion.
CL-Eye Multicam Functions int CLEyeGetCameraCount() returns CameraCount as int Returns number of currently connected and detected cameras.
GUID CLEyeGetCameraUUID(CameraIndex as int) Returns UUID: Camera unique identifier (UUID) for specified camera index.
CLEyeCameraInstance CLEyeCreateCamera(CamUIID as GUID, CLEyeCameraColorMode, CLEyeCameraResolution, Framerate as int) returns CLEyeCameraInstance Creates CLEyeCameraInstance from the camera UUID and sets the desired camera color mode, resolution and frame rate. Returns CLEyeCameraInstance value of NULL if it fails.
bool CLEyeDestroyCamera(CLEyeCameraInstance) Destroys specified CLEyeCameraInstance. Returns true if it succeeds and false if it fails.
bool CLEyeCameraStart(CLEyeCameraInstance) Starts camera video capturing for specified camera instance. Returns true if it succeeds and false if it fails.
bool CLEyeCameraStop(CLEyeCameraInstance) Stops camera video capturing for specified camera instance. Returns true if it succeeds and false if it fails.
bool CLEyeSetCameraParameter(CLEyeCameraInstance, CLEyeCameraParameter, Value as int) Sets given camera parameter (See CLEyeCameraParameters for details) value for specified camera instance. Returns true if it succeeds and false if it fails.
int CLEyeGetCameraParameter(CLEyeCameraInstance, CLEyeCameraParameter) Returns given camera parameter (See CLEyeCameraParameters for details) value for specified camera instance.
bool CLEyeCameraGetFrameDimensions(CLEyeCameraInstance, Width as int, Height as int) Returns the video frame size for specified camera instance. Returns true if it succeeds and false if it fails.
bool CLEyeCameraGetFrame(CLEyeCameraInstance, ImageData as PBYTE, Timeout as int) Waits at most Timeout number of milliseconds (default 2000ms) for the latest video frame. Returns true if it succeeds and false if it fails. If the function succeeds, it also returns video frame data from a specified camera instance.
CL-Eye Platform Downloads
You can find more code examples in our downloads page: CL-Eye Platform Downloads