opencv on mbed

Dependencies:   mbed

Committer:
joeverbout
Date:
Thu Mar 31 21:16:38 2016 +0000
Revision:
0:ea44dc9ed014
OpenCV on mbed attempt

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joeverbout 0:ea44dc9ed014 1 /*M///////////////////////////////////////////////////////////////////////////////////////
joeverbout 0:ea44dc9ed014 2 //
joeverbout 0:ea44dc9ed014 3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
joeverbout 0:ea44dc9ed014 4 //
joeverbout 0:ea44dc9ed014 5 // By downloading, copying, installing or using the software you agree to this license.
joeverbout 0:ea44dc9ed014 6 // If you do not agree to this license, do not download, install,
joeverbout 0:ea44dc9ed014 7 // copy or use the software.
joeverbout 0:ea44dc9ed014 8 //
joeverbout 0:ea44dc9ed014 9 //
joeverbout 0:ea44dc9ed014 10 // License Agreement
joeverbout 0:ea44dc9ed014 11 // For Open Source Computer Vision Library
joeverbout 0:ea44dc9ed014 12 //
joeverbout 0:ea44dc9ed014 13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
joeverbout 0:ea44dc9ed014 14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
joeverbout 0:ea44dc9ed014 15 // Third party copyrights are property of their respective owners.
joeverbout 0:ea44dc9ed014 16 //
joeverbout 0:ea44dc9ed014 17 // Redistribution and use in source and binary forms, with or without modification,
joeverbout 0:ea44dc9ed014 18 // are permitted provided that the following conditions are met:
joeverbout 0:ea44dc9ed014 19 //
joeverbout 0:ea44dc9ed014 20 // * Redistribution's of source code must retain the above copyright notice,
joeverbout 0:ea44dc9ed014 21 // this list of conditions and the following disclaimer.
joeverbout 0:ea44dc9ed014 22 //
joeverbout 0:ea44dc9ed014 23 // * Redistribution's in binary form must reproduce the above copyright notice,
joeverbout 0:ea44dc9ed014 24 // this list of conditions and the following disclaimer in the documentation
joeverbout 0:ea44dc9ed014 25 // and/or other materials provided with the distribution.
joeverbout 0:ea44dc9ed014 26 //
joeverbout 0:ea44dc9ed014 27 // * The name of the copyright holders may not be used to endorse or promote products
joeverbout 0:ea44dc9ed014 28 // derived from this software without specific prior written permission.
joeverbout 0:ea44dc9ed014 29 //
joeverbout 0:ea44dc9ed014 30 // This software is provided by the copyright holders and contributors "as is" and
joeverbout 0:ea44dc9ed014 31 // any express or implied warranties, including, but not limited to, the implied
joeverbout 0:ea44dc9ed014 32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
joeverbout 0:ea44dc9ed014 33 // In no event shall the Intel Corporation or contributors be liable for any direct,
joeverbout 0:ea44dc9ed014 34 // indirect, incidental, special, exemplary, or consequential damages
joeverbout 0:ea44dc9ed014 35 // (including, but not limited to, procurement of substitute goods or services;
joeverbout 0:ea44dc9ed014 36 // loss of use, data, or profits; or business interruption) however caused
joeverbout 0:ea44dc9ed014 37 // and on any theory of liability, whether in contract, strict liability,
joeverbout 0:ea44dc9ed014 38 // or tort (including negligence or otherwise) arising in any way out of
joeverbout 0:ea44dc9ed014 39 // the use of this software, even if advised of the possibility of such damage.
joeverbout 0:ea44dc9ed014 40 //
joeverbout 0:ea44dc9ed014 41 //M*/
joeverbout 0:ea44dc9ed014 42
joeverbout 0:ea44dc9ed014 43 #ifndef __OPENCV_VIDEOIO_HPP__
joeverbout 0:ea44dc9ed014 44 #define __OPENCV_VIDEOIO_HPP__
joeverbout 0:ea44dc9ed014 45
joeverbout 0:ea44dc9ed014 46 #include "opencv2/core.hpp"
joeverbout 0:ea44dc9ed014 47
joeverbout 0:ea44dc9ed014 48 /**
joeverbout 0:ea44dc9ed014 49 @defgroup videoio Media I/O
joeverbout 0:ea44dc9ed014 50 @{
joeverbout 0:ea44dc9ed014 51 @defgroup videoio_c C API
joeverbout 0:ea44dc9ed014 52 @defgroup videoio_ios iOS glue
joeverbout 0:ea44dc9ed014 53 @defgroup videoio_winrt WinRT glue
joeverbout 0:ea44dc9ed014 54 @}
joeverbout 0:ea44dc9ed014 55 */
joeverbout 0:ea44dc9ed014 56
joeverbout 0:ea44dc9ed014 57 ////////////////////////////////// video io /////////////////////////////////
joeverbout 0:ea44dc9ed014 58
joeverbout 0:ea44dc9ed014 59 typedef struct CvCapture CvCapture;
joeverbout 0:ea44dc9ed014 60 typedef struct CvVideoWriter CvVideoWriter;
joeverbout 0:ea44dc9ed014 61
joeverbout 0:ea44dc9ed014 62 namespace cv
joeverbout 0:ea44dc9ed014 63 {
joeverbout 0:ea44dc9ed014 64
joeverbout 0:ea44dc9ed014 65 //! @addtogroup videoio
joeverbout 0:ea44dc9ed014 66 //! @{
joeverbout 0:ea44dc9ed014 67
joeverbout 0:ea44dc9ed014 68 // Camera API
joeverbout 0:ea44dc9ed014 69 enum { CAP_ANY = 0, // autodetect
joeverbout 0:ea44dc9ed014 70 CAP_VFW = 200, // platform native
joeverbout 0:ea44dc9ed014 71 CAP_V4L = 200,
joeverbout 0:ea44dc9ed014 72 CAP_V4L2 = CAP_V4L,
joeverbout 0:ea44dc9ed014 73 CAP_FIREWARE = 300, // IEEE 1394 drivers
joeverbout 0:ea44dc9ed014 74 CAP_FIREWIRE = CAP_FIREWARE,
joeverbout 0:ea44dc9ed014 75 CAP_IEEE1394 = CAP_FIREWARE,
joeverbout 0:ea44dc9ed014 76 CAP_DC1394 = CAP_FIREWARE,
joeverbout 0:ea44dc9ed014 77 CAP_CMU1394 = CAP_FIREWARE,
joeverbout 0:ea44dc9ed014 78 CAP_QT = 500, // QuickTime
joeverbout 0:ea44dc9ed014 79 CAP_UNICAP = 600, // Unicap drivers
joeverbout 0:ea44dc9ed014 80 CAP_DSHOW = 700, // DirectShow (via videoInput)
joeverbout 0:ea44dc9ed014 81 CAP_PVAPI = 800, // PvAPI, Prosilica GigE SDK
joeverbout 0:ea44dc9ed014 82 CAP_OPENNI = 900, // OpenNI (for Kinect)
joeverbout 0:ea44dc9ed014 83 CAP_OPENNI_ASUS = 910, // OpenNI (for Asus Xtion)
joeverbout 0:ea44dc9ed014 84 CAP_ANDROID = 1000, // Android - not used
joeverbout 0:ea44dc9ed014 85 CAP_XIAPI = 1100, // XIMEA Camera API
joeverbout 0:ea44dc9ed014 86 CAP_AVFOUNDATION = 1200, // AVFoundation framework for iOS (OS X Lion will have the same API)
joeverbout 0:ea44dc9ed014 87 CAP_GIGANETIX = 1300, // Smartek Giganetix GigEVisionSDK
joeverbout 0:ea44dc9ed014 88 CAP_MSMF = 1400, // Microsoft Media Foundation (via videoInput)
joeverbout 0:ea44dc9ed014 89 CAP_WINRT = 1410, // Microsoft Windows Runtime using Media Foundation
joeverbout 0:ea44dc9ed014 90 CAP_INTELPERC = 1500, // Intel Perceptual Computing SDK
joeverbout 0:ea44dc9ed014 91 CAP_OPENNI2 = 1600, // OpenNI2 (for Kinect)
joeverbout 0:ea44dc9ed014 92 CAP_OPENNI2_ASUS = 1610, // OpenNI2 (for Asus Xtion and Occipital Structure sensors)
joeverbout 0:ea44dc9ed014 93 CAP_GPHOTO2 = 1700, // gPhoto2 connection
joeverbout 0:ea44dc9ed014 94 CAP_GSTREAMER = 1800, // GStreamer
joeverbout 0:ea44dc9ed014 95 CAP_FFMPEG = 1900, // FFMPEG
joeverbout 0:ea44dc9ed014 96 CAP_IMAGES = 2000 // OpenCV Image Sequence (e.g. img_%02d.jpg)
joeverbout 0:ea44dc9ed014 97 };
joeverbout 0:ea44dc9ed014 98
joeverbout 0:ea44dc9ed014 99 // generic properties (based on DC1394 properties)
joeverbout 0:ea44dc9ed014 100 enum { CAP_PROP_POS_MSEC =0,
joeverbout 0:ea44dc9ed014 101 CAP_PROP_POS_FRAMES =1,
joeverbout 0:ea44dc9ed014 102 CAP_PROP_POS_AVI_RATIO =2,
joeverbout 0:ea44dc9ed014 103 CAP_PROP_FRAME_WIDTH =3,
joeverbout 0:ea44dc9ed014 104 CAP_PROP_FRAME_HEIGHT =4,
joeverbout 0:ea44dc9ed014 105 CAP_PROP_FPS =5,
joeverbout 0:ea44dc9ed014 106 CAP_PROP_FOURCC =6,
joeverbout 0:ea44dc9ed014 107 CAP_PROP_FRAME_COUNT =7,
joeverbout 0:ea44dc9ed014 108 CAP_PROP_FORMAT =8,
joeverbout 0:ea44dc9ed014 109 CAP_PROP_MODE =9,
joeverbout 0:ea44dc9ed014 110 CAP_PROP_BRIGHTNESS =10,
joeverbout 0:ea44dc9ed014 111 CAP_PROP_CONTRAST =11,
joeverbout 0:ea44dc9ed014 112 CAP_PROP_SATURATION =12,
joeverbout 0:ea44dc9ed014 113 CAP_PROP_HUE =13,
joeverbout 0:ea44dc9ed014 114 CAP_PROP_GAIN =14,
joeverbout 0:ea44dc9ed014 115 CAP_PROP_EXPOSURE =15,
joeverbout 0:ea44dc9ed014 116 CAP_PROP_CONVERT_RGB =16,
joeverbout 0:ea44dc9ed014 117 CAP_PROP_WHITE_BALANCE_BLUE_U =17,
joeverbout 0:ea44dc9ed014 118 CAP_PROP_RECTIFICATION =18,
joeverbout 0:ea44dc9ed014 119 CAP_PROP_MONOCHROME =19,
joeverbout 0:ea44dc9ed014 120 CAP_PROP_SHARPNESS =20,
joeverbout 0:ea44dc9ed014 121 CAP_PROP_AUTO_EXPOSURE =21, // DC1394: exposure control done by camera, user can adjust refernce level using this feature
joeverbout 0:ea44dc9ed014 122 CAP_PROP_GAMMA =22,
joeverbout 0:ea44dc9ed014 123 CAP_PROP_TEMPERATURE =23,
joeverbout 0:ea44dc9ed014 124 CAP_PROP_TRIGGER =24,
joeverbout 0:ea44dc9ed014 125 CAP_PROP_TRIGGER_DELAY =25,
joeverbout 0:ea44dc9ed014 126 CAP_PROP_WHITE_BALANCE_RED_V =26,
joeverbout 0:ea44dc9ed014 127 CAP_PROP_ZOOM =27,
joeverbout 0:ea44dc9ed014 128 CAP_PROP_FOCUS =28,
joeverbout 0:ea44dc9ed014 129 CAP_PROP_GUID =29,
joeverbout 0:ea44dc9ed014 130 CAP_PROP_ISO_SPEED =30,
joeverbout 0:ea44dc9ed014 131 CAP_PROP_BACKLIGHT =32,
joeverbout 0:ea44dc9ed014 132 CAP_PROP_PAN =33,
joeverbout 0:ea44dc9ed014 133 CAP_PROP_TILT =34,
joeverbout 0:ea44dc9ed014 134 CAP_PROP_ROLL =35,
joeverbout 0:ea44dc9ed014 135 CAP_PROP_IRIS =36,
joeverbout 0:ea44dc9ed014 136 CAP_PROP_SETTINGS =37,
joeverbout 0:ea44dc9ed014 137 CAP_PROP_BUFFERSIZE =38,
joeverbout 0:ea44dc9ed014 138 CAP_PROP_AUTOFOCUS =39
joeverbout 0:ea44dc9ed014 139 };
joeverbout 0:ea44dc9ed014 140
joeverbout 0:ea44dc9ed014 141
joeverbout 0:ea44dc9ed014 142 // Generic camera output modes.
joeverbout 0:ea44dc9ed014 143 // Currently, these are supported through the libv4l interface only.
joeverbout 0:ea44dc9ed014 144 enum { CAP_MODE_BGR = 0, // BGR24 (default)
joeverbout 0:ea44dc9ed014 145 CAP_MODE_RGB = 1, // RGB24
joeverbout 0:ea44dc9ed014 146 CAP_MODE_GRAY = 2, // Y8
joeverbout 0:ea44dc9ed014 147 CAP_MODE_YUYV = 3 // YUYV
joeverbout 0:ea44dc9ed014 148 };
joeverbout 0:ea44dc9ed014 149
joeverbout 0:ea44dc9ed014 150
joeverbout 0:ea44dc9ed014 151 // DC1394 only
joeverbout 0:ea44dc9ed014 152 // modes of the controlling registers (can be: auto, manual, auto single push, absolute Latter allowed with any other mode)
joeverbout 0:ea44dc9ed014 153 // every feature can have only one mode turned on at a time
joeverbout 0:ea44dc9ed014 154 enum { CAP_PROP_DC1394_OFF = -4, //turn the feature off (not controlled manually nor automatically)
joeverbout 0:ea44dc9ed014 155 CAP_PROP_DC1394_MODE_MANUAL = -3, //set automatically when a value of the feature is set by the user
joeverbout 0:ea44dc9ed014 156 CAP_PROP_DC1394_MODE_AUTO = -2,
joeverbout 0:ea44dc9ed014 157 CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1,
joeverbout 0:ea44dc9ed014 158 CAP_PROP_DC1394_MAX = 31
joeverbout 0:ea44dc9ed014 159 };
joeverbout 0:ea44dc9ed014 160
joeverbout 0:ea44dc9ed014 161
joeverbout 0:ea44dc9ed014 162 // OpenNI map generators
joeverbout 0:ea44dc9ed014 163 enum { CAP_OPENNI_DEPTH_GENERATOR = 1 << 31,
joeverbout 0:ea44dc9ed014 164 CAP_OPENNI_IMAGE_GENERATOR = 1 << 30,
joeverbout 0:ea44dc9ed014 165 CAP_OPENNI_GENERATORS_MASK = CAP_OPENNI_DEPTH_GENERATOR + CAP_OPENNI_IMAGE_GENERATOR
joeverbout 0:ea44dc9ed014 166 };
joeverbout 0:ea44dc9ed014 167
joeverbout 0:ea44dc9ed014 168 // Properties of cameras available through OpenNI interfaces
joeverbout 0:ea44dc9ed014 169 enum { CAP_PROP_OPENNI_OUTPUT_MODE = 100,
joeverbout 0:ea44dc9ed014 170 CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101, // in mm
joeverbout 0:ea44dc9ed014 171 CAP_PROP_OPENNI_BASELINE = 102, // in mm
joeverbout 0:ea44dc9ed014 172 CAP_PROP_OPENNI_FOCAL_LENGTH = 103, // in pixels
joeverbout 0:ea44dc9ed014 173 CAP_PROP_OPENNI_REGISTRATION = 104, // flag that synchronizes the remapping depth map to image map
joeverbout 0:ea44dc9ed014 174 // by changing depth generator's view point (if the flag is "on") or
joeverbout 0:ea44dc9ed014 175 // sets this view point to its normal one (if the flag is "off").
joeverbout 0:ea44dc9ed014 176 CAP_PROP_OPENNI_REGISTRATION_ON = CAP_PROP_OPENNI_REGISTRATION,
joeverbout 0:ea44dc9ed014 177 CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105,
joeverbout 0:ea44dc9ed014 178 CAP_PROP_OPENNI_MAX_BUFFER_SIZE = 106,
joeverbout 0:ea44dc9ed014 179 CAP_PROP_OPENNI_CIRCLE_BUFFER = 107,
joeverbout 0:ea44dc9ed014 180 CAP_PROP_OPENNI_MAX_TIME_DURATION = 108,
joeverbout 0:ea44dc9ed014 181 CAP_PROP_OPENNI_GENERATOR_PRESENT = 109,
joeverbout 0:ea44dc9ed014 182 CAP_PROP_OPENNI2_SYNC = 110,
joeverbout 0:ea44dc9ed014 183 CAP_PROP_OPENNI2_MIRROR = 111
joeverbout 0:ea44dc9ed014 184 };
joeverbout 0:ea44dc9ed014 185
joeverbout 0:ea44dc9ed014 186 // OpenNI shortcats
joeverbout 0:ea44dc9ed014 187 enum { CAP_OPENNI_IMAGE_GENERATOR_PRESENT = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,
joeverbout 0:ea44dc9ed014 188 CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_OUTPUT_MODE,
joeverbout 0:ea44dc9ed014 189 CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_BASELINE,
joeverbout 0:ea44dc9ed014 190 CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_FOCAL_LENGTH,
joeverbout 0:ea44dc9ed014 191 CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_REGISTRATION,
joeverbout 0:ea44dc9ed014 192 CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION
joeverbout 0:ea44dc9ed014 193 };
joeverbout 0:ea44dc9ed014 194
joeverbout 0:ea44dc9ed014 195 // OpenNI data given from depth generator
joeverbout 0:ea44dc9ed014 196 enum { CAP_OPENNI_DEPTH_MAP = 0, // Depth values in mm (CV_16UC1)
joeverbout 0:ea44dc9ed014 197 CAP_OPENNI_POINT_CLOUD_MAP = 1, // XYZ in meters (CV_32FC3)
joeverbout 0:ea44dc9ed014 198 CAP_OPENNI_DISPARITY_MAP = 2, // Disparity in pixels (CV_8UC1)
joeverbout 0:ea44dc9ed014 199 CAP_OPENNI_DISPARITY_MAP_32F = 3, // Disparity in pixels (CV_32FC1)
joeverbout 0:ea44dc9ed014 200 CAP_OPENNI_VALID_DEPTH_MASK = 4, // CV_8UC1
joeverbout 0:ea44dc9ed014 201
joeverbout 0:ea44dc9ed014 202 // Data given from RGB image generator
joeverbout 0:ea44dc9ed014 203 CAP_OPENNI_BGR_IMAGE = 5,
joeverbout 0:ea44dc9ed014 204 CAP_OPENNI_GRAY_IMAGE = 6
joeverbout 0:ea44dc9ed014 205 };
joeverbout 0:ea44dc9ed014 206
joeverbout 0:ea44dc9ed014 207 // Supported output modes of OpenNI image generator
joeverbout 0:ea44dc9ed014 208 enum { CAP_OPENNI_VGA_30HZ = 0,
joeverbout 0:ea44dc9ed014 209 CAP_OPENNI_SXGA_15HZ = 1,
joeverbout 0:ea44dc9ed014 210 CAP_OPENNI_SXGA_30HZ = 2,
joeverbout 0:ea44dc9ed014 211 CAP_OPENNI_QVGA_30HZ = 3,
joeverbout 0:ea44dc9ed014 212 CAP_OPENNI_QVGA_60HZ = 4
joeverbout 0:ea44dc9ed014 213 };
joeverbout 0:ea44dc9ed014 214
joeverbout 0:ea44dc9ed014 215
joeverbout 0:ea44dc9ed014 216 // GStreamer
joeverbout 0:ea44dc9ed014 217 enum { CAP_PROP_GSTREAMER_QUEUE_LENGTH = 200 // default is 1
joeverbout 0:ea44dc9ed014 218 };
joeverbout 0:ea44dc9ed014 219
joeverbout 0:ea44dc9ed014 220
joeverbout 0:ea44dc9ed014 221 // PVAPI
joeverbout 0:ea44dc9ed014 222 enum { CAP_PROP_PVAPI_MULTICASTIP = 300, // ip for anable multicast master mode. 0 for disable multicast
joeverbout 0:ea44dc9ed014 223 CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301, // FrameStartTriggerMode: Determines how a frame is initiated
joeverbout 0:ea44dc9ed014 224 CAP_PROP_PVAPI_DECIMATIONHORIZONTAL = 302, // Horizontal sub-sampling of the image
joeverbout 0:ea44dc9ed014 225 CAP_PROP_PVAPI_DECIMATIONVERTICAL = 303, // Vertical sub-sampling of the image
joeverbout 0:ea44dc9ed014 226 CAP_PROP_PVAPI_BINNINGX = 304, // Horizontal binning factor
joeverbout 0:ea44dc9ed014 227 CAP_PROP_PVAPI_BINNINGY = 305, // Vertical binning factor
joeverbout 0:ea44dc9ed014 228 CAP_PROP_PVAPI_PIXELFORMAT = 306 // Pixel format
joeverbout 0:ea44dc9ed014 229 };
joeverbout 0:ea44dc9ed014 230
joeverbout 0:ea44dc9ed014 231 // PVAPI: FrameStartTriggerMode
joeverbout 0:ea44dc9ed014 232 enum { CAP_PVAPI_FSTRIGMODE_FREERUN = 0, // Freerun
joeverbout 0:ea44dc9ed014 233 CAP_PVAPI_FSTRIGMODE_SYNCIN1 = 1, // SyncIn1
joeverbout 0:ea44dc9ed014 234 CAP_PVAPI_FSTRIGMODE_SYNCIN2 = 2, // SyncIn2
joeverbout 0:ea44dc9ed014 235 CAP_PVAPI_FSTRIGMODE_FIXEDRATE = 3, // FixedRate
joeverbout 0:ea44dc9ed014 236 CAP_PVAPI_FSTRIGMODE_SOFTWARE = 4 // Software
joeverbout 0:ea44dc9ed014 237 };
joeverbout 0:ea44dc9ed014 238
joeverbout 0:ea44dc9ed014 239 // PVAPI: DecimationHorizontal, DecimationVertical
joeverbout 0:ea44dc9ed014 240 enum { CAP_PVAPI_DECIMATION_OFF = 1, // Off
joeverbout 0:ea44dc9ed014 241 CAP_PVAPI_DECIMATION_2OUTOF4 = 2, // 2 out of 4 decimation
joeverbout 0:ea44dc9ed014 242 CAP_PVAPI_DECIMATION_2OUTOF8 = 4, // 2 out of 8 decimation
joeverbout 0:ea44dc9ed014 243 CAP_PVAPI_DECIMATION_2OUTOF16 = 8 // 2 out of 16 decimation
joeverbout 0:ea44dc9ed014 244 };
joeverbout 0:ea44dc9ed014 245
joeverbout 0:ea44dc9ed014 246 // PVAPI: PixelFormat
joeverbout 0:ea44dc9ed014 247 enum { CAP_PVAPI_PIXELFORMAT_MONO8 = 1, // Mono8
joeverbout 0:ea44dc9ed014 248 CAP_PVAPI_PIXELFORMAT_MONO16 = 2, // Mono16
joeverbout 0:ea44dc9ed014 249 CAP_PVAPI_PIXELFORMAT_BAYER8 = 3, // Bayer8
joeverbout 0:ea44dc9ed014 250 CAP_PVAPI_PIXELFORMAT_BAYER16 = 4, // Bayer16
joeverbout 0:ea44dc9ed014 251 CAP_PVAPI_PIXELFORMAT_RGB24 = 5, // Rgb24
joeverbout 0:ea44dc9ed014 252 CAP_PVAPI_PIXELFORMAT_BGR24 = 6, // Bgr24
joeverbout 0:ea44dc9ed014 253 CAP_PVAPI_PIXELFORMAT_RGBA32 = 7, // Rgba32
joeverbout 0:ea44dc9ed014 254 CAP_PVAPI_PIXELFORMAT_BGRA32 = 8, // Bgra32
joeverbout 0:ea44dc9ed014 255 };
joeverbout 0:ea44dc9ed014 256
joeverbout 0:ea44dc9ed014 257 // Properties of cameras available through XIMEA SDK interface
joeverbout 0:ea44dc9ed014 258 enum { CAP_PROP_XI_DOWNSAMPLING = 400, // Change image resolution by binning or skipping.
joeverbout 0:ea44dc9ed014 259 CAP_PROP_XI_DATA_FORMAT = 401, // Output data format.
joeverbout 0:ea44dc9ed014 260 CAP_PROP_XI_OFFSET_X = 402, // Horizontal offset from the origin to the area of interest (in pixels).
joeverbout 0:ea44dc9ed014 261 CAP_PROP_XI_OFFSET_Y = 403, // Vertical offset from the origin to the area of interest (in pixels).
joeverbout 0:ea44dc9ed014 262 CAP_PROP_XI_TRG_SOURCE = 404, // Defines source of trigger.
joeverbout 0:ea44dc9ed014 263 CAP_PROP_XI_TRG_SOFTWARE = 405, // Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE.
joeverbout 0:ea44dc9ed014 264 CAP_PROP_XI_GPI_SELECTOR = 406, // Selects general purpose input
joeverbout 0:ea44dc9ed014 265 CAP_PROP_XI_GPI_MODE = 407, // Set general purpose input mode
joeverbout 0:ea44dc9ed014 266 CAP_PROP_XI_GPI_LEVEL = 408, // Get general purpose level
joeverbout 0:ea44dc9ed014 267 CAP_PROP_XI_GPO_SELECTOR = 409, // Selects general purpose output
joeverbout 0:ea44dc9ed014 268 CAP_PROP_XI_GPO_MODE = 410, // Set general purpose output mode
joeverbout 0:ea44dc9ed014 269 CAP_PROP_XI_LED_SELECTOR = 411, // Selects camera signalling LED
joeverbout 0:ea44dc9ed014 270 CAP_PROP_XI_LED_MODE = 412, // Define camera signalling LED functionality
joeverbout 0:ea44dc9ed014 271 CAP_PROP_XI_MANUAL_WB = 413, // Calculates White Balance(must be called during acquisition)
joeverbout 0:ea44dc9ed014 272 CAP_PROP_XI_AUTO_WB = 414, // Automatic white balance
joeverbout 0:ea44dc9ed014 273 CAP_PROP_XI_AEAG = 415, // Automatic exposure/gain
joeverbout 0:ea44dc9ed014 274 CAP_PROP_XI_EXP_PRIORITY = 416, // Exposure priority (0.5 - exposure 50%, gain 50%).
joeverbout 0:ea44dc9ed014 275 CAP_PROP_XI_AE_MAX_LIMIT = 417, // Maximum limit of exposure in AEAG procedure
joeverbout 0:ea44dc9ed014 276 CAP_PROP_XI_AG_MAX_LIMIT = 418, // Maximum limit of gain in AEAG procedure
joeverbout 0:ea44dc9ed014 277 CAP_PROP_XI_AEAG_LEVEL = 419, // Average intensity of output signal AEAG should achieve(in %)
joeverbout 0:ea44dc9ed014 278 CAP_PROP_XI_TIMEOUT = 420 // Image capture timeout in milliseconds
joeverbout 0:ea44dc9ed014 279 };
joeverbout 0:ea44dc9ed014 280
joeverbout 0:ea44dc9ed014 281 // Properties of cameras available through AVFOUNDATION interface
joeverbout 0:ea44dc9ed014 282 enum { CAP_PROP_IOS_DEVICE_FOCUS = 9001,
joeverbout 0:ea44dc9ed014 283 CAP_PROP_IOS_DEVICE_EXPOSURE = 9002,
joeverbout 0:ea44dc9ed014 284 CAP_PROP_IOS_DEVICE_FLASH = 9003,
joeverbout 0:ea44dc9ed014 285 CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004,
joeverbout 0:ea44dc9ed014 286 CAP_PROP_IOS_DEVICE_TORCH = 9005
joeverbout 0:ea44dc9ed014 287 };
joeverbout 0:ea44dc9ed014 288
joeverbout 0:ea44dc9ed014 289
joeverbout 0:ea44dc9ed014 290 // Properties of cameras available through Smartek Giganetix Ethernet Vision interface
joeverbout 0:ea44dc9ed014 291 /* --- Vladimir Litvinenko (litvinenko.vladimir@gmail.com) --- */
joeverbout 0:ea44dc9ed014 292 enum { CAP_PROP_GIGA_FRAME_OFFSET_X = 10001,
joeverbout 0:ea44dc9ed014 293 CAP_PROP_GIGA_FRAME_OFFSET_Y = 10002,
joeverbout 0:ea44dc9ed014 294 CAP_PROP_GIGA_FRAME_WIDTH_MAX = 10003,
joeverbout 0:ea44dc9ed014 295 CAP_PROP_GIGA_FRAME_HEIGH_MAX = 10004,
joeverbout 0:ea44dc9ed014 296 CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005,
joeverbout 0:ea44dc9ed014 297 CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006
joeverbout 0:ea44dc9ed014 298 };
joeverbout 0:ea44dc9ed014 299
joeverbout 0:ea44dc9ed014 300 enum { CAP_PROP_INTELPERC_PROFILE_COUNT = 11001,
joeverbout 0:ea44dc9ed014 301 CAP_PROP_INTELPERC_PROFILE_IDX = 11002,
joeverbout 0:ea44dc9ed014 302 CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE = 11003,
joeverbout 0:ea44dc9ed014 303 CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE = 11004,
joeverbout 0:ea44dc9ed014 304 CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD = 11005,
joeverbout 0:ea44dc9ed014 305 CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ = 11006,
joeverbout 0:ea44dc9ed014 306 CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT = 11007
joeverbout 0:ea44dc9ed014 307 };
joeverbout 0:ea44dc9ed014 308
joeverbout 0:ea44dc9ed014 309 // Intel PerC streams
joeverbout 0:ea44dc9ed014 310 enum { CAP_INTELPERC_DEPTH_GENERATOR = 1 << 29,
joeverbout 0:ea44dc9ed014 311 CAP_INTELPERC_IMAGE_GENERATOR = 1 << 28,
joeverbout 0:ea44dc9ed014 312 CAP_INTELPERC_GENERATORS_MASK = CAP_INTELPERC_DEPTH_GENERATOR + CAP_INTELPERC_IMAGE_GENERATOR
joeverbout 0:ea44dc9ed014 313 };
joeverbout 0:ea44dc9ed014 314
joeverbout 0:ea44dc9ed014 315 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.
joeverbout 0:ea44dc9ed014 316 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.
joeverbout 0:ea44dc9ed014 317 CAP_INTELPERC_IR_MAP = 2, // Each pixel is a 16-bit integer. The value indicates the intensity of the reflected laser beam.
joeverbout 0:ea44dc9ed014 318 CAP_INTELPERC_IMAGE = 3
joeverbout 0:ea44dc9ed014 319 };
joeverbout 0:ea44dc9ed014 320
joeverbout 0:ea44dc9ed014 321 enum { VIDEOWRITER_PROP_QUALITY = 1, // Quality (0..100%) of the videostream encoded
joeverbout 0:ea44dc9ed014 322 VIDEOWRITER_PROP_FRAMEBYTES = 2, // (Read-only): Size of just encoded video frame
joeverbout 0:ea44dc9ed014 323 VIDEOWRITER_PROP_NSTRIPES = 3 // Number of stripes for parallel encoding. -1 for auto detection
joeverbout 0:ea44dc9ed014 324 };
joeverbout 0:ea44dc9ed014 325
joeverbout 0:ea44dc9ed014 326 // gPhoto2 properties, if propertyId is less than 0 then work on widget with that __additive inversed__ camera setting ID
joeverbout 0:ea44dc9ed014 327 // Get IDs by using CAP_PROP_GPHOTO2_WIDGET_ENUMERATE.
joeverbout 0:ea44dc9ed014 328 // @see CvCaptureCAM_GPHOTO2 for more info
joeverbout 0:ea44dc9ed014 329 enum { CAP_PROP_GPHOTO2_PREVIEW = 17001, // Capture only preview from liveview mode.
joeverbout 0:ea44dc9ed014 330 CAP_PROP_GPHOTO2_WIDGET_ENUMERATE = 17002, // Readonly, returns (const char *).
joeverbout 0:ea44dc9ed014 331 CAP_PROP_GPHOTO2_RELOAD_CONFIG = 17003, // Trigger, only by set. Reload camera settings.
joeverbout 0:ea44dc9ed014 332 CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE = 17004, // Reload all settings on set.
joeverbout 0:ea44dc9ed014 333 CAP_PROP_GPHOTO2_COLLECT_MSGS = 17005, // Collect messages with details.
joeverbout 0:ea44dc9ed014 334 CAP_PROP_GPHOTO2_FLUSH_MSGS = 17006, // Readonly, returns (const char *).
joeverbout 0:ea44dc9ed014 335 CAP_PROP_SPEED = 17007, // Exposure speed. Can be readonly, depends on camera program.
joeverbout 0:ea44dc9ed014 336 CAP_PROP_APERTURE = 17008, // Aperture. Can be readonly, depends on camera program.
joeverbout 0:ea44dc9ed014 337 CAP_PROP_EXPOSUREPROGRAM = 17009, // Camera exposure program.
joeverbout 0:ea44dc9ed014 338 CAP_PROP_VIEWFINDER = 17010 // Enter liveview mode.
joeverbout 0:ea44dc9ed014 339 };
joeverbout 0:ea44dc9ed014 340
joeverbout 0:ea44dc9ed014 341 //enum {
joeverbout 0:ea44dc9ed014 342
joeverbout 0:ea44dc9ed014 343 class IVideoCapture;
joeverbout 0:ea44dc9ed014 344
joeverbout 0:ea44dc9ed014 345 /** @brief Class for video capturing from video files, image sequences or cameras. The class provides C++ API
joeverbout 0:ea44dc9ed014 346 for capturing video from cameras or for reading video files and image sequences. Here is how the
joeverbout 0:ea44dc9ed014 347 class can be used: :
joeverbout 0:ea44dc9ed014 348 @code
joeverbout 0:ea44dc9ed014 349 #include "opencv2/opencv.hpp"
joeverbout 0:ea44dc9ed014 350
joeverbout 0:ea44dc9ed014 351 using namespace cv;
joeverbout 0:ea44dc9ed014 352
joeverbout 0:ea44dc9ed014 353 int main(int, char**)
joeverbout 0:ea44dc9ed014 354 {
joeverbout 0:ea44dc9ed014 355 VideoCapture cap(0); // open the default camera
joeverbout 0:ea44dc9ed014 356 if(!cap.isOpened()) // check if we succeeded
joeverbout 0:ea44dc9ed014 357 return -1;
joeverbout 0:ea44dc9ed014 358
joeverbout 0:ea44dc9ed014 359 Mat edges;
joeverbout 0:ea44dc9ed014 360 namedWindow("edges",1);
joeverbout 0:ea44dc9ed014 361 for(;;)
joeverbout 0:ea44dc9ed014 362 {
joeverbout 0:ea44dc9ed014 363 Mat frame;
joeverbout 0:ea44dc9ed014 364 cap >> frame; // get a new frame from camera
joeverbout 0:ea44dc9ed014 365 cvtColor(frame, edges, COLOR_BGR2GRAY);
joeverbout 0:ea44dc9ed014 366 GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
joeverbout 0:ea44dc9ed014 367 Canny(edges, edges, 0, 30, 3);
joeverbout 0:ea44dc9ed014 368 imshow("edges", edges);
joeverbout 0:ea44dc9ed014 369 if(waitKey(30) >= 0) break;
joeverbout 0:ea44dc9ed014 370 }
joeverbout 0:ea44dc9ed014 371 // the camera will be deinitialized automatically in VideoCapture destructor
joeverbout 0:ea44dc9ed014 372 return 0;
joeverbout 0:ea44dc9ed014 373 }
joeverbout 0:ea44dc9ed014 374 @endcode
joeverbout 0:ea44dc9ed014 375 @note In C API the black-box structure CvCapture is used instead of VideoCapture.
joeverbout 0:ea44dc9ed014 376
joeverbout 0:ea44dc9ed014 377 @note
joeverbout 0:ea44dc9ed014 378 - A basic sample on using the VideoCapture interface can be found at
joeverbout 0:ea44dc9ed014 379 opencv_source_code/samples/cpp/starter_video.cpp
joeverbout 0:ea44dc9ed014 380 - Another basic video processing sample can be found at
joeverbout 0:ea44dc9ed014 381 opencv_source_code/samples/cpp/video_dmtx.cpp
joeverbout 0:ea44dc9ed014 382 - (Python) A basic sample on using the VideoCapture interface can be found at
joeverbout 0:ea44dc9ed014 383 opencv_source_code/samples/python/video.py
joeverbout 0:ea44dc9ed014 384 - (Python) Another basic video processing sample can be found at
joeverbout 0:ea44dc9ed014 385 opencv_source_code/samples/python/video_dmtx.py
joeverbout 0:ea44dc9ed014 386 - (Python) A multi threaded video processing sample can be found at
joeverbout 0:ea44dc9ed014 387 opencv_source_code/samples/python/video_threaded.py
joeverbout 0:ea44dc9ed014 388 */
joeverbout 0:ea44dc9ed014 389 class CV_EXPORTS_W VideoCapture
joeverbout 0:ea44dc9ed014 390 {
joeverbout 0:ea44dc9ed014 391 public:
joeverbout 0:ea44dc9ed014 392 /** @brief
joeverbout 0:ea44dc9ed014 393 @note In C API, when you finished working with video, release CvCapture structure with
joeverbout 0:ea44dc9ed014 394 cvReleaseCapture(), or use Ptr\<CvCapture\> that calls cvReleaseCapture() automatically in the
joeverbout 0:ea44dc9ed014 395 destructor.
joeverbout 0:ea44dc9ed014 396 */
joeverbout 0:ea44dc9ed014 397 CV_WRAP VideoCapture();
joeverbout 0:ea44dc9ed014 398
joeverbout 0:ea44dc9ed014 399 /** @overload
joeverbout 0:ea44dc9ed014 400 @param filename name of the opened video file (eg. video.avi) or image sequence (eg.
joeverbout 0:ea44dc9ed014 401 img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
joeverbout 0:ea44dc9ed014 402 */
joeverbout 0:ea44dc9ed014 403 CV_WRAP VideoCapture(const String& filename);
joeverbout 0:ea44dc9ed014 404
joeverbout 0:ea44dc9ed014 405 /** @overload
joeverbout 0:ea44dc9ed014 406 @param filename name of the opened video file (eg. video.avi) or image sequence (eg.
joeverbout 0:ea44dc9ed014 407 img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
joeverbout 0:ea44dc9ed014 408
joeverbout 0:ea44dc9ed014 409 @param apiPreference preferred Capture API to use. Can be used to enforce a specific reader
joeverbout 0:ea44dc9ed014 410 implementation if multiple are available: e.g. CAP_FFMPEG or CAP_IMAGES
joeverbout 0:ea44dc9ed014 411 */
joeverbout 0:ea44dc9ed014 412 CV_WRAP VideoCapture(const String& filename, int apiPreference);
joeverbout 0:ea44dc9ed014 413
joeverbout 0:ea44dc9ed014 414 /** @overload
joeverbout 0:ea44dc9ed014 415 @param index = camera_id + domain_offset (CAP_*). id of the video capturing device to open. If there is a single
joeverbout 0:ea44dc9ed014 416 camera connected, just pass 0. Advanced Usage: to open Camera 1 using the MS Media Foundation API: index = 1 + CAP_MSMF
joeverbout 0:ea44dc9ed014 417 */
joeverbout 0:ea44dc9ed014 418 CV_WRAP VideoCapture(int index);
joeverbout 0:ea44dc9ed014 419
joeverbout 0:ea44dc9ed014 420 virtual ~VideoCapture();
joeverbout 0:ea44dc9ed014 421
joeverbout 0:ea44dc9ed014 422 /** @brief Open video file or a capturing device for video capturing
joeverbout 0:ea44dc9ed014 423
joeverbout 0:ea44dc9ed014 424 @param filename name of the opened video file (eg. video.avi) or image sequence (eg.
joeverbout 0:ea44dc9ed014 425 img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
joeverbout 0:ea44dc9ed014 426
joeverbout 0:ea44dc9ed014 427 The methods first call VideoCapture::release to close the already opened file or camera.
joeverbout 0:ea44dc9ed014 428 */
joeverbout 0:ea44dc9ed014 429 CV_WRAP virtual bool open(const String& filename);
joeverbout 0:ea44dc9ed014 430
joeverbout 0:ea44dc9ed014 431 /** @overload
joeverbout 0:ea44dc9ed014 432 @param index = camera_id + domain_offset (CAP_*). id of the video capturing device to open. If there is a single
joeverbout 0:ea44dc9ed014 433 camera connected, just pass 0. Advanced Usage: to open Camera 1 using the MS Media Foundation API: index = 1 + CAP_MSMF
joeverbout 0:ea44dc9ed014 434 */
joeverbout 0:ea44dc9ed014 435 CV_WRAP virtual bool open(int index);
joeverbout 0:ea44dc9ed014 436
joeverbout 0:ea44dc9ed014 437 /** @brief Returns true if video capturing has been initialized already.
joeverbout 0:ea44dc9ed014 438
joeverbout 0:ea44dc9ed014 439 If the previous call to VideoCapture constructor or VideoCapture::open succeeded, the method returns
joeverbout 0:ea44dc9ed014 440 true.
joeverbout 0:ea44dc9ed014 441 */
joeverbout 0:ea44dc9ed014 442 CV_WRAP virtual bool isOpened() const;
joeverbout 0:ea44dc9ed014 443
joeverbout 0:ea44dc9ed014 444 /** @brief Closes video file or capturing device.
joeverbout 0:ea44dc9ed014 445
joeverbout 0:ea44dc9ed014 446 The methods are automatically called by subsequent VideoCapture::open and by VideoCapture
joeverbout 0:ea44dc9ed014 447 destructor.
joeverbout 0:ea44dc9ed014 448
joeverbout 0:ea44dc9ed014 449 The C function also deallocates memory and clears \*capture pointer.
joeverbout 0:ea44dc9ed014 450 */
joeverbout 0:ea44dc9ed014 451 CV_WRAP virtual void release();
joeverbout 0:ea44dc9ed014 452
joeverbout 0:ea44dc9ed014 453 /** @brief Grabs the next frame from video file or capturing device.
joeverbout 0:ea44dc9ed014 454
joeverbout 0:ea44dc9ed014 455 The methods/functions grab the next frame from video file or camera and return true (non-zero) in
joeverbout 0:ea44dc9ed014 456 the case of success.
joeverbout 0:ea44dc9ed014 457
joeverbout 0:ea44dc9ed014 458 The primary use of the function is in multi-camera environments, especially when the cameras do not
joeverbout 0:ea44dc9ed014 459 have hardware synchronization. That is, you call VideoCapture::grab() for each camera and after that
joeverbout 0:ea44dc9ed014 460 call the slower method VideoCapture::retrieve() to decode and get frame from each camera. This way
joeverbout 0:ea44dc9ed014 461 the overhead on demosaicing or motion jpeg decompression etc. is eliminated and the retrieved frames
joeverbout 0:ea44dc9ed014 462 from different cameras will be closer in time.
joeverbout 0:ea44dc9ed014 463
joeverbout 0:ea44dc9ed014 464 Also, when a connected camera is multi-head (for example, a stereo camera or a Kinect device), the
joeverbout 0:ea44dc9ed014 465 correct way of retrieving data from it is to call VideoCapture::grab first and then call
joeverbout 0:ea44dc9ed014 466 VideoCapture::retrieve one or more times with different values of the channel parameter. See
joeverbout 0:ea44dc9ed014 467 <https://github.com/Itseez/opencv/tree/master/samples/cpp/openni_capture.cpp>
joeverbout 0:ea44dc9ed014 468 */
joeverbout 0:ea44dc9ed014 469 CV_WRAP virtual bool grab();
joeverbout 0:ea44dc9ed014 470
joeverbout 0:ea44dc9ed014 471 /** @brief Decodes and returns the grabbed video frame.
joeverbout 0:ea44dc9ed014 472
joeverbout 0:ea44dc9ed014 473 The methods/functions decode and return the just grabbed frame. If no frames has been grabbed
joeverbout 0:ea44dc9ed014 474 (camera has been disconnected, or there are no more frames in video file), the methods return false
joeverbout 0:ea44dc9ed014 475 and the functions return NULL pointer.
joeverbout 0:ea44dc9ed014 476
joeverbout 0:ea44dc9ed014 477 @note OpenCV 1.x functions cvRetrieveFrame and cv.RetrieveFrame return image stored inside the video
joeverbout 0:ea44dc9ed014 478 capturing structure. It is not allowed to modify or release the image! You can copy the frame using
joeverbout 0:ea44dc9ed014 479 :ocvcvCloneImage and then do whatever you want with the copy.
joeverbout 0:ea44dc9ed014 480 */
joeverbout 0:ea44dc9ed014 481 CV_WRAP virtual bool retrieve(OutputArray image, int flag = 0);
joeverbout 0:ea44dc9ed014 482 virtual VideoCapture& operator >> (CV_OUT Mat& image);
joeverbout 0:ea44dc9ed014 483 virtual VideoCapture& operator >> (CV_OUT UMat& image);
joeverbout 0:ea44dc9ed014 484
joeverbout 0:ea44dc9ed014 485 /** @brief Grabs, decodes and returns the next video frame.
joeverbout 0:ea44dc9ed014 486
joeverbout 0:ea44dc9ed014 487 The methods/functions combine VideoCapture::grab and VideoCapture::retrieve in one call. This is the
joeverbout 0:ea44dc9ed014 488 most convenient method for reading video files or capturing data from decode and return the just
joeverbout 0:ea44dc9ed014 489 grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more
joeverbout 0:ea44dc9ed014 490 frames in video file), the methods return false and the functions return NULL pointer.
joeverbout 0:ea44dc9ed014 491
joeverbout 0:ea44dc9ed014 492 @note OpenCV 1.x functions cvRetrieveFrame and cv.RetrieveFrame return image stored inside the video
joeverbout 0:ea44dc9ed014 493 capturing structure. It is not allowed to modify or release the image! You can copy the frame using
joeverbout 0:ea44dc9ed014 494 :ocvcvCloneImage and then do whatever you want with the copy.
joeverbout 0:ea44dc9ed014 495 */
joeverbout 0:ea44dc9ed014 496 CV_WRAP virtual bool read(OutputArray image);
joeverbout 0:ea44dc9ed014 497
joeverbout 0:ea44dc9ed014 498 /** @brief Sets a property in the VideoCapture.
joeverbout 0:ea44dc9ed014 499
joeverbout 0:ea44dc9ed014 500 @param propId Property identifier. It can be one of the following:
joeverbout 0:ea44dc9ed014 501 - **CAP_PROP_POS_MSEC** Current position of the video file in milliseconds.
joeverbout 0:ea44dc9ed014 502 - **CAP_PROP_POS_FRAMES** 0-based index of the frame to be decoded/captured next.
joeverbout 0:ea44dc9ed014 503 - **CAP_PROP_POS_AVI_RATIO** Relative position of the video file: 0 - start of the
joeverbout 0:ea44dc9ed014 504 film, 1 - end of the film.
joeverbout 0:ea44dc9ed014 505 - **CAP_PROP_FRAME_WIDTH** Width of the frames in the video stream.
joeverbout 0:ea44dc9ed014 506 - **CAP_PROP_FRAME_HEIGHT** Height of the frames in the video stream.
joeverbout 0:ea44dc9ed014 507 - **CAP_PROP_FPS** Frame rate.
joeverbout 0:ea44dc9ed014 508 - **CAP_PROP_FOURCC** 4-character code of codec.
joeverbout 0:ea44dc9ed014 509 - **CAP_PROP_FRAME_COUNT** Number of frames in the video file.
joeverbout 0:ea44dc9ed014 510 - **CAP_PROP_FORMAT** Format of the Mat objects returned by retrieve() .
joeverbout 0:ea44dc9ed014 511 - **CAP_PROP_MODE** Backend-specific value indicating the current capture mode.
joeverbout 0:ea44dc9ed014 512 - **CAP_PROP_BRIGHTNESS** Brightness of the image (only for cameras).
joeverbout 0:ea44dc9ed014 513 - **CAP_PROP_CONTRAST** Contrast of the image (only for cameras).
joeverbout 0:ea44dc9ed014 514 - **CAP_PROP_SATURATION** Saturation of the image (only for cameras).
joeverbout 0:ea44dc9ed014 515 - **CAP_PROP_HUE** Hue of the image (only for cameras).
joeverbout 0:ea44dc9ed014 516 - **CAP_PROP_GAIN** Gain of the image (only for cameras).
joeverbout 0:ea44dc9ed014 517 - **CAP_PROP_EXPOSURE** Exposure (only for cameras).
joeverbout 0:ea44dc9ed014 518 - **CAP_PROP_CONVERT_RGB** Boolean flags indicating whether images should be converted
joeverbout 0:ea44dc9ed014 519 to RGB.
joeverbout 0:ea44dc9ed014 520 - **CAP_PROP_WHITE_BALANCE** Currently unsupported
joeverbout 0:ea44dc9ed014 521 - **CAP_PROP_RECTIFICATION** Rectification flag for stereo cameras (note: only supported
joeverbout 0:ea44dc9ed014 522 by DC1394 v 2.x backend currently)
joeverbout 0:ea44dc9ed014 523 @param value Value of the property.
joeverbout 0:ea44dc9ed014 524 */
joeverbout 0:ea44dc9ed014 525 CV_WRAP virtual bool set(int propId, double value);
joeverbout 0:ea44dc9ed014 526
joeverbout 0:ea44dc9ed014 527 /** @brief Returns the specified VideoCapture property
joeverbout 0:ea44dc9ed014 528
joeverbout 0:ea44dc9ed014 529 @param propId Property identifier. It can be one of the following:
joeverbout 0:ea44dc9ed014 530 - **CAP_PROP_POS_MSEC** Current position of the video file in milliseconds or video
joeverbout 0:ea44dc9ed014 531 capture timestamp.
joeverbout 0:ea44dc9ed014 532 - **CAP_PROP_POS_FRAMES** 0-based index of the frame to be decoded/captured next.
joeverbout 0:ea44dc9ed014 533 - **CAP_PROP_POS_AVI_RATIO** Relative position of the video file: 0 - start of the
joeverbout 0:ea44dc9ed014 534 film, 1 - end of the film.
joeverbout 0:ea44dc9ed014 535 - **CAP_PROP_FRAME_WIDTH** Width of the frames in the video stream.
joeverbout 0:ea44dc9ed014 536 - **CAP_PROP_FRAME_HEIGHT** Height of the frames in the video stream.
joeverbout 0:ea44dc9ed014 537 - **CAP_PROP_FPS** Frame rate.
joeverbout 0:ea44dc9ed014 538 - **CAP_PROP_FOURCC** 4-character code of codec.
joeverbout 0:ea44dc9ed014 539 - **CAP_PROP_FRAME_COUNT** Number of frames in the video file.
joeverbout 0:ea44dc9ed014 540 - **CAP_PROP_FORMAT** Format of the Mat objects returned by retrieve() .
joeverbout 0:ea44dc9ed014 541 - **CAP_PROP_MODE** Backend-specific value indicating the current capture mode.
joeverbout 0:ea44dc9ed014 542 - **CAP_PROP_BRIGHTNESS** Brightness of the image (only for cameras).
joeverbout 0:ea44dc9ed014 543 - **CAP_PROP_CONTRAST** Contrast of the image (only for cameras).
joeverbout 0:ea44dc9ed014 544 - **CAP_PROP_SATURATION** Saturation of the image (only for cameras).
joeverbout 0:ea44dc9ed014 545 - **CAP_PROP_HUE** Hue of the image (only for cameras).
joeverbout 0:ea44dc9ed014 546 - **CAP_PROP_GAIN** Gain of the image (only for cameras).
joeverbout 0:ea44dc9ed014 547 - **CAP_PROP_EXPOSURE** Exposure (only for cameras).
joeverbout 0:ea44dc9ed014 548 - **CAP_PROP_CONVERT_RGB** Boolean flags indicating whether images should be converted
joeverbout 0:ea44dc9ed014 549 to RGB.
joeverbout 0:ea44dc9ed014 550 - **CAP_PROP_WHITE_BALANCE** Currently not supported
joeverbout 0:ea44dc9ed014 551 - **CAP_PROP_RECTIFICATION** Rectification flag for stereo cameras (note: only supported
joeverbout 0:ea44dc9ed014 552 by DC1394 v 2.x backend currently)
joeverbout 0:ea44dc9ed014 553
joeverbout 0:ea44dc9ed014 554 @note When querying a property that is not supported by the backend used by the VideoCapture
joeverbout 0:ea44dc9ed014 555 class, value 0 is returned.
joeverbout 0:ea44dc9ed014 556 */
joeverbout 0:ea44dc9ed014 557 CV_WRAP virtual double get(int propId) const;
joeverbout 0:ea44dc9ed014 558
joeverbout 0:ea44dc9ed014 559 /** @overload
joeverbout 0:ea44dc9ed014 560
joeverbout 0:ea44dc9ed014 561 @param filename name of the opened video file (eg. video.avi) or image sequence (eg.
joeverbout 0:ea44dc9ed014 562 img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
joeverbout 0:ea44dc9ed014 563
joeverbout 0:ea44dc9ed014 564 @param apiPreference preferred Capture API to use. Can be used to enforce a specific reader
joeverbout 0:ea44dc9ed014 565 implementation if multiple are available: e.g. CAP_FFMPEG or CAP_IMAGES
joeverbout 0:ea44dc9ed014 566
joeverbout 0:ea44dc9ed014 567 The methods first call VideoCapture::release to close the already opened file or camera.
joeverbout 0:ea44dc9ed014 568 */
joeverbout 0:ea44dc9ed014 569 CV_WRAP virtual bool open(const String& filename, int apiPreference);
joeverbout 0:ea44dc9ed014 570
joeverbout 0:ea44dc9ed014 571 protected:
joeverbout 0:ea44dc9ed014 572 Ptr<CvCapture> cap;
joeverbout 0:ea44dc9ed014 573 Ptr<IVideoCapture> icap;
joeverbout 0:ea44dc9ed014 574 };
joeverbout 0:ea44dc9ed014 575
joeverbout 0:ea44dc9ed014 576 class IVideoWriter;
joeverbout 0:ea44dc9ed014 577
joeverbout 0:ea44dc9ed014 578 /** @brief Video writer class.
joeverbout 0:ea44dc9ed014 579 */
joeverbout 0:ea44dc9ed014 580 class CV_EXPORTS_W VideoWriter
joeverbout 0:ea44dc9ed014 581 {
joeverbout 0:ea44dc9ed014 582 public:
joeverbout 0:ea44dc9ed014 583 /** @brief VideoWriter constructors
joeverbout 0:ea44dc9ed014 584
joeverbout 0:ea44dc9ed014 585 The constructors/functions initialize video writers. On Linux FFMPEG is used to write videos; on
joeverbout 0:ea44dc9ed014 586 Windows FFMPEG or VFW is used; on MacOSX QTKit is used.
joeverbout 0:ea44dc9ed014 587 */
joeverbout 0:ea44dc9ed014 588 CV_WRAP VideoWriter();
joeverbout 0:ea44dc9ed014 589
joeverbout 0:ea44dc9ed014 590 /** @overload
joeverbout 0:ea44dc9ed014 591 @param filename Name of the output video file.
joeverbout 0:ea44dc9ed014 592 @param fourcc 4-character code of codec used to compress the frames. For example,
joeverbout 0:ea44dc9ed014 593 VideoWriter::fourcc('P','I','M','1') is a MPEG-1 codec, VideoWriter::fourcc('M','J','P','G') is a
joeverbout 0:ea44dc9ed014 594 motion-jpeg codec etc. List of codes can be obtained at [Video Codecs by
joeverbout 0:ea44dc9ed014 595 FOURCC](http://www.fourcc.org/codecs.php) page. FFMPEG backend with MP4 container natively uses
joeverbout 0:ea44dc9ed014 596 other values as fourcc code: see [ObjectType](http://www.mp4ra.org/codecs.html),
joeverbout 0:ea44dc9ed014 597 so you may receive a warning message from OpenCV about fourcc code conversion.
joeverbout 0:ea44dc9ed014 598 @param fps Framerate of the created video stream.
joeverbout 0:ea44dc9ed014 599 @param frameSize Size of the video frames.
joeverbout 0:ea44dc9ed014 600 @param isColor If it is not zero, the encoder will expect and encode color frames, otherwise it
joeverbout 0:ea44dc9ed014 601 will work with grayscale frames (the flag is currently supported on Windows only).
joeverbout 0:ea44dc9ed014 602 */
joeverbout 0:ea44dc9ed014 603 CV_WRAP VideoWriter(const String& filename, int fourcc, double fps,
joeverbout 0:ea44dc9ed014 604 Size frameSize, bool isColor = true);
joeverbout 0:ea44dc9ed014 605
joeverbout 0:ea44dc9ed014 606 virtual ~VideoWriter();
joeverbout 0:ea44dc9ed014 607
joeverbout 0:ea44dc9ed014 608 /** @brief Initializes or reinitializes video writer.
joeverbout 0:ea44dc9ed014 609
joeverbout 0:ea44dc9ed014 610 The method opens video writer. Parameters are the same as in the constructor
joeverbout 0:ea44dc9ed014 611 VideoWriter::VideoWriter.
joeverbout 0:ea44dc9ed014 612 */
joeverbout 0:ea44dc9ed014 613 CV_WRAP virtual bool open(const String& filename, int fourcc, double fps,
joeverbout 0:ea44dc9ed014 614 Size frameSize, bool isColor = true);
joeverbout 0:ea44dc9ed014 615
joeverbout 0:ea44dc9ed014 616 /** @brief Returns true if video writer has been successfully initialized.
joeverbout 0:ea44dc9ed014 617 */
joeverbout 0:ea44dc9ed014 618 CV_WRAP virtual bool isOpened() const;
joeverbout 0:ea44dc9ed014 619
joeverbout 0:ea44dc9ed014 620 /** @brief Closes the video writer.
joeverbout 0:ea44dc9ed014 621
joeverbout 0:ea44dc9ed014 622 The methods are automatically called by subsequent VideoWriter::open and by the VideoWriter
joeverbout 0:ea44dc9ed014 623 destructor.
joeverbout 0:ea44dc9ed014 624 */
joeverbout 0:ea44dc9ed014 625 CV_WRAP virtual void release();
joeverbout 0:ea44dc9ed014 626 virtual VideoWriter& operator << (const Mat& image);
joeverbout 0:ea44dc9ed014 627
joeverbout 0:ea44dc9ed014 628 /** @brief Writes the next video frame
joeverbout 0:ea44dc9ed014 629
joeverbout 0:ea44dc9ed014 630 @param image The written frame
joeverbout 0:ea44dc9ed014 631
joeverbout 0:ea44dc9ed014 632 The functions/methods write the specified image to video file. It must have the same size as has
joeverbout 0:ea44dc9ed014 633 been specified when opening the video writer.
joeverbout 0:ea44dc9ed014 634 */
joeverbout 0:ea44dc9ed014 635 CV_WRAP virtual void write(const Mat& image);
joeverbout 0:ea44dc9ed014 636
joeverbout 0:ea44dc9ed014 637 /** @brief Sets a property in the VideoWriter.
joeverbout 0:ea44dc9ed014 638
joeverbout 0:ea44dc9ed014 639 @param propId Property identifier. It can be one of the following:
joeverbout 0:ea44dc9ed014 640 - **VIDEOWRITER_PROP_QUALITY** Quality (0..100%) of the videostream encoded. Can be adjusted dynamically in some codecs.
joeverbout 0:ea44dc9ed014 641 - **VIDEOWRITER_PROP_NSTRIPES** Number of stripes for parallel encoding
joeverbout 0:ea44dc9ed014 642 @param value Value of the property.
joeverbout 0:ea44dc9ed014 643 */
joeverbout 0:ea44dc9ed014 644 CV_WRAP virtual bool set(int propId, double value);
joeverbout 0:ea44dc9ed014 645
joeverbout 0:ea44dc9ed014 646 /** @brief Returns the specified VideoWriter property
joeverbout 0:ea44dc9ed014 647
joeverbout 0:ea44dc9ed014 648 @param propId Property identifier. It can be one of the following:
joeverbout 0:ea44dc9ed014 649 - **VIDEOWRITER_PROP_QUALITY** Current quality of the encoded videostream.
joeverbout 0:ea44dc9ed014 650 - **VIDEOWRITER_PROP_FRAMEBYTES** (Read-only) Size of just encoded video frame; note that the encoding order may be different from representation order.
joeverbout 0:ea44dc9ed014 651 - **VIDEOWRITER_PROP_NSTRIPES** Number of stripes for parallel encoding
joeverbout 0:ea44dc9ed014 652
joeverbout 0:ea44dc9ed014 653 @note When querying a property that is not supported by the backend used by the VideoWriter
joeverbout 0:ea44dc9ed014 654 class, value 0 is returned.
joeverbout 0:ea44dc9ed014 655 */
joeverbout 0:ea44dc9ed014 656 CV_WRAP virtual double get(int propId) const;
joeverbout 0:ea44dc9ed014 657
joeverbout 0:ea44dc9ed014 658 /** @brief Concatenates 4 chars to a fourcc code
joeverbout 0:ea44dc9ed014 659
joeverbout 0:ea44dc9ed014 660 This static method constructs the fourcc code of the codec to be used in the constructor
joeverbout 0:ea44dc9ed014 661 VideoWriter::VideoWriter or VideoWriter::open.
joeverbout 0:ea44dc9ed014 662 */
joeverbout 0:ea44dc9ed014 663 CV_WRAP static int fourcc(char c1, char c2, char c3, char c4);
joeverbout 0:ea44dc9ed014 664
joeverbout 0:ea44dc9ed014 665 protected:
joeverbout 0:ea44dc9ed014 666 Ptr<CvVideoWriter> writer;
joeverbout 0:ea44dc9ed014 667 Ptr<IVideoWriter> iwriter;
joeverbout 0:ea44dc9ed014 668
joeverbout 0:ea44dc9ed014 669 static Ptr<IVideoWriter> create(const String& filename, int fourcc, double fps,
joeverbout 0:ea44dc9ed014 670 Size frameSize, bool isColor = true);
joeverbout 0:ea44dc9ed014 671 };
joeverbout 0:ea44dc9ed014 672
joeverbout 0:ea44dc9ed014 673 template<> CV_EXPORTS void DefaultDeleter<CvCapture>::operator ()(CvCapture* obj) const;
joeverbout 0:ea44dc9ed014 674 template<> CV_EXPORTS void DefaultDeleter<CvVideoWriter>::operator ()(CvVideoWriter* obj) const;
joeverbout 0:ea44dc9ed014 675
joeverbout 0:ea44dc9ed014 676 //! @} videoio
joeverbout 0:ea44dc9ed014 677
joeverbout 0:ea44dc9ed014 678 } // cv
joeverbout 0:ea44dc9ed014 679
joeverbout 0:ea44dc9ed014 680 #endif //__OPENCV_VIDEOIO_HPP__
joeverbout 0:ea44dc9ed014 681