24 #include <fvcams/pike.h> 25 #include <fvcams/cam_exceptions.h> 27 #include <fvutils/system/camargp.h> 48 #define AVT_WHITE_BALANCE_REGISTER (0x0F0080C) 51 #define AVT_AUTOFNC_AOI_REGISTER (0x0390) 52 #define AVT_AF_AREA_POSITION_REGISTER (0x0394) 53 #define AVT_AF_AREA_SIZE_REGISTER (0x0398) 56 #define AVT_VERSION_INFO1_REGISTER (0x1000010) 57 #define AVT_VERSION_INFO3_REGISTER (0x1000018) 119 __aoi_show_work_area =
false;
121 __set_autofnc_aoi =
false;
123 if ( cap->
has(
"autofnc_aoi" ) )
125 __set_autofnc_aoi =
true;
145 {
throw Exception(
"PikeCamera::open: FirewireCamera::open dit not succed" ); }
148 __aoi_show_work_area ) )
150 throw Exception(
"PikeCamera::PikeCamera: setting autofnc AOI failed." );
160 dc1394error_t err = dc1394_get_register(
_camera,
161 AVT_VERSION_INFO1_REGISTER,
164 if ( err != DC1394_SUCCESS )
166 throw Exception(
"Pike::print_info; dc1394_get_register(AVT_VERSION_INFO1_REGISTER) failed\n" );
170 memcpy( (
void*) &version1, (
void*) &value,
sizeof(uint32_t) );
172 err = dc1394_get_register(
_camera,
173 AVT_VERSION_INFO3_REGISTER,
176 if ( err != DC1394_SUCCESS )
178 throw Exception(
"Pike::print_info; dc1394_get_register(AVT_VERSION_INFO3_REGISTER) failed\n" );
182 memcpy( (
void*) &version3, (
void*) &value,
sizeof(uint32_t) );
184 printf(
"uC type ID: %d uC version: %x camera type id: %d FPGA version: %x\n",
185 version1.uc_type_id, version1.uc_version, version3.camera_type_id, version3.fpga_version );
201 bool show_work_area )
206 if ( !__set_autofnc_aoi )
216 position.
left = left;
225 memcpy( (
void*) &value, (
void*) &aoi,
sizeof( value ) );
227 err = dc1394_set_adv_control_register(
_camera,
228 AVT_AUTOFNC_AOI_REGISTER,
231 if ( err != DC1394_SUCCESS )
233 throw Exception(
"Pike::set_autofunction_aoi; dc1394_set_register(AVT_AUTOFNC_AOI_REGISTER) failed\n" );
236 memcpy( (
void*) &value, (
void*) &position,
sizeof( value ) );
237 err = dc1394_set_adv_control_register(
_camera,
238 AVT_AF_AREA_POSITION_REGISTER,
241 if ( err != DC1394_SUCCESS )
243 throw Exception(
"Pike::set_autofunction_aoi; dc1394_set_register(AVT_AF_AREA_POSITION_REGISTER) failed\n" );
246 memcpy( (
void*) &value, (
void*) &size,
sizeof( value ) );
247 err = dc1394_set_adv_control_register(
_camera,
248 AVT_AF_AREA_SIZE_REGISTER,
251 if ( err != DC1394_SUCCESS )
253 throw Exception(
"Pike::set_autofunction_aoi; dc1394_set_register(AVT_AF_AREA_SIZE_REGISTER) failed\n" );
256 err = dc1394_get_adv_control_register(
_camera,
257 AVT_AUTOFNC_AOI_REGISTER,
259 if ( err != DC1394_SUCCESS )
261 throw Exception(
"Pike::set_autofunction_aoi; dc1394_get_register(AVT_AUTOFNC_AOI_REGISTER) failed\n" );
264 memcpy ( (
void*) &aoi, (
void*) &value,
sizeof( value ) );
281 string::size_type pos;
283 pos = a.find(
"x", 0 );
284 if ( pos == string::npos )
285 {
throw Exception(
"Illegal autofnc AOI parameter" ); }
286 string left = a.substr( 0, pos );
287 a = a.substr( pos + 1 );
289 pos = a.find(
"+", 0 );
290 if ( pos == string::npos )
291 {
throw Exception(
"Illegal autofnc AOI parameter" ); }
292 string top = a.substr( 0, pos );
293 a = a.substr( pos + 1 );
295 pos = a.find(
"x", 0 );
296 if ( pos == string::npos )
297 {
throw Exception(
"Illegal autofnc AOI parameter" ); }
298 string width = a.substr( 0, pos );
299 a = a.substr( pos + 1 );
303 pos = a.find(
"-", 0 );
304 if ( pos == string::npos )
307 __aoi_show_work_area =
false;
311 height = a.substr( 0, pos );
312 show = a.substr( pos + 1 );
314 __aoi_show_work_area = ( show ==
"show" ) ?
true :
false;
317 __aoi_left = atoi( left.c_str() );
318 __aoi_top = atoi( top.c_str() );
319 __aoi_width = atoi( width.c_str() );
320 __aoi_height = atoi( height.c_str() );
bool _opened
true if camera has been opened, false otherwise
uint32_t fpga_version
Bcd-coded version number.
Datastructure for version information of the uC.
uint32_t camera_type_id
See Table 122: Camera type ID list on page 267 in the technical manual (v 4.3.0). ...
uint32_t reserved1
Reserved.
virtual void print_info()
Print out camera information.
Fawkes library namespace.
uint32_t left
Work area position (left coordinate).
uint32_t width
Width of work area size.
uint32_t uc_type_id
Always 0.
virtual void open()
Open the camera.
uint32_t reserved3
Reserved.
uint32_t uc_version
Bcd-coded version number.
uint32_t on_off
Enable/disable AOI (see note above).
uint32_t show_work_area
Show work area.
bool has(std::string s) const
Check if an parameter was given.
uint32_t presence_inq
Indicates presence of this feature (read only).
Base class for exceptions in Fawkes.
Datastructure for the size of the autofunction AOI.
uint32_t top
Work area position (top coordinate).
uint32_t reserved2
Reserved.
uint32_t yuints
Y units of work area/pos.
uint32_t xuints
X units of work area/pos.
Datastructure for the position of the autofunction AOI.
virtual void open()
Open the camera.
uint32_t height
Height of work area size.
dc1394camera_t * _camera
DC1394 camera handle.
White balance settings data structure.
virtual void print_info()
Print out camera information.
std::string get(std::string s) const
Get the value of the given parameter.
virtual bool set_autofunction_aoi(unsigned int left, unsigned int top, unsigned int width, unsigned int height, bool show_work_area=false)
Set the area of interest (AOI) for the auto functions.
virtual ~PikeCamera()
Destructor.
virtual void parse_set_autofnc_aoi(const char *aoi)
Parse the autofnc_aoi parameter in the camera argument string.
Datastructure for version information of the FGPA.