Table of Contents

Constructor VideoCapture

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

VideoCapture()

Initializes empty capture. To use this, you should call Open.

public VideoCapture()

VideoCapture(int, VideoCaptureAPIs)

Opens a camera for video capturing

public VideoCapture(int index, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY)

Parameters

index int

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)

apiPreference VideoCaptureAPIs

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(int, VideoCaptureAPIs, int[])

Opens a camera for video capturing with API Preference and parameters

public VideoCapture(int index, VideoCaptureAPIs apiPreference, int[] prms)

Parameters

index int

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)

apiPreference VideoCaptureAPIs

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.

prms int[]

The params parameter allows to specify extra parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ...). See cv::VideoCaptureProperties

VideoCapture(int, VideoCaptureAPIs, VideoCapturePara)

Opens a camera for video capturing with API Preference and parameters

public VideoCapture(int index, VideoCaptureAPIs apiPreference, VideoCapturePara prms)

Parameters

index int

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)

apiPreference VideoCaptureAPIs

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.

prms VideoCapturePara

Parameters of VideoCapture for hardware acceleration

VideoCapture(IStreamReader, VideoCaptureAPIs, int[])

Opens a video using a custom data stream.

public VideoCapture(IStreamReader source, VideoCaptureAPIs apiPreference, int[] prms)

Parameters

source IStreamReader

Custom stream reader providing the encoded video data.

apiPreference VideoCaptureAPIs

preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG.

prms int[]

The params parameter allows to specify extra parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ...). See cv::VideoCaptureProperties

VideoCapture(IStreamReader, VideoCaptureAPIs, VideoCapturePara)

Opens a video using a custom data stream.

public VideoCapture(IStreamReader source, VideoCaptureAPIs apiPreference, VideoCapturePara prms)

Parameters

source IStreamReader

Custom stream reader providing the encoded video data.

apiPreference VideoCaptureAPIs

preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG.

prms VideoCapturePara

Parameters of VideoCapture for hardware acceleration

VideoCapture(Stream, VideoCaptureAPIs, int[])

Opens a video using an in-memory or otherwise custom Stream (e.g. a MemoryStream or network stream). The caller remains responsible for disposing the stream; VideoCapture does not take ownership of it.

public VideoCapture(Stream source, VideoCaptureAPIs apiPreference, int[] prms)

Parameters

source Stream

Stream providing the encoded video data.

apiPreference VideoCaptureAPIs

preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG.

prms int[]

The params parameter allows to specify extra parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ...). See cv::VideoCaptureProperties

VideoCapture(Stream, VideoCaptureAPIs, VideoCapturePara)

Opens a video using an in-memory or otherwise custom Stream (e.g. a MemoryStream or network stream). The caller remains responsible for disposing the stream; VideoCapture does not take ownership of it.

public VideoCapture(Stream source, VideoCaptureAPIs apiPreference, VideoCapturePara prms)

Parameters

source Stream

Stream providing the encoded video data.

apiPreference VideoCaptureAPIs

preferred Capture API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG.

prms VideoCapturePara

Parameters of VideoCapture for hardware acceleration

VideoCapture(string, VideoCaptureAPIs)

Opens a video file or a capturing device or an IP video stream for video capturing with API Preference

public VideoCapture(string fileName, VideoCaptureAPIs apiPreference = VideoCaptureAPIs.ANY)

Parameters

fileName string

it can be: - name of video file (e.g. video.avi) - or image sequence (e.g. img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...) - or URL of video stream (e.g. protocol://host:port/script_name?script_params|auth). Note that each video stream or IP camera feed has its own URL scheme. Please refer to the documentation of source stream to know the right URL. On Windows, a path containing characters that can't be represented in the process's ANSI code page may fail to open here even though the file exists; use the Stream-based constructor instead (e.g. wrap the path in a FileStream) to open it via Unicode file APIs.

apiPreference 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_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW.

VideoCapture(string, VideoCaptureAPIs, int[])

Opens a video file or a capturing device or an IP video stream for video capturing with API Preference

public VideoCapture(string fileName, VideoCaptureAPIs apiPreference, int[] prms)

Parameters

fileName string

it can be: - name of video file (eg. video.avi) - or image sequence (eg. img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...) - or URL of video stream (eg. protocol://host:port/script_name?script_params|auth). Note that each video stream or IP camera feed has its own URL scheme. Please refer to the documentation of source stream to know the right URL. On Windows, a path containing characters that can't be represented in the process's ANSI code page may fail to open here even though the file exists; use the Stream-based constructor instead (e.g. wrap the path in a FileStream) to open it via Unicode file APIs.

apiPreference 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_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW.

prms int[]

The params parameter allows to specify extra parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ...). See cv::VideoCaptureProperties

VideoCapture(string, VideoCaptureAPIs, VideoCapturePara)

Opens a video file or a capturing device or an IP video stream for video capturing with API Preference

public VideoCapture(string fileName, VideoCaptureAPIs apiPreference, VideoCapturePara prms)

Parameters

fileName string

it can be: - name of video file (e.g. video.avi) - or image sequence (e.g. img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...) - or URL of video stream (e.g. protocol://host:port/script_name?script_params|auth). Note that each video stream or IP camera feed has its own URL scheme. Please refer to the documentation of source stream to know the right URL.

apiPreference 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_FFMPEG or cv::CAP_IMAGES or cv::CAP_DSHOW.

prms VideoCapturePara

Parameters of VideoCature for hardware acceleration

VideoCapture(nint)

Initializes from native pointer

protected VideoCapture(nint ptr)

Parameters

ptr nint

CvCapture*