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
el_camera.h
Go to the documentation of this file.
1 /*
2 
3 embedded system library for e-puck
4 
5 --------------------------------------------------------------------------------
6 
7 code distribution:
8 https://github.com/jianingchen/epucklib
9 
10 online documentation:
11 http://jianingchen.github.io/epucklib/html/
12 
13 --------------------------------------------------------------------------------
14 
15 This file is released under the terms of the MIT license (see "el.h").
16 
17 */
18 
28 #ifndef EL_CAMERA_H
29 #define EL_CAMERA_H
30 
31 #include "el_common.h"
32 #include "el_clock.h"
33 
34 #define EL_CAMERA_FRAME_DIM_X 40
35 #define EL_CAMERA_FRAME_DIM_Y 15
36 
41 typedef enum {
47 
48 
57 typedef struct {
59  el_bool AutoWhiteBalance;
60  el_bool AutoDigitalGain;
61  float ExposureTime;
65  float GlobalGain;
66  float DigitalGain;
67  float RedGain;
68  float GreenGain;
69  float BlueGain;
71 
72 
77 typedef struct {
78  el_uint16 Width;
79  el_uint16 Height;
80  el_uint16 Data[EL_CAMERA_FRAME_DIM_Y][EL_CAMERA_FRAME_DIM_X];
82 
83 /*
84 --------------------------------------------------------------------------------
85 */
86 
87 
92 void el_enable_camera();
93 
94 
99 void el_disable_camera();
100 
101 
108 
109 
116 
117 
125 
126 
153 void el_config_camera(const el_camera_param*p);
154 
155 
164 void el_camera_lock_frame();
165 
166 
172 
173 
180 
181 
182 
190 el_uint32 el_camera_get_frame_counter();
191 
192 
202 void el_camera_get_frame_pixel(int X,int Y,el_uint8*out3v);
203 
204 
212 el_uint16 el_camera_get_frame_width();
213 
214 
222 el_uint16 el_camera_get_frame_height();
223 
224 
231 
232 
233 /*
234 --------------------------------------------------------------------------------
235 */
236 
237 
238 #ifdef EL_INCLUDE_LIB_INTERNAL_CONTEXT
239 
240 #define EL_CAM_I2C_ID 0xDC
241 
242 extern el_uint16 el_cam_device_id;
243 extern el_uint16 el_cam_revision_n;
244 extern el_uint8 el_cam_auto_function;
245 extern bool el_cam_enabled;
246 extern volatile el_uint16 el_cam_lock_buffer;
247 extern volatile el_uint32 el_cam_frame_counter;
248 extern el_camera_image *el_cam_r_frame;
249 extern el_camera_image *el_cam_w_frame;
250 extern el_uint16 *el_cam_line_pointer;
251 extern el_uint16 *el_cam_pixel_pointer;
252 extern el_uint16 el_cam_x;
253 extern el_uint16 el_cam_y;
254 
255 void el_init_camera(void);
256 void el_cam_init_register(void);
257 void el_cam_swap_buffer(void);
258 
259 #endif /* EL_INCLUDE_LIB_INTERNAL_CONTEXT */
260 
261 #endif /* EL_CAMERA_H */
float ExternalLinearGain
valid range is ( 0.0, 256.0 )
Definition: el_camera.h:63
void el_camera_get_frame_pixel(int X, int Y, el_uint8 *out3v)
get the color of a pixel in current frame buffer.
float ExposureTime
sensible range is [ 1.0, 20.0 ]
Definition: el_camera.h:61
void el_config_camera(const el_camera_param *p)
apply the settings in the given structure
el_uint16 el_camera_get_frame_width()
get width (horizontal dimension) of the image in the frame buffer for reading.
el_uint16 el_camera_get_frame_height()
get height (vertical dimension) of the image in the frame buffer for reading.
float IntegrationTime
valid range is ( 0.0, 512.0 )
Definition: el_camera.h:64
Definition: el_camera.h:57
void el_disable_camera()
disable the camera
float GlobalGain
valid range is [ 1.0, 32.0 ]
Definition: el_camera.h:65
float ExternalIntergationTime
valid range is ( 0.0, 512.0 )
Definition: el_camera.h:62
void el_camera_options_apply()
apply the settings stored in el_camera_options directly
void el_camera_options_reset()
reset the settings stored in el_camera_options to default
float BlueGain
valid range is [ 0.015, 3.98 ]
Definition: el_camera.h:69
void el_enable_camera()
enable the camera
Definition: el_camera.h:77
use IntegrationTime and GlobalGain
Definition: el_camera.h:45
use ExternalIntergationTime and ExternalLinearGain
Definition: el_camera.h:44
automatically adjusted by the camera
Definition: el_camera.h:42
el_camera_exposure_mode
Definition: el_camera.h:41
use ExposureTime
Definition: el_camera.h:43
float RedGain
valid range is [ 0.015, 3.98 ]
Definition: el_camera.h:67
void el_camera_lock_frame()
lock the frame buffers
bool el_camera_is_frame_locked()
check whether the frame buffers is locked
float DigitalGain
valid range is [ 0.015, 3.98 ]
Definition: el_camera.h:66
void el_camera_unlock_frame()
unlock the frame buffers
el_uint32 el_camera_get_frame_counter()
get total number of frames captured since initialization
el_camera_exposure_mode ExposureMode
select one of the four modes (see el_camera_exposure_mode)
Definition: el_camera.h:58
el_camera_param * el_camera_options()
get the pointer to a static instance of el_camera_param
el_camera_image * el_camera_frame()
get the pointer to a static instance of el_camera_image for reading
float GreenGain
valid range is [ 0.015, 3.98 ]
Definition: el_camera.h:68