1//////////////////////////////////////////////////////////////////////////////////////// 2// 3// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4// 5// By downloading, copying, installing or using the software you agree to this license. 6// If you do not agree to this license, do not download, install, 7// copy or use the software. 8// 9// 10// Intel License Agreement 11// For Open Source Computer Vision Library 12// 13// Copyright (C) 2000, Intel Corporation, all rights reserved. 14// Third party copyrights are property of their respective owners. 15// 16// Redistribution and use in source and binary forms, with or without modification, 17// are permitted provided that the following conditions are met: 18// 19// * Redistribution's of source code must retain the above copyright notice, 20// this list of conditions and the following disclaimer. 21// 22// * Redistribution's in binary form must reproduce the above copyright notice, 23// this list of conditions and the following disclaimer in the documentation 24// and/or other materials provided with the distribution. 25// 26// * The name of Intel Corporation may not be used to endorse or promote products 27// derived from this software without specific prior written permission. 28// 29// This software is provided by the copyright holders and contributors "as is" and 30// any express or implied warranties, including, but not limited to, the implied 31// warranties of merchantability and fitness for a particular purpose are disclaimed. 32// In no event shall the Intel Corporation or contributors be liable for any direct, 33// indirect, incidental, special, exemplary, or consequential damages 34// (including, but not limited to, procurement of substitute goods or services; 35// loss of use, data, or profits; or business interruption) however caused 36// and on any theory of liability, whether in contract, strict liability, 37// or tort (including negligence or otherwise) arising in any way out of 38// the use of this software, even if advised of the possibility of such damage. 39// 40// 41 42// 43// The code has been contributed by Vladimir N. Litvinenko on 2012 Jul 44// mailto:vladimir.litvinenko@codepaint.ru 45// 46 47#include "precomp.hpp" 48#include <GigEVisionSDK.h> 49#include <GigEVisionSDK.cpp> 50 51#ifdef WIN32 52#include <io.h> 53#else 54#include <stdio.h> 55#endif 56 57#ifdef NDEBUG 58#define CV_WARN(message) 59#else 60#define CV_WARN(message) fprintf(stderr, "warning: %s (%s:%d)\n", message, __FILE__, __LINE__) 61#endif 62 63#define QTGIG_HEARTBEAT_TIME (12000.0) 64#define QTGIG_MAX_WAIT_TIME (2.0) 65#define QTGIG_IMG_WAIT_TIME (3.0) 66 67/*----------------------------------------------------------------------------*/ 68/** 69 \internal 70 \fn bool wrprInitGigEVisionAPI(); 71 \brief Wrapper to GigEVisionAPI function gige::InitGigEVisionAPI () 72 \return true -- success 73 See \a wrprExitGigEVisionAPI 74 75*/ 76bool 77wrprInitGigEVisionAPI() 78{ 79 CV_FUNCNAME("wrprInitGigEVisionAPI"); 80 __BEGIN__; 81 82 try { 83 gige::InitGigEVisionAPI (); 84 } catch(...) { 85 CV_ERROR(CV_StsError, "GigEVisionAPI: initialization (InitGigEVisionAPI()) failed.\n"); 86 } 87 __END__; 88 return true; 89} 90 91/*----------------------------------------------------------------------------*/ 92/** 93 \internal 94 \fn void wrprExitGigEVisionAPI() 95 \brief Wrapper to GigEVisionAPI function gige::ExitGigEVisionAPI () 96 \return true -- success 97 See \a wrprInitGigEVisionAPI 98 99*/ 100bool 101wrprExitGigEVisionAPI() 102{ 103 CV_FUNCNAME("wrprExitGigEVisionAPI"); 104 __BEGIN__; 105 106 try { 107 gige::ExitGigEVisionAPI (); 108 } catch(...) { 109 CV_ERROR(CV_StsError, "GigEVisionAPI: finalization (ExitGigEVisionAPI()) failed.\n"); 110 return false; 111 } 112 __END__; 113 return true; 114} 115 116 117/*----------------------------------------------------------------------------*/ 118/** 119 \internal 120 \fn gige::IGigEVisionAPI wrprGetGigEVisionAPI() 121 \brief Wrapper to GigEVisionAPI function gige::GetGigEVisionAPI () 122 \return item of gige::IGigEVisionAPI type 123 See \a wrprInitGigEVisionAPI, \a gige::IGigEVisionAPI 124*/ 125gige::IGigEVisionAPI 126wrprGetGigEVisionAPI() 127{ 128 129 gige::IGigEVisionAPI b_ret = 0; 130 131 CV_FUNCNAME("wrprGetGigEVisionAPI"); 132 __BEGIN__; 133 134 try { 135 b_ret = gige::GetGigEVisionAPI (); 136 } catch(...) { 137 CV_ERROR(CV_StsError, "GigEVisionAPI: API instance (from GetGigEVisionAPI()) failed.\n"); 138 } 139 140 __END__; 141 142 return b_ret; 143} 144 145 146/*----------------------------------------------------------------------------*/ 147/** 148 \internal 149 \fn bool wrprUnregisterCallback( const gige::IGigEVisionAPI* api, gige::ICallbackEvent* eventHandler) 150 \brief Wrapper to GigEVisionAPI function 151 \param api 152 \param eventHandler 153 \return true - succsess, else - false 154 See \a wrprInitGigEVisionAPI, \a gige::IGigEVisionAPI 155 156*/ 157bool 158wrprUnregisterCallback( const gige::IGigEVisionAPI* api, gige::ICallbackEvent* eventHandler) 159{ 160 bool b_ret = api != NULL; 161 162 if(b_ret) b_ret = api->IsValid (); 163 164 CV_FUNCNAME("wrprUnregisterCallback"); 165 __BEGIN__; 166 167 if(b_ret) 168 { 169 if(eventHandler != NULL) 170 { 171 try { 172 b_ret = ((gige::IGigEVisionAPIInterface*)api)->UnregisterCallback (eventHandler); 173 } catch(...) { 174 CV_ERROR(CV_StsError, "GigEVisionAPI: API unregister callback function (from UnregisterCallback()) failed.\n"); 175 b_ret = false; 176 } 177 } 178 } 179 __END__; 180 181 return (b_ret); 182} 183 184 185/*----------------------------------------------------------------------------*/ 186/** 187 \internal 188 \fn bool wrprDeviceIsConnect( gige::IDevice& device ) 189 \brief Wrapper to GigEVisionAPI function IDevice::IsConnected() 190 \param device - selected device 191 \return true - device connected 192*/ 193bool 194wrprDeviceIsConnect( gige::IDevice& device ) 195{ 196 bool b_ret = device != NULL; 197 198 CV_FUNCNAME("wrprDeviceIsConnect"); 199 __BEGIN__; 200 201 if(b_ret) 202 { 203 try { 204 b_ret = device->IsConnected (); 205 } catch (...) { 206 CV_ERROR(CV_StsError, "GigEVisionAPI: API device connection state (from IsConnected()) failed.\n"); 207 b_ret = false; 208 } 209 } 210 __END__; 211 212 return (b_ret); 213} 214 215 216/*----------------------------------------------------------------------------*/ 217/** 218 \internal 219 \fn bool wrprDeviceIsValid( gige::IDevice& device ) 220 \brief Wrapper to GigEVisionAPI function IDevice::Connect() 221 \param device - selected device 222 \return true - device valid 223 224*/ 225bool 226wrprDeviceIsValid( gige::IDevice& device ) 227{ 228 bool b_ret = device != NULL; 229 230 CV_FUNCNAME("wrprDeviceIsConnect"); 231 __BEGIN__; 232 233 if(b_ret) 234 { 235 try { 236 b_ret = device.IsValid (); 237 } catch (...) { 238 CV_ERROR(CV_StsError, "GigEVisionAPI: API device validation state (from IsValid()) failed.\n"); 239 b_ret = false; 240 } 241 } 242 __END__; 243 244 return (b_ret); 245} 246 247 248/*----------------------------------------------------------------------------*/ 249/** 250 \internal 251 \fn bool wrprDeviceDisconnect ( gige::IDevice& device ) 252 \brief Wrapper to GigEVisionAPI function IDevice::Disconnect() 253 \param device - selected device 254 \return true - device valid 255 256*/ 257bool 258wrprDeviceDisconnect ( gige::IDevice& device ) 259{ 260 bool b_ret = device != NULL; 261 262 CV_FUNCNAME("wrprDeviceDisconnect"); 263 __BEGIN__; 264 265 if(b_ret) 266 { 267 try { 268 device->Disconnect (); 269 } catch (...) { 270 CV_ERROR(CV_StsError, "GigEVisionAPI: API device disconnect (from Disconnect()) failed.\n"); 271 b_ret = false; 272 } 273 } 274 275 __END__; 276 277 return (b_ret); 278} 279 280 281/*----------------------------------------------------------------------------*/ 282/*----------------------------------------------------------------------------*/ 283/** 284 \internal 285 \class CvCaptureCAM_Giganetix 286 \brief Capturing video from camera via Smartec Giganetix (use GigEVisualSDK library). 287*/ 288 289class CvCaptureCAM_Giganetix : public CvCapture 290{ 291 public: 292 CvCaptureCAM_Giganetix(); 293 virtual ~CvCaptureCAM_Giganetix(); 294 295 virtual bool open( int index ); 296 virtual void close(); 297 virtual double getProperty(int) const; 298 virtual bool setProperty(int, double); 299 virtual bool grabFrame(); 300 virtual IplImage* retrieveFrame(int); 301 virtual int getCaptureDomain() 302 { 303 return CV_CAP_GIGANETIX; 304 } 305 306 bool start (); 307 bool stop (); 308 309 protected: 310 311 void init (); 312 void grabImage (); 313 314 gige::IGigEVisionAPI m_api; 315 bool m_api_on; 316 gige::IDevice m_device; 317 bool m_active; 318 319 IplImage* m_raw_image; 320 UINT32 m_rawImagePixelType; 321 bool m_monocrome; 322 323}; 324/*----------------------------------------------------------------------------*/ 325/*----------------------------------------------------------------------------*/ 326void 327CvCaptureCAM_Giganetix::init () 328{ 329 m_monocrome = m_active = m_api_on = false; 330 m_api = 0; 331 m_device = 0; 332 m_raw_image = 0; 333 m_rawImagePixelType = 0; 334} 335 336/*----------------------------------------------------------------------------*/ 337CvCaptureCAM_Giganetix::CvCaptureCAM_Giganetix() 338{ 339 init (); 340 341 m_api_on = wrprInitGigEVisionAPI (); 342 343 if(m_api_on) 344 { 345 if((m_api = wrprGetGigEVisionAPI ()) != NULL) 346 { 347 m_api->SetHeartbeatTime (QTGIG_HEARTBEAT_TIME); 348 } 349 } 350} 351 352/*----------------------------------------------------------------------------*/ 353CvCaptureCAM_Giganetix::~CvCaptureCAM_Giganetix() 354{ 355 close(); 356} 357/*----------------------------------------------------------------------------*/ 358void 359CvCaptureCAM_Giganetix::close() 360{ 361 stop (); 362 363 (void)wrprDeviceDisconnect(m_device); 364 365 (void)wrprExitGigEVisionAPI (); 366 367 if(m_raw_image) cvReleaseImageHeader(&m_raw_image); 368 369 init (); 370} 371 372/*----------------------------------------------------------------------------*/ 373bool 374CvCaptureCAM_Giganetix::open( int index ) 375{ 376 bool b_ret = m_api_on; 377 378 CV_FUNCNAME("CvCaptureCAM_Giganetix::open"); 379 __BEGIN__; 380 381 if(b_ret) 382 b_ret = m_api.IsValid (); 383 384 if(b_ret ) 385 { 386 m_api->FindAllDevices (QTGIG_MAX_WAIT_TIME); 387 388 //TODO - serch device as DevicesList member 389 gige::DevicesList DevicesList = m_api->GetAllDevices (); 390 391 m_device = 0; 392 b_ret = false; 393 394 for (int i = 0; i < (int) DevicesList.size() && !b_ret; i++) 395 { 396 b_ret = (i == index); 397 if(b_ret) 398 { 399 m_device = DevicesList[i]; 400 b_ret = m_device->Connect (); 401 402 if(b_ret) 403 { 404 b_ret = 405 m_device->SetStringNodeValue("AcquisitionStatusSelector", "AcquisitionActive") 406 && 407 m_device->SetStringNodeValue ("TriggerMode", "Off") 408 && 409 m_device->SetStringNodeValue ("AcquisitionMode", "Continuous") 410 && 411 m_device->SetIntegerNodeValue ("AcquisitionFrameCount", 20) 412 ; 413 } 414 } 415 } // for 416 } 417 418 if(!b_ret) 419 { 420 CV_ERROR(CV_StsError, "Giganetix: Error cannot find camera\n"); 421 close (); 422 } else { 423 start (); 424 } 425 426 __END__; 427 428 return b_ret; 429} 430 431/*----------------------------------------------------------------------------*/ 432void 433CvCaptureCAM_Giganetix::grabImage () 434{ 435 CV_FUNCNAME("CvCaptureCAM_Giganetix::grabImage"); 436 __BEGIN__; 437 438 if(wrprDeviceIsValid(m_device) && wrprDeviceIsConnect(m_device)) 439 { 440 if(!m_device->IsBufferEmpty ()) 441 { 442 gige::IImageInfo imageInfo; 443 m_device->GetImageInfo (&imageInfo); 444 assert(imageInfo.IsValid()); 445 446 if (m_device->GetPendingImagesCount() == 1) 447 { 448 UINT32 newPixelType; 449 UINT32 newWidth, newHeight; 450 451 imageInfo->GetPixelType(newPixelType); 452 imageInfo->GetSize(newWidth, newHeight); 453 454 //TODO - validation of image exists 455 bool b_validation = m_raw_image != NULL; 456 if(b_validation) 457 { 458 b_validation = 459 m_raw_image->imageSize == (int)(imageInfo->GetRawDataSize ()) 460 && 461 m_rawImagePixelType == newPixelType; 462 } else { 463 if(m_raw_image) cvReleaseImageHeader(&m_raw_image); 464 } 465 466 m_rawImagePixelType = newPixelType; 467 m_monocrome = GvspGetBitsPerPixel((GVSP_PIXEL_TYPES)newPixelType) == IPL_DEPTH_8U; 468 469 try { 470 if (m_monocrome) 471 { 472 //TODO - For Mono & Color BayerRGB raw pixel types 473 if (!b_validation) 474 { 475 m_raw_image = cvCreateImageHeader (cvSize((int)newWidth, (int)newHeight),IPL_DEPTH_8U,1); 476 m_raw_image->origin = IPL_ORIGIN_TL; 477 m_raw_image->dataOrder = IPL_DATA_ORDER_PIXEL; 478 m_raw_image->widthStep = newWidth; 479 } 480 // Copy image. 481 // ::memcpy(m_raw_image->imageData, imageInfo->GetRawData (), imageInfo->GetRawDataSize ()); 482 483 //TODO - Set pointer to image ! 484 m_raw_image->imageData = (char*)(imageInfo->GetRawData ()); 485 } 486 487 if (!m_monocrome && newPixelType == GVSP_PIX_RGB8_PACKED) 488 { 489 //TODO - 24 bit RGB color image. 490 if (!b_validation) 491 { 492 m_raw_image = cvCreateImageHeader (cvSize((int)newWidth, (int)newHeight), IPL_DEPTH_32F, 3); 493 m_raw_image->origin = IPL_ORIGIN_TL; 494 m_raw_image->dataOrder = IPL_DATA_ORDER_PIXEL; 495 m_raw_image->widthStep = newWidth * 3; 496 } 497 m_raw_image->imageData = (char*)(imageInfo->GetRawData ()); 498 } 499 } catch (...) { 500 CV_ERROR(CV_StsError, "Giganetix: failed to queue a buffer on device\n"); 501 close (); 502 } 503 } else { 504 //TODO - all other pixel types 505 m_raw_image = 0; 506 CV_WARN("Giganetix: Undefined image pixel type\n"); 507 } 508 m_device->PopImage (imageInfo); 509 m_device->ClearImageBuffer (); 510 } 511 } 512 513 __END__; 514} 515 516/*----------------------------------------------------------------------------*/ 517bool 518CvCaptureCAM_Giganetix::start () 519{ 520 CV_FUNCNAME("CvCaptureCAM_Giganetix::start"); 521 __BEGIN__; 522 523 m_active = wrprDeviceIsValid(m_device) && wrprDeviceIsConnect(m_device); 524 525 if(m_active) 526 { 527 (void)m_device->SetIntegerNodeValue("TLParamsLocked", 1); 528 (void)m_device->CommandNodeExecute("AcquisitionStart"); 529 m_active = m_device->GetBooleanNodeValue("AcquisitionStatus", m_active); 530 } 531 532 if(!m_active) 533 { 534 CV_ERROR(CV_StsError, "Giganetix: Cannot open camera\n"); 535 close (); 536 } 537 538 __END__; 539 540 return m_active; 541} 542 543/*----------------------------------------------------------------------------*/ 544bool 545CvCaptureCAM_Giganetix::stop () 546{ 547 if (!m_active) return true; 548 549 CV_FUNCNAME("CvCaptureCAM_Giganetix::stop"); 550 __BEGIN__; 551 552 if(wrprDeviceIsValid(m_device) && wrprDeviceIsConnect(m_device)) 553 { 554 (void)m_device->GetBooleanNodeValue("AcquisitionStatus", m_active); 555 556 if(m_active) 557 { 558 (void)m_device->CommandNodeExecute("AcquisitionStop"); 559 (void)m_device->SetIntegerNodeValue("TLParamsLocked", 0); 560 m_device->ClearImageBuffer (); 561 (void)m_device->GetBooleanNodeValue("AcquisitionStatus", m_active); 562 } 563 } 564 565 if(m_active) 566 { 567 CV_ERROR(CV_StsError, "Giganetix: Improper closure of the camera\n"); 568 close (); 569 } 570 __END__; 571 572 return !m_active; 573} 574 575/*----------------------------------------------------------------------------*/ 576bool 577CvCaptureCAM_Giganetix::grabFrame() 578{ 579 bool b_ret = 580 wrprDeviceIsValid(m_device) 581 && 582 wrprDeviceIsConnect(m_device); 583 584 if(b_ret) grabImage (); 585 586 return b_ret; 587} 588 589 590/*----------------------------------------------------------------------------*/ 591IplImage* 592CvCaptureCAM_Giganetix::retrieveFrame(int) 593{ 594 return ( 595 wrprDeviceIsValid(m_device) && wrprDeviceIsConnect(m_device) ? 596 m_raw_image : 597 NULL 598 ); 599} 600 601/*----------------------------------------------------------------------------*/ 602double 603CvCaptureCAM_Giganetix::getProperty( int property_id ) const 604{ 605 double d_ret = -1.0; 606 INT64 i; 607 608 if(wrprDeviceIsConnect(m_device)) 609 { 610 switch ( property_id ) 611 { 612 case CV_CAP_PROP_FRAME_WIDTH: 613 m_device->GetIntegerNodeValue ("Width", i); 614 d_ret = i; 615 break; 616 case CV_CAP_PROP_FRAME_HEIGHT: 617 m_device->GetIntegerNodeValue ("Height", i); 618 d_ret = i; 619 break; 620 case CV_CAP_PROP_GIGA_FRAME_OFFSET_X: 621 m_device->GetIntegerNodeValue ("OffsetX", i); 622 d_ret = i; 623 break; 624 case CV_CAP_PROP_GIGA_FRAME_OFFSET_Y: 625 m_device->GetIntegerNodeValue ("OffsetY", i); 626 d_ret = i; 627 break; 628 case CV_CAP_PROP_GIGA_FRAME_WIDTH_MAX: 629 m_device->GetIntegerNodeValue ("WidthMax", i); 630 d_ret = i; 631 break; 632 case CV_CAP_PROP_GIGA_FRAME_HEIGH_MAX: 633 m_device->GetIntegerNodeValue ("HeightMax", i); 634 d_ret = i; 635 break; 636 case CV_CAP_PROP_GIGA_FRAME_SENS_WIDTH: 637 m_device->GetIntegerNodeValue ("SensorWidth", i); 638 d_ret = i; 639 break; 640 case CV_CAP_PROP_GIGA_FRAME_SENS_HEIGH: 641 m_device->GetIntegerNodeValue ("SensorHeight", i); 642 d_ret = i; 643 break; 644 case CV_CAP_PROP_FRAME_COUNT: 645 m_device->GetIntegerNodeValue ("AcquisitionFrameCount", i); 646 d_ret = i; 647 break; 648 case CV_CAP_PROP_EXPOSURE: 649 m_device->GetFloatNodeValue ("ExposureTime",d_ret); 650 break; 651 case CV_CAP_PROP_GAIN : 652 m_device->GetFloatNodeValue ("Gain",d_ret); 653 break; 654 case CV_CAP_PROP_TRIGGER : 655 bool b; 656 m_device->GetBooleanNodeValue ("TriggerMode",b); 657 d_ret = (double)b; 658 break; 659 case CV_CAP_PROP_TRIGGER_DELAY : 660 m_device->GetFloatNodeValue ("TriggerDelay",d_ret); 661 break; 662 default : ; 663 } 664 } 665 666 return d_ret; 667} 668 669/*----------------------------------------------------------------------------*/ 670bool 671CvCaptureCAM_Giganetix::setProperty( int property_id, double value ) 672{ 673 bool b_ret = wrprDeviceIsConnect(m_device); 674 675 if(b_ret) 676 { 677 bool b_val = m_active; 678 679 switch ( property_id ) 680 { 681 case CV_CAP_PROP_FRAME_WIDTH: 682 stop (); 683 b_ret = m_device->SetIntegerNodeValue ("Width", (INT64)value); 684 if(b_val) start (); 685 break; 686 case CV_CAP_PROP_GIGA_FRAME_WIDTH_MAX: 687 stop (); 688 b_ret = m_device->SetIntegerNodeValue ("WidthMax", (INT64)value); 689 if(b_val) start (); 690 break; 691 case CV_CAP_PROP_GIGA_FRAME_SENS_WIDTH: 692 stop (); 693 b_ret = m_device->SetIntegerNodeValue ("SensorWidth", (INT64)value); 694 if(b_val) start (); 695 break; 696 case CV_CAP_PROP_FRAME_HEIGHT: 697 stop (); 698 b_ret = m_device->SetIntegerNodeValue ("Height", (INT64)value); 699 if(b_val) start (); 700 break; 701 case CV_CAP_PROP_GIGA_FRAME_HEIGH_MAX: 702 stop (); 703 b_ret = m_device->SetIntegerNodeValue ("HeightMax", (INT64)value); 704 if(b_val) start (); 705 break; 706 case CV_CAP_PROP_GIGA_FRAME_SENS_HEIGH: 707 stop (); 708 b_ret = m_device->SetIntegerNodeValue ("SensorHeight", (INT64)value); 709 if(b_val) start (); 710 break; 711 case CV_CAP_PROP_GIGA_FRAME_OFFSET_X: { 712 INT64 w, wmax, val = (INT64)value; 713 if((b_ret = m_device->GetIntegerNodeValue ("Width", w))) 714 if((b_ret = m_device->GetIntegerNodeValue ("WidthMax", wmax))) 715 b_ret = m_device->SetIntegerNodeValue ("OffsetX", (val + w) > wmax ? (wmax - w) : val); 716 } break; 717 case CV_CAP_PROP_GIGA_FRAME_OFFSET_Y: { 718 INT64 h, hmax, val = (INT64)value; 719 if((b_ret = m_device->GetIntegerNodeValue ("Height", h))) 720 if((b_ret = m_device->GetIntegerNodeValue ("HeightMax", hmax))) 721 b_ret = m_device->SetIntegerNodeValue ("OffsetY", (val + h) > hmax ? (hmax - h) : val); 722 b_ret = m_device->SetIntegerNodeValue ("OffsetY", (INT64)value); 723 } 724 break; 725 case CV_CAP_PROP_EXPOSURE: 726 b_ret = m_device->SetFloatNodeValue ("ExposureTime",value); 727 break; 728 case CV_CAP_PROP_GAIN : 729 b_ret = m_device->SetFloatNodeValue ("Gain",value); 730 break; 731 case CV_CAP_PROP_TRIGGER : 732 b_ret = m_device->SetBooleanNodeValue ("TriggerMode",(bool)value); 733 break; 734 case CV_CAP_PROP_TRIGGER_DELAY : 735 stop (); 736 b_ret = m_device->SetFloatNodeValue ("TriggerDelay",value); 737 if(b_val) start (); 738 break; 739 default: 740 b_ret = false; 741 } 742 } 743 744 return b_ret; 745} 746 747 748/*----------------------------------------------------------------------------*/ 749/*----------------------------------------------------------------------------*/ 750CvCapture* 751cvCreateCameraCapture_Giganetix( int index ) 752{ 753 CvCaptureCAM_Giganetix* capture = new CvCaptureCAM_Giganetix; 754 755 if (!(capture->open( index ))) 756 { 757 delete capture; 758 capture = NULL; 759 } 760 761 return ((CvCapture*)capture); 762} 763 764/*----------------------------------------------------------------------------*/ 765