embedded system library for e-puck  1.0.1
A redesigned API library for the e-puck robot platform
 All Data Structures Files Functions Variables Enumerations Enumerator Modules Pages
Files
Camera

interface of the camera module More...

Files

file  el_camera.h
 

Detailed Description

interface of the camera module

Introduction

In this library, the resolution of the image captured by the camera is fixed to 40x15 in RGB mode with a maximum frame rate of 18.432. This resolution is a result of subsampling, which means field of view (FOV) of the image is not lost. The horizontal FOV of the camera is about 56 deg while the vertical FOV is about 42 deg. Both FOV are almost fully covered in the captured image.

The camera module in this library uses dual-buffer-swapping mechanism. At any moment, data acquired from the camera are written to the front buffer while any reading functions read data from the back buffer. Once a frame is fully written, pointers to the two buffers will be swapped. This mechanism allows a frame of image to be processed concurrently with the acquisition of next frame.

Usage

To run something when a frame of image is ready, create a trigger with EL_EVENT_CAMERA_FRAME_UPDATE event.

Before reading data in the frame buffer, it (the back buffer) needs to be locked. The following structure is a typical loop to process a frame:

void CertainImageProcessingAlgorithm(){
el_uint8 pixel_rgb[3];
int X,Y,W,H;
...
for( Y=0; Y<H; Y++ ){
for( X=0; X<W; X++ ){
el_camera_get_frame_pixel( X, Y, pixel_rgb );
// pixel-wise image processing algorithm applied on RGB
...
}
}
...
}

When the frame buffer is locked, no further buffer swapping will occur. Therefore, the time cost of the image processing code ought to be less than the update interval of the frames if each of the frames from the camera need to be processed.

See Example 4 for a systematic usage of the camera module with some image processing techniques.

Configuration

In Example 3, the robot can transmit camera images via UART1. While using the serial communication utility of this library, the incoming images will be saved as BMP files. A suitable camera configuration can be tuned based on the images.

The actual frame rate achieved depends on the exposure mode used. When automatic exposure control is used and the environment is not well illuminated, the frame rate may drop to ~9. Fixed time exposure mode can be used to stablize the frame rate. For example:

...
el_camera_options_reset();
el_camera_options()->ExposureTime = 10.0f;// 10.0 gives about 14 fps
...

In EL_EXPOSURE_TIME mode, the framerate will become lower than 18.4 when the ExposureTime is set to be bigger than 7.5 approximately.

More detailed information about tuning the camera should be found in the datasheet of PO6030K.

Appendix

For reference, the setting used in the laboratory in Sheffield Robotics is:

...
el_camera_options_reset();
el_camera_options()->ExposureTime = 8.0f;// gives about 18.0 fps
el_camera_options()->AutoDigitalGain = false;
el_camera_options()->AutoWhiteBalance = false;
...