AVTPikeCam.cpp
Go to the documentation of this file.
00001 /****************************************************************
00002  *
00003  * Copyright (c) 2010
00004  *
00005  * Fraunhofer Institute for Manufacturing Engineering
00006  * and Automation (IPA)
00007  *
00008  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00009  *
00010  * Project name: care-o-bot
00011  * ROS stack name: cob_driver
00012  * ROS package name: cob_camera_sensors
00013  * Description:
00014  *
00015  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00016  *
00017  * Author: Jan Fischer, email:jan.fischer@ipa.fhg.de
00018  * Supervised by: Jan Fischer, email:jan.fischer@ipa.fhg.de
00019  *
00020  * Date of creation: Mai 2008
00021  * ToDo:
00022  *
00023  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00024  *
00025  * Redistribution and use in source and binary forms, with or without
00026  * modification, are permitted provided that the following conditions are met:
00027  *
00028  * * Redistributions of source code must retain the above copyright
00029  * notice, this list of conditions and the following disclaimer.
00030  * * Redistributions in binary form must reproduce the above copyright
00031  * notice, this list of conditions and the following disclaimer in the
00032  * documentation and/or other materials provided with the distribution.
00033  * * Neither the name of the Fraunhofer Institute for Manufacturing
00034  * Engineering and Automation (IPA) nor the names of its
00035  * contributors may be used to endorse or promote products derived from
00036  * this software without specific prior written permission.
00037  *
00038  * This program is free software: you can redistribute it and/or modify
00039  * it under the terms of the GNU Lesser General Public License LGPL as
00040  * published by the Free Software Foundation, either version 3 of the
00041  * License, or (at your option) any later version.
00042  *
00043  * This program is distributed in the hope that it will be useful,
00044  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00045  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00046  * GNU Lesser General Public License LGPL for more details.
00047  *
00048  * You should have received a copy of the GNU Lesser General Public
00049  * License LGPL along with this program.
00050  * If not, see <http://www.gnu.org/licenses/>.
00051  *
00052  ****************************************************************/
00053 #include "../include/cob_camera_sensors/StdAfx.h"
00054 
00055 #ifdef __LINUX__
00056 #include "cob_camera_sensors/AVTPikeCam.h"
00057 #include "tinyxml.h"
00058 #else
00059 #include "cob_driver/cob_camera_sensors/common/include/cob_camera_sensors/AVTPikeCam.h"
00060 #include "cob_vision/windows/src/extern/TinyXml/tinyxml.h"
00061 #endif
00062 
00063 #include <iostream>
00064 
00065 using namespace std;
00066 using namespace ipa_CameraSensors;
00067 
00068 bool AVTPikeCam::m_OpenExecuted = false;
00069 AVTPikeCam::AVTPikeCamDeleter AVTPikeCam::m_Deleter;
00070 
00071 __DLL_LIBCAMERASENSORS__ AbstractColorCameraPtr ipa_CameraSensors::CreateColorCamera_AVTPikeCam()
00072 {
00073         return AbstractColorCameraPtr(new AVTPikeCam());
00074 }
00075 
00076 AVTPikeCam::AVTPikeCam()
00077 {
00078         m_initialized = false;
00079         m_open = false;
00080         m_BufferSize = 3;
00081 
00082 #ifdef __LINUX__
00083         m_cam = 0;
00084         m_IEEE1394Cameras = 0;
00085         m_IEEE1394Info = 0;
00086         m_Frame = 0;
00087 #endif
00088 #ifndef __LINUX__
00089         m_Frame.pData = 0;
00090 #endif
00091                                         
00092 }
00093 
00094 AVTPikeCam::~AVTPikeCam()
00095 {
00096         if (isOpen())
00097         {
00098                 Close();
00099         }
00100 
00101 #ifdef __LINUX__
00102         if (m_IEEE1394Info != 0)
00103         {
00104                 dc1394_free(m_IEEE1394Info);
00105                 m_IEEE1394Info = 0;
00106         }
00107 #endif
00108 }
00109 
00110 
00111 unsigned long AVTPikeCam::Init(std::string directory, int cameraIndex)
00112 {
00113         if (isInitialized())
00114         {
00115                 return (RET_OK | RET_CAMERA_ALREADY_INITIALIZED);
00116         }
00117         m_initialized = false;
00118         m_CameraType = ipa_CameraSensors::CAM_AVTPIKE;
00119 
00120         #ifdef __LINUX__
00121 
00122                 // Load parameters from xml initialization file
00123                 std::string iniFileNameAndPath = directory + "cameraSensorsIni.xml";
00124                 if (LoadParameters(iniFileNameAndPath.c_str(), cameraIndex) & RET_FAILED)
00125                 {
00126                         return (RET_FAILED | RET_INIT_CAMERA_FAILED);
00127                 }
00128 
00129 
00130                 // Search for available cameras
00131                 if (m_IEEE1394Info == 0)
00132                 {
00133                         m_IEEE1394Info = dc1394_new();
00134                 }
00135                 dc1394error_t err = dc1394_camera_enumerate(m_IEEE1394Info, &m_IEEE1394Cameras);                              
00136                 if (err!=DC1394_SUCCESS) 
00137                 {    
00138                         std::cerr << "ERROR - AVTPikeCam::Init:" << std::endl;
00139                         std::cerr << "\t ... Failed to enumerate cameras" << std::endl;
00140                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00141                         return RET_FAILED;                                         
00142                 }             
00143 
00144                 if (m_IEEE1394Cameras->num == 0) 
00145                 {                                                  
00146                         std::cerr << "ERROR - AVTPikeCam::Init:" << std::endl;
00147                         std::cerr << "\t ... No cameras found" << std::endl;
00148                         return RET_FAILED;
00149                 }
00150 
00151                 m_initialized = true;
00152                 return RET_OK;
00153 
00154         #else
00155 
00156                 std::string iniFileNameAndPath = directory + "cameraSensorsIni.xml";
00157                 if (LoadParameters(iniFileNameAndPath.c_str(), cameraIndex) & RET_FAILED)
00158                 {
00159                         return (RET_FAILED | RET_INIT_CAMERA_FAILED);
00160                 }
00161 
00162                 UINT32 err; 
00163 
00164                 // Prepare FireGrab library for use
00165                 if (m_OpenExecuted == false)
00166                 {
00167                         m_OpenExecuted = true;
00168                         UINT32 err = FGInitModule(NULL);
00169                         if(err!=FCE_NOERROR) // err=1001 means library is already initialized (i.e. by other Pike camera)
00170                         {
00171                                 std::cerr << "ERROR - AVTPikeCam::Init:" << std::endl;
00172                                 std::cerr << "\t ... Initialization of FireGrab library failed. ( error " << err << " )" << std::endl;
00173                                 return RET_FAILED;
00174                         }
00175                 }
00176 
00177                 // Retrieve a list of all nodes currently connected to the system
00178                 // At most 5 nodes are retrieved. Actual number is stored in nodeCnt
00179                 m_NodeCnt = 0;
00180                 err=FGGetNodeList(m_nodeInfo, 5, &m_NodeCnt);
00181                 if(err!=FCE_NOERROR)
00182                 {
00183                         std::cerr << "ERROR - AVTPikeCam::Init:" << std::endl;
00184                         std::cerr << "\t ... Retrival of connected IEEE1394 nodes failed. ( error " << err << " )" << std::endl;
00185                         return RET_FAILED;
00186                 }
00187 
00188                 if (m_NodeCnt <= 0) 
00189                 {                                                  
00190                         std::cout << "ERROR - AVTPikeCam::Init:" << std::endl;
00191                         std::cerr << "\t ... No cameras found." << std::endl;
00192                         return RET_FAILED;
00193                 }
00194                 else
00195                 {
00196                         std::cout << "INFO - AVTPikeCam::Init:" << std::endl;
00197                         std::cout << "\t ... Detected '" << m_NodeCnt << "' IEEE1394 node(s)" << std::endl;
00198                         for(unsigned int i=0; i < m_NodeCnt; i++)
00199                         {
00200                                 printf ("\t ... GUID of node '%i' is %-#08lX %-#08lX \n", i+1, m_nodeInfo[i].Guid.High, m_nodeInfo[i].Guid.Low);
00201                         }
00202                 }
00203 
00204                 m_initialized = true;
00205                 return RET_OK;
00206 
00207         #endif
00208 }
00209 
00210 
00211 unsigned long AVTPikeCam::Open()
00212 {
00213         if (!isInitialized())
00214         {
00215                 std::cerr << "ERROR - AVTPikeCam::Open:" << std::endl;
00216                 std::cerr << "\t ... Camera not initialized." << std::endl;
00217                 return (RET_FAILED);
00218         }
00219         m_open = false;
00220 
00221   
00222 #ifdef __LINUX__
00223         dc1394error_t err;
00224         
00225         // Connect with IEEE1394 node
00226         unsigned int i=0;
00227         for(; i<m_IEEE1394Cameras->num; i++)
00228         {
00229                 uint64_t high = m_GUID.High;
00230                 uint64_t low = m_GUID.Low;
00231                 uint64_t guid = (high << 32) + low;
00232                 if (m_IEEE1394Cameras->ids[i].guid == guid) break; 
00233         }
00234         // Check if specified GUID has been found
00235         if (i == m_IEEE1394Cameras->num)
00236         {
00237                 printf ("ERROR - AVTPikeCam::Open: \n\t ... Could not detect specified camera GUID %#08lX %#08lX on IEEE1394 bus\n", m_GUID.High, m_GUID.Low);
00238                 return RET_FAILED;
00239         }
00240 
00241         m_cam = dc1394_camera_new(m_IEEE1394Info, m_IEEE1394Cameras->ids[i].guid);
00242         if (m_cam == 0)
00243         {
00244                 m_open = false;
00245                 return RET_FAILED;
00246         }
00247 
00248         dc1394_camera_free_list(m_IEEE1394Cameras);
00249 
00250         // Set Parameters
00251         if (SetParameters() & ipa_CameraSensors::RET_FAILED)
00252         {
00253                 std::cerr << "ERROR - AVTPikeCam::Open:" << std::endl;
00254                 std::cerr << "\t... Error while setting parameters" << std::endl;
00255                 return RET_FAILED;
00256         }
00257 
00258         err = dc1394_capture_setup(m_cam, m_BufferSize, DC1394_CAPTURE_FLAGS_DEFAULT);
00259         // Relase allocated bandwidth and retry
00260         if (err!=DC1394_SUCCESS) 
00261         {   
00262                 std::cout << "INFO - AVTPikeCam::Open:" << std::endl;
00263                 std::cout << "\t ... Releasing bandwdith and retrying to setup DMA capture" << std::endl;
00264                 uint32_t bandwidth = -1;
00265                 err = dc1394_video_get_bandwidth_usage(m_cam, &bandwidth);
00266                 if (err!=DC1394_SUCCESS) 
00267                 {    
00268                         std::cerr << "ERROR - AVTPikeCam::Open:" << std::endl;
00269                         std::cerr << "\t ... Failed to get bandwith usage of camera device" << std::endl;
00270                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00271                         return RET_FAILED;
00272                 }
00273                 dc1394_iso_release_bandwidth(m_cam, bandwidth);
00274                 if (err!=DC1394_SUCCESS) 
00275                 {    
00276                         std::cerr << "ERROR - AVTPikeCam::Open:" << std::endl;
00277                         std::cerr << "\t ... Failed to relase requested bandwidth '" << bandwidth << "'" << std::endl;
00278                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00279                         return RET_FAILED;
00280                 }
00281                 err = dc1394_capture_setup(m_cam, m_BufferSize, DC1394_CAPTURE_FLAGS_DEFAULT);
00282                 if (err!=DC1394_SUCCESS) 
00283                 {    
00284                         std::cerr << "ERROR - AVTPikeCam::Open:" << std::endl;
00285                         std::cerr << "\t ... Failed to setup cameras device" << std::endl;
00286                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00287                         return RET_FAILED;
00288                 }
00289         }
00290 
00291 
00292         // Start transmission
00293         err=dc1394_video_set_transmission(m_cam, DC1394_ON);                  
00294         if (err!=DC1394_SUCCESS) 
00295         {    
00296                 std::cerr << "ERROR - AVTPikeCam::Open:" << std::endl;
00297                 std::cerr << "\t ... 'dc1394_video_set_transmission' failed." << std::endl;
00298                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00299                 return RET_FAILED;                                         
00300         } 
00301 
00302 #else
00303 
00304         UINT32 err;
00305 
00306         // Connect with IEEE1394 node
00307         unsigned int i=0;
00308         for(; i<m_NodeCnt; i++)
00309         {
00310                 if (m_nodeInfo[i].Guid.Low - m_GUID.Low == 0 && 
00311                         m_nodeInfo[i].Guid.High - m_GUID.High == 0) break;
00312         }
00313         // Check if specified GUID has been found
00314         if (i == m_NodeCnt)
00315         {
00316                 printf ("ERROR - AVTPikeCam::Open: \n\t ... Could not detect specified camera GUID %#08lX %#08lX on IEEE1394 bus\n", m_GUID.High, m_GUID.Low);
00317                 return RET_FAILED;
00318         }
00319 
00320         err=m_cam.Connect(&m_GUID);
00321         if(err!=FCE_NOERROR)
00322         {
00323                 std::cerr << "ERROR - AVTPikeCam::Open:" << std::endl;
00324                 std::cerr << "\t ... Could not connect to camera. ( error " << err << " )" << std::endl;
00325                 return RET_FAILED;
00326         }
00327 
00328         if (SetParameters() & ipa_CameraSensors::RET_FAILED)
00329         {
00330                 std::cerr << "ERROR - AVTPikeCam::Open:" <<  std::endl;
00331                 std::cerr << "\t ... Could not set parameters. ( error " << err << " )" << std::endl;
00332                 return RET_FAILED;
00333         }
00334 
00335         err = m_cam.SetParameter(FGP_FRAMEBUFFERCOUNT, m_BufferSize);
00336         if(err!=FCE_NOERROR)
00337         {
00338                 std::cerr << "ERROR - AVTPikeCam::Open:" << std::endl;
00339                 std::cerr << "\t ... Could not set DMA buffer size to '"<< m_BufferSize 
00340                   << "' ( error " << err << " )" << std::endl;
00341                 return RET_FAILED;
00342         }
00343 
00344         // Opens, prepares and activates the image capture logic on the PC side
00345         err=m_cam.OpenCapture();
00346         if(err!=FCE_NOERROR)
00347         {
00348                 std::cerr << "ERROR - AVTPikeCam::Open:" <<  std::endl;
00349                 std::cerr << "\t ... Could not start DMA logic ( error " << err << " )" << std::endl;
00350                 return RET_FAILED;
00351         }
00352         
00353         // Start image acquisition
00354         err=m_cam.StartDevice();
00355         if(err!=FCE_NOERROR)
00356         {
00357                 std::cerr << "ERROR - AVTPikeCam::Open:" <<  std::endl;
00358                 std::cerr << "\t ... Could not start camera device ( error " << err << " )" << std::endl;
00359                 return RET_FAILED;
00360         }
00361 
00362 #endif
00363         std::cout << "**************************************************" << std::endl;
00364         std::cout << "AVTPikeCam::Open: AVT Pike 145C camera device OPEN" << std::endl;
00365         std::cout << "**************************************************" << std::endl << std::endl;
00366         m_open = true;
00367         return RET_OK;
00368 }
00369 
00370 
00371 unsigned long AVTPikeCam::SaveParameters(const char* filename)
00372 { 
00373         return RET_FAILED;
00374 }
00375 
00376 
00377 
00378 
00379 
00380 unsigned long AVTPikeCam::Close()
00381 {
00382         if (!isOpen())
00383         {
00384                 return (RET_OK);
00385         }
00386 
00387 #ifdef __LINUX__
00388         if (m_cam != 0)
00389         {
00390                 // Stop transmission
00391                 dc1394error_t err;
00392             err=dc1394_video_set_transmission(m_cam, DC1394_OFF);                
00393                 if (err!=DC1394_SUCCESS) 
00394                 {    
00395                         std::cerr << "ERROR - AVTPikeCam::Close:" << std::endl;
00396                         std::cerr << "\t ... 'dc1394_video_set_transmission' failed." << std::endl;
00397                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00398                         return RET_FAILED;                                         
00399                 } 
00400             dc1394_capture_stop(m_cam);                                      
00401                 dc1394_camera_free(m_cam);
00402                 m_cam = 0;
00403         }
00404 #else
00405         // Stops image acquisition
00406         UINT32 err;
00407         err=m_cam.StopDevice();
00408         if(err!=FCE_NOERROR)
00409         {
00410                 std::cerr << "ERROR - AVTPikeCam::Close:" << std::endl;
00411                 std::cerr << "\t ... Could not stop camera device ( error " << err << " )" << std::endl;
00412         }
00413 
00414         // Close capture logic and frees image buffers.
00415         // Also frees all allocated resource on the FireWire bus.
00416         err=m_cam.CloseCapture();
00417         if(err!=FCE_NOERROR)
00418         {
00419                 std::cerr << "ERROR - AVTPikeCam::Close:" << std::endl;
00420                 std::cerr << "\t ...  Could not close capture logic. ( error " << err << " )" << std::endl;             return RET_FAILED;
00421         }
00422 
00423         // Disonnect object from external IEEE1394 node
00424         err=m_cam.Disconnect();
00425         if(err!=FCE_NOERROR)
00426         {
00427                 std::cerr << "ERROR - AVTPikeCam::Close:" << std::endl;
00428                 std::cerr << "\t ...  Could not disconnect camera. ( error " << err << " )" << std::endl;               return RET_FAILED;
00429         }
00430 
00431         
00432 #endif
00433 
00434         m_open = false;
00435         return RET_OK;
00436 } 
00437 
00438 
00439 
00440 unsigned long AVTPikeCam::SetPropertyDefaults() 
00441 {
00442         return RET_FUNCTION_NOT_IMPLEMENTED;
00443 }
00444 
00445 unsigned long AVTPikeCam::GetProperty(t_cameraProperty* cameraProperty)
00446 {
00447 #ifdef __LINUX__
00448         dc1394error_t err;
00449         switch (cameraProperty->propertyID)
00450         {
00451                 case PROP_DMA_BUFFER_SIZE:
00452                         cameraProperty->u_integerData = m_BufferSize;
00453                         return RET_OK;
00454                         break;
00455                 case PROP_CAMERA_RESOLUTION:    
00456                         if (isOpen())
00457                         {       
00458                                 uint32_t imageWidth = -1;
00459                                 uint32_t imageHeight = -1;
00460                                 dc1394video_mode_t videoMode;
00461                                 err=dc1394_video_get_mode(m_cam, &videoMode);
00462                                 if (err!=DC1394_SUCCESS) 
00463                                 {    
00464                                         std::cerr << "ERROR - AVTPikeCam::GetProperty:" << std::endl;
00465                                         std::cerr << "\t ... Failed to get video mode." << std::endl;
00466                                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00467                                         return RET_FAILED;                                         
00468                                 } 
00469         
00470                                 err = dc1394_get_image_size_from_video_mode(m_cam, videoMode, &imageWidth, &imageHeight);
00471                                 if (err!=DC1394_SUCCESS) 
00472                                 {    
00473                                         std::cerr << "ERROR - AVTPikeCam::GetProperty:" << std::endl;
00474                                         std::cerr << "\t ... Failed to get image size." << std::endl;
00475                                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00476                                         return RET_FAILED;                                         
00477                                 } 
00478                                 cameraProperty->cameraResolution.xResolution = (int) imageWidth;
00479                                 cameraProperty->cameraResolution.yResolution = (int) imageHeight;
00480                         }
00481                         else
00482                         {
00483                                 std::cout << "WARNING - AVTPikeCam::GetProperty:" << std::endl;
00484                                 std::cout << "\t ... Camera not open" << std::endl;
00485                                 std::cout << "\t ... Resetting width and height to '1388'x'1038'" << std::endl;
00486                                 cameraProperty->cameraResolution.xResolution = 1388;
00487                                 cameraProperty->cameraResolution.yResolution = 1038;
00488                                 cameraProperty->propertyType = TYPE_CAMERA_RESOLUTION;
00489                         }
00490 
00491                         return RET_OK;
00492                         break;
00493                 default:                                
00494                         std::cerr << "ERROR - AVTPikeCam::GetProperty:" << std::endl;
00495                         std::cerr << "\t ... Property " << cameraProperty->propertyID << " unspecified" << std::endl;
00496                         return RET_FAILED;
00497                         break;
00498         }
00499         return RET_OK;
00500 #endif
00501 #ifndef __LINUX__
00502         UINT32 err;
00503         switch (cameraProperty->propertyID)
00504         {
00505                 case PROP_BRIGHTNESS:   
00506                         
00507                         break;
00508                 case PROP_EXPOSURE_TIME:
00509                         
00510                         break;
00511                 case PROP_WHITE_BALANCE_U:
00512                         
00513                         break;
00514                 case PROP_WHITE_BALANCE_V:      
00515                         
00516                         break;
00517                 case PROP_HUE:  
00518                         
00519                         break;
00520                 case PROP_SATURATION:   
00521                         
00522                         break;
00523                 case PROP_GAMMA:        
00524                         
00525                         break;
00526                 case PROP_GAIN: 
00527                         
00528                         break;
00529                 case PROP_CAMERA_RESOLUTION:    
00530                         if (isOpen())
00531                         {       
00532                                 UINT32 x;
00533                                 UINT32 y;
00534         
00535                                 err = m_cam.GetParameter(FGP_XSIZE, &x);
00536                                 if(err!=FCE_NOERROR)
00537                                 {
00538                                         std::cerr << "ERROR - AVTPikeCam::GetProperty:" << std::endl;
00539                                         std::cerr << "\t ... Could not read image width ( error " << err << " )" << std::endl;
00540                                         return RET_FAILED;
00541                                 }
00542                                 m_cam.GetParameter(FGP_YSIZE, &y);
00543                                 if(err!=FCE_NOERROR)
00544                                 {
00545                                         std::cerr << "ERROR - AVTPikeCam::GetProperty:" << std::endl;
00546                                         std::cerr << "\t ...  Could not read image height ( error " << err << " )" << std::endl;
00547                                         return RET_FAILED;
00548                                 }
00549                                 cameraProperty->cameraResolution.xResolution = x;
00550                                 cameraProperty->cameraResolution.yResolution = y;
00551                         }
00552                         else
00553                         {
00554                                 std::cout << "WARNING - AVTPikeCam::GetProperty:" << std::endl;
00555                                 std::cout << "\t ... Camera not open" << std::endl;
00556                                 std::cout << "\t ... Resetting width and height to '1388'x'1038'" << std::endl;
00557                                 cameraProperty->cameraResolution.xResolution = 1388;
00558                                 cameraProperty->cameraResolution.yResolution = 1038;
00559                                 cameraProperty->propertyType = TYPE_CAMERA_RESOLUTION;
00560                         }
00561         
00562                         return RET_OK;
00563                         break;
00564                 case PROP_FW_OPERATION_MODE:
00565                         cameraProperty->propertyType = TYPE_STRING;
00566                         if (m_operationMode_B == false) cameraProperty->stringData == "A";
00567                         else if (m_operationMode_B == true) cameraProperty->stringData == "B";
00568                         break;
00569                 case PROP_DMA_BUFFER_SIZE:
00570                         cameraProperty->u_integerData = m_BufferSize;
00571                         return RET_OK;
00572                         break;
00573                 case PROP_ISO_SPEED:
00574                         
00575                         break;
00576                 default:                                
00577                         std::cerr << "ERROR - AVTPikeCam::GetProperty:" << std::endl;
00578                         std::cerr << "\t ... Property " << cameraProperty->propertyID << " unspecified";
00579                         return RET_FAILED;
00580                         break;
00581 
00582         }
00583 
00584         return RET_OK;
00585 #endif
00586 } 
00587 
00588 
00589 unsigned long AVTPikeCam::GetColorImage(char* colorImageData, bool getLatestFrame)
00590 {
00591         if (!isOpen())
00592         {
00593                 std::cerr << "ERROR - AVTPikeCam::GetColorImage:" << std::endl;
00594                 std::cerr << "\t ... Color camera not open." << std::endl;
00595                 return (RET_FAILED | RET_CAMERA_NOT_OPEN);
00596         }
00597 #ifdef __LINUX__
00598         
00599         dc1394error_t err;
00600 
00601         if (m_Frame)
00602         {
00603                 // Release the buffer from previous function call
00604                 err=dc1394_capture_enqueue(m_cam, m_Frame);                            
00605                 if (err!=DC1394_SUCCESS) 
00606                 {    
00607                         std::cerr << "AVTPikeCam::GetColorImage:" << std::endl;
00608                         std::cerr << "\t ... 'dc1394_capture_enqueue' failed." << std::endl;
00609                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00610                         return RET_FAILED;                                         
00611                 }
00612         }
00613 
00614         //std::cout << "INFO - AVTPikeCam::GetColorImage:" << std::endl;
00615         //std::cout << "\t ... Flushing DMA" << std::endl;
00616 
00617         if (getLatestFrame)
00618         {
00619                 // Flush the DMA ring buffer
00620                 do
00621                 {
00622                         m_Frame = 0;
00623                         err=dc1394_capture_dequeue(m_cam, DC1394_CAPTURE_POLICY_POLL, &m_Frame);
00624                         if (err!=DC1394_SUCCESS) 
00625                         {    
00626                                 std::cerr << "ERROR - AVTPikeCam::GetColorImage:" << std::endl;
00627                                 std::cerr << "\t ... 'dc1394_capture_dequeue' failed." << std::endl;
00628                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00629                                 return RET_FAILED;                                         
00630                         }
00631 
00632                         if (m_Frame == 0)
00633                         {
00634                                 break;
00635                         }
00636                         
00637                         err=dc1394_capture_enqueue(m_cam, m_Frame);                            
00638                         if (err!=DC1394_SUCCESS) 
00639                         {    
00640                                 std::cerr << "ERROR - AVTPikeCam::GetColorImage:" << std::endl;
00641                                 std::cerr << "\t ... 'dc1394_capture_enqueue' failed." << std::endl;
00642                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00643                                 return RET_FAILED;                                         
00644                         }
00645                 } 
00646                 while (true);
00647         }
00648 
00649         //std::cout << "INFO - AVTPikeCam::GetColorImage:" << std::endl;
00650         //std::cout << "\t ... Waiting for images" << std::endl;
00651 
00652         // Capture
00653         err=dc1394_capture_dequeue(m_cam, DC1394_CAPTURE_POLICY_WAIT, &m_Frame);
00654         if (err!=DC1394_SUCCESS) 
00655         {    
00656                 std::cerr << "ERROR - AVTPikeCam::GetColorImage:" << std::endl;
00657                 std::cerr << "\t ... 'dc1394_capture_dequeue' failed." << std::endl;
00658                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00659                 return RET_FAILED;                                         
00660         } 
00661         unsigned char * src = (unsigned char *)m_Frame->image;
00662         unsigned char * dst = (unsigned char *)colorImageData;
00663         
00664         // Convert RGB to BGR
00665         int width;
00666         int height;
00667         ipa_CameraSensors::t_cameraProperty cameraProperty;
00668         cameraProperty.propertyID = PROP_CAMERA_RESOLUTION;
00669         if (GetProperty(&cameraProperty) & RET_FAILED) return RET_FAILED;
00670         width = cameraProperty.cameraResolution.xResolution;
00671         height = cameraProperty.cameraResolution.yResolution;
00672 
00673         for (int i=0;i<width*height*3;i+=6) 
00674         {
00675                 dst[i]   = src[i+2];
00676                 dst[i+1] = src[i+1];
00677                 dst[i+2] = src[i];
00678                 dst[i+3] = src[i+5];
00679                 dst[i+4] = src[i+4];
00680                 dst[i+5] = src[i+3];
00681         }
00682 
00683         return RET_OK;
00684         
00685 #else
00686         
00687         UINT32 err;
00688 
00689         // Release previously acquired m_Frame
00690         if (m_Frame.pData != 0)
00691         {
00692                 // Return m_Frame to module
00693                 err=m_cam.PutFrame(&m_Frame);
00694                 if(err!=FCE_NOERROR)
00695                 {
00696                         std::cerr << "ERROR - AVTPikeCam::GetColorImage:" << std::endl;
00697                         std::cerr << "\t ... Could not release image buffer ( error " << err << " )" << std::endl;
00698                         return RET_FAILED;
00699                 }
00700         }
00701                 
00702         if (getLatestFrame)
00703         {
00704                 // One shot mode
00705                 // Reset image buffer to guarantee, that the latest images are returned 
00706                 err = m_cam.DiscardFrames();
00707                 if(err!=FCE_NOERROR)
00708                 {
00709                         std::cerr << "ERROR - AVTPikeCam::GetColorImage:" << std::endl;
00710                         std::cerr << "\t ... Could not reset image buffers ( error " << err << " )" << std::endl;
00711                         return RET_FAILED;
00712                 }
00713         }
00714 
00715         
00716         // Blocking-Wait for the next m_Frame
00717         err = m_cam.GetFrame(&m_Frame);
00718         if(err!=FCE_NOERROR)
00719         {
00720                 std::cerr << "AVTPikeCam::GetColorImage:" << std::endl;
00721                 std::cerr << "\t ... Could not acquire image ( error " << err << " )" << std::endl;
00722                 return RET_FAILED;
00723         }
00724 
00725         unsigned char * src = (unsigned char *)m_Frame.pData;
00726         unsigned char * dst = (unsigned char *)colorImageData;
00727         
00728         // Convert RGB to BGR
00729         int width;
00730         int height;
00731         ipa_CameraSensors::t_cameraProperty cameraProperty;
00732         cameraProperty.propertyID = PROP_CAMERA_RESOLUTION;
00733         if (GetProperty(&cameraProperty) & RET_FAILED) return RET_FAILED;
00734         width = cameraProperty.cameraResolution.xResolution;
00735         height = cameraProperty.cameraResolution.yResolution;
00736 
00737         for (int i=0; i<width*height*3; i+=6) 
00738         {
00739                 dst[i]   = src[i+2];
00740                 dst[i+1] = src[i+1];
00741                 dst[i+2] = src[i];
00742                 dst[i+3] = src[i+5];
00743                 dst[i+4] = src[i+4];
00744                 dst[i+5] = src[i+3];
00745         }
00746         
00747         return RET_OK;
00748         
00749 #endif
00750 }
00751 
00752 unsigned long AVTPikeCam::GetColorImage(cv::Mat* colorImage, bool getLatestFrame)
00753 {
00754         if (!isOpen())
00755         {
00756                 std::cerr << "ERROR - AVTPikeCam::GetColorImage:" << std::endl;
00757                 std::cerr << "\t ... Color camera not open." << std::endl;
00758                 return (RET_FAILED | RET_CAMERA_NOT_OPEN);
00759         }
00760 
00761         CV_Assert(colorImage != 0);
00762 
00763         int width;
00764         int height;
00765         ipa_CameraSensors::t_cameraProperty cameraProperty;
00766         cameraProperty.propertyID = PROP_CAMERA_RESOLUTION;
00767         if (GetProperty(&cameraProperty) & RET_FAILED) return RET_FAILED;
00768         width = cameraProperty.cameraResolution.xResolution;
00769         height = cameraProperty.cameraResolution.yResolution;
00770 
00771         // Create color image, if necessary
00772         colorImage->create(height, width, CV_8UC3);
00773         return GetColorImage(colorImage->ptr<char>(0), getLatestFrame);
00774 }
00775 
00776 unsigned long AVTPikeCam::PrintCameraInformation()
00777 {
00778 #ifndef __LINUX__
00779         FGPINFO info;
00780         string parameterName;
00781         std::cout << "INFO - AVTPikeCam::PrintCameraInformation:" << std::endl;
00782 
00783         for (int ID = FGP_BRIGHTNESS; ID <= FGP_BRIGHTNESS+10; ID++)
00784         {
00785                 switch (ID)
00786                 {
00787                         case 0: parameterName = "FGP_IMAGEFORMAT"; break;               // Compact image format
00788                         case 1: parameterName = "FGP_ENUMIMAGEFORMAT"; break;   // Enumeration (Reset,Get)
00789                         case 2: parameterName = "FGP_BRIGHTNESS"; break;         // Set image brightness
00790                         case 3: parameterName = "FGP_AUTOEXPOSURE"; break;              // Set auto exposure
00791                         case 4: parameterName = "FGP_SHARPNESS"; break;          // Set image sharpness
00792                         case 5: parameterName = "FGP_WHITEBALCB"; break;         // Blue
00793                         case 6: parameterName = "FGP_WHITEBALCR"; break;         // Red
00794                         case 7: parameterName = "FGP_HUE"; break;                               // Set image hue
00795                         case 8: parameterName = "FGP_SATURATION"; break;                        // Set color saturation
00796                         case 9: parameterName = "FGP_GAMMA"; break;                             // Set gamma
00797                         case 10: parameterName = "FGP_SHUTTER"; break;                  // Shutter time
00798                         case 11: parameterName = "FGP_GAIN"; break;                             // Gain
00799                         case 12: parameterName = "FGP_IRIS"; break;                             // Iris
00800                         case 13: parameterName = "FGP_FOCUS"; break;                            // Focus
00801                         case 14: parameterName = "FGP_TEMPERATURE"; break;              // Color temperature
00802                         case 15: parameterName = "FGP_TRIGGER"; break;                  // Trigger
00803                         case 16: parameterName = "FGP_TRIGGERDLY"; break;               // Delay of trigger
00804                         case 17: parameterName = "FGP_WHITESHD"; break;                 // Whiteshade
00805                         case 18: parameterName = "FGP_FRAMERATE"; break;                        // Frame rate
00806                         case 19: parameterName = "FGP_ZOOM"; break;                             // Zoom
00807                         case 20: parameterName = "FGP_PAN"; break;                              // Pan
00808                         case 21: parameterName = "FGP_TILT"; break;                             // Tilt
00809                         case 22: parameterName = "FGP_OPTICALFILTER"; break;            // Filter
00810                         case 23: parameterName = "FGP_CAPTURESIZE"; break;              // Size of capture
00811                         case 24: parameterName = "FGP_CAPTUREQUALITY"; break;   // Quality
00812                         case 25: parameterName = "FGP_PHYSPEED"; break;                 // Set speed for asy/iso
00813                         case 26: parameterName = "FGP_XSIZE"; break;                            // Image XSize
00814                         case 27: parameterName = "FGP_YSIZE"; break;                            // Image YSize
00815                         case 28: parameterName = "FGP_XPOSITION"; break;                        // Image x position
00816                         case 29: parameterName = "FGP_YPOSITION"; break;                        // Image y position
00817                         case 30: parameterName = "FGP_PACKETSIZE"; break;               // Packet size
00818                         case 31: parameterName = "FGP_DMAMODE"; break;                  // DMA mode (continuous or limp)
00819                         case 32: parameterName = "FGP_BURSTCOUNT"; break;               // Number of images to produce
00820                         case 33: parameterName = "FGP_FRAMEBUFFERCOUNT"; break; // Number of frame buffers
00821                         case 34: parameterName = "FGP_USEIRMFORBW"; break;              // Allocate bandwidth or not (IsoRscMgr)
00822                         case 35: parameterName = "FGP_ADJUSTPARAMETERS"; break; // Adjust parameters or fail
00823                         case 36: parameterName = "FGP_STARTIMMEDIATELY"; break; // Start bursting immediately
00824                         case 37: parameterName = "FGP_FRAMEMEMORYSIZE"; break;  // Read only: Frame buffer size
00825                         case 38: parameterName = "FGP_COLORFORMAT"; break;              // Read only: Colorformat
00826                         case 39: parameterName = "FGP_IRMFREEBW"; break;                        // Read only: Free iso bytes for 400MBit
00827                         case 40: parameterName = "FGP_DO_FASTTRIGGER"; break;   // Fast trigger (no ACK)
00828                         case 41: parameterName = "FGP_DO_BUSTRIGGER"; break;            // Broadcast trigger
00829                         case 42: parameterName = "FGP_RESIZE"; break;                   // Start/Stop resizing
00830                         case 43: parameterName = "FGP_USEIRMFORCHN"; break;             // Get channel over isochronous resource manager
00831                         case 44: parameterName = "FGP_CAMACCEPTDELAY"; break;   // Delay after writing values
00832                         case 45: parameterName = "FGP_ISOCHANNEL"; break;               // Iso channel
00833                         case 46: parameterName = "FGP_CYCLETIME"; break;                        // Read cycle time
00834                         case 47: parameterName = "FGP_DORESET"; break;                  // Reset camera
00835                         case 48: parameterName = "FGP_DMAFLAGS"; break;                 // Flags for ISO DMA
00836                         case 49: parameterName = "FGP_R0C"; break;                              // Ring 0 call gate
00837                         case 50: parameterName = "FGP_BUSADDRESS"; break;               // Exact bus address
00838                         case 51: parameterName = "FGP_CMDTIMEOUT"; break;               // Global bus command timeout
00839                         case 52: parameterName = "FGP_CARD"; break;                             // Card number of this camera (set before connect)
00840                         case 53: parameterName = "FGP_LICENSEINFO"; break;              // Query license information
00841                         case 54: parameterName = "FGP_PACKETCOUNT"; break;              // Read only: Packet count
00842                         case 55: parameterName = "FGP_DO_MULTIBUSTRIGGER"; break;// Do trigger on several busses
00843                         case 56: parameterName = "FGP_LAST"; break;
00844                         
00845                         default: parameterName = "Unknown parameter";
00846                 }
00847 
00848                 m_cam.GetParameterInfo(ID, &info);
00849                 std::cout << parameterName << std::endl;
00850                 std::cout << "\t ... Value: " << info.IsValue << std::endl;
00851                 std::cout << "\t ... Max: " << info.MaxValue << std::endl;
00852                 std::cout << "\t ... Min: " << info.MinValue << std::endl;
00853                 std::cout << "\t ... Unit: " << info.Unit << std::endl;
00854                 if (info.Specific.Data.FeatureInfo.AutoCap)
00855                         std::cout << "\t ... Auto state: " << (bool) info.Specific.Data.FeatureInfo.AutoState << std::endl;
00856                 std::cout << "\n" << std::endl;
00857         }
00858 #endif
00859         return RET_OK;
00860 }
00861 
00862 unsigned long AVTPikeCam::TestCamera(const char* filename) 
00863 {
00864         if (AbstractColorCamera::TestCamera(filename) & RET_FAILED)
00865         {
00866                 return RET_FAILED;
00867         }
00868 
00869         return RET_OK;
00870 }
00871 
00872 
00873 unsigned long AVTPikeCam::SetProperty(t_cameraProperty* cameraProperty)
00874 
00875 {
00876 #ifdef __LINUX__
00877         dc1394error_t err;
00878 #else
00879         UINT32 err;
00880         FGPINFO info;
00881 #endif
00882 
00883         switch (cameraProperty->propertyID)
00884         {
00886 // PROP_SHUTTER
00888                 case PROP_AMPLITUDE_THRESHOLD:
00889                 case PROP_INTEGRATION_TIME:
00890                 case PROP_VIDEO_MODE:
00891                 case PROP_COLOR_MODE:
00892                 case PROP_VIDEO_FORMAT:
00893                 case PROP_CAMERA_RESOLUTION:
00894                 case PROP_TIMEOUT:
00895                 case PROP_REGISTER:
00896                 case PROP_OPTICAL_FILTER:
00897                 case PROP_SHARPNESS:
00898                 case PROP_MODULATION_FREQUENCY:
00899                         // Not implemented
00900                         break;
00901                 case PROP_SHUTTER:      
00902                         if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
00903                         {
00904                                 if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
00905                                 {
00906 #ifdef __LINUX__
00907                                         err=dc1394_feature_set_mode(m_cam, DC1394_FEATURE_SHUTTER, DC1394_FEATURE_MODE_AUTO);
00908                                         if (err!=DC1394_SUCCESS) 
00909                                         {    
00910                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
00911                                                 std::cerr << "\t ... Failed to set shutter to AUTO mode." << std::endl;
00912                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00913                                                 return RET_FAILED;                                         
00914                                         } 
00915 #else
00916                                         err = m_cam.SetParameter(FGP_SHUTTER, PVAL_AUTO);
00917                                         if(err!=FCE_NOERROR)
00918                                         {
00919                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
00920                                                 std::cerr << "\t ... Could not set shutter time to AUTO mode ( error " << err << " )" << std::endl;
00921                                                 return RET_FAILED;
00922                                         }
00923 #endif
00924                                 }
00925                                 else if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
00926                                 {
00927                                         // Void
00928                                 }
00929                                 else
00930                                 {
00931                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
00932                                         std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
00933                                         return RET_FAILED;
00934                                 }
00935                         }
00936                         else if (cameraProperty->propertyType & (ipa_CameraSensors::TYPE_LONG | ipa_CameraSensors::TYPE_UNSIGNED))
00937                         {
00938 #ifdef __LINUX__
00939                                 uint32_t min;
00940                                 uint32_t max;
00941                                 dc1394_feature_get_boundaries(m_cam, DC1394_FEATURE_SHUTTER, &min, &max);
00942                                 if ((cameraProperty->u_longData < min) | (cameraProperty->u_longData > max))
00943                                 {
00944                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
00945                                         std::cerr << "\t ... Shutter time " << cameraProperty->u_longData 
00946                                                 << " has to be a value between " << min << " and " << max << "." << std::endl;
00947                                         return RET_FAILED;
00948                                 }
00949                                 else
00950                                 {
00951                                         err=dc1394_feature_set_value(m_cam, DC1394_FEATURE_SHUTTER, (uint32_t) cameraProperty->u_longData);
00952                                         if (err!=DC1394_SUCCESS) 
00953                                         {    
00954                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
00955                                                 std::cerr << "\t ... Could not set shutter time " 
00956                                                         << cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
00957                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
00958                                                 return RET_FAILED;                                         
00959                                         } 
00960                                 }
00961 #else
00962                                 m_cam.GetParameterInfo(FGP_SHUTTER, &info);
00963                                 if ((cameraProperty->u_longData < info.MinValue) | (cameraProperty->u_longData > info.MaxValue))
00964                                 {
00965                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
00966                                         std::cerr << "\t ... Shutter time " << cameraProperty->u_longData 
00967                                                 << " has to be a value between " << info.MinValue << " and " << info.MaxValue << "." << std::endl;
00968                                         return RET_FAILED;
00969                                 }
00970                                 else
00971                                 {
00972                                         err = m_cam.SetParameter(FGP_SHUTTER, cameraProperty->u_longData);
00973                                         if(err!=FCE_NOERROR)
00974                                         {
00975                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
00976                                                 std::cerr << "\t ... Could not set shutter time " 
00977                                                         << cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
00978                                                 return RET_FAILED;
00979                                         }
00980                                 }
00981 #endif
00982                         }
00983                         else
00984                         {
00985                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
00986                                 std::cerr << "\t ... Wrong property type. '(TYPE_LONG|TYPE_UNSIGNED)' or special value 'TYPE_SPECIAL' expected." << std::endl;
00987                                 return RET_FAILED;
00988                         }
00989                         break;
00991 // PROP_BRIGHTNESS
00993                 case PROP_BRIGHTNESS:
00994                         if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
00995                         {
00996                                 if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
00997                                 {
00998 #ifdef __LINUX__
00999                                         err=dc1394_feature_set_mode(m_cam, DC1394_FEATURE_BRIGHTNESS, DC1394_FEATURE_MODE_AUTO);
01000                                         if (err!=DC1394_SUCCESS) 
01001                                         {    
01002                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01003                                                 std::cerr << "\t ... Failed to set brightness to AUTO mode." << std::endl;
01004                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01005                                                 return RET_FAILED;                                         
01006                                         } 
01007 #else
01008                                         err = m_cam.SetParameter(FGP_BRIGHTNESS, PVAL_AUTO);
01009                                         if(err!=FCE_NOERROR)
01010                                         {
01011                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01012                                                 std::cerr << "\t ... Could not set brightness time to AUTO mode ( error " << err << " )" << std::endl;
01013                                                 return RET_FAILED;
01014                                         }
01015 #endif
01016                                 }
01017                                 else if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
01018                                 {
01019                                         // Void
01020                                 }
01021                                 else
01022                                 {
01023                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01024                                         std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
01025                                         return RET_FAILED;
01026                                 }
01027                         }
01028                         else if (cameraProperty->propertyType & (ipa_CameraSensors::TYPE_LONG | ipa_CameraSensors::TYPE_UNSIGNED))
01029                         {
01030 #ifdef __LINUX__
01031                                 uint32_t min;
01032                                 uint32_t max;
01033                                 dc1394_feature_get_boundaries(m_cam, DC1394_FEATURE_BRIGHTNESS, &min, &max);
01034                                 if ((cameraProperty->u_longData < min) | (cameraProperty->u_longData > max))
01035                                 {
01036                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01037                                         std::cerr << "\t ... Brighness " << cameraProperty->u_longData 
01038                                                 << " has to be a value between " << min << " and " << max << "." << std::endl;
01039                                         return RET_FAILED;
01040                                 }
01041                                 else
01042                                 {
01043                                         err=dc1394_feature_set_value(m_cam, DC1394_FEATURE_BRIGHTNESS, (uint32_t) cameraProperty->u_longData);
01044                                         if (err!=DC1394_SUCCESS) 
01045                                         {    
01046                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01047                                                 std::cerr << "\t ... Could not set brighness " 
01048                                                         << cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
01049                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01050                                                 return RET_FAILED;                                         
01051                                         } 
01052                                 }
01053 #else
01054                                 m_cam.GetParameterInfo(FGP_BRIGHTNESS, &info);
01055                                 if ((cameraProperty->u_longData < info.MinValue) | (cameraProperty->u_longData > info.MaxValue))
01056                                 {
01057                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01058                                         std::cerr << "\t ... Brigthness " << cameraProperty->u_longData << " has to be a value between " << info.MinValue << " and " << info.MaxValue << "." << std::endl;
01059                                         return RET_FAILED;
01060                                 }
01061                                 else
01062                                 {
01063                                         err = m_cam.SetParameter(FGP_BRIGHTNESS, cameraProperty->u_longData);
01064                                         if(err!=FCE_NOERROR)
01065                                         {
01066                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01067                                                 std::cerr << "\t ... Could not set brightness ( error " << err << " )" << std::endl;
01068                                                 return RET_FAILED;
01069                                         }
01070                                 }
01071 #endif
01072                         }
01073                         else
01074                         {
01075                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01076                                 std::cerr << "\t ... Wrong property type. '(TYPE_LONG|TYPE_UNSIGNED)' or special value 'TYPE_SPECIAL' expected." << std::endl;
01077                                 return RET_FAILED;
01078                         }
01079                         break;
01081 // PROP_EXPOSURE_TIME
01083                 case PROP_EXPOSURE_TIME:
01084                         if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
01085                         {
01086                                 if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
01087                                 {
01088 #ifdef __LINUX__
01089                                         err=dc1394_feature_set_mode(m_cam, DC1394_FEATURE_EXPOSURE, DC1394_FEATURE_MODE_AUTO);
01090                                         if (err!=DC1394_SUCCESS) 
01091                                         {    
01092                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01093                                                 std::cerr << "\t ... Failed to set exposure time to AUTO mode." << std::endl;
01094                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01095                                                 return RET_FAILED;                                         
01096                                         } 
01097 #else
01098                                         err = m_cam.SetParameter(FGP_AUTOEXPOSURE, PVAL_AUTO);
01099                                         if(err!=FCE_NOERROR)
01100                                         {
01101                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01102                                                 std::cerr << "\t ... Could not set exposure time to AUTO mode ( error " << err << " )" << std::endl;
01103                                                 return RET_FAILED;
01104                                         }
01105 #endif
01106                                 }
01107                                 else if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
01108                                 {
01109                                         // Void
01110                                 }
01111                                 else
01112                                 {
01113                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01114                                         std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
01115                                         return RET_FAILED;
01116                                 }
01117                         }
01118                         else if (cameraProperty->propertyType & (ipa_CameraSensors::TYPE_LONG | ipa_CameraSensors::TYPE_UNSIGNED))
01119                         {
01120 #ifdef __LINUX__
01121                                 uint32_t min;
01122                                 uint32_t max;
01123                                 dc1394_feature_get_boundaries(m_cam, DC1394_FEATURE_EXPOSURE, &min, &max);
01124                                 if ((cameraProperty->u_longData < min) | (cameraProperty->u_longData > max))
01125                                 {
01126                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01127                                         std::cerr << "\t ... Exposure time " << cameraProperty->u_longData 
01128                                                 << " has to be a value between " << min << " and " << max << "." << std::endl;
01129                                         return RET_FAILED;
01130                                 }
01131                                 else
01132                                 {
01133                                         err=dc1394_feature_set_value(m_cam, DC1394_FEATURE_EXPOSURE, (uint32_t) cameraProperty->u_longData);
01134                                         if (err!=DC1394_SUCCESS) 
01135                                         {    
01136                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01137                                                 std::cerr << "\t ... Could not set exposure time " 
01138                                                         << cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
01139                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01140                                                 return RET_FAILED;                                         
01141                                         } 
01142                                 }
01143 #else
01144                                 m_cam.GetParameterInfo(FGP_AUTOEXPOSURE, &info);
01145                                 if ((cameraProperty->u_longData < info.MinValue) | (cameraProperty->u_longData > info.MaxValue))
01146                                 {
01147                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01148                                         std::cerr << "\t ... Exposure time " << cameraProperty->u_longData 
01149                                                 << " has to be a value between " << info.MinValue << " and " << info.MaxValue << "." << std::endl;
01150                                         return RET_FAILED;
01151                                 }
01152                                 else
01153                                 {
01154                                         err = m_cam.SetParameter(FGP_AUTOEXPOSURE, cameraProperty->u_longData);
01155                                         if(err!=FCE_NOERROR)
01156                                         {
01157                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01158                                                 std::cerr << "\t ... Could not set exposure time ( error " << err << " )" << std::endl;
01159                                                 return RET_FAILED;
01160                                         }
01161                                 }
01162 #endif
01163                         }
01164                         else
01165                         {
01166                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01167                                 std::cerr << "\t ... Wrong property type. '(TYPE_LONG|TYPE_UNSIGNED)' or special value 'TYPE_SPECIAL' expected." << std::endl;
01168                                 return RET_FAILED;
01169                         }
01170                         break;
01172 // PROP_WHITE_BALANCE_U
01174                 case PROP_WHITE_BALANCE_U:
01175                         if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
01176                         {
01177                                 if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
01178                                 {
01179 #ifdef __LINUX__
01180                                         err=dc1394_feature_set_mode(m_cam, DC1394_FEATURE_WHITE_BALANCE, DC1394_FEATURE_MODE_AUTO);
01181                                         if (err!=DC1394_SUCCESS) 
01182                                         {    
01183                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01184                                                 std::cerr << "\t ... Failed to set white balance U to AUTO mode." << std::endl;
01185                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01186                                                 return RET_FAILED;                                         
01187                                         } 
01188 #else
01189                                         err = m_cam.SetParameter(FGP_WHITEBALCB, PVAL_AUTO);
01190                                         if(err!=FCE_NOERROR)
01191                                         {
01192                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01193                                                 std::cerr << "\t ... Could not set white balance U to AUTO mode ( error " << err << " )" << std::endl;
01194                                                 return RET_FAILED;
01195                                         }
01196 #endif
01197                                 }
01198                                 else if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
01199                                 {
01200                                         // Void
01201                                 }
01202                                 else
01203                                 {
01204                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01205                                         std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
01206                                         return RET_FAILED;
01207                                 }
01208                         }
01209                         else if (cameraProperty->propertyType & (ipa_CameraSensors::TYPE_LONG | ipa_CameraSensors::TYPE_UNSIGNED))
01210                         {
01211 #ifdef __LINUX__
01212                                 uint32_t min;
01213                                 uint32_t max;
01214                                 dc1394_feature_get_boundaries(m_cam, DC1394_FEATURE_WHITE_BALANCE, &min, &max);
01215                                 if ((cameraProperty->u_longData < min) | (cameraProperty->u_longData > max))
01216                                 {
01217                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01218                                         std::cerr << "\t ... White balance U " << cameraProperty->u_longData 
01219                                                 << " has to be a value between " << min << " and " << max << "." << std::endl;
01220                                         return RET_FAILED;
01221                                 }
01222                                 else
01223                                 {
01224                                         uint32_t whiteU;
01225                                         uint32_t whiteV;
01226                                         dc1394_feature_whitebalance_get_value(m_cam, &whiteU, &whiteV);
01227                                         err=dc1394_feature_whitebalance_set_value(m_cam, (uint32_t) cameraProperty->u_longData, whiteV);
01228                                         if (err!=DC1394_SUCCESS) 
01229                                         {    
01230                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01231                                                 std::cerr << "\t ... Could not set white balance U " 
01232                                                         << cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
01233                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01234                                                 return RET_FAILED;                                         
01235                                         } 
01236                                 }
01237 #else
01238                                 m_cam.GetParameterInfo(FGP_WHITEBALCB, &info);
01239                                 if ((cameraProperty->u_longData < info.MinValue) | (cameraProperty->u_longData > info.MaxValue))
01240                                 {
01241                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01242                                         std::cerr << "\t ... White balance U value " << cameraProperty->u_longData 
01243                                                 << " has to be a value between " << info.MinValue << " and " << info.MaxValue << "." << std::endl;
01244                                         return RET_FAILED;
01245                                 }
01246                                 else
01247                                 {
01248                                         err = m_cam.SetParameter(FGP_WHITEBALCB, cameraProperty->u_longData);
01249                                         if(err!=FCE_NOERROR)
01250                                         {
01251                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01252                                                 std::cerr << "\t ... Could not set white balance U value ( error " << err << " )" << std::endl;
01253                                                 return RET_FAILED;
01254                                         }
01255                                 }
01256 #endif
01257                         }
01258                         else
01259                         {
01260                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01261                                 std::cerr << "\t ... Wrong property type. '(TYPE_LONG|TYPE_UNSIGNED)' or special value 'TYPE_SPECIAL' expected." << std::endl;
01262                                 return RET_FAILED;
01263                         }
01264                         break;
01266 // PROP_WHITE_BALANCE_V
01268                 case PROP_WHITE_BALANCE_V:      
01269                         if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
01270                         {
01271                                 if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
01272                                 {
01273 #ifdef __LINUX__
01274                                         err=dc1394_feature_set_mode(m_cam, DC1394_FEATURE_WHITE_BALANCE, DC1394_FEATURE_MODE_AUTO);
01275                                         if (err!=DC1394_SUCCESS) 
01276                                         {    
01277                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01278                                                 std::cerr << "\t ... Failed to set white balance V to AUTO mode." << std::endl;
01279                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01280                                                 return RET_FAILED;                                         
01281                                         } 
01282 #else
01283                                         err = m_cam.SetParameter(FGP_WHITEBALCR, PVAL_AUTO);
01284                                         if(err!=FCE_NOERROR)
01285                                         {
01286                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01287                                                 std::cerr << "\t ... Could not set white balance V to AUTO mode ( error " << err << " )" << std::endl;
01288                                                 return RET_FAILED;
01289                                         }
01290 #endif
01291                                 }
01292                                 else if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
01293                                 {
01294                                         // Void
01295                                 }
01296                                 else
01297                                 {
01298                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01299                                         std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
01300                                         return RET_FAILED;
01301                                 }
01302                         }
01303                         else if (cameraProperty->propertyType & (ipa_CameraSensors::TYPE_LONG | ipa_CameraSensors::TYPE_UNSIGNED))
01304                         {
01305 #ifdef __LINUX__
01306                                 uint32_t min;
01307                                 uint32_t max;
01308                                 dc1394_feature_get_boundaries(m_cam, DC1394_FEATURE_WHITE_BALANCE, &min, &max);
01309                                 if ((cameraProperty->u_longData < min) | (cameraProperty->u_longData > max))
01310                                 {
01311                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01312                                         std::cerr << "\t ... white balance V " << cameraProperty->u_longData 
01313                                                 << " has to be a value between " << min << " and " << max << "." << std::endl;
01314                                         return RET_FAILED;
01315                                 }
01316                                 else
01317                                 {
01318                                         uint32_t whiteU;
01319                                         uint32_t whiteV;
01320                                         dc1394_feature_whitebalance_get_value(m_cam, &whiteU, &whiteV);
01321                                         err=dc1394_feature_whitebalance_set_value(m_cam, whiteU, (uint32_t) cameraProperty->u_longData);
01322                                         if (err!=DC1394_SUCCESS) 
01323                                         {    
01324                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01325                                                 std::cerr << "\t ... Could not set white balance V " 
01326                                                         << cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
01327                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01328                                                 return RET_FAILED;                                         
01329                                         } 
01330                                 }
01331 #else
01332                                 m_cam.GetParameterInfo(FGP_WHITEBALCR, &info);
01333                                 if ((cameraProperty->u_longData < info.MinValue) | (cameraProperty->u_longData > info.MaxValue))
01334                                 {
01335                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01336                                         std::cerr << "\t ... White balance V value " << cameraProperty->u_longData 
01337                                                 << " has to be a value between " << info.MinValue << " and " << info.MaxValue << "." << std::endl;
01338                                         return RET_FAILED;
01339                                 }
01340                                 else
01341                                 {
01342                                         err = m_cam.SetParameter(FGP_WHITEBALCR, cameraProperty->u_longData);
01343                                         if(err!=FCE_NOERROR)
01344                                         {
01345                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01346                                                 std::cerr << "\t ... Could not set white balance V value ( error " << err << " )" << std::endl;
01347                                                 return RET_FAILED;
01348                                         }
01349                                 }
01350 #endif
01351                         }
01352                         else
01353                         {
01354                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01355                                 std::cerr << "\t ... Wrong property type. 'unsigned int' or special value 'TYPE_SPECIAL' expected." << std::endl;
01356                                 return RET_FAILED;
01357                         }
01358                         break;
01360 // PROP_HUE
01362                 case PROP_HUE:
01363                         if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
01364                         {
01365                                 if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
01366                                 {
01367 #ifdef __LINUX__
01368                                         err=dc1394_feature_set_mode(m_cam, DC1394_FEATURE_HUE, DC1394_FEATURE_MODE_AUTO);
01369                                         if (err!=DC1394_SUCCESS) 
01370                                         {    
01371                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01372                                                 std::cerr << "\t ... Failed to set hue to AUTO mode." << std::endl;
01373                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01374                                                 return RET_FAILED;                                         
01375                                         } 
01376 #else
01377                                         err = m_cam.SetParameter(FGP_HUE, PVAL_AUTO);
01378                                         if(err!=FCE_NOERROR)
01379                                         {
01380                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01381                                                 std::cerr << "\t ... Could not set image hue to AUTO ( error " << err << " )" << std::endl;
01382                                                 return RET_FAILED;
01383                                         }
01384 #endif
01385                                 }
01386                                 else if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
01387                                 {
01388                                         // Void
01389                                 }
01390                                 else
01391                                 {
01392                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01393                                         std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
01394                                         return RET_FAILED;
01395                                 }
01396                         }
01397                         else if (cameraProperty->propertyType & (ipa_CameraSensors::TYPE_LONG | ipa_CameraSensors::TYPE_UNSIGNED))
01398                         {
01399 #ifdef __LINUX__
01400                                 uint32_t min;
01401                                 uint32_t max;
01402                                 dc1394_feature_get_boundaries(m_cam, DC1394_FEATURE_HUE, &min, &max);
01403                                 if ((cameraProperty->u_longData < min) | (cameraProperty->u_longData > max))
01404                                 {
01405                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01406                                         std::cerr << "\t ... Hue " << cameraProperty->u_longData 
01407                                                 << " has to be a value between " << min << " and " << max << "." << std::endl;
01408                                         return RET_FAILED;
01409                                 }
01410                                 else
01411                                 {
01412                                         err=dc1394_feature_set_value(m_cam, DC1394_FEATURE_HUE, (uint32_t) cameraProperty->u_longData);
01413                                         if (err!=DC1394_SUCCESS) 
01414                                         {    
01415                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01416                                                 std::cerr << "\t ... Could not set hue " 
01417                                                         << cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
01418                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01419                                                 return RET_FAILED;                                         
01420                                         } 
01421                                 }
01422 #else
01423                                 m_cam.GetParameterInfo(FGP_HUE, &info);
01424                                 if ((cameraProperty->u_longData < info.MinValue) | (cameraProperty->u_longData > info.MaxValue))
01425                                 {
01426                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01427                                         std::cerr << "\t ... Hue " << cameraProperty->u_longData 
01428                                                 << " has to be a value between " << info.MinValue << " and " << info.MaxValue << "." << std::endl;
01429                                 }
01430                                 else
01431                                 {
01432                                         err = m_cam.SetParameter(FGP_HUE, cameraProperty->u_longData);
01433                                         if(err!=FCE_NOERROR)
01434                                         {
01435                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01436                                                 std::cerr << "\t ... Could not set image hue to " << cameraProperty->u_longData 
01437                                                 << " ( error " << err << " )" << std::endl;
01438                                                 return RET_FAILED;
01439                                         }
01440                                 }
01441 #endif
01442                         }
01443                         else
01444                         {
01445                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01446                                 std::cerr << "\t ... Wrong property type. '(TYPE_LONG|TYPE_UNSIGNED)' or special value 'TYPE_SPECIAL' expected." << std::endl;
01447                                 return RET_FAILED;
01448                         }
01449                         break;
01451 // PROP_SATURATION
01453                 case PROP_SATURATION:   
01454                         if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
01455                         {
01456                                 if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
01457                                 {
01458 #ifdef __LINUX__
01459                                         err=dc1394_feature_set_mode(m_cam, DC1394_FEATURE_SATURATION, DC1394_FEATURE_MODE_AUTO);
01460                                         if (err!=DC1394_SUCCESS) 
01461                                         {    
01462                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01463                                                 std::cerr << "\t ... Failed to set saturation to AUTO mode." << std::endl;
01464                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01465                                                 return RET_FAILED;                                         
01466                                         } 
01467 #else
01468                                         err = m_cam.SetParameter(FGP_SATURATION, PVAL_AUTO);
01469                                         if(err!=FCE_NOERROR)
01470                                         {
01471                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01472                                                 std::cerr << "\t ... << Could not set saturation to AUTO ( error " << err << " )" << std::endl;
01473                                                 return RET_FAILED;
01474                                         }
01475 #endif
01476                                 }
01477                                 else if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
01478                                 {
01479                                         // Void
01480                                 }
01481                                 else
01482                                 {
01483                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01484                                         std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
01485                                         return RET_FAILED;
01486                                 }
01487                         }
01488                         else if (cameraProperty->propertyType & (ipa_CameraSensors::TYPE_LONG | ipa_CameraSensors::TYPE_UNSIGNED))
01489                         {
01490 #ifdef __LINUX__
01491                                 uint32_t min;
01492                                 uint32_t max;
01493                                 dc1394_feature_get_boundaries(m_cam, DC1394_FEATURE_SATURATION, &min, &max);
01494                                 if ((cameraProperty->u_longData < min) | (cameraProperty->u_longData > max))
01495                                 {
01496                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01497                                         std::cerr << "\t ... Saturation " << cameraProperty->u_longData 
01498                                                 << " has to be a value between " << min << " and " << max << "." << std::endl;
01499                                         return RET_FAILED;
01500                                 }
01501                                 else
01502                                 {
01503                                         err=dc1394_feature_set_value(m_cam, DC1394_FEATURE_SATURATION, (uint32_t) cameraProperty->u_longData);
01504                                         if (err!=DC1394_SUCCESS) 
01505                                         {    
01506                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01507                                                 std::cerr << "\t ... Could not set saturation " 
01508                                                         << cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
01509                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01510                                                 return RET_FAILED;                                         
01511                                         } 
01512                                 }
01513 #else
01514                                 m_cam.GetParameterInfo(FGP_SATURATION, &info);
01515                                 if ((cameraProperty->u_longData < info.MinValue) | (cameraProperty->u_longData > info.MaxValue))
01516                                 {
01517                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01518                                         std::cerr << "\t ... Saturation has to be a value between " << info.MinValue << " and " << info.MaxValue << "." << std::endl;
01519                                 }
01520                                 else
01521                                 {
01522                                         err = m_cam.SetParameter(FGP_SATURATION, cameraProperty->u_longData);
01523                                         if(err!=FCE_NOERROR)
01524                                         {
01525                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01526                                                 std::cerr << "\t ... Could not set saturation ( error " << err << " )" << std::endl;
01527                                                 return RET_FAILED;
01528                                         }
01529                                 }
01530 #endif
01531                         }
01532                         else
01533                         {
01534                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01535                                 std::cerr << "\t ... Wrong property type. '(TYPE_LONG|TYPE_UNSIGNED)' or special value 'TYPE_SPECIAL' expected." << std::endl;
01536                                 return RET_FAILED;
01537                         }
01538                         break;
01540 // PROP_GAMMA
01542                 case PROP_GAMMA:        
01543                         if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
01544                         {
01545                                 if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
01546                                 {
01547 #ifdef __LINUX__
01548                                         err=dc1394_feature_set_mode(m_cam, DC1394_FEATURE_GAMMA, DC1394_FEATURE_MODE_AUTO);
01549                                         if (err!=DC1394_SUCCESS) 
01550                                         {    
01551                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01552                                                 std::cerr << "\t ... Failed to set gamma to AUTO mode." << std::endl;
01553                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01554                                                 return RET_FAILED;                                         
01555                                         } 
01556 #else
01557                                         err = m_cam.SetParameter(FGP_GAMMA, PVAL_AUTO);
01558                                         if(err!=FCE_NOERROR)
01559                                         {
01560                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01561                                                 std::cerr << "\t ... << Could not set gamma to AUTO ( error " << err << " )" << std::endl;
01562                                                 return RET_FAILED;
01563                                         }
01564 #endif
01565                                 }
01566                                 else if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
01567                                 {
01568                                         // Void
01569                                 }
01570                                 else
01571                                 {
01572                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01573                                         std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
01574                                         return RET_FAILED;
01575                                 }
01576                         }
01577                         else if (cameraProperty->propertyType & (ipa_CameraSensors::TYPE_LONG | ipa_CameraSensors::TYPE_UNSIGNED))
01578                         {
01579 #ifdef __LINUX__
01580                                 uint32_t min;
01581                                 uint32_t max;
01582                                 dc1394_feature_get_boundaries(m_cam, DC1394_FEATURE_GAMMA, &min, &max);
01583                                 if ((cameraProperty->u_longData < min) | (cameraProperty->u_longData > max))
01584                                 {
01585                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01586                                         std::cerr << "\t ... Gamma " << cameraProperty->u_longData 
01587                                                 << " has to be a value between " << min << " and " << max << "." << std::endl;
01588                                         return RET_FAILED;
01589                                 }
01590                                 else
01591                                 {
01592                                         err=dc1394_feature_set_value(m_cam, DC1394_FEATURE_GAMMA, (uint32_t) cameraProperty->u_longData);
01593                                         if (err!=DC1394_SUCCESS) 
01594                                         {    
01595                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01596                                                 std::cerr << "\t ... Could not set gamma " 
01597                                                         << cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
01598                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01599                                                 return RET_FAILED;                                         
01600                                         } 
01601                                 }
01602 #else
01603                                 m_cam.GetParameterInfo(FGP_GAMMA, &info);
01604                                 if ((cameraProperty->u_longData < info.MinValue) | (cameraProperty->u_longData > info.MaxValue))
01605                                 {
01606                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01607                                         std::cerr << "\t ... Gamma has to be a value between " << info.MinValue << " and " << info.MaxValue << "." << std::endl;
01608                                         return RET_FAILED;
01609                                 }
01610                                 else
01611                                 {
01612                                         err = m_cam.SetParameter(FGP_GAMMA, cameraProperty->u_longData);
01613                                         if(err!=FCE_NOERROR)
01614                                         {
01615                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01616                                                 std::cerr << "\t ... << Could not set gamma to " << cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
01617                                                 return RET_FAILED;
01618                                         }
01619                                 }       
01620 #endif
01621                         }
01622                         else
01623                         {
01624                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01625                                 std::cerr << "\t ... Wrong property type. '(TYPE_LONG|TYPE_UNSIGNED)' or special value 'TYPE_SPECIAL' expected." << std::endl;
01626                                 return RET_FAILED;
01627                         }
01628                         break;
01630 // PROP_GAIN
01632                 case PROP_GAIN:         
01633                         if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
01634                         {
01635                                 if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
01636                                 {
01637 #ifdef __LINUX__
01638                                         err=dc1394_feature_set_mode(m_cam, DC1394_FEATURE_GAIN, DC1394_FEATURE_MODE_AUTO);
01639                                         if (err!=DC1394_SUCCESS) 
01640                                         {    
01641                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01642                                                 std::cerr << "\t ... Failed to set gamma to AUTO mode." << std::endl;
01643                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01644                                                 return RET_FAILED;                                         
01645                                         } 
01646 #else
01647                                         err = m_cam.SetParameter(FGP_GAIN, PVAL_AUTO);
01648                                         if(err!=FCE_NOERROR)
01649                                         {
01650                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01651                                                 std::cerr << "\t ... Could not set gain (on auto mode) ( error " << err << " )" << std::endl;
01652                                                 return RET_FAILED;
01653                                         }
01654 #endif
01655                                 }
01656                                 else if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
01657                                 {
01658                                         // Void
01659                                 }
01660                                 else
01661                                 {
01662                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01663                                         std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
01664                                         return RET_FAILED;
01665                                 }
01666                         }
01667                         else if (cameraProperty->propertyType & (ipa_CameraSensors::TYPE_LONG | ipa_CameraSensors::TYPE_UNSIGNED))
01668                         {
01669 #ifdef __LINUX__
01670                                 uint32_t min;
01671                                 uint32_t max;
01672                                 dc1394_feature_get_boundaries(m_cam, DC1394_FEATURE_GAIN, &min, &max);
01673                                 if ((cameraProperty->u_longData < min) | (cameraProperty->u_longData > max))
01674                                 {
01675                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01676                                         std::cerr << "\t ... Gamma " << cameraProperty->u_longData 
01677                                                 << " has to be a value between " << min << " and " << max << "." << std::endl;
01678                                         return RET_FAILED;
01679                                 }
01680                                 else
01681                                 {
01682                                         err=dc1394_feature_set_value(m_cam, DC1394_FEATURE_GAIN, (uint32_t) cameraProperty->u_longData);
01683                                         if (err!=DC1394_SUCCESS) 
01684                                         {    
01685                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01686                                                 std::cerr << "\t ... Could not set gamma " 
01687                                                         << cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
01688                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01689                                                 return RET_FAILED;                                         
01690                                         } 
01691                                 }
01692 #else
01693                                 m_cam.GetParameterInfo(FGP_GAIN, &info);
01694                                 if ((cameraProperty->u_longData < info.MinValue) | (cameraProperty->u_longData > info.MaxValue))
01695                                 {
01696                                         std::cerr << "ERROR - AVTPikeCam::SetProperty: " << std::endl;
01697                                         std::cerr << "\t ... Gain has to be a value between " << info.MinValue << " and " << info.MaxValue << "." << std::endl;
01698                                         return RET_FAILED;
01699                                 }
01700                                 else
01701                                 {
01702                                         err = m_cam.SetParameter(FGP_GAIN, cameraProperty->u_longData);
01703                                         if(err!=FCE_NOERROR)
01704                                         {
01705                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty: " << std::endl;
01706                                                 std::cerr << "\t ... Could not set gain to value " << cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
01707                                                 return RET_FAILED;
01708                                         }
01709                                 }
01710 #endif
01711                         }
01712                         else
01713                         {
01714                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01715                                 std::cerr << "\t ... Wrong property type. '(TYPE_LONG|TYPE_UNSIGNED)' or special value 'TYPE_SPECIAL' expected." << std::endl;
01716                                 return RET_FAILED;
01717                         }
01718                         break;
01720 // VIDEO FORMAT, VIDEO MODE and COLOR CODING
01722                 case PROP_VIDEO_ALL:            
01723                         if (cameraProperty->propertyType ==
01724                                 (ipa_CameraSensors::TYPE_VIDEO_FORMAT | 
01725                                 ipa_CameraSensors::TYPE_VIDEO_MODE | 
01726                                 ipa_CameraSensors::TYPE_COLOR_MODE))
01727                         {
01728 #ifdef __LINUX__
01729                                 dc1394color_coding_t colorMode;
01730                                 dc1394video_mode_t videoMode;
01731                                 switch(cameraProperty->videoFormat)
01732                                 {
01733                                 case FORMAT_0:
01734                                         switch(cameraProperty->videoMode)
01735                                         {
01736                                         case MODE_1:
01737                                                 videoMode = DC1394_VIDEO_MODE_320x240_YUV422;
01738                                                 break;
01739                                         case MODE_2:
01740                                                 videoMode = DC1394_VIDEO_MODE_640x480_YUV411;
01741                                                 break;
01742                                         case MODE_3:
01743                                                 videoMode = DC1394_VIDEO_MODE_640x480_YUV422;
01744                                                 break;
01745                                         case MODE_4:
01746                                         case MODE_DEFAULT:
01747                                                 videoMode = DC1394_VIDEO_MODE_640x480_RGB8;
01748                                                 break;
01749                                         case MODE_5:
01750                                                 videoMode = DC1394_VIDEO_MODE_640x480_MONO8;
01751                                                 break;
01752                                         default:
01753                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01754                                                 std::cerr << "\t ... Specified video mode unknown." << std::endl;
01755                                                 return RET_FAILED;
01756                                         }
01757 
01758                                         err=dc1394_video_set_mode(m_cam, videoMode);
01759                                         if (err!=DC1394_SUCCESS) 
01760                                         {    
01761                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01762                                                 std::cerr << "\t ... Failed to setup video mode for format 0" << std::endl;
01763                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01764                                                 return RET_FAILED;                                         
01765                                         }
01766 
01767                                         break;
01768                                 case FORMAT_1:
01769                                         switch(cameraProperty->videoMode)
01770                                         {
01771                                         case MODE_0:
01772                                                 videoMode = DC1394_VIDEO_MODE_800x600_YUV422;
01773                                                 break;
01774                                         case MODE_1:
01775                                                 videoMode = DC1394_VIDEO_MODE_800x600_RGB8;
01776                                                 break;
01777                                         case MODE_2:
01778                                                 videoMode = DC1394_VIDEO_MODE_800x600_MONO8;
01779                                                 break;
01780                                         case MODE_3:
01781                                                 videoMode = DC1394_VIDEO_MODE_1024x768_YUV422;
01782                                                 break;
01783                                         case MODE_4:
01784                                         case MODE_DEFAULT:
01785                                                 videoMode = DC1394_VIDEO_MODE_1024x768_RGB8;
01786                                                 break;
01787                                         case MODE_5:
01788                                                 videoMode = DC1394_VIDEO_MODE_1024x768_MONO8;
01789                                                 break;
01790                                         default:
01791                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01792                                                 std::cerr << "\t ... Specified video mode not supported." << std::endl;
01793                                                 return RET_FAILED;
01794                                         }
01795 
01796                                         err=dc1394_video_set_mode(m_cam, videoMode);
01797                                         if (err!=DC1394_SUCCESS) 
01798                                         {    
01799                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01800                                                 std::cerr << "\t ... Failed to setup video for format 1" << std::endl;
01801                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01802                                                 return RET_FAILED;                                         
01803                                         }
01804 
01805                                         break;
01806                                 case FORMAT_2:
01807                                         switch(cameraProperty->videoMode)
01808                                         {
01809                                         case MODE_0:
01810                                                 videoMode = DC1394_VIDEO_MODE_1280x960_YUV422;
01811                                                 break;
01812                                         case MODE_1:
01813                                         case MODE_DEFAULT:
01814                                                 videoMode = DC1394_VIDEO_MODE_1280x960_RGB8;
01815                                                 break;
01816                                         case MODE_2:
01817                                                 videoMode = DC1394_VIDEO_MODE_1280x960_MONO8;
01818                                                 break;
01819                                         default:
01820                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01821                                                 std::cerr << "\t ... Specified video mode not supported." << std::endl;
01822                                                 return RET_FAILED;
01823                                         }
01824 
01825                                         err=dc1394_video_set_mode(m_cam, videoMode);
01826                                         if (err!=DC1394_SUCCESS) 
01827                                         {    
01828                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01829                                                 std::cerr << "\t ... Failed to setup video for format 1" << std::endl;
01830                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01831                                                 return RET_FAILED;                                         
01832                                         }
01833 
01834                                         break;
01835                                 case FORMAT_DEFAULT:
01836                                 case FORMAT_7:
01837                                         switch(cameraProperty->colorMode)
01838                                         {
01839                                         case COLOR_YUV411:
01840                                                 colorMode = DC1394_COLOR_CODING_YUV411;
01841                                                 break;
01842                                         case COLOR_YUV422:
01843                                                 colorMode =  DC1394_COLOR_CODING_YUV422;
01844                                                 break;
01845                                         case COLOR_YUV444:
01846                                                 colorMode =  DC1394_COLOR_CODING_YUV444;
01847                                                 break;
01848                                         case COLOR_DEFAULT:
01849                                         case COLOR_RGB8:
01850                                                 colorMode =  DC1394_COLOR_CODING_RGB8;
01851                                                 break;
01852                                         case COLOR_RGB16S:
01853                                                 colorMode =  DC1394_COLOR_CODING_RGB16S;
01854                                                 break;
01855                                         case COLOR_RGB16:
01856                                                 colorMode =  DC1394_COLOR_CODING_RGB16;
01857                                                 break;
01858                                         case COLOR_MONO8:
01859                                                 colorMode =  DC1394_COLOR_CODING_MONO8;
01860                                                 break;
01861                                         case COLOR_MONO16S:
01862                                                 colorMode =  DC1394_COLOR_CODING_MONO16S;
01863                                                 break;
01864                                         case COLOR_MONO16:
01865                                                 colorMode =  DC1394_COLOR_CODING_MONO16;
01866                                                 break;
01867                                         case COLOR_RAW8:
01868                                                 colorMode =  DC1394_COLOR_CODING_RAW8;
01869                                                 break;
01870                                         case COLOR_RAW16:
01871                                                 colorMode =  DC1394_COLOR_CODING_RAW16;
01872                                                 break;
01873                                         default:
01874                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01875                                                 std::cerr << "\t ... Specified color mode not supported." << std::endl;
01876                                                 return RET_FAILED;
01877                                         }
01878 
01879 
01880                                         switch(cameraProperty->videoMode)
01881                                         {
01882                                         case MODE_DEFAULT:
01883                                         case MODE_0:
01884                                                 videoMode = DC1394_VIDEO_MODE_FORMAT7_0;
01885                                                 break;
01886                                         case MODE_4:
01887                                                 videoMode = DC1394_VIDEO_MODE_FORMAT7_4;
01888                                                 break;
01889                                         case MODE_5:
01890                                                 videoMode = DC1394_VIDEO_MODE_FORMAT7_5;
01891                                                 break;
01892                                         case MODE_6:
01893                                                 videoMode = DC1394_VIDEO_MODE_FORMAT7_6;
01894                                                 break;
01895                                         default:
01896                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01897                                                 std::cerr << "\t ... Specified video mode not supported." << std::endl;
01898                                                 return RET_FAILED;
01899                                         }
01900                                         
01901                                         
01902                                         err = dc1394_video_set_mode(m_cam, videoMode);
01903                                         if (err!=DC1394_SUCCESS) 
01904                                         {    
01905                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01906                                                 std::cerr << "\t ... Failed to setup video mode." << std::endl;
01907                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01908                                                 return RET_FAILED;                                         
01909                                         } 
01910                                         err = dc1394_format7_set_color_coding(m_cam, videoMode, colorMode);
01911                                         if (err!=DC1394_SUCCESS) 
01912                                         {    
01913                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01914                                                 std::cerr << "\t ... Failed to setup color coding." << std::endl;
01915                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
01916                                                 return RET_FAILED;                                         
01917                                         }
01918 
01919                                         break;
01920                                 default:
01921                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01922                                         std::cerr << "\t ... Specified video format unknown." << std::endl;
01923                                         return RET_FAILED;
01924                                 }
01925 #else
01926 
01927                                 FG_RESOLUTION resolution;
01928                                 FG_COLORMODE colorMode;
01929                                 int videoMode = -1;
01930                                 switch(cameraProperty->videoFormat)
01931                                 {
01932                                 case FORMAT_0:
01933                                         switch(cameraProperty->videoMode)
01934                                         {
01935                                         case MODE_1:
01936                                                 resolution = RES_320_240;
01937                                                 colorMode = CM_YUV422;
01938                                                 break;
01939                                         case MODE_2:
01940                                                 resolution = RES_640_480;
01941                                                 colorMode = CM_YUV411;
01942                                                 break;
01943                                         case MODE_3:
01944                                                 resolution = RES_640_480;
01945                                                 colorMode = CM_YUV422;
01946                                                 break;
01947                                         case MODE_4:
01948                                         case MODE_DEFAULT:
01949                                                 resolution = RES_640_480;
01950                                                 colorMode = CM_RGB8;
01951                                                 break;
01952                                         case MODE_5:
01953                                                 resolution = RES_640_480;
01954                                                 colorMode = CM_Y8;
01955                                                 break;
01956                                         default:
01957                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01958                                                 std::cerr << "\t ... Specified video mode unknown." << std::endl;
01959                                                 return RET_FAILED;
01960                                         }
01961 
01962                                         err = m_cam.SetParameter(FGP_IMAGEFORMAT, MAKEIMAGEFORMAT(resolution, colorMode, FR_30));
01963                                         if(err!=FCE_NOERROR)
01964                                         {
01965                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
01966                                                 std::cerr << "\t ... Could not set video format and mode ( error " << err << " )" << std::endl;
01967                                                 return RET_FAILED;
01968                                         }
01969 
01970                                         break;
01971                                 case FORMAT_1:
01972                                         switch(cameraProperty->videoMode)
01973                                         {
01974                                         case MODE_0:
01975                                                 resolution = RES_800_600;
01976                                                 colorMode = CM_YUV422;
01977                                                 break;
01978                                         case MODE_1:
01979                                                 resolution = RES_800_600;
01980                                                 colorMode = CM_RGB8;
01981                                                 break;
01982                                         case MODE_2:
01983                                                 resolution = RES_800_600;
01984                                                 colorMode = CM_Y8;
01985                                                 break;
01986                                         case MODE_3:
01987                                                 resolution = RES_1024_768;
01988                                                 colorMode = CM_YUV422;
01989                                                 break;
01990                                         case MODE_4:
01991                                         case MODE_DEFAULT:
01992                                                 resolution = RES_1024_768;
01993                                                 colorMode = CM_RGB8;
01994                                                 break;
01995                                         case MODE_5:
01996                                                 resolution = RES_1024_768;
01997                                                 colorMode = CM_Y8;
01998                                                 break;
01999                                         default:
02000                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02001                                                 std::cerr << "\t ... Specified video mode not supported." << std::endl;
02002                                                 return RET_FAILED;
02003                                         }
02004 
02005                                         err = m_cam.SetParameter(FGP_IMAGEFORMAT, MAKEIMAGEFORMAT(resolution, colorMode, FR_15));
02006                                         if(err!=FCE_NOERROR)
02007                                         {
02008                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02009                                                 std::cerr << "\t ... Could not set video format and mode ( error " << err << " )" << std::endl;
02010                                                 return RET_FAILED;
02011                                         }
02012 
02013                                         break;
02014                                 case FORMAT_2:
02015                                         switch(cameraProperty->videoMode)
02016                                         {
02017                                         case MODE_0:
02018                                                 resolution = RES_1280_960;
02019                                                 colorMode = CM_YUV422;
02020                                                 break;
02021                                         case MODE_1:
02022                                         case MODE_DEFAULT:
02023                                                 resolution = RES_1280_960;
02024                                                 colorMode = CM_RGB8;
02025                                                 break;
02026                                         case MODE_2:
02027                                                 resolution = RES_1280_960;
02028                                                 colorMode = CM_Y8;
02029                                                 break;
02030                                         default:
02031                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02032                                                 std::cerr << "\t ... Specified video mode not supported." << std::endl;
02033                                                 return RET_FAILED;
02034                                         }
02035 
02036                                         err = m_cam.SetParameter(FGP_IMAGEFORMAT, MAKEIMAGEFORMAT(resolution, colorMode, FR_15));
02037                                         if(err!=FCE_NOERROR)
02038                                         {
02039                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02040                                                 std::cerr << "\t ... Could not set video format and mode ( error " << err << " )" << std::endl;
02041                                                 return RET_FAILED;
02042                                         }
02043 
02044                                         break;
02045                                 case FORMAT_DEFAULT:
02046                                 case FORMAT_7:
02047                                         switch(cameraProperty->colorMode)
02048                                         {
02049                                         case COLOR_YUV444:
02050                                                 colorMode = CM_YUV444;
02051                                                 break;
02052                                         case COLOR_YUV422:
02053                                                 colorMode =  CM_YUV422;
02054                                                 break;
02055                                         case COLOR_YUV411:
02056                                                 colorMode =  CM_YUV411;
02057                                                 break;
02058                                         case COLOR_DEFAULT:
02059                                         case COLOR_RGB8:
02060                                                 colorMode =  CM_RGB8;
02061                                                 break;
02062                                         case COLOR_RGB16S:
02063                                                 colorMode =  CM_SRGB16;
02064                                                 break;
02065                                         case COLOR_RGB16:
02066                                                 colorMode =  CM_RGB16;
02067                                                 break;
02068                                         case COLOR_MONO8:
02069                                                 colorMode =  CM_Y8;
02070                                                 break;
02071                                         case COLOR_MONO16S:
02072                                                 colorMode =  CM_SY16;
02073                                                 break;
02074                                         case COLOR_MONO16:
02075                                                 colorMode =  CM_Y16;
02076                                                 break;
02077                                         case COLOR_RAW8:
02078                                                 colorMode =  CM_RAW8;
02079                                                 break;
02080                                         case COLOR_RAW16:
02081                                                 colorMode =  CM_RAW16;
02082                                                 break;
02083                                         default:
02084                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02085                                                 std::cerr << "\t ... Specified color mode not supported." << std::endl;
02086                                                 return RET_FAILED;
02087                                         }
02088 
02089                                         switch(cameraProperty->videoMode)
02090                                         {
02091                                         case MODE_0:
02092                                         case COLOR_DEFAULT:
02093                                                 videoMode = 0;
02094                                                 break;
02095                                         case MODE_4:
02096                                                 videoMode = 4;
02097                                                 break;
02098                                         case MODE_5:
02099                                                 videoMode = 5;
02100                                                 break;
02101                                         case MODE_6:
02102                                                 videoMode = 6;
02103                                                 break;
02104                                         default:
02105                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02106                                                 std::cerr << "\t ... Specified video mode not supported." << std::endl;
02107                                                 return RET_FAILED;
02108                                         }
02109 
02110                                         err = m_cam.SetParameter(FGP_IMAGEFORMAT, MAKEDCAMFORMAT(RES_SCALABLE, videoMode, colorMode));
02111                                         if(err!=FCE_NOERROR)
02112                                         {
02113                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02114                                                 std::cerr << "\t ... Could not set video format and mode ( error " << err << " )" << std::endl;
02115                                                 return RET_FAILED;
02116                                         }
02117 
02118                                         break;
02119                                 default:
02120                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02121                                         std::cerr << "\t ... Specified video format not supported." << std::endl;
02122                                         return RET_FAILED;
02123                                 }
02124 #endif
02125                         }
02126                         else
02127                         {
02128                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02129                                 std::cerr << "\t ... Wrong property type. 'TYPE_VIDEO_MODE' or special value 'TYPE_SPECIAL' expected." << std::endl;
02130                                 return RET_FAILED;
02131                         }
02132                         break;
02133 
02135 // PROP_FRAME_RATE
02137                 case PROP_FRAME_RATE:
02138 #ifdef __LINUX__
02139                         dc1394video_mode_t videoMode;
02140                         err=dc1394_video_get_mode(m_cam, &videoMode);
02141                         if(err!=DC1394_SUCCESS)
02142                         {
02143                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02144                                                 std::cerr << "\t ... Could not get video mode ( error " << err << " )" << std::endl;
02145                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02146                                 return RET_FAILED;
02147                         }
02148                         
02149                         // Format 7
02150                         // Bytes_per_packet = (fps * width * height * ByteDepth * 125microsec)/1000000
02151                         if (videoMode==DC1394_VIDEO_MODE_FORMAT7_0 ||
02152                                 videoMode==DC1394_VIDEO_MODE_FORMAT7_1 ||
02153                                 videoMode==DC1394_VIDEO_MODE_FORMAT7_2 ||
02154                                 videoMode==DC1394_VIDEO_MODE_FORMAT7_3 ||
02155                                 videoMode==DC1394_VIDEO_MODE_FORMAT7_4 ||
02156                                 videoMode==DC1394_VIDEO_MODE_FORMAT7_5 ||
02157                                 videoMode==DC1394_VIDEO_MODE_FORMAT7_6 ||
02158                                 videoMode==DC1394_VIDEO_MODE_FORMAT7_7)
02159                         {
02160 #else
02161                         UINT32 imageFormat;
02162                         FGPINFO packetSizeInfo;
02163                         err = m_cam.GetParameter(FGP_IMAGEFORMAT, &imageFormat);
02164                         if(err!=FCE_NOERROR)
02165                         {
02166                                 std::cout << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02167                                 std::cerr << "\t ... Could not read image format ( error " << err << " )" << std::endl;
02168                                 return RET_FAILED;
02169                         }
02170                         
02171                         // Format 7
02172                         // Bytes_per_packet = (fps * width * height * ByteDepth * 125microsec)/1000000
02173                         if (IMGRES(imageFormat)==RES_SCALABLE)
02174                         {
02175 #endif
02176                                 if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
02177                                 {
02178                                         if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO || 
02179                                                 cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
02180                                         {
02181                                                 // Void
02182                                         }
02183                                 }
02184                                 else if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_FLOAT)
02185                                 {
02186 #ifdef __LINUX__
02187                                         uint64_t bytesPerFrame;
02188                                         
02189                                         err = dc1394_format7_get_total_bytes(m_cam, videoMode, &bytesPerFrame);
02190                                         if (err!=DC1394_SUCCESS) 
02191                                         {    
02192                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02193                                                 std::cerr << "\t ... Could not get bytes per image ( error " << err << " )" << std::endl;
02194                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02195                                                 return RET_FAILED;                                         
02196                                         } 
02197                                         
02198                                         if (cameraProperty->floatData > 0 && cameraProperty->floatData <= 60)
02199                                         {
02200                                                 double fps = cameraProperty->floatData;
02201                                                 uint32_t min = 0;
02202                                                 uint32_t max = 0;
02203                                                 uint64_t bytesPerFrame = 0;
02204                                                 uint32_t bytesPerPacket = 0;
02205                                                 unsigned long packetsPerFrame = 0;
02206                                                 double busPeriodInSeconds = 0;
02207                                                 dc1394speed_t isoSpeed;
02208 
02209                                                 err = dc1394_format7_get_packet_parameters(m_cam, videoMode, &min, &max);
02210                                                 if (err!=DC1394_SUCCESS) 
02211                                                 {    
02212                                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02213                                                         std::cerr << "\t ... Could not get min/max bytes per packet ( error " << err << " )" << std::endl;
02214                                                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02215                                                         return RET_FAILED;                                         
02216                                                 } 
02217                                                 err = dc1394_format7_get_total_bytes(m_cam, videoMode, &bytesPerFrame);
02218                                                 if (err!=DC1394_SUCCESS) 
02219                                                 {    
02220                                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02221                                                         std::cerr << "\t ... Could not get total bytes per frame ( error " << err << " )" << std::endl;
02222                                                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02223                                                         return RET_FAILED;                                         
02224                                                 }
02225 
02226                                                 err = dc1394_video_get_iso_speed(m_cam, &isoSpeed);
02227                                                 if (err!=DC1394_SUCCESS) 
02228                                                 {    
02229                                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02230                                                         std::cerr << "\t ... Could not get iso speed ( error " << err << " )" << std::endl;
02231                                                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02232                                                         return RET_FAILED;                                         
02233                                                 }
02234 
02235                                                 if (isoSpeed == DC1394_ISO_SPEED_100)
02236                                                 {
02237                                                         busPeriodInSeconds = 500.0/1000000.0;
02238                                                 }
02239                                                 else if(isoSpeed == DC1394_ISO_SPEED_200)
02240                                                 {
02241                                                         busPeriodInSeconds = 250.0/1000000.0;
02242                                                 }
02243                                                 else if(isoSpeed == DC1394_ISO_SPEED_400)
02244                                                 {
02245                                                         busPeriodInSeconds = 125.0/1000000.0;
02246                                                 }
02247                                                 else
02248                                                 {
02249                                                         busPeriodInSeconds = 62.5/1000000.0;
02250                                                 }
02251                                                 
02252                                                 packetsPerFrame = (int) (1.0/(busPeriodInSeconds*fps) + 0.5);
02253                                                 bytesPerPacket = (uint32_t) ((bytesPerFrame + packetsPerFrame - 1)/(packetsPerFrame));
02254 
02255                                                 if (bytesPerPacket < min || bytesPerPacket > max)
02256                                                 {
02257                                                         std::cout << "WARNING - AVTPikeCam::SetProperty:" << std::endl;
02258                                                         std::cout << "\t ... Desired packet size out of bounds. Resetting packet size to max value" << std::endl;
02259                                                         bytesPerPacket = max;
02260                                                 }
02261 
02262                                                 // Bytes per packet must be a multiple of min bytes
02263                                                 bytesPerPacket = ((int)(bytesPerPacket/min))*min;
02264 
02265                                                 err = dc1394_format7_set_packet_size(m_cam, videoMode, bytesPerPacket);
02266                                                 if (err!=DC1394_SUCCESS) 
02267                                                 {
02268                                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02269                                                         std::cerr << "\t ... Could not set packet size " << bytesPerPacket << " ( error " << err << " )" << std::endl;
02270                                                         return RET_FAILED;
02271                                                 }
02272                                         }
02273 #else
02274                                         UINT32 bytesPerImage = 0;
02275                                         UINT32 isoSpeed = 0;
02276                                         double busPeriodInSeconds = 0;
02277                                         err = m_cam.GetParameter(FGP_FRAMEMEMORYSIZE, &bytesPerImage);
02278                                         if(err!=FCE_NOERROR)
02279                                         {
02280                                                 std::cout << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02281                                                 std::cerr << "\t ... Could not read image size ( error " << err << " )" << std::endl;
02282                                                 return RET_FAILED;
02283                                         }
02284 
02285                                         err = m_cam.GetParameter(FGP_PHYSPEED, &isoSpeed);
02286                                         if (err!=FCE_NOERROR) 
02287                                         {    
02288                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02289                                                 std::cerr << "\t ... Could not read iso speed info ( error " << err << " )" << std::endl;
02290                                                 return RET_FAILED;                                         
02291                                         }
02292 
02293                                         if (isoSpeed == PS_100MBIT)
02294                                         {
02295                                                 busPeriodInSeconds = 500.0/1000000.0;
02296                                         }
02297                                         else if(isoSpeed == PS_200MBIT)
02298                                         {
02299                                                 busPeriodInSeconds = 250.0/1000000.0;
02300                                         }
02301                                         else if(isoSpeed == PS_400MBIT)
02302                                         {
02303                                                 busPeriodInSeconds = 125.0/1000000.0;
02304                                         }
02305                                         else
02306                                         {
02307                                                 busPeriodInSeconds = 62.5/1000000.0;
02308                                         }
02309                                         
02310                                         if (cameraProperty->floatData > 0 && cameraProperty->floatData <= 60)
02311                                         {
02312                                                 double fps = cameraProperty->floatData;
02313                                                 UINT32 bytesPerPacket = (UINT32) (fps * busPeriodInSeconds * (double)bytesPerImage);
02314 
02315                                                 err = m_cam.GetParameterInfo(FGP_PACKETSIZE, &packetSizeInfo);
02316                                                 if(err!=FCE_NOERROR)
02317                                                 {
02318                                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02319                                                         std::cerr << "\t ... Could not read packet size info ( error " << err << " )" << std::endl;
02320                                                         return RET_FAILED;
02321                                                 }
02322 
02323                                                 if (bytesPerPacket < packetSizeInfo.MinValue || bytesPerPacket > packetSizeInfo.MaxValue)
02324                                                 {
02325                                                         std::cout << "WARNING - AVTPikeCam::SetProperty:" << std::endl;
02326                                                         std::cout << "\t ... Desired packet size out of bounds. Resetting packet size to max value" << std::endl;
02327                                                         bytesPerPacket = packetSizeInfo.MaxValue;
02328                                                 }
02329                                                 
02330                                                 // Bytes per packet must be a multiple of min bytes
02331                                                 bytesPerPacket = ((int)(bytesPerPacket/packetSizeInfo.MinValue))*packetSizeInfo.MinValue;
02332 
02333                                                 err = m_cam.SetParameter(FGP_PACKETSIZE, bytesPerPacket);
02334                                                 if(err!=FCE_NOERROR)
02335                                                 {
02336                                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02337                                                         std::cerr << "\t ... Could not set packet size " << bytesPerPacket << " ( error " << err << " )" << std::endl;
02338                                                         return RET_FAILED;
02339                                                 }
02340                                         }
02341 #endif
02342                                         
02343                                         else 
02344                                         {
02345                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02346                                                 std::cerr << "\t ... Specified framerate out of range ( error " << err << " )" << std::endl;
02347                                                 return RET_FAILED;
02348                                         }
02349                                 }
02350                                 else
02351                                 {
02352                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02353                                         std::cerr << "\t ... Wrong property type. 'TYPE_FLOAT' or special values 'TYPE_SPECIAL' expected." << std::endl;
02354                                         return RET_FAILED;
02355                                 }
02356                         }
02357                         // Other formats than Format 7
02358                         else
02359                         {
02360                                 if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
02361                                 {
02362                                         if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
02363                                         {
02364 #ifdef __LINUX__
02365                                                 err=dc1394_video_set_framerate(m_cam, DC1394_FRAMERATE_7_5);
02366                                                 if (err!=DC1394_SUCCESS) 
02367                                                 {    
02368                                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02369                                                         std::cerr << "\t ... Failed to set framerate to AUTO mode." << std::endl;
02370                                                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02371                                                         return RET_FAILED;                                         
02372                                                 } 
02373 #else
02374                                                 err = m_cam.SetParameter(FGP_FRAMERATE, PVAL_AUTO);
02375                                                 if(err!=FCE_NOERROR)
02376                                                 {
02377                                                         std::cout << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02378                                                         std::cerr << "\t ... Could not set framerate to AUTO ( error " << err << " )" << std::endl;
02379                                                         return RET_FAILED;
02380                                                 }
02381 #endif
02382                                         }
02383                                         if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
02384                                         {
02385                                                 // Void
02386                                         }
02387                                         else
02388                                         {
02389                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02390                                                 std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
02391                                                 return RET_FAILED;
02392                                         }
02393                                 }
02394                                 else if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_FLOAT)
02395                                 {
02396 #ifdef __LINUX__
02397                                         dc1394framerate_t framerate;
02398                                         if (cameraProperty->floatData <= 1.875)
02399                                         {
02400                                                 framerate = DC1394_FRAMERATE_1_875;
02401                                         }
02402                                         else if (cameraProperty->floatData <= 3.75)
02403                                         {
02404                                                 framerate = DC1394_FRAMERATE_3_75;
02405                                         }
02406                                         else if (cameraProperty->floatData <= 7.5)
02407                                         {
02408                                                 framerate = DC1394_FRAMERATE_7_5;
02409                                         }
02410                                         else if (cameraProperty->floatData <= 15)
02411                                         {
02412                                                 framerate = DC1394_FRAMERATE_15;
02413                                         }               
02414                                         else if (cameraProperty->floatData <= 30)
02415                                         {               
02416                                                 framerate = DC1394_FRAMERATE_30;
02417                                         }
02418                                         else if (cameraProperty->floatData <= 60)
02419                                         {
02420                                                 framerate = DC1394_FRAMERATE_60;
02421                                         }
02422                                         else 
02423                                         {
02424                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02425                                                 std::cerr << "\t ... Specified framerate " << cameraProperty->floatData << " out of range ( error " << err << " )" << std::endl;
02426                                                 return RET_FAILED;
02427                                         }
02428                                         err=dc1394_video_set_framerate(m_cam, framerate);
02429                                         if (err!=DC1394_SUCCESS) 
02430                                         {
02431                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02432                                                 std::cerr << "\t ... Could not set specified framerate " << cameraProperty->floatData << " ( error " << err << " )" << std::endl;
02433                                                 return RET_FAILED;
02434                                         }
02435 #else
02436                                         UINT32 framerate;
02437                                         if (cameraProperty->floatData <= 1.875)
02438                                         {
02439                                                 framerate = FR_1_875;
02440                                         }
02441                                         else if (cameraProperty->floatData <= 3.75)
02442                                         {
02443                                                 framerate = FR_3_75;
02444                                         }
02445                                         else if (cameraProperty->floatData <= 7.5)
02446                                         {
02447                                                 framerate = FR_7_5;
02448                                         }
02449                                         else if (cameraProperty->floatData <= 15)
02450                                         {
02451                                                 framerate = FR_15;
02452                                         }               
02453                                         else if (cameraProperty->floatData <= 30)
02454                                         {               
02455                                                 framerate = FR_30;
02456                                         }
02457                                         else if (cameraProperty->floatData <= 60)
02458                                         {
02459                                                 framerate = FR_60;
02460                                         }
02461                                         else 
02462                                         {
02463                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02464                                                 std::cerr << "\t ... Specified framerate " << cameraProperty->floatData << " out of range ( error " << err << " )" << std::endl;
02465                                                 return RET_FAILED;
02466                                         }
02467                                         err = m_cam.SetParameter(FGP_FRAMERATE, framerate);
02468                                         if(err!=FCE_NOERROR)
02469                                         {
02470                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02471                                                 std::cerr << "\t ... Could not set specified framerate " << cameraProperty->floatData << " ( error " << err << " )" << std::endl;
02472                                                 return RET_FAILED;
02473                                         }
02474 #endif
02475                                 }
02476                                 else
02477                                 {
02478                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02479                                         std::cerr << "\t ... Wrong property type. 'TYPE_FLOAT' or special values 'TYPE_SPECIAL' expected." << std::endl;
02480                                         return RET_FAILED;
02481                                 }
02482                         }
02483                         return RET_OK;
02484                         break;
02486 // PROP_FW_OPERATION_MODE
02488                 case PROP_FW_OPERATION_MODE:
02489                         if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
02490                         {
02491                                 if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
02492                                 {
02493                                         m_operationMode_B = false;
02494                                         return RET_OK;
02495                                 }
02496                                 else if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
02497                                 {
02498                                         m_operationMode_B = false;
02499                                         return RET_OK;
02500                                 }
02501                                 else
02502                                 {
02503                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02504                                         std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
02505                                         return RET_FAILED;
02506                                 }
02507 
02508                         }
02509                         else if (cameraProperty->propertyType & TYPE_STRING)
02510                         {
02511                                 if (cameraProperty->stringData == "A")
02512                                 {
02513                                         m_operationMode_B = false;
02514                                         return RET_OK;
02515                                 }
02516                                 else if (cameraProperty->stringData == "B") 
02517                                 {
02518                                         m_operationMode_B = true;
02519                                         return RET_OK;
02520                                 }
02521                                 else
02522                                 {
02523                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02524                                         std::cerr << "\t ... FireWire operation mode " << cameraProperty->stringData << " unknown." << std::endl;
02525                                         return RET_FAILED;
02526                                 }
02527                         }
02528                         else
02529                         {
02530                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02531                                 std::cerr << "\t ... Wrong property type. 'TYPE_STRING' or special values 'TYPE_SPECIAL' expected." << std::endl;
02532                                 return RET_FAILED;
02533                         }
02534                         break;
02536 // PROP_ISO_SPEED
02538                 case PROP_ISO_SPEED:
02539                         if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
02540                         {
02541                                 if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
02542                                 {
02543 #ifdef __LINUX__
02544                                         err=dc1394_video_set_iso_speed(m_cam, DC1394_ISO_SPEED_400);
02545                                         if (err!=DC1394_SUCCESS) 
02546                                         {    
02547                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02548                                                 std::cerr << "\t ... Failed to setup iso speed." << std::endl;
02549                                                 std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02550                                                 return RET_FAILED;                                         
02551                                         } 
02552 #else
02553                                         err = m_cam.SetParameter(FGP_PHYSPEED, PS_AUTO);
02554                                         if(err!=FCE_NOERROR)
02555                                         {
02556                                                 std::cerr<< "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02557                                                 std::cerr << "\t ... Could not set iso speed to AUTO mode ( error " << err << " )" << std::endl;
02558                                                 return RET_FAILED;
02559                                         }
02560 #endif
02561                                 }
02562                                 else if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
02563                                 {
02564 #ifdef __LINUX__
02565 #else
02566                                         err = m_cam.SetParameter(FGP_PHYSPEED, PS_LAST);
02567                                         if(err!=FCE_NOERROR)
02568                                         {
02569                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02570                                                 std::cerr << "\t ... Could not set iso speed to DEFAULT mode ( error " << err << " )" << std::endl;
02571                                                 return RET_FAILED;
02572                                         }
02573 #endif
02574                                 }
02575                                 else
02576                                 {
02577                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02578                                         std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
02579                                         return RET_FAILED;
02580                                 }
02581                         }
02582                         else if (cameraProperty->propertyType & (ipa_CameraSensors::TYPE_LONG | ipa_CameraSensors::TYPE_UNSIGNED))
02583                         {
02584 #ifdef __LINUX__
02585                                 err = DC1394_FAILURE;
02586                                 if (cameraProperty->u_longData <= 100)
02587                                 {
02588                                         err=dc1394_video_set_iso_speed(m_cam, DC1394_ISO_SPEED_100);
02589                                 }
02590                                 else if (cameraProperty->u_longData <= 200)
02591                                 {
02592                                         err=dc1394_video_set_iso_speed(m_cam, DC1394_ISO_SPEED_200);
02593                                 }
02594                                 else if (cameraProperty->u_longData <= 400)
02595                                 {
02596                                         err=dc1394_video_set_iso_speed(m_cam, DC1394_ISO_SPEED_400);
02597                                 }
02598                                 else if (cameraProperty->u_longData <= 800)
02599                                 {
02600                                         err=dc1394_video_set_iso_speed(m_cam, DC1394_ISO_SPEED_800);
02601                                 }
02602                                 if (err!=DC1394_SUCCESS) 
02603                                 {    
02604                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02605                                         std::cerr << "\t ... Failed to setup iso speed " << cameraProperty->u_longData << std::endl;
02606                                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02607                                         return RET_FAILED;                                         
02608                                 } 
02609 #else
02610                                 err = 1;
02611                                 if (cameraProperty->u_longData <= 100)
02612                                 {
02613                                         err = m_cam.SetParameter(FGP_PHYSPEED, PS_100MBIT);
02614                                 }
02615                                 else if (cameraProperty->u_longData <= 200)
02616                                 {
02617                                         err = m_cam.SetParameter(FGP_PHYSPEED, PS_200MBIT);
02618                                 }
02619                                 else if (cameraProperty->u_longData <= 400)
02620                                 {
02621                                         err = m_cam.SetParameter(FGP_PHYSPEED, PS_400MBIT);
02622                                 }
02623                                 else if (cameraProperty->u_longData <= 800)
02624                                 {
02625                                         err = m_cam.SetParameter(FGP_PHYSPEED, PS_800MBIT);
02626                                 }
02627                                 if(err!=FCE_NOERROR)
02628                                 {
02629                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02630                                         std::cerr << "\t ... Could not set iso speed to " << 
02631                                                 cameraProperty->u_longData << " ( error " << err << " )" << std::endl;
02632                                         return RET_FAILED;
02633                                 }
02634 #endif
02635                         }
02636                         else
02637                         {
02638                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02639                                 std::cerr << "\t ... Wrong property type. '(TYPE_LONG|TYPE_UNSIGNED)' or 'TYPE_SPECIAL' expected." << std::endl;
02640                                 return RET_FAILED;
02641                         }
02642                         break;
02644 // PROP_RESOLUTION
02646                 case PROP_RESOLUTION:
02647                         if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_SPECIAL)
02648                         {
02649                                 if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_AUTO)
02650                                 {
02651 #ifdef __LINUX__
02652 #else
02653                                         err = m_cam.SetParameter(FGP_XSIZE, PVAL_AUTO);
02654                                         if(err!=FCE_NOERROR)
02655                                         {
02656                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02657                                                 std::cerr << "\t ... Could not set x resolution to AUTO mode ( error " << err << " )" << std::endl;
02658                                                 return RET_FAILED;
02659                                         }
02660                                         err = m_cam.SetParameter(FGP_YSIZE, PVAL_AUTO);
02661                                         if(err!=FCE_NOERROR)
02662                                         {
02663                                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02664                                                 std::cerr << "\t ... Could not set y resolution to AUTO mode ( error " << err << " )" << std::endl;
02665                                                 return RET_FAILED;
02666                                         }
02667 #endif
02668                                 }
02669                                 else if(cameraProperty->specialValue == ipa_CameraSensors::VALUE_DEFAULT)
02670                                 {
02671                                         // Void
02672                                 }
02673                                 else
02674                                 {
02675                                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02676                                         std::cerr << "\t ... Special value 'VALUE_AUTO' or 'VALUE_DEFAULT' expected." << std::endl;
02677                                         return RET_FAILED;
02678                                 }
02679                         }
02680                         else if (cameraProperty->propertyType & ipa_CameraSensors::TYPE_CAMERA_RESOLUTION)
02681                         {
02682 #ifdef __LINUX__
02683 #else
02684                                 m_cam.GetParameterInfo(FGP_XSIZE, &info);
02685                                 if (((unsigned int) cameraProperty->cameraResolution.xResolution < info.MinValue) ||
02686                                         ((unsigned int) cameraProperty->cameraResolution.xResolution > info.MaxValue))
02687                                 {
02688                                         std::cout << "WARNING - AVTPikeCam::SetProperty:" << std::endl;
02689                                         std::cout << "\t ... x resolution " << cameraProperty->cameraResolution.xResolution 
02690                                                 << " has to be a value between " << info.MinValue << " and " << info.MaxValue << "." << std::endl;
02691                                         std::cout << "\t ... Setting maximal x resolution" << std::endl;
02692                                 }
02693                                 m_cam.GetParameterInfo(FGP_YSIZE, &info);
02694                                 if (((unsigned int) cameraProperty->cameraResolution.yResolution < info.MinValue) ||
02695                                         ((unsigned int) cameraProperty->cameraResolution.yResolution > info.MaxValue))
02696                                 {
02697                                         std::cout << "WARNING - AVTPikeCam::SetProperty:" << std::endl;
02698                                         std::cout << "\t ... y resolution " << cameraProperty->cameraResolution.yResolution 
02699                                                 << " has to be a value between " << info.MinValue << " and " << info.MaxValue << "." << std::endl;
02700                                         std::cout << "\t ... Setting maximal y resolution" << std::endl;
02701                                 }
02702 
02703                                 // Set x/y resolution. If values are out of range, 
02704                                 // the maximal possible reolution is set through the AVT library
02705                                 err = m_cam.SetParameter(FGP_XSIZE, cameraProperty->cameraResolution.xResolution);
02706                                 if(err!=FCE_NOERROR)
02707                                 {
02708                                         std::cout << "WARNING - AVTPikeCam::SetProperty:" << std::endl;
02709                                         std::cout << "\t ... Could not set image width ( error " << err << " )" << std::endl;
02710                                 }
02711 
02712                                 err = m_cam.SetParameter(FGP_YSIZE, cameraProperty->cameraResolution.yResolution);
02713                                 if(err!=FCE_NOERROR)
02714                                 {
02715                                         std::cout << "WARNING - AVTPikeCam::SetProperty:" << std::endl;
02716                                         std::cout << "\t ... Could not set image height ( error " << err << " )" << std::endl;
02717                                 }
02718 #endif
02719                                 
02720                         }
02721                         else
02722                         {
02723                                 std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02724                                 std::cerr << "\t ... Wrong property type. 'TYPE_CAMERA_RESOLUTION' or 'TYPE_SPECIAL' expected." << std::endl;
02725                                 return RET_FAILED;
02726                         }
02727                         break;
02729 // DEFAULT
02731                 default: 
02732                         std::cerr << "ERROR - VTPikeCam::SetProperty:" << std::endl;
02733                         std::cerr << "\t ... Property " << cameraProperty->propertyID << " unspecified." << std::endl;
02734                         return RET_FAILED;
02735                         break;
02736         }
02737 
02738         return RET_OK;
02739 }
02740 
02741 unsigned long AVTPikeCam::SetParameters()
02742 {
02743         ipa_CameraSensors::t_cameraProperty cameraProperty;
02744 
02745 // -----------------------------------------------------------------
02746 // Setup trigger
02747 // -----------------------------------------------------------------
02748         if (m_ColorCameraParameters.m_CameraRole == MASTER)
02749         {
02750                 std::cout << "Info - AVTPikeCam::SetProperty:" << std::endl;
02751                 std::cout << "\t ... Setting camera in MASTER mode." << std::endl;
02752 #ifdef __LINUX__
02753                 // Trigger OFF, Trigger mode 3 -> Edge mode 0, falling
02754                 // Trigger OFF -> Edge mode 0, falling
02755                 dc1394error_t err;
02756                 err = dc1394_external_trigger_set_power(m_cam, DC1394_OFF);
02757                 if (err!=DC1394_SUCCESS) 
02758                 {    
02759                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02760                         std::cerr << "\t ... Failed to deactivate external trigger." << std::endl;
02761                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02762                         return RET_FAILED;                                         
02763                 }
02764                 err = dc1394_external_trigger_set_mode(m_cam, DC1394_TRIGGER_MODE_3);
02765                 if (err!=DC1394_SUCCESS) 
02766                 {    
02767                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02768                         std::cerr << "\t ... Failed to set trigger mode." << std::endl;
02769                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02770                         return RET_FAILED;                                         
02771                 }
02772 #else
02773                 UINT32 err;
02774                 // Use internal trigger
02775                 UINT32 triggerValue;
02776                 triggerValue=MAKETRIGGER(0, 0, 0, 0, 0);
02777                 err = m_cam.SetParameter(FGP_TRIGGER,triggerValue);
02778                 if(err!=FCE_NOERROR)
02779                 {
02780                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02781                         std::cerr << "\t ... Could not set Slave trigger mode ( error " << err << " )" << std::endl;
02782                         return RET_FAILED;
02783                 }
02784 #endif
02785         }
02786         else if (m_ColorCameraParameters.m_CameraRole == SLAVE)
02787         {
02788                 std::cout << "Info - AVTPikeCam::SetProperty:" << std::endl;
02789                 std::cout << "\t ... Setting camera in SLAVE mode." << std::endl;
02790 #ifdef __LINUX__
02791                 // Trigger ON, Trigger mode 0, low -> Edge mode 0, rizing
02792                 dc1394error_t err;
02793                 err = dc1394_external_trigger_set_power(m_cam, DC1394_ON);
02794                 if (err!=DC1394_SUCCESS) 
02795                 {    
02796                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02797                         std::cerr << "\t ... Failed to activate external trigger." << std::endl;
02798                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02799                         return RET_FAILED;                                         
02800                 }
02801                 
02802                 err = dc1394_external_trigger_set_polarity(m_cam, DC1394_TRIGGER_ACTIVE_HIGH);
02803                 if (err!=DC1394_SUCCESS) 
02804                 {    
02805                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02806                         std::cerr << "\t ... Failed to set trigger polarity." << std::endl;
02807                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02808                         return RET_FAILED;                                         
02809                 }
02810 
02811                 err = dc1394_external_trigger_set_mode(m_cam, DC1394_TRIGGER_MODE_0);
02812                 if (err!=DC1394_SUCCESS) 
02813                 {    
02814                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02815                         std::cerr << "\t ... Failed to set trigger mode." << std::endl;
02816                         std::cerr << "\t ... " << dc1394_error_get_string(err) << std::endl;
02817                         return RET_FAILED;                                         
02818                 }
02819 #else
02820                 UINT32 err;
02821                 UINT32 nOn=1; // 0=ext. trigger off, 1=ext. trigger on
02822                 UINT32 nPolarity=1; // 0=low active input, 1=high active input
02823                 UINT32 nSrc=0; // not currently applicable to AVT cameras
02824                 UINT32 nMode=0; // 0=edge mode, 1=level mode, 15=bulk mode
02825                 UINT32 nParm=0; // not currently applicable to AVT cameras
02826                 UINT32 triggerValue;
02827                 triggerValue=MAKETRIGGER(nOn, nPolarity, nSrc, nMode, nParm);
02828                 err = m_cam.SetParameter(FGP_TRIGGER,triggerValue);
02829                 if(err!=FCE_NOERROR)
02830                 {
02831                         std::cerr << "ERROR - AVTPikeCam::SetProperty:" << std::endl;
02832                         std::cerr << "\t ... Could not set Slave trigger mode ( error " << err << " )" << std::endl;
02833                         return RET_FAILED;
02834                 }
02835 #endif
02836         }
02837 
02838 // -----------------------------------------------------------------
02839 // Set isochronous speed
02840 // -----------------------------------------------------------------
02841         cameraProperty.propertyID = ipa_CameraSensors::PROP_ISO_SPEED;
02842         std::string sIsoSpeed = "";
02843         m_ColorCameraParameters.m_IsoSpeed.clear(); // Clear flags within stringstream
02844         m_ColorCameraParameters.m_IsoSpeed.seekg(0); // Set Pointer to position 0 within stringstream
02845         m_ColorCameraParameters.m_IsoSpeed >> sIsoSpeed;
02846         if (sIsoSpeed == "AUTO")
02847         {
02848                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
02849                 cameraProperty.specialValue = VALUE_AUTO;
02850         }
02851         else if (sIsoSpeed == "DEFAULT")
02852         {
02853                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
02854                 cameraProperty.specialValue = VALUE_DEFAULT;
02855         }
02856         else
02857         {
02858                 cameraProperty.propertyType = (ipa_CameraSensors::TYPE_UNSIGNED | ipa_CameraSensors::TYPE_LONG);
02859                 m_ColorCameraParameters.m_IsoSpeed.clear(); // Clear flags within stringstream
02860                 m_ColorCameraParameters.m_IsoSpeed.seekg(0); // Set Pointer to position 0 within stringstream
02861                 m_ColorCameraParameters.m_IsoSpeed >> cameraProperty.u_longData;
02862         }
02863 
02864         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
02865         {
02866                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
02867                 std::cout << "\t ... Could not set ISO speed." << std::endl;
02868         }
02869 
02870 // -----------------------------------------------------------------
02871 // Set video mode, video format and color mode
02872 // -----------------------------------------------------------------
02873         cameraProperty.propertyID = ipa_CameraSensors::PROP_VIDEO_ALL;
02874         cameraProperty.propertyType = (ipa_CameraSensors::TYPE_VIDEO_FORMAT | 
02875                                 ipa_CameraSensors::TYPE_VIDEO_MODE | 
02876                                 ipa_CameraSensors::TYPE_COLOR_MODE);
02877         std::string sVideoFormat = "";
02878         std::string sVideoMode = "";
02879         std::string sColorMode = "";
02880         
02881         m_ColorCameraParameters.m_VideoFormat.clear(); // Clear flags within stringstream
02882         m_ColorCameraParameters.m_VideoFormat.seekg(0); // Set Pointer to position 0 within stringstream
02883         m_ColorCameraParameters.m_VideoFormat >> sVideoFormat;
02884         if (sVideoFormat == "FORMAT_DEFAULT")
02885         {
02886                 cameraProperty.videoFormat = FORMAT_DEFAULT;
02887         }
02888         else if (sVideoFormat == "FORMAT_0")
02889         {
02890                 cameraProperty.videoFormat = FORMAT_0;
02891         }
02892         else if (sVideoFormat == "FORMAT_1")
02893         {
02894                 cameraProperty.videoFormat = FORMAT_1;
02895         }
02896         else if (sVideoFormat == "FORMAT_2")
02897         {
02898                 cameraProperty.videoFormat = FORMAT_2;
02899         }
02900         else if (sVideoFormat == "FORMAT_7")
02901         {
02902                 cameraProperty.videoFormat = FORMAT_7;
02903         }
02904 
02905         m_ColorCameraParameters.m_VideoMode.clear(); // Clear flags within stringstream
02906         m_ColorCameraParameters.m_VideoMode.seekg(0); // Set Pointer to position 0 within stringstream
02907         m_ColorCameraParameters.m_VideoMode >> sVideoMode;
02908         if (sVideoMode == "MODE_DEFAULT")
02909         {
02910                 cameraProperty.videoMode = MODE_DEFAULT;
02911         }
02912         else if (sVideoMode == "MODE_0")
02913         {
02914                 cameraProperty.videoMode = MODE_0;
02915         }
02916         else if (sVideoMode == "MODE_1")
02917         {
02918                 cameraProperty.videoMode = MODE_1;
02919         }
02920         else if (sVideoMode == "MODE_2")
02921         {
02922                 cameraProperty.videoMode = MODE_2;
02923         }
02924         else if (sVideoMode == "MODE_3")
02925         {
02926                 cameraProperty.videoMode = MODE_3;
02927         }
02928         else if (sVideoMode == "MODE_4")
02929         {
02930                 cameraProperty.videoMode = MODE_4;
02931         }
02932         else if (sVideoMode == "MODE_5")
02933         {
02934                 cameraProperty.videoMode = MODE_5;
02935         }
02936         else if (sVideoMode == "MODE_6")
02937         {
02938                 cameraProperty.videoMode = MODE_6;
02939         }
02940         else if (sVideoMode == "MODE_7")
02941         {
02942                 cameraProperty.videoMode = MODE_7;
02943         }
02944 
02945         m_ColorCameraParameters.m_ColorMode.clear(); // Clear flags within stringstream
02946         m_ColorCameraParameters.m_ColorMode.seekg(0); // Set Pointer to position 0 within stringstream
02947         m_ColorCameraParameters.m_ColorMode >> sColorMode;
02948         if (sColorMode == "COLOR_DEFAULT")
02949         {
02950                 cameraProperty.colorMode = COLOR_DEFAULT;
02951         }
02952         else if (sColorMode == "COLOR_YUV422")
02953         {
02954                 cameraProperty.colorMode = COLOR_YUV422;
02955         }
02956         else if (sColorMode == "COLOR_YUV411")
02957         {
02958                 cameraProperty.colorMode = COLOR_YUV411;
02959         }
02960         else if (sColorMode == "COLOR_RGB8")
02961         {
02962                 cameraProperty.colorMode = COLOR_RGB8;
02963         }
02964         else if (sColorMode == "COLOR_RGB16S")
02965         {
02966                 cameraProperty.colorMode = COLOR_RGB16S;
02967         }
02968         else if (sColorMode == "COLOR_RGB16")
02969         {
02970                 cameraProperty.colorMode = COLOR_RGB16;
02971         }
02972         else if (sColorMode == "COLOR_MONO8")
02973         {
02974                 cameraProperty.colorMode = COLOR_MONO8;
02975         }
02976         else if (sColorMode == "COLOR_MONO16")
02977         {
02978                 cameraProperty.colorMode = COLOR_MONO16;
02979         }
02980         else if (sColorMode == "COLOR_MONO16S")
02981         {
02982                 cameraProperty.colorMode = COLOR_MONO16S;
02983         }
02984         else if (sColorMode == "COLOR_RAW8")
02985         {
02986                 cameraProperty.colorMode = COLOR_RAW8;
02987         }
02988         else if (sColorMode == "COLOR_RAW16")
02989         {
02990                 cameraProperty.colorMode = COLOR_RAW16;
02991         }
02992 
02993         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
02994         {
02995                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
02996                 std::cout << "\t ... Could not set video format, video mode and color mode" << std::endl;
02997         }
02998 
02999 
03000 // -----------------------------------------------------------------
03001 // Set resolution
03002 // -----------------------------------------------------------------
03003         cameraProperty.propertyID = ipa_CameraSensors::PROP_RESOLUTION;
03004         std::string sImageWidth = "";
03005         std::string sImageHeight = "";
03006         int iImageWidth = -1;
03007         int iImageHeight = -1;
03008 
03009         m_ColorCameraParameters.m_ImageWidth.clear(); // Clear flags within stringstream
03010         m_ColorCameraParameters.m_ImageWidth.seekg(0); // Set Pointer to position 0 within stringstream
03011         m_ColorCameraParameters.m_ImageWidth >> sImageWidth;
03012         m_ColorCameraParameters.m_ImageHeight.clear(); // Clear flags within stringstream
03013         m_ColorCameraParameters.m_ImageHeight.seekg(0); // Set Pointer to position 0 within stringstream
03014         m_ColorCameraParameters.m_ImageHeight >> sImageHeight;
03015 
03016         if (sImageWidth == "AUTO" || sImageHeight == "Auto")
03017         {
03018                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03019                 cameraProperty.specialValue = VALUE_AUTO;
03020         }
03021         else if (sImageWidth == "DEFAULT" || sImageHeight == "DEFAULT")
03022         {
03023                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03024                 cameraProperty.specialValue = VALUE_DEFAULT;
03025         }
03026         else
03027         {
03028                 cameraProperty.propertyType = (ipa_CameraSensors::TYPE_UNSIGNED | ipa_CameraSensors::TYPE_LONG);
03029                 m_ColorCameraParameters.m_ImageWidth.clear(); // Clear flags within stringstream
03030                 m_ColorCameraParameters.m_ImageWidth.seekg(0); // Set Pointer to position 0 within stringstream
03031                 m_ColorCameraParameters.m_ImageWidth >> iImageWidth;
03032                 m_ColorCameraParameters.m_ImageHeight.clear(); // Clear flags within stringstream
03033                 m_ColorCameraParameters.m_ImageHeight.seekg(0); // Set Pointer to position 0 within stringstream
03034                 m_ColorCameraParameters.m_ImageHeight >> iImageHeight;
03035         }
03036 
03037         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
03038         {
03039                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
03040                 std::cout << "\t ... Could not set resolution." << std::endl;
03041         }
03042 
03043 
03044 // -----------------------------------------------------------------
03045 // Set exposure time
03046 // -----------------------------------------------------------------
03047         cameraProperty.propertyID = ipa_CameraSensors::PROP_EXPOSURE_TIME;
03048         std::string sExposureTime = "";
03049 
03050         m_ColorCameraParameters.m_ExposureTime.clear(); // Clear flags within stringstream
03051         m_ColorCameraParameters.m_ExposureTime.seekg(0); // Set Pointer to position 0 within stringstream
03052         m_ColorCameraParameters.m_ExposureTime >> sExposureTime;
03053 
03054         if (sExposureTime == "AUTO")
03055         {
03056                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03057                 cameraProperty.specialValue = VALUE_AUTO;
03058         }
03059         else if (sExposureTime == "DEFAULT")
03060         {
03061                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03062                 cameraProperty.specialValue = VALUE_DEFAULT;
03063         }
03064         else
03065         {
03066                 cameraProperty.propertyType = (ipa_CameraSensors::TYPE_UNSIGNED | ipa_CameraSensors::TYPE_LONG);
03067                 m_ColorCameraParameters.m_ExposureTime.clear(); // Clear flags within stringstream
03068                 m_ColorCameraParameters.m_ExposureTime.seekg(0); // Set Pointer to position 0 within stringstream
03069                 m_ColorCameraParameters.m_ExposureTime >> cameraProperty.u_longData;
03070         }
03071 
03072         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
03073         {
03074                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
03075                 std::cout << "\t ... Could not set auto exposure." << std::endl;
03076         }
03077 
03078 // -----------------------------------------------------------------
03079 // Set frame rate
03080 // -----------------------------------------------------------------
03081         cameraProperty.propertyID = ipa_CameraSensors::PROP_FRAME_RATE;
03082         std::string sFrameRate = "";
03083 
03084         m_ColorCameraParameters.m_FrameRate.clear(); // Clear flags within stringstream
03085         m_ColorCameraParameters.m_FrameRate.seekg(0); // Set Pointer to position 0 within stringstream
03086         m_ColorCameraParameters.m_FrameRate >> sFrameRate;
03087 
03088         if (sFrameRate == "AUTO")
03089         {
03090                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03091                 cameraProperty.specialValue = VALUE_AUTO;
03092         }
03093         else if (sFrameRate == "DEFAULT")
03094         {
03095                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03096                 cameraProperty.specialValue = VALUE_DEFAULT;
03097         }
03098         else
03099         {
03100                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_FLOAT;
03101                 m_ColorCameraParameters.m_FrameRate.clear(); // Clear flags within stringstream
03102                 m_ColorCameraParameters.m_FrameRate.seekg(0); // Set Pointer to position 0 within stringstream
03103                 m_ColorCameraParameters.m_FrameRate >> cameraProperty.floatData;
03104         }
03105 
03106         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
03107         {
03108                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
03109                 std::cout << "\t ... Could not set frame rate." << std::endl;
03110         }
03111 
03112 
03113 // -----------------------------------------------------------------
03114 // Set shutter
03115 // -----------------------------------------------------------------
03116         cameraProperty.propertyID = ipa_CameraSensors::PROP_SHUTTER;
03117         std::string sShutter = "";
03118 
03119         m_ColorCameraParameters.m_Shutter.clear(); // Clear flags within stringstream
03120         m_ColorCameraParameters.m_Shutter.seekg(0); // Set Pointer to position 0 within stringstream
03121         m_ColorCameraParameters.m_Shutter >> sShutter;
03122 
03123         if (sShutter == "AUTO")
03124         {
03125                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03126                 cameraProperty.specialValue = VALUE_AUTO;
03127         }
03128         else if (sShutter == "DEFAULT")
03129         {
03130                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03131                 cameraProperty.specialValue = VALUE_DEFAULT;
03132         }
03133         else
03134         {
03135                 cameraProperty.propertyType = (ipa_CameraSensors::TYPE_UNSIGNED | ipa_CameraSensors::TYPE_LONG);
03136                 m_ColorCameraParameters.m_Shutter.clear(); // Clear flags within stringstream
03137                 m_ColorCameraParameters.m_Shutter.seekg(0);
03138                 m_ColorCameraParameters.m_Shutter >> cameraProperty.u_longData;
03139         }
03140 
03141         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
03142         {
03143                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
03144                 std::cout << "\t ... Could not set shutter." << std::endl;
03145         }
03146 
03147 // -----------------------------------------------------------------
03148 // Set brightness
03149 // -----------------------------------------------------------------
03150         cameraProperty.propertyID = ipa_CameraSensors::PROP_BRIGHTNESS;
03151         std::string sBrightness = "";
03152 
03153         m_ColorCameraParameters.m_Brightness.clear(); // Clear flags within stringstream
03154         m_ColorCameraParameters.m_Brightness.seekg(0); // Set Pointer to position 0 within stringstream
03155         m_ColorCameraParameters.m_Brightness >> sBrightness;
03156 
03157         if (sBrightness == "AUTO")
03158         {
03159                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03160                 cameraProperty.specialValue = VALUE_AUTO;
03161         }
03162         else if (sBrightness == "DEFAULT")
03163         {
03164                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03165                 cameraProperty.specialValue = VALUE_DEFAULT;
03166         }
03167         else
03168         {
03169                 cameraProperty.propertyType = (ipa_CameraSensors::TYPE_UNSIGNED | ipa_CameraSensors::TYPE_LONG);
03170                 m_ColorCameraParameters.m_Brightness.clear(); // Clear flags within stringstream
03171                 m_ColorCameraParameters.m_Brightness.seekg(0); // Set Pointer to position 0 within stringstream
03172                 m_ColorCameraParameters.m_Brightness >> cameraProperty.u_longData;
03173         }
03174 
03175         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
03176         {
03177                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
03178                 std::cout << "\t ... Could not set brightness." << std::endl;
03179         }
03180 
03181 // -----------------------------------------------------------------
03182 // Set gain
03183 // -----------------------------------------------------------------
03184         cameraProperty.propertyID = ipa_CameraSensors::PROP_GAIN;
03185         std::string sGain = "";
03186 
03187         m_ColorCameraParameters.m_Gain.clear(); // Clear flags within stringstream
03188         m_ColorCameraParameters.m_Gain.seekg(0); // Set Pointer to position 0 within stringstream
03189         m_ColorCameraParameters.m_Gain >> sGain;
03190 
03191         if (sGain == "AUTO")
03192         {
03193                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03194                 cameraProperty.specialValue = VALUE_AUTO;
03195         }
03196         else if (sGain == "DEFAULT")
03197         {
03198                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03199                 cameraProperty.specialValue = VALUE_DEFAULT;
03200         }
03201         else
03202         {
03203                 cameraProperty.propertyType = (ipa_CameraSensors::TYPE_UNSIGNED | ipa_CameraSensors::TYPE_LONG);
03204                 m_ColorCameraParameters.m_Gain.clear(); // Clear flags within stringstream
03205                 m_ColorCameraParameters.m_Gain.seekg(0); // Set Pointer to position 0 within stringstream
03206                 m_ColorCameraParameters.m_Gain >> cameraProperty.u_longData;
03207         }
03208 
03209         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
03210         {
03211                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
03212                 std::cout << "\t ... Could not set gain." << std::endl;
03213         }
03214 
03215 // -----------------------------------------------------------------
03216 // Set gamma
03217 // -----------------------------------------------------------------
03218         cameraProperty.propertyID = ipa_CameraSensors::PROP_GAMMA;
03219         std::string sGamma = "";
03220 
03221         m_ColorCameraParameters.m_Gamma.clear(); // Clear flags within stringstream
03222         m_ColorCameraParameters.m_Gamma.seekg(0); // Set Pointer to position 0 within stringstream
03223         m_ColorCameraParameters.m_Gamma >> sGamma;
03224 
03225         if (sGamma == "AUTO")
03226         {
03227                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03228                 cameraProperty.specialValue = VALUE_AUTO;
03229         }
03230         else if (sGamma == "DEFAULT")
03231         {
03232                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03233                 cameraProperty.specialValue = VALUE_DEFAULT;
03234         }
03235         else
03236         {
03237                 cameraProperty.propertyType = (ipa_CameraSensors::TYPE_UNSIGNED | ipa_CameraSensors::TYPE_LONG);
03238                 m_ColorCameraParameters.m_Gamma.clear(); // Clear flags within stringstream
03239                 m_ColorCameraParameters.m_Gamma.seekg(0); // Set Pointer to position 0 within stringstream
03240                 m_ColorCameraParameters.m_Gamma >> cameraProperty.u_longData;
03241         }
03242 
03243         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
03244         {
03245                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
03246                 std::cout << "\t ... Could not set gamma." << std::endl;
03247         }
03248 
03249 // -----------------------------------------------------------------
03250 // Set hue
03251 // -----------------------------------------------------------------
03252         cameraProperty.propertyID = ipa_CameraSensors::PROP_HUE;
03253         std::string sHue = "";
03254 
03255         m_ColorCameraParameters.m_Hue.clear(); // Clear flags within stringstream
03256         m_ColorCameraParameters.m_Hue.seekg(0); // Set Pointer to position 0 within stringstream
03257         m_ColorCameraParameters.m_Hue >> sHue;
03258 
03259         if (sHue == "AUTO")
03260         {
03261                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03262                 cameraProperty.specialValue = VALUE_AUTO;
03263         }
03264         else if (sHue == "DEFAULT")
03265         {
03266                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03267                 cameraProperty.specialValue = VALUE_DEFAULT;
03268         }
03269         else
03270         {
03271                 cameraProperty.propertyType = (ipa_CameraSensors::TYPE_UNSIGNED | ipa_CameraSensors::TYPE_LONG);
03272                 m_ColorCameraParameters.m_Hue.clear(); // Clear flags within stringstream
03273                 m_ColorCameraParameters.m_Hue.seekg(0); // Set Pointer to position 0 within stringstream
03274                 m_ColorCameraParameters.m_Hue >> cameraProperty.u_longData;
03275         }
03276 
03277         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
03278         {
03279                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
03280                 std::cout << "\t ... Could not set hue." << std::endl;
03281         }
03282 
03283 // -----------------------------------------------------------------
03284 // Set saturation
03285 // -----------------------------------------------------------------
03286         cameraProperty.propertyID = ipa_CameraSensors::PROP_SATURATION;
03287         std::string sSaturation = "";
03288 
03289         m_ColorCameraParameters.m_Saturation.clear(); // Clear flags within stringstream
03290         m_ColorCameraParameters.m_Saturation.seekg(0); // Set Pointer to position 0 within stringstream
03291         m_ColorCameraParameters.m_Saturation >> sSaturation;
03292 
03293         if (sSaturation == "AUTO")
03294         {
03295                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03296                 cameraProperty.specialValue = VALUE_AUTO;
03297         }
03298         else if (sSaturation == "DEFAULT")
03299         {
03300                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03301                 cameraProperty.specialValue = VALUE_DEFAULT;
03302         }
03303         else
03304         {
03305                 cameraProperty.propertyType = (ipa_CameraSensors::TYPE_UNSIGNED | ipa_CameraSensors::TYPE_LONG);
03306                 m_ColorCameraParameters.m_Saturation.clear(); // Clear flags within stringstream
03307                 m_ColorCameraParameters.m_Saturation.seekg(0); // Set Pointer to position 0 within stringstream
03308                 m_ColorCameraParameters.m_Saturation >> cameraProperty.u_longData;
03309         }
03310 
03311         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
03312         {
03313                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
03314                 std::cout << "\t ... Could not set saturation." << std::endl;
03315         }
03316 
03317 // -----------------------------------------------------------------
03318 // Set white balance U
03319 // -----------------------------------------------------------------
03320         cameraProperty.propertyID = ipa_CameraSensors::PROP_WHITE_BALANCE_U;
03321         std::string sWhiteBalanceU = "";
03322 
03323         m_ColorCameraParameters.m_WhiteBalanceU.clear(); // Clear flags within stringstream
03324         m_ColorCameraParameters.m_WhiteBalanceU.seekg(0); // Set Pointer to position 0 within stringstream
03325         m_ColorCameraParameters.m_WhiteBalanceU >> sWhiteBalanceU;
03326 
03327         if (sWhiteBalanceU == "AUTO")
03328         {
03329                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03330                 cameraProperty.specialValue = VALUE_AUTO;
03331         }
03332         else if (sWhiteBalanceU == "DEFAULT")
03333         {
03334                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03335                 cameraProperty.specialValue = VALUE_DEFAULT;
03336         }
03337         else
03338         {
03339                 cameraProperty.propertyType = (ipa_CameraSensors::TYPE_UNSIGNED | ipa_CameraSensors::TYPE_LONG);
03340                 m_ColorCameraParameters.m_WhiteBalanceU.clear(); // Clear flags within stringstream
03341                 m_ColorCameraParameters.m_WhiteBalanceU.seekg(0); // Set Pointer to position 0 within stringstream
03342                 m_ColorCameraParameters.m_WhiteBalanceU >> cameraProperty.u_longData;
03343         }
03344 
03345         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
03346         {
03347                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
03348                 std::cout << "\t ... Could not set white balance U." << std::endl;
03349         }
03350 
03351 // -----------------------------------------------------------------
03352 // Set white balance V
03353 // -----------------------------------------------------------------
03354         cameraProperty.propertyID = ipa_CameraSensors::PROP_WHITE_BALANCE_V;
03355         std::string sWhiteBalanceV = "";
03356 
03357         m_ColorCameraParameters.m_WhiteBalanceV.clear(); // Clear flags within stringstream
03358         m_ColorCameraParameters.m_WhiteBalanceV.seekg(0); // Set Pointer to position 0 within stringstream
03359         m_ColorCameraParameters.m_WhiteBalanceV >> sWhiteBalanceV;
03360 
03361         if (sWhiteBalanceV == "AUTO")
03362         {
03363                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03364                 cameraProperty.specialValue = VALUE_AUTO;
03365         }
03366         else if (sWhiteBalanceV == "DEFAULT")
03367         {
03368                 cameraProperty.propertyType = ipa_CameraSensors::TYPE_SPECIAL;
03369                 cameraProperty.specialValue = VALUE_DEFAULT;
03370         }
03371         else
03372         {
03373                 cameraProperty.propertyType = (ipa_CameraSensors::TYPE_UNSIGNED | ipa_CameraSensors::TYPE_LONG);
03374                 m_ColorCameraParameters.m_WhiteBalanceV.clear(); // Clear flags within stringstream
03375                 m_ColorCameraParameters.m_WhiteBalanceV.seekg(0); // Set Pointer to position 0 within stringstream
03376                 m_ColorCameraParameters.m_WhiteBalanceV >> cameraProperty.u_longData;
03377         }
03378 
03379         if (SetProperty(&cameraProperty) & ipa_CameraSensors::RET_FAILED)
03380         {
03381                 std::cout << "WARNING - AVTPikeCam::SetParameters:" << std::endl;
03382                 std::cout << "\t ... Could not set white balance V." << std::endl;
03383         }
03384         return RET_OK;
03385 }
03386 
03387 unsigned long AVTPikeCam::LoadParameters(const char* filename, int cameraIndex)
03388 { 
03389         boost::shared_ptr<TiXmlDocument> p_configXmlDocument (new TiXmlDocument( filename ));
03390 
03391         if (!p_configXmlDocument->LoadFile())
03392         {
03393                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03394                 std::cerr << "\t ... Error while loading xml configuration file (Check filename and syntax of the file):\n";
03395                 std::cerr << "\t ... '" << filename << "'" << std::endl;
03396                 return (RET_FAILED | RET_FAILED_OPEN_FILE);
03397         }
03398         std::cout << "INFO - AVTPikeCam::LoadParameters:" << std::endl;
03399         std::cout << "\t ... Parsing xml configuration file:" << std::endl;
03400         std::cout << "\t ... '" << filename << "'" << std::endl;
03401 
03402         if ( p_configXmlDocument )
03403         {
03404 
03405 //************************************************************************************
03406 //      BEGIN LibCameraSensors
03407 //************************************************************************************
03408                 // Tag element "LibCameraSensors" of Xml Inifile                
03409                 TiXmlElement *p_xmlElement_Root = NULL;
03410                 p_xmlElement_Root = p_configXmlDocument->FirstChildElement( "LibCameraSensors" );
03411                 if ( p_xmlElement_Root )
03412                 {
03413 
03414 //************************************************************************************
03415 //      BEGIN LibCameraSensors->AVTPikeCam
03416 //************************************************************************************
03417                         // Tag element "AVTPikeCam" of Xml Inifile              
03418                         TiXmlElement *p_xmlElement_Root_AVTPikeCam = NULL;
03419                         std::stringstream ss;
03420                         ss << "AVTPikeCam_" << cameraIndex;
03421                         p_xmlElement_Root_AVTPikeCam = p_xmlElement_Root->FirstChildElement( ss.str() );
03422                         if ( p_xmlElement_Root_AVTPikeCam )
03423                         {
03424 
03425 //************************************************************************************
03426 //      BEGIN LibCameraSensors->AVTPikeCam->GUID
03427 //************************************************************************************
03428                                 // Subtag element "SerialNumber" of Xml Inifile
03429                                 TiXmlElement *p_xmlElement_Child = NULL;
03430                                 std::string tempString;
03431                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "GUID" );
03432                                 if ( p_xmlElement_Child )
03433                                 {
03434                                         // read and save value of attribute
03435                                         if ( p_xmlElement_Child->QueryValueAttribute( "high", &tempString ) != TIXML_SUCCESS)
03436                                         {
03437                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03438                                                 std::cerr << "\t ... Can't find attribute 'high' of tag 'GUID'." << std::endl;
03439                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03440                                         }
03441                                         m_GUID.High = strtoul(tempString.c_str(),NULL,16);
03442 
03443                                         // read and save value of attribute
03444                                         if ( p_xmlElement_Child->QueryValueAttribute( "low", &tempString ) != TIXML_SUCCESS)
03445                                         {
03446                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03447                                                 std::cerr << "\t ...  Can't find attribute 'low' of tag 'GUID'." << std::endl;
03448                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03449                                         }
03450                                         m_GUID.Low = strtoul(tempString.c_str(),NULL,16);
03451                                 }
03452                                 else
03453                                 {
03454                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03455                                         std::cerr << "\t ...  Can't find tag 'GUID'." << std::endl;
03456                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03457                                 }
03458 //************************************************************************************
03459 //      BEGIN LibCameraSensors->AVTPikeCam->Role
03460 //************************************************************************************
03461                                 // Subtag element "Role" of Xml Inifile
03462                                 p_xmlElement_Child = NULL;
03463                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "Role" );
03464                                 if ( p_xmlElement_Child )
03465                                 {
03466                                         // read and save value of attribute
03467                                         if ( p_xmlElement_Child->QueryValueAttribute( "value", &tempString ) != TIXML_SUCCESS)
03468                                         {
03469                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03470                                                 std::cerr << "\t ...  Can't find attribute 'value' of tag 'Role'." << std::endl;
03471                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03472                                         }
03473 
03474                                         if (tempString == "MASTER") m_ColorCameraParameters.m_CameraRole = MASTER;
03475                                         else if (tempString == "SLAVE") m_ColorCameraParameters.m_CameraRole = SLAVE;
03476                                         else
03477                                         {
03478                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03479                                                 std::cerr << "\t ... Role " << tempString << " unspecified." << std::endl;
03480                                                 return (RET_FAILED);
03481                                         }
03482 
03483                                 }
03484                                 else
03485                                 {
03486                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03487                                         std::cerr << "\t ... Can't find tag 'Role'." << std::endl;
03488                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03489                                 }
03490 
03491 //************************************************************************************
03492 //      BEGIN LibCameraSensors->AVTPikeCam->VideoFormat
03493 //************************************************************************************
03494                                 // Subtag element "ImageFormat" of Xml Inifile
03495                                 p_xmlElement_Child = NULL;
03496                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "VideoFormat" );
03497                                 if ( p_xmlElement_Child )
03498                                 {
03499                                         // read and save value of attribute
03500                                         if ( p_xmlElement_Child->QueryValueAttribute( "type", &tempString) != TIXML_SUCCESS)
03501                                         {
03502                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03503                                                 std::cerr << "\t ... Can't find attribute 'type' of tag 'VideoFormat'." << std::endl;
03504                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03505                                         }
03506                                         else
03507                                         {
03508                                                 m_ColorCameraParameters.m_VideoFormat.str( " " );       // Clear stringstream
03509                                                 m_ColorCameraParameters.m_VideoFormat.clear();          // Reset flags
03510                                                 m_ColorCameraParameters.m_VideoFormat << tempString;
03511                                         }
03512                                 }
03513                                 else
03514                                 {
03515                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03516                                         std::cerr << "\t ... Can't find tag 'VideoFormat'." << std::endl;
03517                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03518                                 }
03519 
03520 //************************************************************************************
03521 //      BEGIN LibCameraSensors->AVTPikeCam->VideoMode
03522 //************************************************************************************
03523                                 // Subtag element "ColorFormat" of Xml Inifile
03524                                 p_xmlElement_Child = NULL;
03525                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "VideoMode" );
03526                                 if ( p_xmlElement_Child )
03527                                 {
03528                                         // read and save value of attribute
03529                                         if ( p_xmlElement_Child->QueryValueAttribute( "type", &tempString ) != TIXML_SUCCESS)
03530                                         {
03531                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03532                                                 std::cerr << "\t ... Can't find attribute 'type' of tag 'VideoMode'." << std::endl;
03533                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03534                                         }
03535                                         else
03536                                         {
03537                                                 m_ColorCameraParameters.m_VideoMode.str( " " ); // Clear stringstream
03538                                                 m_ColorCameraParameters.m_VideoMode.clear();            // Reset flags
03539                                                 m_ColorCameraParameters.m_VideoMode << tempString;
03540                                         }
03541 
03542                                 }
03543                                 else
03544                                 {
03545                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03546                                         std::cerr << "\t ... Can't find tag 'VideoMode'." << std::endl;
03547                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03548                                 }
03549 
03550 //************************************************************************************
03551 //      BEGIN LibCameraSensors->AVTPikeCam->Resolution
03552 //************************************************************************************
03553                                 // Subtag element "XSize" of Xml Inifile
03554                                 p_xmlElement_Child = NULL;
03555                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "Resolution" );
03556                                 if ( p_xmlElement_Child )
03557                                 {
03558                                         // read and save value of attribute
03559                                         if ( p_xmlElement_Child->QueryValueAttribute("width", &tempString) != TIXML_SUCCESS)
03560                                         {
03561                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03562                                                 std::cerr << "\t ... Can't find attribute 'width' of tag 'Resolution'." << std::endl;
03563                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03564                                         }
03565                                         else
03566                                         {
03567                                                 m_ColorCameraParameters.m_ImageWidth.str( " " );        // Clear stringstream
03568                                                 m_ColorCameraParameters.m_ImageWidth.clear();           // Reset flags
03569                                                 m_ColorCameraParameters.m_ImageWidth << tempString;
03570                                         }
03571                                         // read and save value of attribute
03572                                         if ( p_xmlElement_Child->QueryValueAttribute("height", &tempString) != TIXML_SUCCESS)
03573                                         {
03574                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03575                                                 std::cerr << "\t ... Can't find attribute 'height' of tag 'Resolution'." << std::endl;
03576                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03577                                         }
03578                                         else
03579                                         {
03580                                                 m_ColorCameraParameters.m_ImageHeight.str( " " );       // Clear stringstream
03581                                                 m_ColorCameraParameters.m_ImageHeight.clear();          // Reset flags
03582                                                 m_ColorCameraParameters.m_ImageHeight << tempString;
03583                                         }
03584                                 }
03585                                 else
03586                                 {
03587                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03588                                         std::cerr << "\t ... Can't find tag 'Resolution'." << std::endl;
03589                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03590                                 }
03591 
03592 //************************************************************************************
03593 //      BEGIN LibCameraSensors->AVTPikeCam->FrameRate
03594 //************************************************************************************
03595                                 // Subtag element "FrameRate" of Xml Inifile
03596                                 p_xmlElement_Child = NULL;
03597                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "FrameRate" );
03598                                 if ( p_xmlElement_Child )
03599                                 {
03600                                         // read and save value of attribute
03601                                         if ( p_xmlElement_Child->QueryValueAttribute("fps", &tempString) != TIXML_SUCCESS)
03602                                         {
03603                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03604                                                 std::cerr << "\t ... Can't find attribute 'fps' of tag 'FrameRate'." << std::endl;
03605                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03606                                         }
03607                                         else
03608                                         {
03609                                                 m_ColorCameraParameters.m_FrameRate.str( " " ); // Clear stringstream
03610                                                 m_ColorCameraParameters.m_FrameRate.clear();            // Reset flags
03611                                                 m_ColorCameraParameters.m_FrameRate << tempString;
03612                                         }
03613 
03614                                 }
03615                                 else
03616                                 {
03617                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03618                                         std::cerr << "\t ... Can't find tag 'FrameRate'." << std::endl;
03619                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03620                                 }
03621 
03622 
03623 //************************************************************************************
03624 //      BEGIN LibCameraSensors->AVTPikeCam->ColorMode
03625 //************************************************************************************
03626                                 // Subtag element "ColorFormat" of Xml Inifile
03627                                 p_xmlElement_Child = NULL;
03628                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "ColorMode" );
03629                                 if ( p_xmlElement_Child )
03630                                 {
03631                                         // read and save value of attribute
03632                                         if ( p_xmlElement_Child->QueryValueAttribute( "type", &tempString ) != TIXML_SUCCESS)
03633                                         {
03634                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03635                                                 std::cerr << "\t ... Can't find attribute 'type' of tag 'ColorMode'." << std::endl;
03636                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03637                                         }
03638                                         else
03639                                         {
03640                                                 m_ColorCameraParameters.m_ColorMode.str( " " ); // Clear stringstream
03641                                                 m_ColorCameraParameters.m_ColorMode.clear();            // Reset flags
03642                                                 m_ColorCameraParameters.m_ColorMode << tempString;
03643                                         }
03644 
03645                                 }
03646                                 else
03647                                 {
03648                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03649                                         std::cerr << "\t ... Can't find tag 'ColorMode'." << std::endl;
03650                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03651                                 }
03652 
03653 //************************************************************************************
03654 //      BEGIN LibCameraSensors->AVTPikeCam->IsoSpeed
03655 //************************************************************************************
03656                                 // Subtag element "IsoSpeed " of Xml Inifile
03657                                 p_xmlElement_Child = NULL;
03658                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "IsoSpeed" );
03659                                 if ( p_xmlElement_Child )
03660                                 {
03661                                         // read and save value of attribute
03662                                         if ( p_xmlElement_Child->QueryValueAttribute( "speed", &tempString ) != TIXML_SUCCESS)
03663                                         {
03664                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03665                                                 std::cerr << "\t ... Can't find attribute 'speed' of tag 'IsoSpeed'." << std::endl;
03666                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03667                                         }
03668                                         else
03669                                         {
03670                                                 m_ColorCameraParameters.m_IsoSpeed.str( " " );  // Clear stringstream
03671                                                 m_ColorCameraParameters.m_IsoSpeed.clear();             // Reset flags
03672                                                 m_ColorCameraParameters.m_IsoSpeed << tempString;
03673                                         }
03674 
03675                                 }
03676                                 else
03677                                 {
03678                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03679                                         std::cerr << "\t ... Can't find tag 'IsoSpeed'." << std::endl;
03680                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03681                                 }
03682 
03683 //************************************************************************************
03684 //      BEGIN LibCameraSensors->AVTPikeCam->OperationMode
03685 //************************************************************************************
03686                                 // Subtag element "OperationMode" of Xml Inifile
03687                                 p_xmlElement_Child = NULL;
03688                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "OperationMode" );
03689                                 if ( p_xmlElement_Child )
03690                                 {
03691                                         // read and save value of attribute
03692                                         if ( p_xmlElement_Child->QueryValueAttribute( "value", &tempString ) != TIXML_SUCCESS)
03693                                         {
03694                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03695                                                 std::cerr << "\t ... Can't find attribute 'value' of tag 'OperationMode'." << std::endl;
03696                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03697                                         }
03698                                         if (tempString == "A") m_operationMode_B = false;
03699                                         else if (tempString == "B") m_operationMode_B = true;
03700                                         else
03701                                         {
03702                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03703                                                 std::cerr << "\t ... FireWire operation mode " << tempString << " unspecified." << std::endl;
03704                                                 return (RET_FAILED);
03705                                         }
03706                                 }
03707                                 else
03708                                 {
03709                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03710                                         std::cerr << "\t ... Can't find tag 'OperationMode'." << std::endl;
03711                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03712                                 }
03713 
03714 //************************************************************************************
03715 //      BEGIN LibCameraSensors->AVTPikeCam->PROP_SHUTTER
03716 //************************************************************************************
03717                                 // Subtag element "PROP_SHUTTER" of Xml Inifile
03718                                 p_xmlElement_Child = NULL;
03719                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "PROP_SHUTTER" );
03720                                 if ( p_xmlElement_Child )
03721                                 {
03722                                         // read and save value of attribute
03723                                         if ( p_xmlElement_Child->QueryValueAttribute( "value", &tempString) != TIXML_SUCCESS)
03724                                         {
03725                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03726                                                 std::cerr << "\t ... Can't find attribute 'value' of tag 'PROP_SHUTTER'." << std::endl;
03727                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03728                                         }
03729                                         else
03730                                         {
03731                                                 m_ColorCameraParameters.m_Shutter.str( " " );   // Clear stringstream
03732                                                 m_ColorCameraParameters.m_Shutter.clear();              // Reset flags
03733                                                 m_ColorCameraParameters.m_Shutter << tempString;
03734                                         }
03735                                 }
03736                                 else
03737                                 {
03738                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03739                                         std::cerr << "\t ... Can't find tag 'PROP_SHUTTER'." << std::endl;
03740                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03741                                 }
03742 
03743 //************************************************************************************
03744 //      BEGIN LibCameraSensors->AVTPikeCam->PROP_BRIGHTNESS
03745 //************************************************************************************
03746                                 // Subtag element "SerialNumber" of Xml Inifile
03747                                 p_xmlElement_Child = NULL;
03748                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "PROP_BRIGHTNESS" );
03749                                 if ( p_xmlElement_Child )
03750                                 {
03751                                         // read and save value of attribute
03752                                         if ( p_xmlElement_Child->QueryValueAttribute( "value", &tempString) != TIXML_SUCCESS)
03753                                         {
03754                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03755                                                 std::cerr << "\t ... Can't find attribute 'value' of tag 'PROP_BRIGHTNESS'." << std::endl;
03756                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03757                                         }
03758                                         else
03759                                         {
03760                                                 m_ColorCameraParameters.m_Brightness.str( " " );        // Clear stringstream
03761                                                 m_ColorCameraParameters.m_Brightness.clear();           // Reset flags
03762                                                 m_ColorCameraParameters.m_Brightness << tempString;
03763                                         }
03764 
03765                                 }
03766                                 else
03767                                 {
03768                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03769                                         std::cerr << "\t ... Can't find tag 'PROP_BRIGHTNES'." << std::endl;
03770                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03771                                 }
03772 
03773 //************************************************************************************
03774 //      BEGIN LibCameraSensors->AVTPikeCam->PROP_EXPOSURE_TIME
03775 //************************************************************************************
03776                                 // Subtag element "SerialNumber" of Xml Inifile
03777                                 p_xmlElement_Child = NULL;
03778                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "PROP_EXPOSURE_TIME" );
03779                                 if ( p_xmlElement_Child )
03780                                 {
03781                                         // read and save value of attribute
03782                                         if ( p_xmlElement_Child->QueryValueAttribute( "value", &tempString) != TIXML_SUCCESS)
03783                                         {
03784                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03785                                                 std::cerr << "\t ... Can't find attribute 'value' of tag 'PROP_EXPOSURE_TIME'." << std::endl;
03786                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03787                                         }
03788                                         else
03789                                         {
03790                                                 m_ColorCameraParameters.m_ExposureTime.str( " " );      // Clear stringstream
03791                                                 m_ColorCameraParameters.m_ExposureTime.clear();         // Reset flags
03792                                                 m_ColorCameraParameters.m_ExposureTime << tempString;
03793                                         }
03794 
03795                                 }
03796                                 else
03797                                 {
03798                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03799                                         std::cerr << "\t ... Can't find tag 'PROP_EXPOSURE_TIME'." << std::endl;
03800                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03801                                 }
03802 
03803 //************************************************************************************
03804 //      BEGIN LibCameraSensors->AVTPikeCam->PROP_WHITE_BALANCE_U 
03805 //************************************************************************************
03806                                 // Subtag element "SerialNumber" of Xml Inifile
03807                                 p_xmlElement_Child = NULL;
03808                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement("PROP_WHITE_BALANCE_U");
03809                                 if ( p_xmlElement_Child )
03810                                 {
03811                                         // read and save value of attribute
03812                                         if ( p_xmlElement_Child->QueryValueAttribute("value", &tempString) != TIXML_SUCCESS)
03813                                         {
03814                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03815                                                 std::cerr << "\t ... Can't find attribute 'value' of tag 'PROP_WHITE_BALANCE_U'." << std::endl;
03816                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03817                                         }
03818                                         else
03819                                         {
03820                                                 m_ColorCameraParameters.m_WhiteBalanceU.str( " " );     // Clear stringstream
03821                                                 m_ColorCameraParameters.m_WhiteBalanceU.clear();                // Reset flags
03822                                                 m_ColorCameraParameters.m_WhiteBalanceU << tempString;
03823                                         }
03824                                 }
03825                                 else
03826                                 {
03827                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03828                                         std::cerr << "\t ... Can't find tag 'PROP_WHITE_BALANCE_U'." << std::endl;
03829                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03830                                 }
03831 
03832 //************************************************************************************
03833 //      BEGIN LibCameraSensors->AVTPikeCam->PROP_WHITE_BALANCE_V 
03834 //************************************************************************************
03835                                 // Subtag element "SerialNumber" of Xml Inifile
03836                                 p_xmlElement_Child = NULL;
03837                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "PROP_WHITE_BALANCE_V" );
03838                                 if ( p_xmlElement_Child )
03839                                 {
03840                                         // read and save value of attribute
03841                                         if ( p_xmlElement_Child->QueryValueAttribute( "value", &tempString) != TIXML_SUCCESS)
03842                                         {
03843                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03844                                                 std::cerr << "\t ... Can't find attribute 'value' of tag 'PROP_WHITE_BALANCE_V'." << std::endl;
03845                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03846                                         }
03847                                         else
03848                                         {
03849                                                 m_ColorCameraParameters.m_WhiteBalanceV.str( " " );     // Clear stringstream
03850                                                 m_ColorCameraParameters.m_WhiteBalanceV.clear();                // Reset flags
03851                                                 m_ColorCameraParameters.m_WhiteBalanceV << tempString;
03852                                         }
03853                                 }
03854                                 else
03855                                 {
03856                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03857                                         std::cerr << "\t ... Can't find tag 'PROP_WHITE_BALANCE_V'." << std::endl;
03858                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03859                                 }
03860 
03861 //************************************************************************************
03862 //      BEGIN LibCameraSensors->AVTPikeCam->PROP_HUE
03863 //************************************************************************************
03864                                 // Subtag element "SerialNumber" of Xml Inifile
03865                                 p_xmlElement_Child = NULL;
03866                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "PROP_HUE" );
03867                                 if ( p_xmlElement_Child )
03868                                 {
03869                                         // read and save value of attribute
03870                                         if ( p_xmlElement_Child->QueryValueAttribute( "value", &tempString) != TIXML_SUCCESS)
03871                                         {
03872                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03873                                                 std::cerr << "\t ... Can't find attribute 'value' of tag 'PROP_HUE'." << std::endl;
03874                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03875                                         }
03876                                         else
03877                                         {
03878                                                 m_ColorCameraParameters.m_Hue.str( " " );       // Clear stringstream
03879                                                 m_ColorCameraParameters.m_Hue.clear();          // Reset flags
03880                                                 m_ColorCameraParameters.m_Hue << tempString;
03881                                         }
03882                                 }
03883                                 else
03884                                 {
03885                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03886                                         std::cerr << "\t ... Can't find tag 'PROP_HUE'." << std::endl;
03887                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03888                                 }
03889 
03890 //************************************************************************************
03891 //      BEGIN LibCameraSensors->AVTPikeCam->PROP_SATURATION
03892 //************************************************************************************
03893                                 // Subtag element "SerialNumber" of Xml Inifile
03894                                 p_xmlElement_Child = NULL;
03895                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "PROP_SATURATION" );
03896                                 if ( p_xmlElement_Child )
03897                                 {
03898                                         // read and save value of attribute
03899                                         if ( p_xmlElement_Child->QueryValueAttribute( "value", &tempString) != TIXML_SUCCESS)
03900                                         {
03901                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03902                                                 std::cerr << "\t ... Can't find attribute 'value' of tag 'PROP_SATURATION'." << std::endl;
03903                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03904                                         }
03905                                         else
03906                                         {
03907                                                 m_ColorCameraParameters.m_Saturation.str( " " );        // Clear stringstream
03908                                                 m_ColorCameraParameters.m_Saturation.clear();           // Reset flags
03909                                                 m_ColorCameraParameters.m_Saturation << tempString;
03910                                         }
03911                                 }
03912                                 else
03913                                 {
03914                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03915                                         std::cerr << "\t ... Can't find tag 'PROP_SATURATION'." << std::endl;
03916                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03917                                 }
03918 
03919 //************************************************************************************
03920 //      BEGIN LibCameraSensors->AVTPikeCam->PROP_GAMMA 
03921 //************************************************************************************
03922                                 // Subtag element "SerialNumber" of Xml Inifile
03923                                 p_xmlElement_Child = NULL;
03924                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "PROP_GAMMA" );
03925                                 if ( p_xmlElement_Child )
03926                                 {
03927                                         // read and save value of attribute
03928                                         if ( p_xmlElement_Child->QueryValueAttribute( "value", &tempString) != TIXML_SUCCESS)
03929                                         {
03930                                                 std::cerr << "AVTPikeCam::LoadParameters:" << std::endl;
03931                                                 std::cerr << "\t ... Can't find attribute 'value' of tag 'PROP_GAMMA'." << std::endl;
03932                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03933                                         }
03934                                         else
03935                                         {
03936                                                 m_ColorCameraParameters.m_Gamma.str( " " );     // Clear stringstream
03937                                                 m_ColorCameraParameters.m_Gamma.clear();                // Reset flags
03938                                                 m_ColorCameraParameters.m_Gamma << tempString;
03939                                         }
03940                                 }
03941                                 else
03942                                 {
03943                                         std::cerr << "AVTPikeCam::LoadParameters:" << std::endl;
03944                                         std::cerr << "\t ... Can't find tag 'PROP_GAMMA'." << std::endl;
03945                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03946                                 }
03947 
03948 //************************************************************************************
03949 //      BEGIN LibCameraSensors->AVTPikeCam->PROP_GAIN 
03950 //************************************************************************************
03951                                 // Subtag element "PROP_GAIN" of Xml Inifile
03952                                 p_xmlElement_Child = NULL;
03953                                 p_xmlElement_Child = p_xmlElement_Root_AVTPikeCam->FirstChildElement( "PROP_GAIN" );
03954                                 if ( p_xmlElement_Child )
03955                                 {
03956                                         // read and save value of attribute
03957                                         if ( p_xmlElement_Child->QueryValueAttribute( "value", &tempString) != TIXML_SUCCESS)
03958                                         {
03959                                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03960                                                 std::cerr << "\t ... Can't find attribute 'value' of tag 'PROP_GAIN '." << std::endl;
03961                                                 return (RET_FAILED | RET_XML_ATTR_NOT_FOUND);
03962                                         }
03963                                         else
03964                                         {
03965                                                 m_ColorCameraParameters.m_Gain.str( " " );      // Clear stringstream
03966                                                 m_ColorCameraParameters.m_Gain.clear();         // Reset flags
03967                                                 m_ColorCameraParameters.m_Gain << tempString;
03968                                         }
03969                                 }
03970                                 else
03971                                 {
03972                                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03973                                         std::cerr << "\t ... Can't find tag 'PROP_EXPOSURE_TIME'." << std::endl;
03974                                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03975                                 }
03976                         }
03977 
03978 //************************************************************************************
03979 //      END LibCameraSensors->AVTPikeCam
03980 //************************************************************************************
03981                         else 
03982                         {
03983                                 std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03984                                 std::cerr << "\t ... Can't find tag '" << ss.str() << "'" << std::endl;
03985                                 return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03986                         }
03987                 }
03988 
03989 //************************************************************************************
03990 //      END LibCameraSensors
03991 //************************************************************************************
03992                 else 
03993                 {
03994                         std::cerr << "ERROR - AVTPikeCam::LoadParameters:" << std::endl;
03995                         std::cerr << "\t ... Can't find tag 'LibCameraSensors'." << std::endl;
03996                         return (RET_FAILED | RET_XML_TAG_NOT_FOUND);
03997                 }
03998         }
03999 
04000         
04001 
04002         return RET_OK;
04003 }
04004 


cob_camera_sensors
Author(s): Jan Fischer
autogenerated on Thu Aug 27 2015 12:45:58