rec::robotino::api2 C interface
Macros | Typedefs | Functions
Camera.h File Reference

In "rec/robotino/api2/c/Camera.h" you can find functions for reading Robotino's camera. More...

#include "rec/robotino/api2/c/globals.h"
#include "rec/robotino/api2/c/Com.h"

Go to the source code of this file.

Macros

#define INVALID_CAMERAID   -1
 

Typedefs

typedef int CameraId
 

Functions

DLLEXPORT CameraId Camera_construct ()
 
DLLEXPORT BOOL Camera_destroy (CameraId id)
 
DLLEXPORT BOOL Camera_setComId (CameraId id, ComId comId)
 
DLLEXPORT BOOL Camera_setCameraNumber (CameraId id, unsigned int n)
 
DLLEXPORT unsigned int numCameras ()
 
DLLEXPORT BOOL Camera_grab (CameraId id)
 
DLLEXPORT BOOL Camera_imageSize (CameraId id, unsigned int *width, unsigned int *height)
 
DLLEXPORT BOOL Camera_getImage (CameraId id, unsigned char *imageBuffer, unsigned int imageBufferSize, unsigned int *width, unsigned int *height)
 
DLLEXPORT BOOL Camera_setFormat (CameraId id, unsigned int width, unsigned int height)
 
DLLEXPORT BOOL Camera_setStreaming (CameraId id, BOOL streaming)
 

Detailed Description

In "rec/robotino/api2/c/Camera.h" you can find functions for reading Robotino's camera.

Use Camera_construct() to create a new camera object. Associate the camera object with a com object using Camera_setComId(). Use Camera_setStreaming() to enable/disable streaming of images. Use Camera_getImage() to get images from Robotino's camera.

Macro Definition Documentation

#define INVALID_CAMERAID   -1

Invalid CameraId is -1

Typedef Documentation

typedef int CameraId

CameraId

Function Documentation

DLLEXPORT CameraId Camera_construct ( )

Construct an Camera object

Returns
Returns the ID of the newly constructed Camera object.
DLLEXPORT BOOL Camera_destroy ( CameraId  id)

Destroy the Camera object assigned to id

Parameters
idThe id of the Camera object to be destroyed
Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given CameraId is invalid.
DLLEXPORT BOOL Camera_getImage ( CameraId  id,
unsigned char *  imageBuffer,
unsigned int  imageBufferSize,
unsigned int *  width,
unsigned int *  height 
)

Get Robotino's camera image. Do not forget to call Camera_setStreaming( id, TRUE ) and Camera_grab first. Get the size of the image by Camera_imageSize first. imageBufferSize must be at least 3*width*height. The image copied to image buffer is an interleaved RGB image width 3 channels and 1 byte per channel.

Parameters
idThe camera id.
imageBufferThe image is copied to imageBuffer.
imageBufferSizeThe size (number of bytes) of imageBuffer.
widthImage width.
heightImage height.
Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given CameraId.
See also
Camera_setStreaming Camera_imageSize
DLLEXPORT BOOL Camera_grab ( CameraId  id)

Grab image.

Parameters
idThe camera id.
Returns
Returns TRUE (1) if a new image is available since the last call of Camera_grab. Returns FALSE (0) otherwise.
DLLEXPORT BOOL Camera_imageSize ( CameraId  id,
unsigned int *  width,
unsigned int *  height 
)

Size of image aquired by grab.

Parameters
idThe camera id.
widthImage width.
heightImage height.
Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given CameraId is invalid or if no image has been grabed up to this point in time.
DLLEXPORT BOOL Camera_setCameraNumber ( CameraId  id,
unsigned int  n 
)

Sets the number of this camera device.

Parameters
idThe id of the camera object to be set
nThe camera number. Range [0 - numCameras()]
Exceptions
ReturnsTRUE (1) on success otherwise FALSE (0)
DLLEXPORT BOOL Camera_setComId ( CameraId  id,
ComId  comId 
)

Associated an Camera object with a communication interface, i.e. binding the Camera to a specific Robotino

Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given CameraId or ComId is invalid.
DLLEXPORT BOOL Camera_setFormat ( CameraId  id,
unsigned int  width,
unsigned int  height 
)

Set the image format

Parameters
idThe camera id.
widthImage width.
heightImage height.
Returns
Returns TRUE (1) on success. Returns FALSE (0) if the given CameraId is invalid.
DLLEXPORT BOOL Camera_setStreaming ( CameraId  id,
BOOL  streaming 
)

Only for compatibility reasons. Function does nothing and always returns TRUE.

Parameters
idThe camera id.
streaming
Returns
Returns TRUE.
DLLEXPORT unsigned int numCameras ( )
Returns
Returns the number of analog inputs.