Openni2 support
[profile/ivi/opencv.git] / modules / highgui / include / opencv2 / highgui.hpp
1 /*M///////////////////////////////////////////////////////////////////////////////////////
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 //                          License Agreement
11 //                For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15 // Third party copyrights are property of their respective owners.
16 //
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
19 //
20 //   * Redistribution's of source code must retain the above copyright notice,
21 //     this list of conditions and the following disclaimer.
22 //
23 //   * Redistribution's in binary form must reproduce the above copyright notice,
24 //     this list of conditions and the following disclaimer in the documentation
25 //     and/or other materials provided with the distribution.
26 //
27 //   * The name of the copyright holders may not be used to endorse or promote products
28 //     derived from this software without specific prior written permission.
29 //
30 // This software is provided by the copyright holders and contributors "as is" and
31 // any express or implied warranties, including, but not limited to, the implied
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
34 // indirect, incidental, special, exemplary, or consequential damages
35 // (including, but not limited to, procurement of substitute goods or services;
36 // loss of use, data, or profits; or business interruption) however caused
37 // and on any theory of liability, whether in contract, strict liability,
38 // or tort (including negligence or otherwise) arising in any way out of
39 // the use of this software, even if advised of the possibility of such damage.
40 //
41 //M*/
42
43 #ifndef __OPENCV_HIGHGUI_HPP__
44 #define __OPENCV_HIGHGUI_HPP__
45
46 #include "opencv2/core.hpp"
47
48
49 ///////////////////////// graphical user interface //////////////////////////
50 namespace cv
51 {
52
53 // Flags for namedWindow
54 enum { WINDOW_NORMAL     = 0x00000000, // the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size
55        WINDOW_AUTOSIZE   = 0x00000001, // the user cannot resize the window, the size is constrainted by the image displayed
56        WINDOW_OPENGL     = 0x00001000, // window with opengl support
57
58        WINDOW_FULLSCREEN = 1,          // change the window to fullscreen
59        WINDOW_FREERATIO  = 0x00000100, // the image expends as much as it can (no ratio constraint)
60        WINDOW_KEEPRATIO  = 0x00000000  // the ratio of the image is respected
61      };
62
63 // Flags for set / getWindowProperty
64 enum { WND_PROP_FULLSCREEN   = 0, // fullscreen property    (can be WINDOW_NORMAL or WINDOW_FULLSCREEN)
65        WND_PROP_AUTOSIZE     = 1, // autosize property      (can be WINDOW_NORMAL or WINDOW_AUTOSIZE)
66        WND_PROP_ASPECT_RATIO = 2, // window's aspect ration (can be set to WINDOW_FREERATIO or WINDOW_KEEPRATIO);
67        WND_PROP_OPENGL       = 3  // opengl support
68      };
69
70 enum { EVENT_MOUSEMOVE      = 0,
71        EVENT_LBUTTONDOWN    = 1,
72        EVENT_RBUTTONDOWN    = 2,
73        EVENT_MBUTTONDOWN    = 3,
74        EVENT_LBUTTONUP      = 4,
75        EVENT_RBUTTONUP      = 5,
76        EVENT_MBUTTONUP      = 6,
77        EVENT_LBUTTONDBLCLK  = 7,
78        EVENT_RBUTTONDBLCLK  = 8,
79        EVENT_MBUTTONDBLCLK  = 9,
80        EVENT_MOUSEWHEEL     = 10,
81        EVENT_MOUSEHWHEEL    = 11
82      };
83
84 enum { EVENT_FLAG_LBUTTON   = 1,
85        EVENT_FLAG_RBUTTON   = 2,
86        EVENT_FLAG_MBUTTON   = 4,
87        EVENT_FLAG_CTRLKEY   = 8,
88        EVENT_FLAG_SHIFTKEY  = 16,
89        EVENT_FLAG_ALTKEY    = 32
90      };
91
92 // Qt font
93 enum {  QT_FONT_LIGHT           = 25, //QFont::Light,
94         QT_FONT_NORMAL          = 50, //QFont::Normal,
95         QT_FONT_DEMIBOLD        = 63, //QFont::DemiBold,
96         QT_FONT_BOLD            = 75, //QFont::Bold,
97         QT_FONT_BLACK           = 87  //QFont::Black
98      };
99
100 // Qt font style
101 enum {  QT_STYLE_NORMAL         = 0, //QFont::StyleNormal,
102         QT_STYLE_ITALIC         = 1, //QFont::StyleItalic,
103         QT_STYLE_OBLIQUE        = 2  //QFont::StyleOblique
104      };
105
106 // Qt "button" type
107 enum { QT_PUSH_BUTTON = 0,
108        QT_CHECKBOX    = 1,
109        QT_RADIOBOX    = 2
110      };
111
112
113 typedef void (*MouseCallback)(int event, int x, int y, int flags, void* userdata);
114 typedef void (*TrackbarCallback)(int pos, void* userdata);
115 typedef void (*OpenGlDrawCallback)(void* userdata);
116 typedef void (*ButtonCallback)(int state, void* userdata);
117
118
119 CV_EXPORTS_W void namedWindow(const String& winname, int flags = WINDOW_AUTOSIZE);
120
121 CV_EXPORTS_W void destroyWindow(const String& winname);
122
123 CV_EXPORTS_W void destroyAllWindows();
124
125 CV_EXPORTS_W int startWindowThread();
126
127 CV_EXPORTS_W int waitKey(int delay = 0);
128
129 CV_EXPORTS_W void imshow(const String& winname, InputArray mat);
130
131 CV_EXPORTS_W void resizeWindow(const String& winname, int width, int height);
132
133 CV_EXPORTS_W void moveWindow(const String& winname, int x, int y);
134
135 CV_EXPORTS_W void setWindowProperty(const String& winname, int prop_id, double prop_value);
136
137 CV_EXPORTS_W double getWindowProperty(const String& winname, int prop_id);
138
139 //! assigns callback for mouse events
140 CV_EXPORTS void setMouseCallback(const String& winname, MouseCallback onMouse, void* userdata = 0);
141
142 CV_EXPORTS int getMouseWheelDelta(int flags);
143
144 CV_EXPORTS int createTrackbar(const String& trackbarname, const String& winname,
145                               int* value, int count,
146                               TrackbarCallback onChange = 0,
147                               void* userdata = 0);
148
149 CV_EXPORTS_W int getTrackbarPos(const String& trackbarname, const String& winname);
150
151 CV_EXPORTS_W void setTrackbarPos(const String& trackbarname, const String& winname, int pos);
152
153
154 // OpenGL support
155 CV_EXPORTS void imshow(const String& winname, const ogl::Texture2D& tex);
156
157 CV_EXPORTS void setOpenGlDrawCallback(const String& winname, OpenGlDrawCallback onOpenGlDraw, void* userdata = 0);
158
159 CV_EXPORTS void setOpenGlContext(const String& winname);
160
161 CV_EXPORTS void updateWindow(const String& winname);
162
163
164 // Only for Qt
165
166 struct QtFont
167 {
168     const char* nameFont;  // Qt: nameFont
169     Scalar      color;     // Qt: ColorFont -> cvScalar(blue_component, green_component, red\_component[, alpha_component])
170     int         font_face; // Qt: bool italic
171     const int*  ascii;     // font data and metrics
172     const int*  greek;
173     const int*  cyrillic;
174     float       hscale, vscale;
175     float       shear;     // slope coefficient: 0 - normal, >0 - italic
176     int         thickness; // Qt: weight
177     float       dx;        // horizontal interval between letters
178     int         line_type; // Qt: PointSize
179 };
180
181 CV_EXPORTS QtFont fontQt(const String& nameFont, int pointSize = -1,
182                          Scalar color = Scalar::all(0), int weight = QT_FONT_NORMAL,
183                          int style = QT_STYLE_NORMAL, int spacing = 0);
184
185 CV_EXPORTS void addText( const Mat& img, const String& text, Point org, const QtFont& font);
186
187 CV_EXPORTS void displayOverlay(const String& winname, const String& text, int delayms = 0);
188
189 CV_EXPORTS void displayStatusBar(const String& winname, const String& text, int delayms = 0);
190
191 CV_EXPORTS void saveWindowParameters(const String& windowName);
192
193 CV_EXPORTS void loadWindowParameters(const String& windowName);
194
195 CV_EXPORTS  int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
196
197 CV_EXPORTS  void stopLoop();
198
199 CV_EXPORTS int createButton( const String& bar_name, ButtonCallback on_change,
200                              void* userdata = 0, int type = QT_PUSH_BUTTON,
201                              bool initial_button_state = false);
202
203 } // cv
204
205 ////////////////////////////////// video io /////////////////////////////////
206
207 typedef struct CvCapture CvCapture;
208 typedef struct CvVideoWriter CvVideoWriter;
209
210 namespace cv
211 {
212
213 // Camera API
214 enum { CAP_ANY          = 0,     // autodetect
215        CAP_VFW          = 200,   // platform native
216        CAP_V4L          = 200,
217        CAP_V4L2         = CAP_V4L,
218        CAP_FIREWARE     = 300,   // IEEE 1394 drivers
219        CAP_FIREWIRE     = CAP_FIREWARE,
220        CAP_IEEE1394     = CAP_FIREWARE,
221        CAP_DC1394       = CAP_FIREWARE,
222        CAP_CMU1394      = CAP_FIREWARE,
223        CAP_QT           = 500,   // QuickTime
224        CAP_UNICAP       = 600,   // Unicap drivers
225        CAP_DSHOW        = 700,   // DirectShow (via videoInput)
226        CAP_PVAPI        = 800,   // PvAPI, Prosilica GigE SDK
227        CAP_OPENNI       = 900,   // OpenNI (for Kinect)
228        CAP_OPENNI_ASUS  = 910,   // OpenNI (for Asus Xtion)
229        CAP_ANDROID      = 1000,  // Android
230        CAP_XIAPI        = 1100,  // XIMEA Camera API
231        CAP_AVFOUNDATION = 1200,  // AVFoundation framework for iOS (OS X Lion will have the same API)
232        CAP_GIGANETIX    = 1300,  // Smartek Giganetix GigEVisionSDK
233        CAP_MSMF         = 1400,  // Microsoft Media Foundation (via videoInput)
234        CAP_INTELPERC    = 1500,  // Intel Perceptual Computing SDK
235        CAP_OPENNI2      = 1600   // OpenNI2 (for Kinect)
236      };
237
238 // generic properties (based on DC1394 properties)
239 enum { CAP_PROP_POS_MSEC       =0,
240        CAP_PROP_POS_FRAMES     =1,
241        CAP_PROP_POS_AVI_RATIO  =2,
242        CAP_PROP_FRAME_WIDTH    =3,
243        CAP_PROP_FRAME_HEIGHT   =4,
244        CAP_PROP_FPS            =5,
245        CAP_PROP_FOURCC         =6,
246        CAP_PROP_FRAME_COUNT    =7,
247        CAP_PROP_FORMAT         =8,
248        CAP_PROP_MODE           =9,
249        CAP_PROP_BRIGHTNESS    =10,
250        CAP_PROP_CONTRAST      =11,
251        CAP_PROP_SATURATION    =12,
252        CAP_PROP_HUE           =13,
253        CAP_PROP_GAIN          =14,
254        CAP_PROP_EXPOSURE      =15,
255        CAP_PROP_CONVERT_RGB   =16,
256        CAP_PROP_WHITE_BALANCE_BLUE_U =17,
257        CAP_PROP_RECTIFICATION =18,
258        CAP_PROP_MONOCROME     =19,
259        CAP_PROP_SHARPNESS     =20,
260        CAP_PROP_AUTO_EXPOSURE =21, // DC1394: exposure control done by camera, user can adjust refernce level using this feature
261        CAP_PROP_GAMMA         =22,
262        CAP_PROP_TEMPERATURE   =23,
263        CAP_PROP_TRIGGER       =24,
264        CAP_PROP_TRIGGER_DELAY =25,
265        CAP_PROP_WHITE_BALANCE_RED_V =26,
266        CAP_PROP_ZOOM          =27,
267        CAP_PROP_FOCUS         =28,
268        CAP_PROP_GUID          =29,
269        CAP_PROP_ISO_SPEED     =30,
270        CAP_PROP_BACKLIGHT     =32,
271        CAP_PROP_PAN           =33,
272        CAP_PROP_TILT          =34,
273        CAP_PROP_ROLL          =35,
274        CAP_PROP_IRIS          =36,
275        CAP_PROP_SETTINGS      =37
276      };
277
278
279 // DC1394 only
280 // modes of the controlling registers (can be: auto, manual, auto single push, absolute Latter allowed with any other mode)
281 // every feature can have only one mode turned on at a time
282 enum { CAP_PROP_DC1394_OFF                = -4, //turn the feature off (not controlled manually nor automatically)
283        CAP_PROP_DC1394_MODE_MANUAL        = -3, //set automatically when a value of the feature is set by the user
284        CAP_PROP_DC1394_MODE_AUTO          = -2,
285        CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1,
286        CAP_PROP_DC1394_MAX                = 31
287      };
288
289
290 // OpenNI map generators
291 enum { CAP_OPENNI_DEPTH_GENERATOR = 1 << 31,
292        CAP_OPENNI_IMAGE_GENERATOR = 1 << 30,
293        CAP_OPENNI_GENERATORS_MASK = CAP_OPENNI_DEPTH_GENERATOR + CAP_OPENNI_IMAGE_GENERATOR
294      };
295
296 // Properties of cameras available through OpenNI interfaces
297 enum {
298     CAP_PROP_OPENNI_OUTPUT_MODE       = 100,
299     CAP_PROP_OPENNI_FRAME_MAX_DEPTH   = 101, // in mm
300     CAP_PROP_OPENNI_BASELINE          = 102, // in mm
301     CAP_PROP_OPENNI_FOCAL_LENGTH      = 103, // in pixels
302     CAP_PROP_OPENNI_REGISTRATION      = 104, // flag that synchronizes the remapping depth map to image map
303                                              // by changing depth generator's view point (if the flag is "on") or
304                                              // sets this view point to its normal one (if the flag is "off").
305     CAP_PROP_OPENNI_REGISTRATION_ON   = CAP_PROP_OPENNI_REGISTRATION,
306     CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105,
307     CAP_PROP_OPENNI_MAX_BUFFER_SIZE   = 106,
308     CAP_PROP_OPENNI_CIRCLE_BUFFER     = 107,
309     CAP_PROP_OPENNI_MAX_TIME_DURATION = 108,
310     CAP_PROP_OPENNI_GENERATOR_PRESENT = 109,
311     CAP_PROP_OPENNI2_SYNC             = 110,
312     CAP_PROP_OPENNI2_MIRROR           = 111
313      };
314
315 // OpenNI shortcats
316 enum { CAP_OPENNI_IMAGE_GENERATOR_PRESENT         = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,
317        CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE     = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_OUTPUT_MODE,
318        CAP_OPENNI_DEPTH_GENERATOR_BASELINE        = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_BASELINE,
319        CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH    = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_FOCAL_LENGTH,
320        CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION    = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_REGISTRATION,
321        CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION
322      };
323
324 // OpenNI data given from depth generator
325 enum { CAP_OPENNI_DEPTH_MAP         = 0, // Depth values in mm (CV_16UC1)
326        CAP_OPENNI_POINT_CLOUD_MAP   = 1, // XYZ in meters (CV_32FC3)
327        CAP_OPENNI_DISPARITY_MAP     = 2, // Disparity in pixels (CV_8UC1)
328        CAP_OPENNI_DISPARITY_MAP_32F = 3, // Disparity in pixels (CV_32FC1)
329        CAP_OPENNI_VALID_DEPTH_MASK  = 4, // CV_8UC1
330
331        // Data given from RGB image generator
332        CAP_OPENNI_BGR_IMAGE         = 5,
333        CAP_OPENNI_GRAY_IMAGE        = 6
334      };
335
336 // Supported output modes of OpenNI image generator
337 enum { CAP_OPENNI_VGA_30HZ  = 0,
338        CAP_OPENNI_SXGA_15HZ = 1,
339        CAP_OPENNI_SXGA_30HZ = 2,
340        CAP_OPENNI_QVGA_30HZ = 3,
341        CAP_OPENNI_QVGA_60HZ = 4
342      };
343
344
345 // GStreamer
346 enum { CAP_PROP_GSTREAMER_QUEUE_LENGTH = 200 // default is 1
347      };
348
349
350 // PVAPI
351 enum { CAP_PROP_PVAPI_MULTICASTIP               = 300, // ip for anable multicast master mode. 0 for disable multicast
352        CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE     = 301  // FrameStartTriggerMode: Determines how a frame is initiated
353      };
354
355 // PVAPI: FrameStartTriggerMode
356 enum { CAP_PVAPI_FSTRIGMODE_FREERUN     = 0,    // Freerun
357        CAP_PVAPI_FSTRIGMODE_SYNCIN1     = 1,    // SyncIn1
358        CAP_PVAPI_FSTRIGMODE_SYNCIN2     = 2,    // SyncIn2
359        CAP_PVAPI_FSTRIGMODE_FIXEDRATE   = 3,    // FixedRate
360        CAP_PVAPI_FSTRIGMODE_SOFTWARE    = 4     // Software
361      };
362
363 // Properties of cameras available through XIMEA SDK interface
364 enum { CAP_PROP_XI_DOWNSAMPLING  = 400, // Change image resolution by binning or skipping.
365        CAP_PROP_XI_DATA_FORMAT   = 401, // Output data format.
366        CAP_PROP_XI_OFFSET_X      = 402, // Horizontal offset from the origin to the area of interest (in pixels).
367        CAP_PROP_XI_OFFSET_Y      = 403, // Vertical offset from the origin to the area of interest (in pixels).
368        CAP_PROP_XI_TRG_SOURCE    = 404, // Defines source of trigger.
369        CAP_PROP_XI_TRG_SOFTWARE  = 405, // Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE.
370        CAP_PROP_XI_GPI_SELECTOR  = 406, // Selects general purpose input
371        CAP_PROP_XI_GPI_MODE      = 407, // Set general purpose input mode
372        CAP_PROP_XI_GPI_LEVEL     = 408, // Get general purpose level
373        CAP_PROP_XI_GPO_SELECTOR  = 409, // Selects general purpose output
374        CAP_PROP_XI_GPO_MODE      = 410, // Set general purpose output mode
375        CAP_PROP_XI_LED_SELECTOR  = 411, // Selects camera signalling LED
376        CAP_PROP_XI_LED_MODE      = 412, // Define camera signalling LED functionality
377        CAP_PROP_XI_MANUAL_WB     = 413, // Calculates White Balance(must be called during acquisition)
378        CAP_PROP_XI_AUTO_WB       = 414, // Automatic white balance
379        CAP_PROP_XI_AEAG          = 415, // Automatic exposure/gain
380        CAP_PROP_XI_EXP_PRIORITY  = 416, // Exposure priority (0.5 - exposure 50%, gain 50%).
381        CAP_PROP_XI_AE_MAX_LIMIT  = 417, // Maximum limit of exposure in AEAG procedure
382        CAP_PROP_XI_AG_MAX_LIMIT  = 418, // Maximum limit of gain in AEAG procedure
383        CAP_PROP_XI_AEAG_LEVEL    = 419, // Average intensity of output signal AEAG should achieve(in %)
384        CAP_PROP_XI_TIMEOUT       = 420  // Image capture timeout in milliseconds
385      };
386
387
388 // Properties for Android cameras
389 enum { CAP_PROP_ANDROID_AUTOGRAB               = 1024,
390        CAP_PROP_ANDROID_PREVIEW_SIZES_STRING   = 1025, // readonly, tricky property, returns const char* indeed
391        CAP_PROP_ANDROID_PREVIEW_FORMAT         = 1026, // readonly, tricky property, returns const char* indeed
392        CAP_PROP_ANDROID_FLASH_MODE             = 8001,
393        CAP_PROP_ANDROID_FOCUS_MODE             = 8002,
394        CAP_PROP_ANDROID_WHITE_BALANCE          = 8003,
395        CAP_PROP_ANDROID_ANTIBANDING            = 8004,
396        CAP_PROP_ANDROID_FOCAL_LENGTH           = 8005,
397        CAP_PROP_ANDROID_FOCUS_DISTANCE_NEAR    = 8006,
398        CAP_PROP_ANDROID_FOCUS_DISTANCE_OPTIMAL = 8007,
399        CAP_PROP_ANDROID_FOCUS_DISTANCE_FAR     = 8008
400      };
401
402
403 // Android camera output formats
404 enum { CAP_ANDROID_COLOR_FRAME_BGR  = 0, //BGR
405        CAP_ANDROID_COLOR_FRAME      = CAP_ANDROID_COLOR_FRAME_BGR,
406        CAP_ANDROID_GREY_FRAME       = 1,  //Y
407        CAP_ANDROID_COLOR_FRAME_RGB  = 2,
408        CAP_ANDROID_COLOR_FRAME_BGRA = 3,
409        CAP_ANDROID_COLOR_FRAME_RGBA = 4
410      };
411
412
413 // Android camera flash modes
414 enum { CAP_ANDROID_FLASH_MODE_AUTO     = 0,
415        CAP_ANDROID_FLASH_MODE_OFF      = 1,
416        CAP_ANDROID_FLASH_MODE_ON       = 2,
417        CAP_ANDROID_FLASH_MODE_RED_EYE  = 3,
418        CAP_ANDROID_FLASH_MODE_TORCH    = 4
419      };
420
421
422 // Android camera focus modes
423 enum { CAP_ANDROID_FOCUS_MODE_AUTO             = 0,
424        CAP_ANDROID_FOCUS_MODE_CONTINUOUS_VIDEO = 1,
425        CAP_ANDROID_FOCUS_MODE_EDOF             = 2,
426        CAP_ANDROID_FOCUS_MODE_FIXED            = 3,
427        CAP_ANDROID_FOCUS_MODE_INFINITY         = 4,
428        CAP_ANDROID_FOCUS_MODE_MACRO            = 5
429      };
430
431
432 // Android camera white balance modes
433 enum { CAP_ANDROID_WHITE_BALANCE_AUTO             = 0,
434        CAP_ANDROID_WHITE_BALANCE_CLOUDY_DAYLIGHT  = 1,
435        CAP_ANDROID_WHITE_BALANCE_DAYLIGHT         = 2,
436        CAP_ANDROID_WHITE_BALANCE_FLUORESCENT      = 3,
437        CAP_ANDROID_WHITE_BALANCE_INCANDESCENT     = 4,
438        CAP_ANDROID_WHITE_BALANCE_SHADE            = 5,
439        CAP_ANDROID_WHITE_BALANCE_TWILIGHT         = 6,
440        CAP_ANDROID_WHITE_BALANCE_WARM_FLUORESCENT = 7
441      };
442
443
444 // Android camera antibanding modes
445 enum { CAP_ANDROID_ANTIBANDING_50HZ = 0,
446        CAP_ANDROID_ANTIBANDING_60HZ = 1,
447        CAP_ANDROID_ANTIBANDING_AUTO = 2,
448        CAP_ANDROID_ANTIBANDING_OFF  = 3
449      };
450
451
452 // Properties of cameras available through AVFOUNDATION interface
453 enum { CAP_PROP_IOS_DEVICE_FOCUS        = 9001,
454        CAP_PROP_IOS_DEVICE_EXPOSURE     = 9002,
455        CAP_PROP_IOS_DEVICE_FLASH        = 9003,
456        CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004,
457        CAP_PROP_IOS_DEVICE_TORCH        = 9005
458      };
459
460
461 // Properties of cameras available through Smartek Giganetix Ethernet Vision interface
462 /* --- Vladimir Litvinenko (litvinenko.vladimir@gmail.com) --- */
463 enum { CAP_PROP_GIGA_FRAME_OFFSET_X   = 10001,
464        CAP_PROP_GIGA_FRAME_OFFSET_Y   = 10002,
465        CAP_PROP_GIGA_FRAME_WIDTH_MAX  = 10003,
466        CAP_PROP_GIGA_FRAME_HEIGH_MAX  = 10004,
467        CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005,
468        CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006
469      };
470
471 enum { CAP_PROP_INTELPERC_PROFILE_COUNT               = 11001,
472        CAP_PROP_INTELPERC_PROFILE_IDX                 = 11002,
473        CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE  = 11003,
474        CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE      = 11004,
475        CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD  = 11005,
476        CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ     = 11006,
477        CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT     = 11007
478      };
479
480 // Intel PerC streams
481 enum { CAP_INTELPERC_DEPTH_GENERATOR = 1 << 29,
482        CAP_INTELPERC_IMAGE_GENERATOR = 1 << 28,
483        CAP_INTELPERC_GENERATORS_MASK = CAP_INTELPERC_DEPTH_GENERATOR + CAP_INTELPERC_IMAGE_GENERATOR
484      };
485
486 enum { CAP_INTELPERC_DEPTH_MAP              = 0, // Each pixel is a 16-bit integer. The value indicates the distance from an object to the camera's XY plane or the Cartesian depth.
487        CAP_INTELPERC_UVDEPTH_MAP            = 1, // Each pixel contains two 32-bit floating point values in the range of 0-1, representing the mapping of depth coordinates to the color coordinates.
488        CAP_INTELPERC_IR_MAP                 = 2, // Each pixel is a 16-bit integer. The value indicates the intensity of the reflected laser beam.
489        CAP_INTELPERC_IMAGE                  = 3
490      };
491
492
493 class IVideoCapture;
494 class CV_EXPORTS_W VideoCapture
495 {
496 public:
497     CV_WRAP VideoCapture();
498     CV_WRAP VideoCapture(const String& filename);
499     CV_WRAP VideoCapture(int device);
500
501     virtual ~VideoCapture();
502     CV_WRAP virtual bool open(const String& filename);
503     CV_WRAP virtual bool open(int device);
504     CV_WRAP virtual bool isOpened() const;
505     CV_WRAP virtual void release();
506
507     CV_WRAP virtual bool grab();
508     CV_WRAP virtual bool retrieve(OutputArray image, int flag = 0);
509     virtual VideoCapture& operator >> (CV_OUT Mat& image);
510     virtual VideoCapture& operator >> (CV_OUT UMat& image);
511     CV_WRAP virtual bool read(OutputArray image);
512
513     CV_WRAP virtual bool set(int propId, double value);
514     CV_WRAP virtual double get(int propId);
515
516 protected:
517     Ptr<CvCapture> cap;
518     Ptr<IVideoCapture> icap;
519 private:
520     static Ptr<IVideoCapture> createCameraCapture(int index);
521 };
522
523 class CV_EXPORTS_W VideoWriter
524 {
525 public:
526     CV_WRAP VideoWriter();
527     CV_WRAP VideoWriter(const String& filename, int fourcc, double fps,
528                 Size frameSize, bool isColor = true);
529
530     virtual ~VideoWriter();
531     CV_WRAP virtual bool open(const String& filename, int fourcc, double fps,
532                       Size frameSize, bool isColor = true);
533     CV_WRAP virtual bool isOpened() const;
534     CV_WRAP virtual void release();
535     virtual VideoWriter& operator << (const Mat& image);
536     CV_WRAP virtual void write(const Mat& image);
537
538     CV_WRAP static int fourcc(char c1, char c2, char c3, char c4);
539
540 protected:
541     Ptr<CvVideoWriter> writer;
542 };
543
544 template<> CV_EXPORTS void DefaultDeleter<CvCapture>::operator ()(CvCapture* obj) const;
545 template<> CV_EXPORTS void DefaultDeleter<CvVideoWriter>::operator ()(CvVideoWriter* obj) const;
546
547 } // cv
548
549 #endif