Class VideoCapture
Video capturing class
Implements
Inherited Members
Namespace: OpenCvSharp
Assembly: OpenCvSharp.dll
Syntax
public class VideoCapture : DisposableCvObject, ICvPtrHolder
Constructors
| Improve this Doc View SourceVideoCapture()
Initializes empty capture. To use this, you should call Open.
Declaration
public VideoCapture()
VideoCapture(IntPtr)
Initializes from native pointer
Declaration
protected VideoCapture(IntPtr ptr)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | ptr | CvCapture* |
VideoCapture(Int32, VideoCaptureAPIs)
Opens a camera for video capturing
Declaration
public VideoCapture(int index, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | id of the video capturing device to open. To open default camera using default backend just pass 0. (to backward compatibility usage of camera_id + domain_offset (CAP_*) is valid when apiPreference is CAP_ANY) |
VideoCaptureAPIs | apiPreference | preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_DSHOW or cv::CAP_MSMF or cv::CAP_V4L. |
VideoCapture(Int32, VideoCaptureAPIs, VideoCapturePara)
Opens a camera for video capturing with API Preference and parameters
Declaration
public VideoCapture(int index, VideoCaptureAPIs apiPreference, VideoCapturePara prms)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | id of the video capturing device to open. To open default camera using default backend just pass 0. (to backward compatibility usage of camera_id + domain_offset (CAP_*) is valid when apiPreference is CAP_ANY) |
VideoCaptureAPIs | apiPreference | preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_DSHOW or cv::CAP_MSMF or cv::CAP_V4L. |
VideoCapturePara | prms | Parameters of VideoCature for hardware acceleration |
VideoCapture(Int32, VideoCaptureAPIs, Int32[])
Opens a camera for video capturing with API Preference and parameters
Declaration
public VideoCapture(int index, VideoCaptureAPIs apiPreference, int[] prms)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | id of the video capturing device to open. To open default camera using default backend just pass 0. (to backward compatibility usage of camera_id + domain_offset (CAP_*) is valid when apiPreference is CAP_ANY) |
VideoCaptureAPIs | apiPreference | preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_DSHOW or cv::CAP_MSMF or cv::CAP_V4L. |
System.Int32[] | prms | The |
VideoCapture(String, VideoCaptureAPIs)
Opens a video file or a capturing device or an IP video stream for video capturing with API Preference
Declaration
public VideoCapture(string fileName, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | it can be:
|
VideoCaptureAPIs | apiPreference | apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW. |
VideoCapture(String, VideoCaptureAPIs, VideoCapturePara)
Opens a video file or a capturing device or an IP video stream for video capturing with API Preference
Declaration
public VideoCapture(string fileName, VideoCaptureAPIs apiPreference, VideoCapturePara prms)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | it can be:
|
VideoCaptureAPIs | apiPreference | apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW. |
VideoCapturePara | prms | Parameters of VideoCature for hardware acceleration |
VideoCapture(String, VideoCaptureAPIs, Int32[])
Opens a video file or a capturing device or an IP video stream for video capturing with API Preference
Declaration
public VideoCapture(string fileName, VideoCaptureAPIs apiPreference, int[] prms)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | it can be:
|
VideoCaptureAPIs | apiPreference | apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW. |
System.Int32[] | prms | The |
Properties
| Improve this Doc View SourceAutoExposure
exposure control done by camera, user can adjust refernce level using this feature [CV_CAP_PROP_AUTO_EXPOSURE]
Declaration
public double AutoExposure { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
AutoFocus
Declaration
public bool AutoFocus { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
BackLight
Declaration
public double BackLight { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Brightness
Gets or sets brightness of image (only for cameras)
Declaration
public double Brightness { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
BufferSize
Declaration
public double BufferSize { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
CaptureType
Gets the capture type (File or Camera)
Declaration
public CaptureType CaptureType { get; }
Property Value
Type | Description |
---|---|
CaptureType |
Contrast
Gets or sets contrast of image (only for cameras)
Declaration
public double Contrast { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
ConvertRgb
Boolean flags indicating whether images should be converted to RGB
Declaration
public bool ConvertRgb { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Exposure
Exposure (only for cameras)
Declaration
public double Exposure { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Focus
Declaration
public double Focus { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Format
The format of the Mat objects returned by retrieve()
Declaration
public int Format { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
FourCC
Gets or sets 4-character code of codec
Declaration
public string FourCC { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Fps
Gets or sets frame rate
Declaration
public double Fps { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
FrameCount
Gets number of frames in video file
Declaration
public int FrameCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
FrameHeight
Gets or sets height of frames in the video stream
Declaration
public int FrameHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
FrameWidth
Gets or sets width of frames in the video stream
Declaration
public int FrameWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Gain
Gain of the image (only for cameras)
Declaration
public double Gain { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Gamma
Declaration
public double Gamma { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
GStreamerQueueLength
default is 1 [CV_CAP_GSTREAMER_QUEUE_LENGTH]
Declaration
public double GStreamerQueueLength { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Guid
Declaration
public double Guid { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Hue
Gets or sets hue of image (only for cameras)
Declaration
public double Hue { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Iris
Declaration
public double Iris { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
IsoSpeed
Declaration
public double IsoSpeed { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Mode
A backend-specific value indicating the current capture mode
Declaration
public int Mode { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Monocrome
Declaration
public double Monocrome { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
OpenNI_Baseline
in mm [CV_CAP_PROP_OPENNI_BASELINE]
Declaration
public double OpenNI_Baseline { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
OpenNI_DepthGeneratorBaseline
[CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE]
Declaration
public double OpenNI_DepthGeneratorBaseline { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
OpenNI_DepthGeneratorFocalLength
[CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH]
Declaration
public double OpenNI_DepthGeneratorFocalLength { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
OpenNI_DepthGeneratorRegistrationON
[CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON]
Declaration
public double OpenNI_DepthGeneratorRegistrationON { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
OpenNI_FocalLength
in pixels [CV_CAP_PROP_OPENNI_FOCAL_LENGTH]
Declaration
public double OpenNI_FocalLength { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
OpenNI_FrameMaxDepth
in mm [CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH]
Declaration
public double OpenNI_FrameMaxDepth { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
OpenNI_ImageGeneratorOutputMode
[CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE]
Declaration
public double OpenNI_ImageGeneratorOutputMode { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
OpenNI_OutputMode
[CV_CAP_PROP_OPENNI_OUTPUT_MODE]
Declaration
public double OpenNI_OutputMode { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
OpenNI_Registration
flag that synchronizes the remapping depth map to image map by changing depth generator's view point (if the flag is "on") or sets this view point to its normal one (if the flag is "off"). [CV_CAP_PROP_OPENNI_REGISTRATION]
Declaration
public double OpenNI_Registration { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Pan
Declaration
public double Pan { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
PosAviRatio
Gets or sets relative position of video file
Declaration
public CapturePosAviRatio PosAviRatio { get; set; }
Property Value
Type | Description |
---|---|
CapturePosAviRatio |
PosFrames
Gets or sets 0-based index of the frame to be decoded/captured next
Declaration
public int PosFrames { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
PosMsec
Gets or sets film current position in milliseconds or video capture timestamp
Declaration
public int PosMsec { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
PvAPIMulticastIP
ip for anable multicast master mode. 0 for disable multicast [CV_CAP_PROP_PVAPI_MULTICASTIP]
Declaration
public double PvAPIMulticastIP { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Rectification
TOWRITE (note: only supported by DC1394 v 2.x backend currently)
Declaration
public double Rectification { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Roll
Declaration
public double Roll { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Saturation
Gets or sets saturation of image (only for cameras)
Declaration
public double Saturation { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Settings
Declaration
public double Settings { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Sharpness
Declaration
public double Sharpness { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Temperature
[CV_CAP_PROP_TEMPERATURE]
Declaration
public double Temperature { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Tilt
Declaration
public double Tilt { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Trigger
Declaration
public double Trigger { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
TriggerDelay
Declaration
public double TriggerDelay { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
WhiteBalanceBlueU
Declaration
public double WhiteBalanceBlueU { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
WhiteBalanceRedV
Declaration
public double WhiteBalanceRedV { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_AEAG
Automatic exposure/gain [CV_CAP_PROP_XI_AEAG]
Declaration
public double XI_AEAG { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_AEAGLevel
default is 1 [CV_CAP_PROP_XI_AEAG_LEVEL]
Declaration
public double XI_AEAGLevel { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_AEMaxLimit
Maximum limit of exposure in AEAG procedure [CV_CAP_PROP_XI_AE_MAX_LIMIT]
Declaration
public double XI_AEMaxLimit { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_AGMaxLimit
Maximum limit of gain in AEAG procedure [CV_CAP_PROP_XI_AG_MAX_LIMIT]
Declaration
public double XI_AGMaxLimit { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_AutoWB
Automatic white balance [CV_CAP_PROP_XI_AUTO_WB]
Declaration
public double XI_AutoWB { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_DataFormat
Output data format. [CV_CAP_PROP_XI_DATA_FORMAT]
Declaration
public double XI_DataFormat { get; }
Property Value
Type | Description |
---|---|
System.Double |
XI_Downsampling
Change image resolution by binning or skipping.
[CV_CAP_PROP_XI_DOWNSAMPLING]
Declaration
public double XI_Downsampling { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_ExpPriority
Exposure priority (0.5 - exposure 50%, gain 50%). [CV_CAP_PROP_XI_EXP_PRIORITY]
Declaration
public double XI_ExpPriority { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_GpiLevel
Get general purpose level [CV_CAP_PROP_XI_GPI_LEVEL]
Declaration
public double XI_GpiLevel { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_GpiMode
Set general purpose input mode [CV_CAP_PROP_XI_GPI_MODE]
Declaration
public double XI_GpiMode { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_GpiSelector
Selects general purpose input [CV_CAP_PROP_XI_GPI_SELECTOR]
Declaration
public double XI_GpiSelector { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_GpoMode
Set general purpose output mode [CV_CAP_PROP_XI_GPO_MODE]
Declaration
public double XI_GpoMode { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_GpoSelector
Selects general purpose output [CV_CAP_PROP_XI_GPO_SELECTOR]
Declaration
public double XI_GpoSelector { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_LedMode
Define camera signalling LED functionality [CV_CAP_PROP_XI_LED_MODE]
Declaration
public double XI_LedMode { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_LedSelector
Selects camera signalling LED [CV_CAP_PROP_XI_LED_SELECTOR]
Declaration
public double XI_LedSelector { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_ManualWB
Calculates White Balance(must be called during acquisition) [CV_CAP_PROP_XI_MANUAL_WB]
Declaration
public double XI_ManualWB { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_OffsetX
Horizontal offset from the origin to the area of interest (in pixels). [CV_CAP_PROP_XI_OFFSET_X]
Declaration
public double XI_OffsetX { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_OffsetY
Vertical offset from the origin to the area of interest (in pixels). [CV_CAP_PROP_XI_OFFSET_Y]
Declaration
public double XI_OffsetY { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_Timeout
default is 1 [CV_CAP_PROP_XI_TIMEOUT]
Declaration
public double XI_Timeout { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_TrgSoftware
Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. [CV_CAP_PROP_XI_TRG_SOFTWARE]
Declaration
public double XI_TrgSoftware { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
XI_TrgSource
Defines source of trigger. [CV_CAP_PROP_XI_TRG_SOURCE]
Declaration
public double XI_TrgSource { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Zoom
Declaration
public double Zoom { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
| Improve this Doc View SourceDisposeUnmanaged()
Releases unmanaged resources
Declaration
protected override void DisposeUnmanaged()
Overrides
| Improve this Doc View SourceFromCamera(Int32, VideoCaptureAPIs)
Opens a camera for video capturing
Declaration
public static VideoCapture FromCamera(int index, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | id of the video capturing device to open. To open default camera using default backend just pass 0. (to backward compatibility usage of camera_id + domain_offset (CAP_*) is valid when apiPreference is CAP_ANY) |
VideoCaptureAPIs | apiPreference | preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_DSHOW or cv::CAP_MSMF or cv::CAP_V4L. |
Returns
Type | Description |
---|---|
VideoCapture |
FromFile(String, VideoCaptureAPIs)
Opens a video file or a capturing device or an IP video stream for video capturing with API Preference
Declaration
public static VideoCapture FromFile(string fileName, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | it can be:
|
VideoCaptureAPIs | apiPreference | apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW. |
Returns
Type | Description |
---|---|
VideoCapture |
Get(VideoCaptureProperties)
Returns the specified VideoCapture property
Declaration
public double Get(VideoCaptureProperties propertyId)
Parameters
Type | Name | Description |
---|---|---|
VideoCaptureProperties | propertyId | Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...) or one from @ref videoio_flags_others |
Returns
Type | Description |
---|---|
System.Double | Value for the specified property. Value 0 is returned when querying a property that is not supported by the backend used by the VideoCapture instance. |
Get(Int32)
Returns the specified VideoCapture property
Declaration
public double Get(int propertyId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | propertyId | Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...) or one from @ref videoio_flags_others |
Returns
Type | Description |
---|---|
System.Double | Value for the specified property. Value 0 is returned when querying a property that is not supported by the backend used by the VideoCapture instance. |
GetBackendName()
Returns used backend API name. Note that stream should be opened.
Declaration
public string GetBackendName()
Returns
Type | Description |
---|---|
System.String |
GetExceptionMode()
query if exception mode is active
Declaration
public bool GetExceptionMode()
Returns
Type | Description |
---|---|
System.Boolean |
Grab()
Grabs the next frame from video file or capturing device.
The method/function grabs the next frame from video file or camera and returns true (non-zero) in the case of success.
The primary use of the function is in multi-camera environments, especially when the cameras do not have hardware synchronization. That is, you call VideoCapture::grab() for each camera and after that call the slower method VideoCapture::retrieve() to decode and get frame from each camera. This way the overhead on demosaicing or motion jpeg decompression etc. is eliminated and the retrieved frames from different cameras will be closer in time.
Also, when a connected camera is multi-head (for example, a stereo camera or a Kinect device), the correct way of retrieving data from it is to call VideoCapture::grab() first and then call VideoCapture::retrieve() one or more times with different values of the channel parameter.
Declaration
public bool Grab()
Returns
Type | Description |
---|---|
System.Boolean |
|
IsOpened()
Returns true if video capturing has been initialized already.
Declaration
public bool IsOpened()
Returns
Type | Description |
---|---|
System.Boolean |
Open(Int32, VideoCaptureAPIs)
Opens a camera for video capturing
Declaration
public bool Open(int index, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | id of the video capturing device to open. To open default camera using default backend just pass 0. (to backward compatibility usage of camera_id + domain_offset (CAP_*) is valid when apiPreference is CAP_ANY) |
VideoCaptureAPIs | apiPreference | preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_DSHOW or cv::CAP_MSMF or cv::CAP_V4L. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Open(String, VideoCaptureAPIs)
Opens a video file or a capturing device or an IP video stream for video capturing.
Declaration
public bool Open(string fileName, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | it can be:
|
VideoCaptureAPIs | apiPreference | apiPreference preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Read(Mat)
Grabs, decodes and returns the next video frame.
The method/function combines VideoCapture::grab() and VideoCapture::retrieve() in one call. This is the most convenient method for reading video files or capturing data from decode and returns the just grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the method returns false and the function returns empty image (with %cv::Mat, test it with Mat::empty()).
Declaration
public bool Read(Mat image)
Parameters
Type | Name | Description |
---|---|---|
Mat | image |
Returns
Type | Description |
---|---|
System.Boolean |
|
Read(OutputArray)
Grabs, decodes and returns the next video frame.
The method/function combines VideoCapture::grab() and VideoCapture::retrieve() in one call. This is the most convenient method for reading video files or capturing data from decode and returns the just grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the method returns false and the function returns empty image (with %cv::Mat, test it with Mat::empty()).
Declaration
public bool Read(OutputArray image)
Parameters
Type | Name | Description |
---|---|---|
OutputArray | image |
Returns
Type | Description |
---|---|
System.Boolean |
|
Release()
Closes video file or capturing device.
Declaration
public void Release()
Retrieve(Mat, CameraChannels)
Decodes and returns the grabbed video frame.
The method decodes and returns the just grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the method returns false and the function returns an empty image (with %cv::Mat, test it with Mat::empty()).
Declaration
public bool Retrieve(Mat image, CameraChannels streamIdx)
Parameters
Type | Name | Description |
---|---|---|
Mat | image | the video frame is returned here. If no frames has been grabbed the image will be empty. |
CameraChannels | streamIdx | non-zero streamIdx is only valid for multi-head camera live streams |
Returns
Type | Description |
---|---|
System.Boolean |
Retrieve(Mat, Int32)
Decodes and returns the grabbed video frame.
The method decodes and returns the just grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the method returns false and the function returns an empty image (with %cv::Mat, test it with Mat::empty()).
Declaration
public bool Retrieve(Mat image, int flag = 0)
Parameters
Type | Name | Description |
---|---|---|
Mat | image | the video frame is returned here. If no frames has been grabbed the image will be empty. |
System.Int32 | flag | it could be a frame index or a driver specific flag |
Returns
Type | Description |
---|---|
System.Boolean |
Retrieve(OutputArray, CameraChannels)
Decodes and returns the grabbed video frame.
The method decodes and returns the just grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the method returns false and the function returns an empty image (with %cv::Mat, test it with Mat::empty()).
Declaration
public bool Retrieve(OutputArray image, CameraChannels streamIdx)
Parameters
Type | Name | Description |
---|---|---|
OutputArray | image | the video frame is returned here. If no frames has been grabbed the image will be empty. |
CameraChannels | streamIdx | non-zero streamIdx is only valid for multi-head camera live streams |
Returns
Type | Description |
---|---|
System.Boolean |
Retrieve(OutputArray, Int32)
Decodes and returns the grabbed video frame.
The method decodes and returns the just grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the method returns false and the function returns an empty image (with %cv::Mat, test it with Mat::empty()).
Declaration
public bool Retrieve(OutputArray image, int flag = 0)
Parameters
Type | Name | Description |
---|---|---|
OutputArray | image | the video frame is returned here. If no frames has been grabbed the image will be empty. |
System.Int32 | flag | it could be a frame index or a driver specific flag |
Returns
Type | Description |
---|---|
System.Boolean |
RetrieveMat()
Decodes and returns the grabbed video frame.
The method decodes and returns the just grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the method returns false and the function returns an empty image (with %cv::Mat, test it with Mat::empty()).
Declaration
public Mat RetrieveMat()
Returns
Type | Description |
---|---|
Mat | the video frame is returned here. If no frames has been grabbed the image will be empty. |
Set(VideoCaptureProperties, Double)
Sets a property in the VideoCapture.
Declaration
public bool Set(VideoCaptureProperties propertyId, double value)
Parameters
Type | Name | Description |
---|---|---|
VideoCaptureProperties | propertyId | Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...) or one from @ref videoio_flags_others |
System.Double | value | Value of the property. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Set(Int32, Double)
Sets a property in the VideoCapture.
Declaration
public bool Set(int propertyId, double value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | propertyId | Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...) or one from @ref videoio_flags_others |
System.Double | value | Value of the property. |
Returns
Type | Description |
---|---|
System.Boolean |
|
SetExceptionMode(Boolean)
Switches exceptions mode. methods raise exceptions if not successful instead of returning an error code
Declaration
public void SetExceptionMode(bool enable)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | enable |
WaitAny(IEnumerable<VideoCapture>, out Int32[], Int64)
Wait for ready frames from VideoCapture.
The primary use of the function is in multi-camera environments. The method fills the ready state vector, grabs video frame, if camera is ready.
After this call use VideoCapture::retrieve() to decode and fetch frame data.
Declaration
public static bool WaitAny(IEnumerable<VideoCapture> streams, out int[] readyIndex, long timeoutNs = 0L)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<VideoCapture> | streams | input video streams |
System.Int32[] | readyIndex | stream indexes with grabbed frames (ready to use .retrieve() to fetch actual frame) |
System.Int64 | timeoutNs | number of nanoseconds (0 - infinite) |
Returns
Type | Description |
---|---|
System.Boolean | `true if streamReady is not empty |
Exceptions
Type | Condition |
---|---|
OpenCVException | Exception %Exception on stream errors (check .isOpened() to filter out malformed streams) or VideoCapture type is not supported |