-
Notifications
You must be signed in to change notification settings - Fork 0
/
tisgrabber.h
2245 lines (1748 loc) · 87.9 KB
/
tisgrabber.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#ifndef _TISGRABBER
#define _TISGRABBER
//////////////////////////////////////////////////////////////////////////
/*! @mainpage
Please see "tisgrabber.h" for the function documentation.
*/
#include "TISGrabberGlobalDefs.h"
// WINAPI for Visual Basic
//#define AC WINAPI
//////////////////////////////////////////////////////////////////////////
/*! Calling convention of the DLL functions. For internal use only.
*/
#define AC __stdcall ///< __stdcall for Borland C and Ansi C
#ifndef _WINUSER_
//////////////////////////////////////////////////////////////////////////
/*! Workaround if we are in non windows environment.
*/
#define NOHWNDDEFINED 1
#define __HWND int ///< Workaround if we are in non windows environment.
#else
#define __HWND HWND ///<Workaround if we are in windows environment.
#endif
//////////////////////////////////////////////////////////////////////////
/*! This is the handle of an grabber object. Please use the HGRABBER type to access
this object.
*/
typedef struct HGRABBER_t__ { int unused; } HGRABBER_t; ///<Internal structure of the grabber object handle.
//////////////////////////////////////////////////////////////////////////
/*! The HGRABBER type is used to hold a handle to a grabber object. Each variable of
HGRABBER type can contain one video capture device. It is possible to create more
than one variables of this type:
HGRABBER camera1 = IC_CreateGrabber();
HGRABBER camera2 = IC_CreateGrabber();
*/
#define HGRABBER HGRABBER_t* ///< Type of grabber object handle. Used for all functions.
typedef int _cdecl IC_ENUMCB( char* Name, void*);
typedef struct FILTERPARAMETER_t__
{
char Name[30];
FRAMEFILTER_PARAM_TYPE Type;
} FILTERPARAMETER_t;
typedef struct HFRAMEFILTER_t__
{
void *pFilter;
int bHasDialog;
int ParameterCount;
FILTERPARAMETER_t *Parameters;
} HFRAMEFILTER_t;
#define HFRAMEFILTER HFRAMEFILTER_t
//////////////////////////////////////////////////////////////////////////
/*! A return value of IC_SUCCESS indicates that a function has been performed
without an error.
*/
#define IC_SUCCESS 1 ///< Return value for success.
//////////////////////////////////////////////////////////////////////////
/*! If a function returns IC_ERROR, then something went wrong.
*/
#define IC_ERROR 0 ///< Return value that indicates an error.
//////////////////////////////////////////////////////////////////////////
/*! This error indicates, that an HGRABBER handle has not been created yet. Please
see IC_CreateGrabber() for creating an HGRABBER handle.
*/
#define IC_NO_HANDLE -1 ///< No device handle. HGRABBER is NULL.
//////////////////////////////////////////////////////////////////////////
/*! This return values indicates that no device has been opened. Please refer to
IC_OpenVideoCaptureDevice().
*/
#define IC_NO_DEVICE -2 ///< No device opened, but HGRABBER is valid.
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that the video capture device is not in live mode,
but live mode is for the current function call required. Please refer to
IC_StartLive().
*/
#define IC_NOT_AVAILABLE -3 ///< Property not avaiable, but HGRABBER is valid.
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that the video capture device does not support
the specified property.
*/
#define IC_NO_PROPERTYSET -3 ///< The Propertyset was not queried.
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that the porperty set was not queried for
the current grabber handle. Please check, whether IC_QueryPropertySet()
was called once before using the function.
*/
#define IC_DEFAULT_WINDOW_SIZE_SET -3 ///< The live display window size could not be set
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that setting of a custom live display window size
failed, because IC_SetDefaultWindowPosition() was not called with parameter false
somewhere before.
@sa IC_SetDefaultWindowPosition
@sa IC_SetWindowPosition
*/
#define IC_NOT_IN_LIVEMODE -3 ///< A device has been opened, but is is not in live mode.
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that a device does not support the requested property, or
the name of a property was written in wrong way.
@sa IC_GetPropertyValueRange
*/
#define IC_PROPERTY_ITEM_NOT_AVAILABLE -4 ///< A requested property item is not available
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that a device does not support the requested element property, or
the name of an element was written in wrong way.
@sa IC_GetPropertyValueRange
*/
#define IC_PROPERTY_ELEMENT_NOT_AVAILABLE -5 ///< A requested element of a given property item is not available
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that a property element does not support
the request, that is wanted. e.g. Exposure Auto has no range, therefore
IC_GetPropertyValueRange(hGrabber, "Epxosure","Auto", &min, &max )
will return IC_PROPERTY_ELEMENT_WRONG_INTERFACE.
@sa IC_GetPropertyValueRange
*/
#define IC_PROPERTY_ELEMENT_WRONG_INTERFACE -6 ///< A requested element has not the interface, which is needed.
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that there was an index passed, which
was out of range of the number of available elements
@sa IC_ListDevicesbyIndex
*/
#define IC_INDEX_OUT_OF_RANGE -7 ///< A requested element has not the interface, which is needed.
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that that the passed XML file contains no valid XML
data.
@sa IC_LoadDeviceStateFromFileEx
*/
#define IC_WRONG_XML_FORMAT -1
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that the passed XML file contains no compatible XML
data.
@sa IC_LoadDeviceStateFromFileEx
*/
#define IC_WRONG_INCOMPATIBLE_XML -3
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that not all properties have been restored
as desired, but the camera itself was opened.
@sa IC_LoadDeviceStateFromFileEx
*/
#define IC_NOT_ALL_PROPERTIES_RESTORED -4
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that the device specified in the XML was not
found. E.g. The same model, but different serial number, or no camera
connected at all.
@sa IC_LoadDeviceStateFromFileEx
*/
#define IC_DEVICE_NOT_FOUND -5
//////////////////////////////////////////////////////////////////////////
/*! This return value indicates, that the passed file does not exist
@sa IC_LoadDeviceStateFromFileEx
*/
#define IC_FILE_NOT_FOUND 35
#if defined(__cplusplus)
extern "C"
{
#endif
//////////////////////////////////////////////////////////////////////////
/*! Initialize the ICImagingControl class library. This function must be called
only once before any other functions of this library are called.
@param szLicenseKey IC Imaging Control license key or NULL if only a trial version is available.
@retval IC_SUCCESS on success.
@retval IC_ERROR on wrong license key or other errors.
@sa IC_CloseLibrary
*/
int AC IC_InitLibrary( char* szLicenseKey );///<Initialize the library.
//////////////////////////////////////////////////////////////////////////
/*! Creates a new grabber handle and returns it. A new created grabber should be
release with a call to IC_ReleaseGrabber if it is no longer needed.
@retval IC_SUCCESS on success.
@retval IC_ERROR if an error occurred.
@sa IC_ReleaseGrabber
*/
HGRABBER AC IC_CreateGrabber();///<Create a new grabber handle
//////////////////////////////////////////////////////////////////////////
/*! Release the grabber object. Must be called, if the calling application
does no longer need the grabber.
@param hGrabber The handle to grabber to be released.
@sa IC_CreateGrabber
*/
void AC IC_ReleaseGrabber( HGRABBER *hGrabber ); ///< Release an HGRABBER object.
//////////////////////////////////////////////////////////////////////////
/* Must be called at the of the application to release allocated memory.
@sa IC_InitLibrary
*/
void AC IC_CloseLibrary(); ///< Closes the library, cleans up memory.
//////////////////////////////////////////////////////////////////////////
/*! Open a video capture device. The hGrabber handle must have been created previously by
a call to IC_CreateGrabber(). Once a hGrabber handle has been created it can be
recycled to open different video capture devices in sequence.
@param hGrabber The handle to grabber object, that has been created by a call to IC_CreateGrabber
@param szDeviceName Friendly name of the video capture device e.g. "DFK 21F04".
@retval IC_SUCCESS on success.
@retval IC_ERROR on errors.
@sa IC_CloseVideoCaptureDevice
@code
#include "tisgrabber.h"
void main()
{
HGRABBER hGrabber;
if( IC_InitLibrary(0) == IC_SUCCESS )
{
hGrabber = IC_CreateGrabber();
if( hGrabber )
{
if( IC_OpenVideoCaptureDevice(hGrabber,"DFK 21F04") == IC_SUCCESS )
{
// .. do something with the video capture device.
// Now clean up.
IC_CloseVideoCaptureDevice( hGrabber );
IC_ReleaseGrabber( hGrabber );
}
IC_CloseLibrary();
}
}
@endcode
*/
int AC IC_OpenVideoCaptureDevice( HGRABBER hGrabber, char *szDeviceName ); ///< Opens a video capture device.
//////////////////////////////////////////////////////////////////////////
/*! Close the current video capture device. The HGRABBER object will not be deleted.
It can be used again for opening another video capture device.
@param hGrabber The handle to the grabber object.
*/
void AC IC_CloseVideoCaptureDevice( HGRABBER hGrabber ); ///<Closes a video capture device.
//////////////////////////////////////////////////////////////////////////
/*! Retrieve the name of the current video capture device. If the device is
invalid, NULL is returned.
@param hGrabber The handle to the grabber object.
@retval char* The name of the video capture device
@retval NULL If no video capture device is currently opened.
*/
char* AC IC_GetDeviceName(HGRABBER hGrabber ); ///<Returns the name of the current video capture device.
int AC IC_GetVideoFormatWidth( HGRABBER hGrabber); ///<Returns the width of the video format.
int AC IC_GetVideoFormatHeight( HGRABBER hGrabber);///<returns the height of the video format.
//////////////////////////////////////////////////////////////////////////
/*! Set the sink type. A sink type must be set before images can be snapped.
The sink type basically describes the format of the buffer where the snapped
images are stored.
Possible values for format are:
@li Y800
@li RGB24
@li RGB32
@li UYVY
The sink type may differ from the currently set video format.
@param hGrabber The handle to the grabber object.
@param format The desired color format. Possible values for format are:
@li Y800
@li RGB24
@li RGB32
@li UYVY
@retval IC_SUCCESS on success
@retval IC_ERROR if something went wrong.
@note Please note that UYVY can only be used in conjunction with a UYVY video format.
*/
int AC IC_SetFormat( HGRABBER hGrabber, COLORFORMAT format ); ///< Sets the color format of the sink.
//////////////////////////////////////////////////////////////////////////
/*! Retrieves the format of the sink type currently set (See IC_SetFormat()
for possible formats). If no sink type is set
or an error occurred, NONE is returned.
The function returns a valid value only after IC_PreprareLive() or IC_StartLive()
was called. Before these calls, NONE is returned.
@param hGrabber The handle to the grabber object.
@return The current sink color format.
*/
COLORFORMAT AC IC_GetFormat( HGRABBER hGrabber ); ///<Returns the current color format of the sink.
//////////////////////////////////////////////////////////////////////////
/*! Set a video format for the current video capture device. The video format
must be supported by the current video capture device.
@param hGrabber The handle to the grabber object.
@param szFormat A string that contains the desired video format.
@retval IC_SUCCESS on success
@retval IC_ERROR if something went wrong.
@code
#include "tisgrabber.h"
void main()
{
HGRABBER hGrabber;
if( IC_InitLibrary(0) == IC_SUCCESS )
{
hGrabber = IC_CreateGrabber();
if( hGrabber )
{
if( IC_OpenVideoCaptureDevice(hGrabber,"DFK 21F04") == IC_SUCCESS )
{
if( IC_SetVideoFormat(hGrabber,"UYVY (640x480)" == IC_SUCCESS )
{
// .. do something with the video capture device.
}
// Now clean up.
IC_CloseVideoCaptureDevice( hGrabber );
IC_ReleaseGrabber( hGrabber );
}
IC_CloseLibrary();
}
}
}
@endcode
*/
int AC IC_SetVideoFormat( HGRABBER hGrabber, char *szFormat ); ///<Sets the video format.
//////////////////////////////////////////////////////////////////////////
/*! Set a video norm for the current video capture device.
@note The current video capture device must support video norms.
@param hGrabber The handle to the grabber object.
@param szNorm A string that contains the desired video format.
@retval IC_SUCCESS on success
@retval IC_ERROR if something went wrong.
*/
int AC IC_SetVideoNorm( HGRABBER hGrabber, char *szNorm ); ///<Set the video norm.
//////////////////////////////////////////////////////////////////////////
/*! Set a input channel for the current video capture device.
@note The current video capture device must support input channels..
@param hGrabber The handle to the grabber object.
@param szChannel A string that contains the desired video format.
@retval IC_SUCCESS on success
@retval IC_ERROR if something went wrong.
*/
int AC IC_SetInputChannel( HGRABBER hGrabber, char *szChannel ); ///<Sets an input channel.
//////////////////////////////////////////////////////////////////////////
/*! Start the live video.
@param hGrabber The handle to the grabber object.
@param iShow The parameter indicates: @li 1 : Show the video @li 0 : Do not show the video, but deliver frames. (For callbacks etc.)
@retval IC_SUCCESS on success
@retval IC_ERROR if something went wrong.
@sa IC_StopLive
*/
int AC IC_StartLive( HGRABBER hGrabber, int iShow ); ///<Starts the live video.
int AC IC_PrepareLive( HGRABBER hGrabber, int iShow); ///<Prepare the grabber for starting the live video.
int AC IC_SuspendLive(HGRABBER hGrabber); ///<Suspends an image stream and puts it into prepared state.
//////////////////////////////////////////////////////////////////////////
/*! Check, whether the passed grabber already provides are live video
@param hGrabber The handle to the grabber object.
@retval 1 : Livevideo is running, 0 : Livevideo is not running.
@retval IC_NO_HANDLE hGrabber is not a valid handle. GetGrabber was not called.
@retval IC_NO_DEVICE No device opened. Open a device, before this function can be used.
*/
int AC IC_IsLive( HGRABBER hGrabber );
//////////////////////////////////////////////////////////////////////////
/*! Stop the live video.
@param hGrabber The handle to the grabber object.
@sa IC_StartLive
*/
void AC IC_StopLive( HGRABBER hGrabber ); ///<Stops the live video.
//////////////////////////////////////////////////////////////////////////
/*! Check, whether a property is supported by the current video capture device.
@param hGrabber The handle to the grabber object.
@sa eProperty The cammera property to be checked
@retval IC_SUCCESS The property is supported.
@retval IC_ERROR The property is not supported.
@retval IC_NO_HANDLE hGrabber is not a valid handle. GetGrabber was not called.
@retval IC_NO_DEVICE No device opened. Open a device, before this function can be used.
*/
int AC IC_IsCameraPropertyAvailable( HGRABBER hGrabber, CAMERA_PROPERTY eProperty ); ///< Check whether a camera property is available.
//////////////////////////////////////////////////////////////////////////
/*! Set a camera property like exposure, zoom.
@param hGrabber The handle to the grabber object.
@param eProperty The property to be set. It can have following values:
@li PROP_CAM_PAN
@li PROP_CAM_TILT,
@li PROP_CAM_ROLL,
@li PROP_CAM_ZOOM,
@li PROP_CAM_EXPOSURE,
@li PROP_CAM_IRIS,
@li PROP_CAM_FOCUS
@param lValue The value the property is to be set to.
@retval IC_SUCCESS on success
@retval IC_ERROR if something went wrong.
@note lValue should be in the range of the specified property.
If the value could not be set (out of range, auto is currently enabled), the
function returns 0. On success, the functions returns 1.
*/
int AC IC_SetCameraProperty( HGRABBER hGrabber, CAMERA_PROPERTY eProperty, long lValue ); ///< Set a camera property.
int AC IC_CameraPropertyGetRange( HGRABBER hGrabber, CAMERA_PROPERTY eProperty, long *lMin, long *lMax); ///<Get the minimum and maximum value of a camera property
int AC IC_GetCameraProperty( HGRABBER hGrabber, CAMERA_PROPERTY eProperty, long *lValue); ///< Get a camera property's value.
//////////////////////////////////////////////////////////////////////////
/*! Enable or disable automatic for a camera property.
@param hGrabber The handle to the grabber object.
@param iProperty The property to be set. It can have following values:
@li PROP_CAM_PAN
@li PROP_CAM_TILT,
@li PROP_CAM_ROLL,
@li PROP_CAM_ZOOM,
@li PROP_CAM_EXPOSURE,
@li PROP_CAM_IRIS,
@li PROP_CAM_FOCUS
@param iOnOFF Enables or disables the automation. Possible values ar
@li 1 : Enable automatic
@li 0 : Disable Automatic
@retval IC_SUCCESS on success
@retval IC_ERROR if something went wrong.
@note If the property is not supported by the current video capture device or
automation of the property is not available with the current video capture
device, the function returns 0. On success, the function returns 1.
*/
int AC IC_EnableAutoCameraProperty( HGRABBER hGrabber, int iProperty, int iOnOff ); ///<Enables or disables property automation.
int AC IC_IsCameraPropertyAutoAvailable( HGRABBER hGrabber, CAMERA_PROPERTY iProperty ); ///<Check whether automation for a camera property is available.
int AC IC_GetAutoCameraProperty( HGRABBER hGrabber, int iProperty, int *iOnOff ); ///<Retrieve whether automatic is enabled for the specifield camera property.
int AC IC_IsVideoPropertyAvailable( HGRABBER hGrabber, VIDEO_PROPERTY eProperty ); ///<Check whether the specified video property is available.
int AC IC_VideoPropertyGetRange( HGRABBER hGrabber, VIDEO_PROPERTY eProperty, long *lMin, long *lMax); ///<Retrieve the lower and upper limit of a video property.
int AC IC_GetVideoProperty( HGRABBER hGrabber, VIDEO_PROPERTY eProperty, long *lValue ); ///< Retrieve the the current value of the specified video property.
int AC IC_IsVideoPropertyAutoAvailable( HGRABBER hGrabber, VIDEO_PROPERTY eProperty ); ///<Check whether the specified video property supports automation.
int AC IC_GetAutoVideoProperty( HGRABBER hGrabber, int iProperty, int *iOnOff ); ///<Get the automation state of a video property.
//////////////////////////////////////////////////////////////////////////
/*! Set a video property like brightness, contrast.
@param hGrabber The handle to the grabber object.
@param eProperty The property to be set. It can have following values:
@li PROP_VID_BRIGHTNESS ,
@li PROP_VID_CONTRAST,
@li PROP_VID_HUE,
@li PROP_VID_SATURATION,
@li PROP_VID_SHARPNESS,
@li PROP_VID_GAMMA,
@li PROP_VID_COLORENABLE,
@li PROP_VID_WHITEBALANCE,
@li PROP_VID_BLACKLIGHTCOMPENSATION,
@li PROP_VID_GAIN
@param lValue The value the property is to be set to.
@retval IC_SUCCESS on success
@retval IC_ERROR if something went wrong.
@note lValue should be in the range of the specified property.
If the value could not be set (out of range, auto is currently enabled), the
function returns 0. On success, the functions returns 1.
*/
int AC IC_SetVideoProperty( HGRABBER hGrabber, VIDEO_PROPERTY eProperty, long lValue ); ///<Set a video property.
//////////////////////////////////////////////////////////////////////////
/*! Enable or disable automatic for a video propertery.
@param hGrabber The handle to the grabber object.
@param iProperty The property to be set. It can have following values:
@li PROP_VID_BRIGHTNESS,
@li PROP_VID_CONTRAST,
@li PROP_VID_HUE,
@li PROP_VID_SATURATION,
@li PROP_VID_SHARPNESS,
@li PROP_VID_GAMMA,
@li PROP_VID_COLORENABLE,
@li PROP_VID_WHITEBALANCE,
@li PROP_VID_BLACKLIGHTCOMPENSATION,
@li PROP_VID_GAIN
@param iOnOFF Enables or disables the automation. Possible values ar
@li 1 : Enable automatic
@li 0 : Disable Automatic
@retval IC_SUCCESS on success
@retval IC_ERROR if something went wrong.
@note If the property is not supported by the current video capture device or
automation of the property is not available with the current video capture
device, the function reurns 0. On success, the function returns 1.
*/
int AC IC_EnableAutoVideoProperty( HGRABBER hGrabber, int iProperty, int iOnOff ); ///< Switch automatition for a video property,
//////////////////////////////////////////////////////////////////////////
/*! Retrieve the properties of the current video format and sink type
@param hGrabber The handle to the grabber object.
@param *lWidth This recieves the width of the image buffer.
@param *lHeight This recieves the height of the image buffer.
@param *iBitsPerPixel This recieves the count of bits per pixel.
@param *format This recieves the current color format.
@retval IC_SUCCESS on success
@retval IC_ERROR if something went wrong.
*/
int AC IC_GetImageDescription( HGRABBER hGrabber, long *lWidth, long *lHeight, int *iBitsPerPixel, COLORFORMAT *format );///<Retrieve the properties of the current video format and sink typ.
//////////////////////////////////////////////////////////////////////////
/*! Snaps an image. The video capture device must be set to live mode and a
sink type has to be set before this call. The format of the snapped images depend on
the selected sink type.
@param hGrabber The handle to the grabber object.
@param iTimeOutMillisek The Timeout time is passed in milli seconds. A value of -1 indicates, that
no time out is set.
@retval IC_SUCCESS if an image has been snapped
@retval IC_ERROR if something went wrong.
@retval IC_NOT_IN_LIVEMODE if the live video has not been started.
@sa IC_StartLive
@sa IC_SetFormat
*/
int AC IC_SnapImage( HGRABBER hGrabber, int iTimeOutMillisek); ///<Snaps an image from the live stream.
//////////////////////////////////////////////////////////////////////////
/*! Save the contents of the last snapped image by IC_SnapImage into a file.
@param hGrabber The handle to the grabber object.
@param szFileName String containing the file name to be saved to.
@param ft File type if the image, It have be
@li FILETYPE_BMP for bitmap files
@li FILETYPE_JPEG for JPEG file.
@param quality If the JPEG format is used, the image quality must be specified in a range from 0 to 100.
@retval IC_SUCCESS if an image has been snapped
@retval IC_ERROR if something went wrong.
@remarks
The format of the saved images depend on the sink type. If the sink type
is set to Y800, the saved image will be an 8 Bit grayscale image. In any
other case the saved image will be a 24 Bit RGB image.
@note IC Imaging Control 1.41 only supports FILETYPE_BMP.
@sa IC_SnapImage
@sa IC_SetFormat
*/
int AC IC_SaveImage( HGRABBER hGrabber, char *szFileName, IMG_FILETYPE ft, long quality ); ///< Saves an image to a file.
//////////////////////////////////////////////////////////////////////////
/*! Retrieve a byte pointer to the image data (pixel data) of the last snapped
image (see SnapImage()). If the function fails, the return value is NULL
otherwise the value is a pointer to the first byte in the lowest image line
(the image is saved bottom up!).
@param hGrabber The handle to the grabber object.
@retval Nonnull Pointer to the image data
@retval NULL Indicates that an error occurred.
@sa IC_SnapImage
@sa IC_SetFormat
*/
unsigned char* AC IC_GetImagePtr( HGRABBER hGrabber ); ///< Retuns a pointer to the image data
//////////////////////////////////////////////////////////////////////////
/*! Assign an Window handle to display the video in.
@param hGrabber The handle to the grabber object.
@param hWnd The handle of the window where to display the live video in.
@retval IC_SUCCESS if an image has been snapped
@retval IC_ERROR if something went wrong.
*/
int AC IC_SetHWnd( HGRABBER hGrabber, __HWND hWnd ); ///< Sets a window handle for live display
//////////////////////////////////////////////////////////////////////////
/*! Return the serialnumber of the current device. Memory for the serialnumber
must has been allocated by the application:
@code
char szSerial[20];
GetSerialNumber( hGrabber, szSerial );
@endcode
This function decodes the The Imaging Source serialnumbers.
@param hGrabber The handle to the grabber object.
@param szSerial char array that recieves the serial number.
@retval IC_SUCCESS The serial number could be retrieved.
@retval IC_IC_NOT_AVAILABLE The video capture device does not provide a serial number.
@retval IC_NO_DEVICE No video capture device opened-
@retval IC_NO_HANDLE hGrabber is NULL.
*/
int AC IC_GetSerialNumber( HGRABBER hGrabber, char* szSerial );///<Return the video capture device's serial number.
//////////////////////////////////////////////////////////////////////////
/*! Count all connected video capture devices. If the Parameter szDeviceList
is NULL, only the number of devices is queried. The Parameter szDeviceList
must be a two dimensional array of char. The iSize parameter specifies the
length of the strings, that are used in the array.
@param szDeviceList A two dimensional char array that recieves the list. Or NULL if only the count of devices is to be returned.
@param iSize Not used.
@retval >= 0 Success, count of found devices
@retval <0 An error occurred.
Simple sample to list the video capture devices:
@code
char szDeviceList[20][40];
int iDeviceCount;
iDeviceCount = IC_ListDevices( (char*)szDeviceList,40 );
for( i = 0; i < iDeviceCount; i++ )
{
printf("%2d. %s\n",i+1,szDeviceList[i]);
}
@endcode
*/
int AC IC_ListDevices( char *szDeviceList, int iSize );///< Count and list devices.
//////////////////////////////////////////////////////////////////////////
/*! Simpler approach of enumerating devices. No 2D char array needed
@code
char szDeviceName[40]; // Use max 39 chars for a device name
int iDeviceCount;
iDeviceCount = IC_GetDeviceCount(); // Query number of connected devices
for( i = 0; i < iDeviceCount; i++ )
{
IC_ListDevicesbyIndex(szDeviceName,39, i);
printf("%2d. %s\n",i+1,szDeviceName);
}
@endcode
@param szDeviceName Char memory, that receives the device name
@param iSize Size of the char memory. If names are longer, they will be truncated.
@param DeviceIndex Index of the device to be query. Must be between 0 and IC_GetDeviceCount.
@retval >= 0 Success, count of found devices
@retval <0 An error occurred.
*/
int AC IC_ListDevicesbyIndex( char *szDeviceName, int iSize, int DeviceIndex );
//////////////////////////////////////////////////////////////////////////
/*! Count all available video formats. If the Parameter szFormatList
is NULL, only the number of formats is queried. The Parameter szFormatList
must be a two dimensional array of char. The iSize parameter specifies the
length of the strings, that are used in the array to store the format names.
@param hGrabber The handle to the grabber object.
@param szFormatList A two dimensional char array that recieves the list. Or NULL if only the count of formats is to be returned.
@retval >= 0 Success, count of found video formats
@retval <0 An error occurred.
Simple sample to list the video capture devices:
@code
char szFormatList[80][40];
int iFormatCount;
HGRABBER hGrabber;
hGrabber = IC_CreateGrabber();
IC_OpenVideoCaptureDevice(hGrabber, "DFK 21F04" );
iFormatCount = IC_ListDevices(hGrabber, (char*)szFormatList,40 );
for( i = 0; i < min( iFormatCount, 80); i++ )
{
printf("%2d. %s\n",i+1,szFormatList[i]);
}
IC_ReleaseGrabber( hGrabber );
@endcode
*/
int AC IC_ListVideoFormats( HGRABBER hGrabber, char *szFormatList, int iSize );///<List available video formats.
//////////////////////////////////////////////////////////////////////////
/*! Simpler approach of enumerating video formats. No 2D char array needed.
@param hGrabber The handle to the grabber object.
@param szFormatName char memory, that will receive the name of the video format. Should be big enough.
@param iSize Size in byte of szFormatName
@iIndex Index of the video format to query.
@code
char szVideoFormatName[40]; // Use max 39 chars for a video format name
int FormatCount;
HGRABBER hGrabber;
hGrabber = IC_CreateGrabber();
IC_OpenVideoCaptureDevice(hGrabber, "DFK 21AU04" );
FormatCount = IC_GetVideoFormatCount(hGrabber); // Query number of connected devices
for( i = 0; i < FormatCount; i++ )
{
IC_ListVideoFormatbyIndex(szVideoFormatName,39, i);
printf("%2d. %s\n",i+1,szVideoFormatName);
}
@endcode
@param szDeviceName Char memory, that receives the device name
@param iSize Size of the char memory. If names are longer, they will be truncated.
@param DeviceIndex Index of the device to be query. Must be between 0 and IC_GetDeviceCount.
@retval IC_SUCCESS Success,
@retval IC_NO_DEVICE No video capture device selected.
@retval IC_NO_HANDLE No handle to the grabber object.
*/
int AC IC_ListVideoFormatbyIndex( HGRABBER hGrabber, char *szFormatName, int iSize, int iIndex);
//////////////////////////////////////////////////////////////////////////
/*! Get the number of the currently available devices. This function creates an
internal array of all connected video capture devices. With each call to this
function, this array is rebuild. The name and the unique name can be retrieved
from the internal array using the functions IC_GetDevice() and IC_GetUniqueNamefromList.
They are usefull for retrieving device names for opening devices.
@retval >= 0 Success, count of found devices.
@retval IC_NO_HANDLE Internal Error.
@sa IC_GetDevice
@sa IC_GetUniqueNamefromList
*/
int AC IC_GetDeviceCount(); ///<Get the number of the currently available devices.
//////////////////////////////////////////////////////////////////////////
/*! Get a string representation of a device specified by iIndex. iIndex
must be between 0 and IC_GetDeviceCount(). IC_GetDeviceCount() must
have been called before this function, otherwise it will always fail.
@param iIndex The number of the device whose name is to be returned. It must be
in the range from 0 to IC_GetDeviceCount(),
@return Returns the string representation of the device on success, NULL
otherwise.
@sa IC_GetDeviceCount
@sa IC_GetUniqueNamefromList
*/
char* AC IC_GetDevice( int iIndex ); ///< Get the name of a video capture device.
//////////////////////////////////////////////////////////////////////////
/*! Get unique device name of a device specified by iIndex. The unique device name
consist from the device name and its serial number. It allows to differ between
more then one device of the same type connected to the computer. The unique device name
is passed to the function IC_OpenDevByUniqueName
@param iIndex The number of the device whose name is to be returned. It must be
in the range from 0 to IC_GetDeviceCount(),
@return Returns the string representation of the device on success, NULL
otherwise.
@sa IC_GetDeviceCount
@sa IC_GetUniqueNamefromList
@sa IC_OpenDevByUniqueName
*/
char* AC IC_GetUniqueNamefromList( int iIndex );///< Get the unique name of a video capture device.
//////////////////////////////////////////////////////////////////////////
/*! Get the number of the available input channels for the current device.
A video capture device must have been opened before this call.
@param hGrabber The handle to the grabber object.
@retval >= 0 Success
@retval IC_NO_DEVICE No video capture device selected.
@retval IC_NO_HANDLE No handle to the grabber object.
@sa IC_GetInputChannel
*/
int AC IC_GetInputChannelCount( HGRABBER hGrabber ); ///<Get the number of the available input channels.
//////////////////////////////////////////////////////////////////////////
/*! Get a string representation of the input channel specified by iIndex.
iIndex must be between 0 and IC_GetInputChannelCount().
IC_GetInputChannelCount() must have been called before this function,
otherwise it will always fail.
@param hGrabber The handle to the grabber object.
@param iIndex Number of the input channel to be used..
@retval Nonnull The name of the specified input channel
@retval NULL An error occured.
@sa IC_GetInputChannelCount
*/
char* AC IC_GetInputChannel( HGRABBER hGrabber, int iIndex ); ///<Get the name of an input channel.
//////////////////////////////////////////////////////////////////////////
/*! Get the number of the available video norms for the current device.
A video capture device must have been opened before this call.
@param hGrabber The handle to the grabber object.
@retval >= 0 Success
@retval IC_NO_DEVICE No video capture device selected.
@retval IC_NO_HANDLE No handle to the grabber object.
@sa IC_GetVideoNorm
*/
int AC IC_GetVideoNormCount( HGRABBER hGrabber ); ///<Get the count of available video norms.
//////////////////////////////////////////////////////////////////////////
/*! Get a string representation of the video norm specified by iIndex.
iIndex must be between 0 and IC_GetVideoNormCount().
IC_GetVideoNormCount() must have been called before this function,
otherwise it will always fail.
@param hGrabber The handle to the grabber object.
@param iIndex Number of the video norm to be used.
@retval Nonnull The name of the specified video norm.
@retval NULL An error occured.
@sa IC_GetVideoNormCount
*/
char* AC IC_GetVideoNorm( HGRABBER hGrabber, int iIndex ); ///<Get the name of a video norm.
//////////////////////////////////////////////////////////////////////////
/*! Get the number of the available video formats for the current device.
A video capture device must have been opened before this call.
@param hGrabber The handle to the grabber object.
@retval >= 0 Success
@retval IC_NO_DEVICE No video capture device selected.
@retval IC_NO_HANDLE No handle to the grabber object.
@sa IC_GetVideoFormat
*/
int AC IC_GetVideoFormatCount( HGRABBER hGrabber ); ///< Returns the count of available video formats.
//////////////////////////////////////////////////////////////////////////
/*! Get a string representation of the video format specified by iIndex.
iIndex must be between 0 and IC_GetVideoFormatCount().
IC_GetVideoFormatCount() must have been called before this function,
otherwise it will always fail.
@param hGrabber The handle to the grabber object.
@param iIndex Number of the video format to be used.
@retval Nonnull The name of the specified video format.
@retval NULL An error occured.
@sa IC_GetVideoFormatCount
*/
char* AC IC_GetVideoFormat( HGRABBER hGrabber, int iIndex ); ///<Return the name of a video format.
//////////////////////////////////////////////////////////////////////////
/*! Save the state of a video capture device to a file.
@param hGrabber The handle to the grabber object.
@param szFileName Name of the file where to save to.
@retval IC_SUCCESS if an image has been snapped
@retval IC_ERROR if something went wrong.
@sa IC_LoadDeviceStateFromFile
*/
int AC IC_SaveDeviceStateToFile(HGRABBER hGrabber, char* szFileName);///<Save the state of a video capture device to a file.
//////////////////////////////////////////////////////////////////////////
/*! Load a device settings file. On success the device is opened automatically.
@param hGrabber The handle to the grabber object. If it is NULL then a new HGRABBER handle is
created. This should be released by a call to IC_ReleaseGrabber when it is no longer needed.
@param szFileName Name of the file where to save to.
@return HGRABBER The handle of the grabber object, that contains the new opened video capture device.
@sa IC_SaveDeviceStateToFile
@sa IC_ReleaseGrabber
*/
HGRABBER AC IC_LoadDeviceStateFromFile(HGRABBER hGrabber, char* szFileName); ///<Load a device settings file.
//////////////////////////////////////////////////////////////////////////
/*! Load a device settings file.
@param hGrabber The handle to the grabber object. If it is NULL then a new HGRABBER handle is
created, in case OpenDevice is true. If OpenDevice is set to false, the a device must be already
open in the grabber handle. The properties in the passed XML file will be apllied to
the opened device.
This should be released by a call to IC_ReleaseGrabber when it is no longer needed.
@param szFileName Name of the file where to save to.
@param OpenDevice If 1, the device specified in the XML file is opened. If 0, then a device must be opened in the hGrabber.
The properties and video format specified in the XML file will be applied to the opened device.
@return IC_SUCCESS The device was successfully opened and the settings saved in the XML file were set.
@return IC_NO_DEVICE False was passed to OpenDevice, but no device was opened in the grabber handle or the handle is NULL
@return IC_WRONG_XML_FORMAT No device opened.
@return IC_WRONG_INCOMPATIBLE_XML No device opened.
@return IC_DEVICE_NOT_FOUND No device opened.
@return IC_FILE_NOT_FOUND Passed XML file does not exist.
@return IC_NOT_ALL_PROPERTIES_RESTORED The device was opened, but not all properties could be set as wanted.
@sa IC_SaveDeviceStateToFile
@sa IC_ReleaseGrabber
*/
int AC IC_LoadDeviceStateFromFileEx(HGRABBER hGrabber, char* szFileName, int OpenDevice); ///<Load a device settings file.
//////////////////////////////////////////////////////////////////////////
/*! Save the device settings to a file specified by szFilename. When used
with IC Imaging Control 1.41 the device name, the input channel, the
video norm and the video format are saved. When used with IC Imaging
Control 2.0, the VCDProperties are saved as well. Returns 1 on success,
0 otherwise.
Notice that in IC Imaging Control 1.41 the device name includes the trailing
number if there is more than one device of the same type available. This can
cause IC_OpenDeviceBySettings() to fail if one of those devices is unplugged.
When used with IC Imaging Control 2.0, this cannot happen because the device
name is stored without the trailing number. Instead the first device that
matches the type specified in the settings file is opened.
@deprecated Use IC_SaveDeviceStateToFile instead.
*/
int AC IC_SaveDeviceSettings( HGRABBER hGrabber, char* szFilename );
//////////////////////////////////////////////////////////////////////////
/*! Open a device by a settings file specified by szFilename. If succedeed,
1 is returned and a device specified in the settings file is opened and
initialized with the settings data. If failed, 0 is returned.
@deprecated Use IC_LoadDeviceStateFromFile instead.
*/
int AC IC_OpenDeviceBySettings( HGRABBER hGrabber, char* szFilename );
//////////////////////////////////////////////////////////////////////////
/*! Load device settings from a file specified by szFilename. A device must
have been opened before this function is called. A check is performed whether
the current device matches the device type stored in the settings file.
If so, the settings are loaded and set.
Returns 1 on success, 0 otherwise.
Notice: This function will only work with IC Imaging Control 2.0. When used
with IC Imaging Control 1.41, it will always return 0.
@deprecated Use IC_LoadDeviceStateFromFile instead.
*/
int AC IC_LoadDeviceSettings( HGRABBER hGrabber, char* szFilename );
//////////////////////////////////////////////////////////////////////////
/*! Open a video capture by using its DisplayName.
@param hGrabber The handle to the grabber object.
@param szDisplayname Displayname of the device. Can be retrieved by a call to IC_GetDisplayName().
@retval IC_SUCCESS if an image has been snapped
@retval IC_ERROR if something went wrong.