EpuckCamera Class Reference

Class for to get images from e-puck camera. More...

#include <epuckCamera.hpp>

Inheritance diagram for EpuckCamera:
Collaboration diagram for EpuckCamera:

List of all members.


Detailed Description

Class for to get images from e-puck camera.

Exceptions:
camera_version_errorRaised when the version of camera in e-puck is unknown.
window_length_errorRaised when the desired image window width or height is larger that e-puck camera can support.
window_out_of_rangeRaised when the positioning of image window is out of image sensor border.
Author:
Renato Florentino Garcia.
Date:
October 2008

Classes

class  camera_version_error
class  window_length_error
class  window_out_of_range

Public Types

enum  ColorModes { GREY_SCALE_MODE = 0, RGB_565_MODE = 1, YUV_MODE = 2 }
 Possible color modes for e-puck camera. More...

Public Member Functions

 EpuckCamera (const SerialPort *const serialPort, unsigned sensor_x1, unsigned sensor_y1, unsigned sensor_width, unsigned sensor_height, unsigned zoom_fact_width, unsigned zoom_fact_height, ColorModes color_mode) throw ()
 The EpuckCamera class constructor.
void Initialize ()
 Send the configurations givens in EpuckCamera constructor to e-puck.
std::string GetCameraVersion () const
 Get the version of camera in e-puck.
void GetCameraData (unsigned &imageWidth, unsigned &imageHeight, EpuckCamera::ColorModes &colorMode) const
 Get the relevant configurations camera data.
void GetImage (unsigned char *const ptrImage)
 Get a new image from e-puck.

Private Types

enum  { bpp_8, bpp_16 }

Private Member Functions

void checkCameraParameters () const
template<typename T >
void processTmpImage (T *ptrImage) const

Private Attributes

unsigned sensor_x1
unsigned sensor_y1
unsigned sensor_width
unsigned sensor_height
unsigned zoom_fact_width
unsigned zoom_fact_height
ColorModes color_mode
enum EpuckCamera:: { ... }  bpp
unsigned imageByteSize
unsigned imagePixelSize
unsigned rowPixelLength
unsigned columnPixelLength
unsigned epuckCameraVersion
unsigned char * tmpImage
bool tmpImageAllocated

Static Private Attributes

static const unsigned PO3030K = 0x3030
static const unsigned PO6030K = 0x6030

Member Enumeration Documentation

Possible color modes for e-puck camera.

This are the possible color modes for e-puck camera. The YUV_MODE is unknown by Player, because of that, in this mode the variable "format" of playerc_camera_t struct, will be set to PLAYER_CAMERA_FORMAT_MONO16.

Enumerator:
GREY_SCALE_MODE 

Grey color mode, with 8 bits per pixel.

RGB_565_MODE 

RGB color mode, with 16 bits per pixel.

YUV_MODE 

YUV color mode, with 16 bits per pixel.


Constructor & Destructor Documentation

EpuckCamera::EpuckCamera ( const SerialPort *const  serialPort,
unsigned  sensor_x1,
unsigned  sensor_y1,
unsigned  sensor_width,
unsigned  sensor_height,
unsigned  zoom_fact_width,
unsigned  zoom_fact_height,
ColorModes  color_mode 
) throw ()

The EpuckCamera class constructor.

Except by serialPort, the other variables are mapped directly to variables with same name in e_po3030k_config_cam function, from official e-puck library.

Parameters:
serialPortPointer for a SerialPort class already created and connected with an e-puck.
sensor_x1The X coordinate of the window's corner.
sensor_y1The Y coordinate of the window's corner.
sensor_widthThe Width of the interest area, in FULL sampling scale.
sensor_heightThe Height of the insterest area, in FULL sampling scale .
zoom_fact_widthThe subsampling to apply for the window's width.
zoom_fact_heightThe subsampling to apply for the window's height.
color_modeThe color mode in which the camera should be configured.

References GREY_SCALE_MODE, RGB_565_MODE, and YUV_MODE.


Member Function Documentation

void EpuckCamera::GetCameraData ( unsigned &  imageWidth,
unsigned &  imageHeight,
EpuckCamera::ColorModes colorMode 
) const

Get the relevant configurations camera data.

Parameters:
imageWidthImage width in pixels.
imageHeightImage height in pixels.
colorModeImage color mode.
std::string EpuckCamera::GetCameraVersion ( ) const

Get the version of camera in e-puck.

This method must be called after the Initialize method.
It can throw the camera_version_error exception.

Returns:
A string representing the camera version.
void EpuckCamera::GetImage ( unsigned char *const  ptrImage)

Get a new image from e-puck.

Parameters:
ptrImageA pointer to a const char vector, where the incoming image will be put it.

References EpuckInterface::GET_CAMERA_IMG, SerialPort::recvUnsignedCharArray(), and EpuckInterface::serialPort.

Here is the call graph for this function:

void EpuckCamera::Initialize ( )

Send the configurations givens in EpuckCamera constructor to e-puck.

This function must be called before an image be captured.
It can throw the following exceptions: std::length_error, camera_version_error, window_length_error and window_out_of_range.

References EpuckInterface::CONFIG_CAMERA, SerialPort::recvChar(), SerialPort::recvUnsigned(), SerialPort::sendInt(), and EpuckInterface::serialPort.

Here is the call graph for this function:


The documentation for this class was generated from the following files: