Path: blob/master/modules/videoio/include/opencv2/videoio.hpp
16349 views
/*M///////////////////////////////////////////////////////////////////////////////////////1//2// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.3//4// By downloading, copying, installing or using the software you agree to this license.5// If you do not agree to this license, do not download, install,6// copy or use the software.7//8//9// License Agreement10// For Open Source Computer Vision Library11//12// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.13// Copyright (C) 2009, Willow Garage Inc., all rights reserved.14// Third party copyrights are property of their respective owners.15//16// Redistribution and use in source and binary forms, with or without modification,17// are permitted provided that the following conditions are met:18//19// * Redistribution's of source code must retain the above copyright notice,20// this list of conditions and the following disclaimer.21//22// * Redistribution's in binary form must reproduce the above copyright notice,23// this list of conditions and the following disclaimer in the documentation24// and/or other materials provided with the distribution.25//26// * The name of the copyright holders may not be used to endorse or promote products27// derived from this software without specific prior written permission.28//29// This software is provided by the copyright holders and contributors "as is" and30// any express or implied warranties, including, but not limited to, the implied31// warranties of merchantability and fitness for a particular purpose are disclaimed.32// In no event shall the Intel Corporation or contributors be liable for any direct,33// indirect, incidental, special, exemplary, or consequential damages34// (including, but not limited to, procurement of substitute goods or services;35// loss of use, data, or profits; or business interruption) however caused36// and on any theory of liability, whether in contract, strict liability,37// or tort (including negligence or otherwise) arising in any way out of38// the use of this software, even if advised of the possibility of such damage.39//40//M*/4142#ifndef OPENCV_VIDEOIO_HPP43#define OPENCV_VIDEOIO_HPP4445#include "opencv2/core.hpp"4647/**48@defgroup videoio Video I/O4950@brief Read and write video or images sequence with OpenCV5152### See also:53- @ref videoio_overview54- Tutorials: @ref tutorial_table_of_content_videoio55@{56@defgroup videoio_flags_base Flags for video I/O57@defgroup videoio_flags_others Additional flags for video I/O API backends58@defgroup videoio_c C API for video I/O59@defgroup videoio_ios iOS glue for video I/O60@defgroup videoio_winrt WinRT glue for video I/O61@defgroup videoio_registry Query I/O API backends registry62@}63*/6465////////////////////////////////// video io /////////////////////////////////6667typedef struct CvCapture CvCapture;68typedef struct CvVideoWriter CvVideoWriter;6970namespace cv71{7273//! @addtogroup videoio74//! @{7576//! @addtogroup videoio_flags_base77//! @{787980/** @brief %VideoCapture API backends identifier.8182Select preferred API for a capture object.83To be used in the VideoCapture::VideoCapture() constructor or VideoCapture::open()8485@note Backends are available only if they have been built with your OpenCV binaries.86See @ref videoio_overview for more information.87*/88enum VideoCaptureAPIs {89CAP_ANY = 0, //!< Auto detect == 090CAP_VFW = 200, //!< Video For Windows (platform native)91CAP_V4L = 200, //!< V4L/V4L2 capturing support via libv4l92CAP_V4L2 = CAP_V4L, //!< Same as CAP_V4L93CAP_FIREWIRE = 300, //!< IEEE 1394 drivers94CAP_FIREWARE = CAP_FIREWIRE, //!< Same as CAP_FIREWIRE95CAP_IEEE1394 = CAP_FIREWIRE, //!< Same as CAP_FIREWIRE96CAP_DC1394 = CAP_FIREWIRE, //!< Same as CAP_FIREWIRE97CAP_CMU1394 = CAP_FIREWIRE, //!< Same as CAP_FIREWIRE98CAP_QT = 500, //!< QuickTime99CAP_UNICAP = 600, //!< Unicap drivers100CAP_DSHOW = 700, //!< DirectShow (via videoInput)101CAP_PVAPI = 800, //!< PvAPI, Prosilica GigE SDK102CAP_OPENNI = 900, //!< OpenNI (for Kinect)103CAP_OPENNI_ASUS = 910, //!< OpenNI (for Asus Xtion)104CAP_ANDROID = 1000, //!< Android - not used105CAP_XIAPI = 1100, //!< XIMEA Camera API106CAP_AVFOUNDATION = 1200, //!< AVFoundation framework for iOS (OS X Lion will have the same API)107CAP_GIGANETIX = 1300, //!< Smartek Giganetix GigEVisionSDK108CAP_MSMF = 1400, //!< Microsoft Media Foundation (via videoInput)109CAP_WINRT = 1410, //!< Microsoft Windows Runtime using Media Foundation110CAP_INTELPERC = 1500, //!< Intel Perceptual Computing SDK111CAP_OPENNI2 = 1600, //!< OpenNI2 (for Kinect)112CAP_OPENNI2_ASUS = 1610, //!< OpenNI2 (for Asus Xtion and Occipital Structure sensors)113CAP_GPHOTO2 = 1700, //!< gPhoto2 connection114CAP_GSTREAMER = 1800, //!< GStreamer115CAP_FFMPEG = 1900, //!< Open and record video file or stream using the FFMPEG library116CAP_IMAGES = 2000, //!< OpenCV Image Sequence (e.g. img_%02d.jpg)117CAP_ARAVIS = 2100, //!< Aravis SDK118CAP_OPENCV_MJPEG = 2200, //!< Built-in OpenCV MotionJPEG codec119CAP_INTEL_MFX = 2300, //!< Intel MediaSDK120CAP_XINE = 2400, //!< XINE engine (Linux)121};122123/** @brief %VideoCapture generic properties identifier.124125Reading / writing properties involves many layers. Some unexpected result might happens along this chain.126Effective behaviour depends from device hardware, driver and API Backend.127@sa videoio_flags_others, VideoCapture::get(), VideoCapture::set()128*/129enum VideoCaptureProperties {130CAP_PROP_POS_MSEC =0, //!< Current position of the video file in milliseconds.131CAP_PROP_POS_FRAMES =1, //!< 0-based index of the frame to be decoded/captured next.132CAP_PROP_POS_AVI_RATIO =2, //!< Relative position of the video file: 0=start of the film, 1=end of the film.133CAP_PROP_FRAME_WIDTH =3, //!< Width of the frames in the video stream.134CAP_PROP_FRAME_HEIGHT =4, //!< Height of the frames in the video stream.135CAP_PROP_FPS =5, //!< Frame rate.136CAP_PROP_FOURCC =6, //!< 4-character code of codec. see VideoWriter::fourcc .137CAP_PROP_FRAME_COUNT =7, //!< Number of frames in the video file.138CAP_PROP_FORMAT =8, //!< Format of the %Mat objects returned by VideoCapture::retrieve().139CAP_PROP_MODE =9, //!< Backend-specific value indicating the current capture mode.140CAP_PROP_BRIGHTNESS =10, //!< Brightness of the image (only for those cameras that support).141CAP_PROP_CONTRAST =11, //!< Contrast of the image (only for cameras).142CAP_PROP_SATURATION =12, //!< Saturation of the image (only for cameras).143CAP_PROP_HUE =13, //!< Hue of the image (only for cameras).144CAP_PROP_GAIN =14, //!< Gain of the image (only for those cameras that support).145CAP_PROP_EXPOSURE =15, //!< Exposure (only for those cameras that support).146CAP_PROP_CONVERT_RGB =16, //!< Boolean flags indicating whether images should be converted to RGB.147CAP_PROP_WHITE_BALANCE_BLUE_U =17, //!< Currently unsupported.148CAP_PROP_RECTIFICATION =18, //!< Rectification flag for stereo cameras (note: only supported by DC1394 v 2.x backend currently).149CAP_PROP_MONOCHROME =19,150CAP_PROP_SHARPNESS =20,151CAP_PROP_AUTO_EXPOSURE =21, //!< DC1394: exposure control done by camera, user can adjust reference level using this feature.152CAP_PROP_GAMMA =22,153CAP_PROP_TEMPERATURE =23,154CAP_PROP_TRIGGER =24,155CAP_PROP_TRIGGER_DELAY =25,156CAP_PROP_WHITE_BALANCE_RED_V =26,157CAP_PROP_ZOOM =27,158CAP_PROP_FOCUS =28,159CAP_PROP_GUID =29,160CAP_PROP_ISO_SPEED =30,161CAP_PROP_BACKLIGHT =32,162CAP_PROP_PAN =33,163CAP_PROP_TILT =34,164CAP_PROP_ROLL =35,165CAP_PROP_IRIS =36,166CAP_PROP_SETTINGS =37, //!< Pop up video/camera filter dialog (note: only supported by DSHOW backend currently. The property value is ignored)167CAP_PROP_BUFFERSIZE =38,168CAP_PROP_AUTOFOCUS =39,169CAP_PROP_SAR_NUM =40, //!< Sample aspect ratio: num/den (num)170CAP_PROP_SAR_DEN =41, //!< Sample aspect ratio: num/den (den)171CAP_PROP_BACKEND =42, //!< current backend (enum VideoCaptureAPIs). Read-only property172CAP_CROSSBAR_INPIN_TYPE =43, //!<CrossBar input pin Setting173#ifndef CV_DOXYGEN174CV__CAP_PROP_LATEST175#endif176};177178179/** @brief Generic camera output modes identifier.180@note Currently, these are supported through the libv4l backend only.181*/182enum VideoCaptureModes {183CAP_MODE_BGR = 0, //!< BGR24 (default)184CAP_MODE_RGB = 1, //!< RGB24185CAP_MODE_GRAY = 2, //!< Y8186CAP_MODE_YUYV = 3 //!< YUYV187};188189/** @brief %VideoWriter generic properties identifier.190@sa VideoWriter::get(), VideoWriter::set()191*/192enum VideoWriterProperties {193VIDEOWRITER_PROP_QUALITY = 1, //!< Current quality (0..100%) of the encoded videostream. Can be adjusted dynamically in some codecs.194VIDEOWRITER_PROP_FRAMEBYTES = 2, //!< (Read-only): Size of just encoded video frame. Note that the encoding order may be different from representation order.195VIDEOWRITER_PROP_NSTRIPES = 3 //!< Number of stripes for parallel encoding. -1 for auto detection.196};197198//! @} videoio_flags_base199200//! @addtogroup videoio_flags_others201//! @{202203/** @name IEEE 1394 drivers204@{205*/206207/** @brief Modes of the IEEE 1394 controlling registers208(can be: auto, manual, auto single push, absolute Latter allowed with any other mode)209every feature can have only one mode turned on at a time210*/211enum { CAP_PROP_DC1394_OFF = -4, //!< turn the feature off (not controlled manually nor automatically).212CAP_PROP_DC1394_MODE_MANUAL = -3, //!< set automatically when a value of the feature is set by the user.213CAP_PROP_DC1394_MODE_AUTO = -2,214CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1,215CAP_PROP_DC1394_MAX = 31216};217218//! @} IEEE 1394 drivers219220/** @name OpenNI (for Kinect)221@{222*/223224//! OpenNI map generators225enum { CAP_OPENNI_DEPTH_GENERATOR = 1 << 31,226CAP_OPENNI_IMAGE_GENERATOR = 1 << 30,227CAP_OPENNI_IR_GENERATOR = 1 << 29,228CAP_OPENNI_GENERATORS_MASK = CAP_OPENNI_DEPTH_GENERATOR + CAP_OPENNI_IMAGE_GENERATOR + CAP_OPENNI_IR_GENERATOR229};230231//! Properties of cameras available through OpenNI backend232enum { CAP_PROP_OPENNI_OUTPUT_MODE = 100,233CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101, //!< In mm234CAP_PROP_OPENNI_BASELINE = 102, //!< In mm235CAP_PROP_OPENNI_FOCAL_LENGTH = 103, //!< In pixels236CAP_PROP_OPENNI_REGISTRATION = 104, //!< Flag that synchronizes the remapping depth map to image map237//!< by changing depth generator's view point (if the flag is "on") or238//!< sets this view point to its normal one (if the flag is "off").239CAP_PROP_OPENNI_REGISTRATION_ON = CAP_PROP_OPENNI_REGISTRATION,240CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105,241CAP_PROP_OPENNI_MAX_BUFFER_SIZE = 106,242CAP_PROP_OPENNI_CIRCLE_BUFFER = 107,243CAP_PROP_OPENNI_MAX_TIME_DURATION = 108,244CAP_PROP_OPENNI_GENERATOR_PRESENT = 109,245CAP_PROP_OPENNI2_SYNC = 110,246CAP_PROP_OPENNI2_MIRROR = 111247};248249//! OpenNI shortcuts250enum { CAP_OPENNI_IMAGE_GENERATOR_PRESENT = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,251CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_OUTPUT_MODE,252CAP_OPENNI_DEPTH_GENERATOR_PRESENT = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,253CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_BASELINE,254CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_FOCAL_LENGTH,255CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_REGISTRATION,256CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION,257CAP_OPENNI_IR_GENERATOR_PRESENT = CAP_OPENNI_IR_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,258};259260//! OpenNI data given from depth generator261enum { CAP_OPENNI_DEPTH_MAP = 0, //!< Depth values in mm (CV_16UC1)262CAP_OPENNI_POINT_CLOUD_MAP = 1, //!< XYZ in meters (CV_32FC3)263CAP_OPENNI_DISPARITY_MAP = 2, //!< Disparity in pixels (CV_8UC1)264CAP_OPENNI_DISPARITY_MAP_32F = 3, //!< Disparity in pixels (CV_32FC1)265CAP_OPENNI_VALID_DEPTH_MASK = 4, //!< CV_8UC1266267CAP_OPENNI_BGR_IMAGE = 5, //!< Data given from RGB image generator268CAP_OPENNI_GRAY_IMAGE = 6, //!< Data given from RGB image generator269270CAP_OPENNI_IR_IMAGE = 7 //!< Data given from IR image generator271};272273//! Supported output modes of OpenNI image generator274enum { CAP_OPENNI_VGA_30HZ = 0,275CAP_OPENNI_SXGA_15HZ = 1,276CAP_OPENNI_SXGA_30HZ = 2,277CAP_OPENNI_QVGA_30HZ = 3,278CAP_OPENNI_QVGA_60HZ = 4279};280281//! @} OpenNI282283/** @name GStreamer284@{285*/286287enum { CAP_PROP_GSTREAMER_QUEUE_LENGTH = 200 //!< Default is 1288};289290//! @} GStreamer291292/** @name PvAPI, Prosilica GigE SDK293@{294*/295296//! PVAPI297enum { CAP_PROP_PVAPI_MULTICASTIP = 300, //!< IP for enable multicast master mode. 0 for disable multicast.298CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301, //!< FrameStartTriggerMode: Determines how a frame is initiated.299CAP_PROP_PVAPI_DECIMATIONHORIZONTAL = 302, //!< Horizontal sub-sampling of the image.300CAP_PROP_PVAPI_DECIMATIONVERTICAL = 303, //!< Vertical sub-sampling of the image.301CAP_PROP_PVAPI_BINNINGX = 304, //!< Horizontal binning factor.302CAP_PROP_PVAPI_BINNINGY = 305, //!< Vertical binning factor.303CAP_PROP_PVAPI_PIXELFORMAT = 306 //!< Pixel format.304};305306//! PVAPI: FrameStartTriggerMode307enum { CAP_PVAPI_FSTRIGMODE_FREERUN = 0, //!< Freerun308CAP_PVAPI_FSTRIGMODE_SYNCIN1 = 1, //!< SyncIn1309CAP_PVAPI_FSTRIGMODE_SYNCIN2 = 2, //!< SyncIn2310CAP_PVAPI_FSTRIGMODE_FIXEDRATE = 3, //!< FixedRate311CAP_PVAPI_FSTRIGMODE_SOFTWARE = 4 //!< Software312};313314//! PVAPI: DecimationHorizontal, DecimationVertical315enum { CAP_PVAPI_DECIMATION_OFF = 1, //!< Off316CAP_PVAPI_DECIMATION_2OUTOF4 = 2, //!< 2 out of 4 decimation317CAP_PVAPI_DECIMATION_2OUTOF8 = 4, //!< 2 out of 8 decimation318CAP_PVAPI_DECIMATION_2OUTOF16 = 8 //!< 2 out of 16 decimation319};320321//! PVAPI: PixelFormat322enum { CAP_PVAPI_PIXELFORMAT_MONO8 = 1, //!< Mono8323CAP_PVAPI_PIXELFORMAT_MONO16 = 2, //!< Mono16324CAP_PVAPI_PIXELFORMAT_BAYER8 = 3, //!< Bayer8325CAP_PVAPI_PIXELFORMAT_BAYER16 = 4, //!< Bayer16326CAP_PVAPI_PIXELFORMAT_RGB24 = 5, //!< Rgb24327CAP_PVAPI_PIXELFORMAT_BGR24 = 6, //!< Bgr24328CAP_PVAPI_PIXELFORMAT_RGBA32 = 7, //!< Rgba32329CAP_PVAPI_PIXELFORMAT_BGRA32 = 8, //!< Bgra32330};331332//! @} PvAPI333334/** @name XIMEA Camera API335@{336*/337338//! Properties of cameras available through XIMEA SDK backend339enum { CAP_PROP_XI_DOWNSAMPLING = 400, //!< Change image resolution by binning or skipping.340CAP_PROP_XI_DATA_FORMAT = 401, //!< Output data format.341CAP_PROP_XI_OFFSET_X = 402, //!< Horizontal offset from the origin to the area of interest (in pixels).342CAP_PROP_XI_OFFSET_Y = 403, //!< Vertical offset from the origin to the area of interest (in pixels).343CAP_PROP_XI_TRG_SOURCE = 404, //!< Defines source of trigger.344CAP_PROP_XI_TRG_SOFTWARE = 405, //!< Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE.345CAP_PROP_XI_GPI_SELECTOR = 406, //!< Selects general purpose input.346CAP_PROP_XI_GPI_MODE = 407, //!< Set general purpose input mode.347CAP_PROP_XI_GPI_LEVEL = 408, //!< Get general purpose level.348CAP_PROP_XI_GPO_SELECTOR = 409, //!< Selects general purpose output.349CAP_PROP_XI_GPO_MODE = 410, //!< Set general purpose output mode.350CAP_PROP_XI_LED_SELECTOR = 411, //!< Selects camera signalling LED.351CAP_PROP_XI_LED_MODE = 412, //!< Define camera signalling LED functionality.352CAP_PROP_XI_MANUAL_WB = 413, //!< Calculates White Balance(must be called during acquisition).353CAP_PROP_XI_AUTO_WB = 414, //!< Automatic white balance.354CAP_PROP_XI_AEAG = 415, //!< Automatic exposure/gain.355CAP_PROP_XI_EXP_PRIORITY = 416, //!< Exposure priority (0.5 - exposure 50%, gain 50%).356CAP_PROP_XI_AE_MAX_LIMIT = 417, //!< Maximum limit of exposure in AEAG procedure.357CAP_PROP_XI_AG_MAX_LIMIT = 418, //!< Maximum limit of gain in AEAG procedure.358CAP_PROP_XI_AEAG_LEVEL = 419, //!< Average intensity of output signal AEAG should achieve(in %).359CAP_PROP_XI_TIMEOUT = 420, //!< Image capture timeout in milliseconds.360CAP_PROP_XI_EXPOSURE = 421, //!< Exposure time in microseconds.361CAP_PROP_XI_EXPOSURE_BURST_COUNT = 422, //!< Sets the number of times of exposure in one frame.362CAP_PROP_XI_GAIN_SELECTOR = 423, //!< Gain selector for parameter Gain allows to select different type of gains.363CAP_PROP_XI_GAIN = 424, //!< Gain in dB.364CAP_PROP_XI_DOWNSAMPLING_TYPE = 426, //!< Change image downsampling type.365CAP_PROP_XI_BINNING_SELECTOR = 427, //!< Binning engine selector.366CAP_PROP_XI_BINNING_VERTICAL = 428, //!< Vertical Binning - number of vertical photo-sensitive cells to combine together.367CAP_PROP_XI_BINNING_HORIZONTAL = 429, //!< Horizontal Binning - number of horizontal photo-sensitive cells to combine together.368CAP_PROP_XI_BINNING_PATTERN = 430, //!< Binning pattern type.369CAP_PROP_XI_DECIMATION_SELECTOR = 431, //!< Decimation engine selector.370CAP_PROP_XI_DECIMATION_VERTICAL = 432, //!< Vertical Decimation - vertical sub-sampling of the image - reduces the vertical resolution of the image by the specified vertical decimation factor.371CAP_PROP_XI_DECIMATION_HORIZONTAL = 433, //!< Horizontal Decimation - horizontal sub-sampling of the image - reduces the horizontal resolution of the image by the specified vertical decimation factor.372CAP_PROP_XI_DECIMATION_PATTERN = 434, //!< Decimation pattern type.373CAP_PROP_XI_TEST_PATTERN_GENERATOR_SELECTOR = 587, //!< Selects which test pattern generator is controlled by the TestPattern feature.374CAP_PROP_XI_TEST_PATTERN = 588, //!< Selects which test pattern type is generated by the selected generator.375CAP_PROP_XI_IMAGE_DATA_FORMAT = 435, //!< Output data format.376CAP_PROP_XI_SHUTTER_TYPE = 436, //!< Change sensor shutter type(CMOS sensor).377CAP_PROP_XI_SENSOR_TAPS = 437, //!< Number of taps.378CAP_PROP_XI_AEAG_ROI_OFFSET_X = 439, //!< Automatic exposure/gain ROI offset X.379CAP_PROP_XI_AEAG_ROI_OFFSET_Y = 440, //!< Automatic exposure/gain ROI offset Y.380CAP_PROP_XI_AEAG_ROI_WIDTH = 441, //!< Automatic exposure/gain ROI Width.381CAP_PROP_XI_AEAG_ROI_HEIGHT = 442, //!< Automatic exposure/gain ROI Height.382CAP_PROP_XI_BPC = 445, //!< Correction of bad pixels.383CAP_PROP_XI_WB_KR = 448, //!< White balance red coefficient.384CAP_PROP_XI_WB_KG = 449, //!< White balance green coefficient.385CAP_PROP_XI_WB_KB = 450, //!< White balance blue coefficient.386CAP_PROP_XI_WIDTH = 451, //!< Width of the Image provided by the device (in pixels).387CAP_PROP_XI_HEIGHT = 452, //!< Height of the Image provided by the device (in pixels).388CAP_PROP_XI_REGION_SELECTOR = 589, //!< Selects Region in Multiple ROI which parameters are set by width, height, ... ,region mode.389CAP_PROP_XI_REGION_MODE = 595, //!< Activates/deactivates Region selected by Region Selector.390CAP_PROP_XI_LIMIT_BANDWIDTH = 459, //!< Set/get bandwidth(datarate)(in Megabits).391CAP_PROP_XI_SENSOR_DATA_BIT_DEPTH = 460, //!< Sensor output data bit depth.392CAP_PROP_XI_OUTPUT_DATA_BIT_DEPTH = 461, //!< Device output data bit depth.393CAP_PROP_XI_IMAGE_DATA_BIT_DEPTH = 462, //!< bitdepth of data returned by function xiGetImage.394CAP_PROP_XI_OUTPUT_DATA_PACKING = 463, //!< Device output data packing (or grouping) enabled. Packing could be enabled if output_data_bit_depth > 8 and packing capability is available.395CAP_PROP_XI_OUTPUT_DATA_PACKING_TYPE = 464, //!< Data packing type. Some cameras supports only specific packing type.396CAP_PROP_XI_IS_COOLED = 465, //!< Returns 1 for cameras that support cooling.397CAP_PROP_XI_COOLING = 466, //!< Start camera cooling.398CAP_PROP_XI_TARGET_TEMP = 467, //!< Set sensor target temperature for cooling.399CAP_PROP_XI_CHIP_TEMP = 468, //!< Camera sensor temperature.400CAP_PROP_XI_HOUS_TEMP = 469, //!< Camera housing temperature.401CAP_PROP_XI_HOUS_BACK_SIDE_TEMP = 590, //!< Camera housing back side temperature.402CAP_PROP_XI_SENSOR_BOARD_TEMP = 596, //!< Camera sensor board temperature.403CAP_PROP_XI_CMS = 470, //!< Mode of color management system.404CAP_PROP_XI_APPLY_CMS = 471, //!< Enable applying of CMS profiles to xiGetImage (see XI_PRM_INPUT_CMS_PROFILE, XI_PRM_OUTPUT_CMS_PROFILE).405CAP_PROP_XI_IMAGE_IS_COLOR = 474, //!< Returns 1 for color cameras.406CAP_PROP_XI_COLOR_FILTER_ARRAY = 475, //!< Returns color filter array type of RAW data.407CAP_PROP_XI_GAMMAY = 476, //!< Luminosity gamma.408CAP_PROP_XI_GAMMAC = 477, //!< Chromaticity gamma.409CAP_PROP_XI_SHARPNESS = 478, //!< Sharpness Strength.410CAP_PROP_XI_CC_MATRIX_00 = 479, //!< Color Correction Matrix element [0][0].411CAP_PROP_XI_CC_MATRIX_01 = 480, //!< Color Correction Matrix element [0][1].412CAP_PROP_XI_CC_MATRIX_02 = 481, //!< Color Correction Matrix element [0][2].413CAP_PROP_XI_CC_MATRIX_03 = 482, //!< Color Correction Matrix element [0][3].414CAP_PROP_XI_CC_MATRIX_10 = 483, //!< Color Correction Matrix element [1][0].415CAP_PROP_XI_CC_MATRIX_11 = 484, //!< Color Correction Matrix element [1][1].416CAP_PROP_XI_CC_MATRIX_12 = 485, //!< Color Correction Matrix element [1][2].417CAP_PROP_XI_CC_MATRIX_13 = 486, //!< Color Correction Matrix element [1][3].418CAP_PROP_XI_CC_MATRIX_20 = 487, //!< Color Correction Matrix element [2][0].419CAP_PROP_XI_CC_MATRIX_21 = 488, //!< Color Correction Matrix element [2][1].420CAP_PROP_XI_CC_MATRIX_22 = 489, //!< Color Correction Matrix element [2][2].421CAP_PROP_XI_CC_MATRIX_23 = 490, //!< Color Correction Matrix element [2][3].422CAP_PROP_XI_CC_MATRIX_30 = 491, //!< Color Correction Matrix element [3][0].423CAP_PROP_XI_CC_MATRIX_31 = 492, //!< Color Correction Matrix element [3][1].424CAP_PROP_XI_CC_MATRIX_32 = 493, //!< Color Correction Matrix element [3][2].425CAP_PROP_XI_CC_MATRIX_33 = 494, //!< Color Correction Matrix element [3][3].426CAP_PROP_XI_DEFAULT_CC_MATRIX = 495, //!< Set default Color Correction Matrix.427CAP_PROP_XI_TRG_SELECTOR = 498, //!< Selects the type of trigger.428CAP_PROP_XI_ACQ_FRAME_BURST_COUNT = 499, //!< Sets number of frames acquired by burst. This burst is used only if trigger is set to FrameBurstStart.429CAP_PROP_XI_DEBOUNCE_EN = 507, //!< Enable/Disable debounce to selected GPI.430CAP_PROP_XI_DEBOUNCE_T0 = 508, //!< Debounce time (x * 10us).431CAP_PROP_XI_DEBOUNCE_T1 = 509, //!< Debounce time (x * 10us).432CAP_PROP_XI_DEBOUNCE_POL = 510, //!< Debounce polarity (pol = 1 t0 - falling edge, t1 - rising edge).433CAP_PROP_XI_LENS_MODE = 511, //!< Status of lens control interface. This shall be set to XI_ON before any Lens operations.434CAP_PROP_XI_LENS_APERTURE_VALUE = 512, //!< Current lens aperture value in stops. Examples: 2.8, 4, 5.6, 8, 11.435CAP_PROP_XI_LENS_FOCUS_MOVEMENT_VALUE = 513, //!< Lens current focus movement value to be used by XI_PRM_LENS_FOCUS_MOVE in motor steps.436CAP_PROP_XI_LENS_FOCUS_MOVE = 514, //!< Moves lens focus motor by steps set in XI_PRM_LENS_FOCUS_MOVEMENT_VALUE.437CAP_PROP_XI_LENS_FOCUS_DISTANCE = 515, //!< Lens focus distance in cm.438CAP_PROP_XI_LENS_FOCAL_LENGTH = 516, //!< Lens focal distance in mm.439CAP_PROP_XI_LENS_FEATURE_SELECTOR = 517, //!< Selects the current feature which is accessible by XI_PRM_LENS_FEATURE.440CAP_PROP_XI_LENS_FEATURE = 518, //!< Allows access to lens feature value currently selected by XI_PRM_LENS_FEATURE_SELECTOR.441CAP_PROP_XI_DEVICE_MODEL_ID = 521, //!< Returns device model id.442CAP_PROP_XI_DEVICE_SN = 522, //!< Returns device serial number.443CAP_PROP_XI_IMAGE_DATA_FORMAT_RGB32_ALPHA = 529, //!< The alpha channel of RGB32 output image format.444CAP_PROP_XI_IMAGE_PAYLOAD_SIZE = 530, //!< Buffer size in bytes sufficient for output image returned by xiGetImage.445CAP_PROP_XI_TRANSPORT_PIXEL_FORMAT = 531, //!< Current format of pixels on transport layer.446CAP_PROP_XI_SENSOR_CLOCK_FREQ_HZ = 532, //!< Sensor clock frequency in Hz.447CAP_PROP_XI_SENSOR_CLOCK_FREQ_INDEX = 533, //!< Sensor clock frequency index. Sensor with selected frequencies have possibility to set the frequency only by this index.448CAP_PROP_XI_SENSOR_OUTPUT_CHANNEL_COUNT = 534, //!< Number of output channels from sensor used for data transfer.449CAP_PROP_XI_FRAMERATE = 535, //!< Define framerate in Hz.450CAP_PROP_XI_COUNTER_SELECTOR = 536, //!< Select counter.451CAP_PROP_XI_COUNTER_VALUE = 537, //!< Counter status.452CAP_PROP_XI_ACQ_TIMING_MODE = 538, //!< Type of sensor frames timing.453CAP_PROP_XI_AVAILABLE_BANDWIDTH = 539, //!< Calculate and returns available interface bandwidth(int Megabits).454CAP_PROP_XI_BUFFER_POLICY = 540, //!< Data move policy.455CAP_PROP_XI_LUT_EN = 541, //!< Activates LUT.456CAP_PROP_XI_LUT_INDEX = 542, //!< Control the index (offset) of the coefficient to access in the LUT.457CAP_PROP_XI_LUT_VALUE = 543, //!< Value at entry LUTIndex of the LUT.458CAP_PROP_XI_TRG_DELAY = 544, //!< Specifies the delay in microseconds (us) to apply after the trigger reception before activating it.459CAP_PROP_XI_TS_RST_MODE = 545, //!< Defines how time stamp reset engine will be armed.460CAP_PROP_XI_TS_RST_SOURCE = 546, //!< Defines which source will be used for timestamp reset. Writing this parameter will trigger settings of engine (arming).461CAP_PROP_XI_IS_DEVICE_EXIST = 547, //!< Returns 1 if camera connected and works properly.462CAP_PROP_XI_ACQ_BUFFER_SIZE = 548, //!< Acquisition buffer size in buffer_size_unit. Default bytes.463CAP_PROP_XI_ACQ_BUFFER_SIZE_UNIT = 549, //!< Acquisition buffer size unit in bytes. Default 1. E.g. Value 1024 means that buffer_size is in KiBytes.464CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_SIZE = 550, //!< Acquisition transport buffer size in bytes.465CAP_PROP_XI_BUFFERS_QUEUE_SIZE = 551, //!< Queue of field/frame buffers.466CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_COMMIT = 552, //!< Number of buffers to commit to low level.467CAP_PROP_XI_RECENT_FRAME = 553, //!< GetImage returns most recent frame.468CAP_PROP_XI_DEVICE_RESET = 554, //!< Resets the camera to default state.469CAP_PROP_XI_COLUMN_FPN_CORRECTION = 555, //!< Correction of column FPN.470CAP_PROP_XI_ROW_FPN_CORRECTION = 591, //!< Correction of row FPN.471CAP_PROP_XI_SENSOR_MODE = 558, //!< Current sensor mode. Allows to select sensor mode by one integer. Setting of this parameter affects: image dimensions and downsampling.472CAP_PROP_XI_HDR = 559, //!< Enable High Dynamic Range feature.473CAP_PROP_XI_HDR_KNEEPOINT_COUNT = 560, //!< The number of kneepoints in the PWLR.474CAP_PROP_XI_HDR_T1 = 561, //!< Position of first kneepoint(in % of XI_PRM_EXPOSURE).475CAP_PROP_XI_HDR_T2 = 562, //!< Position of second kneepoint (in % of XI_PRM_EXPOSURE).476CAP_PROP_XI_KNEEPOINT1 = 563, //!< Value of first kneepoint (% of sensor saturation).477CAP_PROP_XI_KNEEPOINT2 = 564, //!< Value of second kneepoint (% of sensor saturation).478CAP_PROP_XI_IMAGE_BLACK_LEVEL = 565, //!< Last image black level counts. Can be used for Offline processing to recall it.479CAP_PROP_XI_HW_REVISION = 571, //!< Returns hardware revision number.480CAP_PROP_XI_DEBUG_LEVEL = 572, //!< Set debug level.481CAP_PROP_XI_AUTO_BANDWIDTH_CALCULATION = 573, //!< Automatic bandwidth calculation.482CAP_PROP_XI_FFS_FILE_ID = 594, //!< File number.483CAP_PROP_XI_FFS_FILE_SIZE = 580, //!< Size of file.484CAP_PROP_XI_FREE_FFS_SIZE = 581, //!< Size of free camera FFS.485CAP_PROP_XI_USED_FFS_SIZE = 582, //!< Size of used camera FFS.486CAP_PROP_XI_FFS_ACCESS_KEY = 583, //!< Setting of key enables file operations on some cameras.487CAP_PROP_XI_SENSOR_FEATURE_SELECTOR = 585, //!< Selects the current feature which is accessible by XI_PRM_SENSOR_FEATURE_VALUE.488CAP_PROP_XI_SENSOR_FEATURE_VALUE = 586, //!< Allows access to sensor feature value currently selected by XI_PRM_SENSOR_FEATURE_SELECTOR.489};490491//! @} XIMEA492493/** @name AVFoundation framework for iOS494OS X Lion will have the same API495@{496*/497498//! Properties of cameras available through AVFOUNDATION backend499enum { CAP_PROP_IOS_DEVICE_FOCUS = 9001,500CAP_PROP_IOS_DEVICE_EXPOSURE = 9002,501CAP_PROP_IOS_DEVICE_FLASH = 9003,502CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004,503CAP_PROP_IOS_DEVICE_TORCH = 9005504};505506/** @name Smartek Giganetix GigEVisionSDK507@{508*/509510//! Properties of cameras available through Smartek Giganetix Ethernet Vision backend511/* --- Vladimir Litvinenko ([email protected]) --- */512enum { CAP_PROP_GIGA_FRAME_OFFSET_X = 10001,513CAP_PROP_GIGA_FRAME_OFFSET_Y = 10002,514CAP_PROP_GIGA_FRAME_WIDTH_MAX = 10003,515CAP_PROP_GIGA_FRAME_HEIGH_MAX = 10004,516CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005,517CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006518};519520//! @} Smartek521522/** @name Intel Perceptual Computing SDK523@{524*/525enum { CAP_PROP_INTELPERC_PROFILE_COUNT = 11001,526CAP_PROP_INTELPERC_PROFILE_IDX = 11002,527CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE = 11003,528CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE = 11004,529CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD = 11005,530CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ = 11006,531CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT = 11007532};533534//! Intel Perceptual Streams535enum { CAP_INTELPERC_DEPTH_GENERATOR = 1 << 29,536CAP_INTELPERC_IMAGE_GENERATOR = 1 << 28,537CAP_INTELPERC_GENERATORS_MASK = CAP_INTELPERC_DEPTH_GENERATOR + CAP_INTELPERC_IMAGE_GENERATOR538};539540enum { 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.541CAP_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.542CAP_INTELPERC_IR_MAP = 2, //!< Each pixel is a 16-bit integer. The value indicates the intensity of the reflected laser beam.543CAP_INTELPERC_IMAGE = 3544};545546//! @} Intel Perceptual547548/** @name gPhoto2 connection549@{550*/551552/** @brief gPhoto2 properties553554If `propertyId` is less than 0 then work on widget with that __additive inversed__ camera setting ID555Get IDs by using CAP_PROP_GPHOTO2_WIDGET_ENUMERATE.556@see CvCaptureCAM_GPHOTO2 for more info557*/558enum { CAP_PROP_GPHOTO2_PREVIEW = 17001, //!< Capture only preview from liveview mode.559CAP_PROP_GPHOTO2_WIDGET_ENUMERATE = 17002, //!< Readonly, returns (const char *).560CAP_PROP_GPHOTO2_RELOAD_CONFIG = 17003, //!< Trigger, only by set. Reload camera settings.561CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE = 17004, //!< Reload all settings on set.562CAP_PROP_GPHOTO2_COLLECT_MSGS = 17005, //!< Collect messages with details.563CAP_PROP_GPHOTO2_FLUSH_MSGS = 17006, //!< Readonly, returns (const char *).564CAP_PROP_SPEED = 17007, //!< Exposure speed. Can be readonly, depends on camera program.565CAP_PROP_APERTURE = 17008, //!< Aperture. Can be readonly, depends on camera program.566CAP_PROP_EXPOSUREPROGRAM = 17009, //!< Camera exposure program.567CAP_PROP_VIEWFINDER = 17010 //!< Enter liveview mode.568};569570//! @} gPhoto2571572573/** @name Images backend574@{575*/576577/** @brief Images backend properties578579*/580enum { CAP_PROP_IMAGES_BASE = 18000,581CAP_PROP_IMAGES_LAST = 19000 // excluding582};583584//! @} Images585586//! @} videoio_flags_others587588589class IVideoCapture;590591/** @brief Class for video capturing from video files, image sequences or cameras.592593The class provides C++ API for capturing video from cameras or for reading video files and image sequences.594595Here is how the class can be used:596@include samples/cpp/videocapture_basic.cpp597598@note In @ref videoio_c "C API" the black-box structure `CvCapture` is used instead of %VideoCapture.599@note600- (C++) A basic sample on using the %VideoCapture interface can be found at601`OPENCV_SOURCE_CODE/samples/cpp/videocapture_starter.cpp`602- (Python) A basic sample on using the %VideoCapture interface can be found at603`OPENCV_SOURCE_CODE/samples/python/video.py`604- (Python) A multi threaded video processing sample can be found at605`OPENCV_SOURCE_CODE/samples/python/video_threaded.py`606- (Python) %VideoCapture sample showcasing some features of the Video4Linux2 backend607`OPENCV_SOURCE_CODE/samples/python/video_v4l2.py`608*/609class CV_EXPORTS_W VideoCapture610{611public:612/** @brief Default constructor613@note In @ref videoio_c "C API", when you finished working with video, release CvCapture structure with614cvReleaseCapture(), or use Ptr\<CvCapture\> that calls cvReleaseCapture() automatically in the615destructor.616*/617CV_WRAP VideoCapture();618619/** @overload620@brief Opens a video file or a capturing device or an IP video stream for video capturing with API Preference621622@param filename it can be:623- name of video file (eg. `video.avi`)624- or image sequence (eg. `img_%02d.jpg`, which will read samples like `img_00.jpg, img_01.jpg, img_02.jpg, ...`)625- or URL of video stream (eg. `protocol://host:port/script_name?script_params|auth`).626Note that each video stream or IP camera feed has its own URL scheme. Please refer to the627documentation of source stream to know the right URL.628@param apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader629implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW.630@sa The list of supported API backends cv::VideoCaptureAPIs631*/632CV_WRAP VideoCapture(const String& filename, int apiPreference = CAP_ANY);633634/** @overload635@brief Opens a camera for video capturing636637@param index id of the video capturing device to open. To open default camera using default backend just pass 0.638(to backward compatibility usage of camera_id + domain_offset (CAP_*) is valid when apiPreference is CAP_ANY)639@param apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader640implementation if multiple are available: e.g. cv::CAP_DSHOW or cv::CAP_MSMF or cv::CAP_V4L.641642@sa The list of supported API backends cv::VideoCaptureAPIs643*/644CV_WRAP VideoCapture(int index, int apiPreference = CAP_ANY);645646/** @brief Default destructor647648The method first calls VideoCapture::release to close the already opened file or camera.649*/650virtual ~VideoCapture();651652/** @brief Opens a video file or a capturing device or an IP video stream for video capturing.653654@overload655656Parameters are same as the constructor VideoCapture(const String& filename, int apiPreference = CAP_ANY)657@return `true` if the file has been successfully opened658659The method first calls VideoCapture::release to close the already opened file or camera.660*/661CV_WRAP virtual bool open(const String& filename, int apiPreference = CAP_ANY);662663/** @brief Opens a camera for video capturing664665@overload666667Parameters are same as the constructor VideoCapture(int index, int apiPreference = CAP_ANY)668@return `true` if the camera has been successfully opened.669670The method first calls VideoCapture::release to close the already opened file or camera.671*/672CV_WRAP virtual bool open(int index, int apiPreference = CAP_ANY);673674/** @brief Returns true if video capturing has been initialized already.675676If the previous call to VideoCapture constructor or VideoCapture::open() succeeded, the method returns677true.678*/679CV_WRAP virtual bool isOpened() const;680681/** @brief Closes video file or capturing device.682683The method is automatically called by subsequent VideoCapture::open and by VideoCapture684destructor.685686The C function also deallocates memory and clears \*capture pointer.687*/688CV_WRAP virtual void release();689690/** @brief Grabs the next frame from video file or capturing device.691692@return `true` (non-zero) in the case of success.693694The method/function grabs the next frame from video file or camera and returns true (non-zero) in695the case of success.696697The primary use of the function is in multi-camera environments, especially when the cameras do not698have hardware synchronization. That is, you call VideoCapture::grab() for each camera and after that699call the slower method VideoCapture::retrieve() to decode and get frame from each camera. This way700the overhead on demosaicing or motion jpeg decompression etc. is eliminated and the retrieved frames701from different cameras will be closer in time.702703Also, when a connected camera is multi-head (for example, a stereo camera or a Kinect device), the704correct way of retrieving data from it is to call VideoCapture::grab() first and then call705VideoCapture::retrieve() one or more times with different values of the channel parameter.706707@ref tutorial_kinect_openni708*/709CV_WRAP virtual bool grab();710711/** @brief Decodes and returns the grabbed video frame.712713@param [out] image the video frame is returned here. If no frames has been grabbed the image will be empty.714@param flag it could be a frame index or a driver specific flag715@return `false` if no frames has been grabbed716717The method decodes and returns the just grabbed frame. If no frames has been grabbed718(camera has been disconnected, or there are no more frames in video file), the method returns false719and the function returns an empty image (with %cv::Mat, test it with Mat::empty()).720721@sa read()722723@note In @ref videoio_c "C API", functions cvRetrieveFrame() and cv.RetrieveFrame() return image stored inside the video724capturing structure. It is not allowed to modify or release the image! You can copy the frame using725cvCloneImage and then do whatever you want with the copy.726*/727CV_WRAP virtual bool retrieve(OutputArray image, int flag = 0);728729/** @brief Stream operator to read the next video frame.730@sa read()731*/732virtual VideoCapture& operator >> (CV_OUT Mat& image);733734/** @overload735@sa read()736*/737virtual VideoCapture& operator >> (CV_OUT UMat& image);738739/** @brief Grabs, decodes and returns the next video frame.740741@param [out] image the video frame is returned here. If no frames has been grabbed the image will be empty.742@return `false` if no frames has been grabbed743744The method/function combines VideoCapture::grab() and VideoCapture::retrieve() in one call. This is the745most convenient method for reading video files or capturing data from decode and returns the just746grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more747frames in video file), the method returns false and the function returns empty image (with %cv::Mat, test it with Mat::empty()).748749@note In @ref videoio_c "C API", functions cvRetrieveFrame() and cv.RetrieveFrame() return image stored inside the video750capturing structure. It is not allowed to modify or release the image! You can copy the frame using751cvCloneImage and then do whatever you want with the copy.752*/753CV_WRAP virtual bool read(OutputArray image);754755/** @brief Sets a property in the VideoCapture.756757@param propId Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...)758or one from @ref videoio_flags_others759@param value Value of the property.760@return `true` if the property is supported by backend used by the VideoCapture instance.761@note Even if it returns `true` this doesn't ensure that the property762value has been accepted by the capture device. See note in VideoCapture::get()763*/764CV_WRAP virtual bool set(int propId, double value);765766/** @brief Returns the specified VideoCapture property767768@param propId Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...)769or one from @ref videoio_flags_others770@return Value for the specified property. Value 0 is returned when querying a property that is771not supported by the backend used by the VideoCapture instance.772773@note Reading / writing properties involves many layers. Some unexpected result might happens774along this chain.775@code {.txt}776`VideoCapture -> API Backend -> Operating System -> Device Driver -> Device Hardware`777@endcode778The returned value might be different from what really used by the device or it could be encoded779using device dependent rules (eg. steps or percentage). Effective behaviour depends from device780driver and API Backend781782*/783CV_WRAP virtual double get(int propId) const;784785/** @brief Returns used backend API name786787@note Stream should be opened.788*/789CV_WRAP String getBackendName() const;790791protected:792Ptr<CvCapture> cap;793Ptr<IVideoCapture> icap;794};795796class IVideoWriter;797798/** @example samples/cpp/tutorial_code/videoio/video-write/video-write.cpp799Check @ref tutorial_video_write "the corresponding tutorial" for more details800*/801802/** @example samples/cpp/videowriter_basic.cpp803An example using VideoCapture and VideoWriter class804*/805806/** @brief Video writer class.807808The class provides C++ API for writing video files or image sequences.809*/810class CV_EXPORTS_W VideoWriter811{812public:813/** @brief Default constructors814815The constructors/functions initialize video writers.816- On Linux FFMPEG is used to write videos;817- On Windows FFMPEG or VFW is used;818- On MacOSX QTKit is used.819*/820CV_WRAP VideoWriter();821822/** @overload823@param filename Name of the output video file.824@param fourcc 4-character code of codec used to compress the frames. For example,825VideoWriter::fourcc('P','I','M','1') is a MPEG-1 codec, VideoWriter::fourcc('M','J','P','G') is a826motion-jpeg codec etc. List of codes can be obtained at [Video Codecs by827FOURCC](http://www.fourcc.org/codecs.php) page. FFMPEG backend with MP4 container natively uses828other values as fourcc code: see [ObjectType](http://www.mp4ra.org/codecs.html),829so you may receive a warning message from OpenCV about fourcc code conversion.830@param fps Framerate of the created video stream.831@param frameSize Size of the video frames.832@param isColor If it is not zero, the encoder will expect and encode color frames, otherwise it833will work with grayscale frames (the flag is currently supported on Windows only).834835@b Tips:836- With some backends `fourcc=-1` pops up the codec selection dialog from the system.837- To save image sequence use a proper filename (eg. `img_%02d.jpg`) and `fourcc=0`838OR `fps=0`. Use uncompressed image format (eg. `img_%02d.BMP`) to save raw frames.839- Most codecs are lossy. If you want lossless video file you need to use a lossless codecs840(eg. FFMPEG FFV1, Huffman HFYU, Lagarith LAGS, etc...)841- If FFMPEG is enabled, using `codec=0; fps=0;` you can create an uncompressed (raw) video file.842*/843CV_WRAP VideoWriter(const String& filename, int fourcc, double fps,844Size frameSize, bool isColor = true);845846/** @overload847The `apiPreference` parameter allows to specify API backends to use. Can be used to enforce a specific reader implementation848if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_GSTREAMER.849*/850CV_WRAP VideoWriter(const String& filename, int apiPreference, int fourcc, double fps,851Size frameSize, bool isColor = true);852853/** @brief Default destructor854855The method first calls VideoWriter::release to close the already opened file.856*/857virtual ~VideoWriter();858859/** @brief Initializes or reinitializes video writer.860861The method opens video writer. Parameters are the same as in the constructor862VideoWriter::VideoWriter.863@return `true` if video writer has been successfully initialized864865The method first calls VideoWriter::release to close the already opened file.866*/867CV_WRAP virtual bool open(const String& filename, int fourcc, double fps,868Size frameSize, bool isColor = true);869870/** @overload871*/872CV_WRAP bool open(const String& filename, int apiPreference, int fourcc, double fps,873Size frameSize, bool isColor = true);874875/** @brief Returns true if video writer has been successfully initialized.876*/877CV_WRAP virtual bool isOpened() const;878879/** @brief Closes the video writer.880881The method is automatically called by subsequent VideoWriter::open and by the VideoWriter882destructor.883*/884CV_WRAP virtual void release();885886/** @brief Stream operator to write the next video frame.887@sa write888*/889virtual VideoWriter& operator << (const Mat& image);890891/** @overload892@sa write893*/894virtual VideoWriter& operator << (const UMat& image);895896/** @brief Writes the next video frame897898@param image The written frame. In general, color images are expected in BGR format.899900The function/method writes the specified image to video file. It must have the same size as has901been specified when opening the video writer.902*/903CV_WRAP virtual void write(InputArray image);904905/** @brief Sets a property in the VideoWriter.906907@param propId Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY)908or one of @ref videoio_flags_others909910@param value Value of the property.911@return `true` if the property is supported by the backend used by the VideoWriter instance.912*/913CV_WRAP virtual bool set(int propId, double value);914915/** @brief Returns the specified VideoWriter property916917@param propId Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY)918or one of @ref videoio_flags_others919920@return Value for the specified property. Value 0 is returned when querying a property that is921not supported by the backend used by the VideoWriter instance.922*/923CV_WRAP virtual double get(int propId) const;924925/** @brief Concatenates 4 chars to a fourcc code926927@return a fourcc code928929This static method constructs the fourcc code of the codec to be used in the constructor930VideoWriter::VideoWriter or VideoWriter::open.931*/932CV_WRAP static int fourcc(char c1, char c2, char c3, char c4);933934/** @brief Returns used backend API name935936@note Stream should be opened.937*/938CV_WRAP String getBackendName() const;939940protected:941Ptr<CvVideoWriter> writer;942Ptr<IVideoWriter> iwriter;943944static Ptr<IVideoWriter> create(const String& filename, int fourcc, double fps,945Size frameSize, bool isColor = true);946};947948template<> struct DefaultDeleter<CvCapture>{ CV_EXPORTS void operator ()(CvCapture* obj) const; };949template<> struct DefaultDeleter<CvVideoWriter>{ CV_EXPORTS void operator ()(CvVideoWriter* obj) const; };950951//! @} videoio952953} // cv954955#endif //OPENCV_VIDEOIO_HPP956957958