24 #include <fvcams/cam_exceptions.h> 25 #include <fvcams/pike.h> 26 #include <fvutils/system/camargp.h> 34 namespace firevision {
44 #define AVT_WHITE_BALANCE_REGISTER (0x0F0080C) 47 #define AVT_AUTOFNC_AOI_REGISTER (0x0390) 48 #define AVT_AF_AREA_POSITION_REGISTER (0x0394) 49 #define AVT_AF_AREA_SIZE_REGISTER (0x0398) 52 #define AVT_VERSION_INFO1_REGISTER (0x1000010) 53 #define AVT_VERSION_INFO3_REGISTER (0x1000018) 119 aoi_show_work_area_ =
false;
121 set_autofnc_aoi_ =
false;
123 if (cap->
has(
"autofnc_aoi")) {
124 set_autofnc_aoi_ =
true;
144 throw Exception(
"PikeCamera::open: FirewireCamera::open dit not succed");
148 throw Exception(
"PikeCamera::PikeCamera: setting autofnc AOI failed.");
158 dc1394error_t err = dc1394_get_register(
_camera, AVT_VERSION_INFO1_REGISTER, &value);
160 if (err != DC1394_SUCCESS) {
161 throw Exception(
"Pike::print_info; dc1394_get_register(AVT_VERSION_INFO1_REGISTER) failed\n");
165 memcpy((
void *)&version1, (
void *)&value,
sizeof(uint32_t));
167 err = dc1394_get_register(
_camera, AVT_VERSION_INFO3_REGISTER, &value);
169 if (err != DC1394_SUCCESS) {
170 throw Exception(
"Pike::print_info; dc1394_get_register(AVT_VERSION_INFO3_REGISTER) failed\n");
174 memcpy((
void *)&version3, (
void *)&value,
sizeof(uint32_t));
176 printf(
"uC type ID: %d uC version: %x camera type id: %d FPGA version: %x\n",
179 version3.camera_type_id,
180 version3.fpga_version);
202 if (!set_autofnc_aoi_) {
213 position.
left = left;
222 memcpy((
void *)&value, (
void *)&aoi,
sizeof(value));
224 err = dc1394_set_adv_control_register(
_camera, AVT_AUTOFNC_AOI_REGISTER, value);
226 if (err != DC1394_SUCCESS) {
228 "Pike::set_autofunction_aoi; dc1394_set_register(AVT_AUTOFNC_AOI_REGISTER) failed\n");
231 memcpy((
void *)&value, (
void *)&position,
sizeof(value));
232 err = dc1394_set_adv_control_register(
_camera, AVT_AF_AREA_POSITION_REGISTER, value);
234 if (err != DC1394_SUCCESS) {
236 "Pike::set_autofunction_aoi; dc1394_set_register(AVT_AF_AREA_POSITION_REGISTER) failed\n");
239 memcpy((
void *)&value, (
void *)&size,
sizeof(value));
240 err = dc1394_set_adv_control_register(
_camera, AVT_AF_AREA_SIZE_REGISTER, value);
242 if (err != DC1394_SUCCESS) {
244 "Pike::set_autofunction_aoi; dc1394_set_register(AVT_AF_AREA_SIZE_REGISTER) failed\n");
247 err = dc1394_get_adv_control_register(
_camera, AVT_AUTOFNC_AOI_REGISTER, &value);
248 if (err != DC1394_SUCCESS) {
250 "Pike::set_autofunction_aoi; dc1394_get_register(AVT_AUTOFNC_AOI_REGISTER) failed\n");
253 memcpy((
void *)&aoi, (
void *)&value,
sizeof(value));
270 string::size_type pos;
272 pos = a.find(
"x", 0);
273 if (pos == string::npos) {
274 throw Exception(
"Illegal autofnc AOI parameter");
276 string left = a.substr(0, pos);
277 a = a.substr(pos + 1);
279 pos = a.find(
"+", 0);
280 if (pos == string::npos) {
281 throw Exception(
"Illegal autofnc AOI parameter");
283 string top = a.substr(0, pos);
284 a = a.substr(pos + 1);
286 pos = a.find(
"x", 0);
287 if (pos == string::npos) {
288 throw Exception(
"Illegal autofnc AOI parameter");
290 string width = a.substr(0, pos);
291 a = a.substr(pos + 1);
295 pos = a.find(
"-", 0);
296 if (pos == string::npos) {
298 aoi_show_work_area_ =
false;
300 height = a.substr(0, pos);
301 show = a.substr(pos + 1);
303 aoi_show_work_area_ = (show ==
"show") ?
true :
false;
306 aoi_left_ = atoi(left.c_str());
307 aoi_top_ = atoi(top.c_str());
308 aoi_width_ = atoi(width.c_str());
309 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.