C# Class OpenCvSharp.VideoCapture

Video capturing class
Inheritance: OpenCvSharp.DisposableCvObject
Mostra file Open project: shimat/opencvsharp Class Usage Examples

Public Methods

Method Description
FromCamera ( CaptureDevice device ) : VideoCapture

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).

FromCamera ( CaptureDevice device, int index ) : VideoCapture

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).

FromCamera ( int index ) : VideoCapture

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).

FromFile ( string fileName ) : VideoCapture

Allocates and initialized the CvCapture structure for reading the video stream from the specified file. After the allocated structure is not used any more it should be released by cvReleaseCapture function.

Get ( CaptureProperty propertyId ) : double

Retrieves the specified property of camera or video file.

Get ( int propertyId ) : double

Retrieves the specified property of camera or video file.

Grab ( ) : bool

Grabs the frame from camera or file. The grabbed frame is stored internally. The purpose of this function is to grab frame fast that is important for syncronization in case of reading from several cameras simultaneously. The grabbed frames are not exposed because they may be stored in compressed format (as defined by camera/driver). To retrieve the grabbed frame, cvRetrieveFrame should be used.

IsOpened ( ) : bool

Returns true if video capturing has been initialized already.

Open ( CaptureDevice device ) : void

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).

Open ( CaptureDevice device, int index ) : void

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).

Open ( int index ) : void

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).

Open ( string fileName ) : void

Opens the specified video file

Read ( OpenCvSharp.Mat image ) : bool

Grabs a frame from camera or video file, decompresses and returns it. This function is just a combination of cvGrabFrame and cvRetrieveFrame in one call. The returned image should not be released or modified by user.

Release ( ) : void

Closes video file or capturing device.

Retrieve ( OpenCvSharp.Mat image, CameraChannels streamIdx = CameraChannels.OpenNI_DepthMap ) : bool

Returns the pointer to the image grabbed with cvGrabFrame function. The returned image should not be released or modified by user.

Retrieve ( OpenCvSharp.Mat image, int channel ) : bool

Decodes and returns the grabbed video frame.

RetrieveMat ( ) : OpenCvSharp.Mat

Decodes and returns the grabbed video frame.

Set ( CaptureProperty propertyId, double value ) : int

Sets the specified property of video capturing.

Set ( int propertyId, double value ) : int

Sets the specified property of video capturing.

VideoCapture ( ) : System

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

VideoCapture ( CaptureDevice device ) : System

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).

VideoCapture ( CaptureDevice device, int index ) : System

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).

VideoCapture ( int index ) : System

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).

VideoCapture ( string fileName ) : System

Allocates and initialized the CvCapture structure for reading the video stream from the specified file. After the allocated structure is not used any more it should be released by cvReleaseCapture function.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Clean up any resources being used.

VideoCapture ( IntPtr ptr ) : System

Initializes from native pointer

Method Details

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed. ///
return void

FromCamera() public static method

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
public static FromCamera ( CaptureDevice device ) : VideoCapture
device CaptureDevice Device type
return VideoCapture

FromCamera() public static method

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
public static FromCamera ( CaptureDevice device, int index ) : VideoCapture
device CaptureDevice Device type
index int Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed.
return VideoCapture

FromCamera() public static method

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
public static FromCamera ( int index ) : VideoCapture
index int Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed.
return VideoCapture

FromFile() public static method

Allocates and initialized the CvCapture structure for reading the video stream from the specified file. After the allocated structure is not used any more it should be released by cvReleaseCapture function.
public static FromFile ( string fileName ) : VideoCapture
fileName string Name of the video file.
return VideoCapture

Get() public method

Retrieves the specified property of camera or video file.
public Get ( CaptureProperty propertyId ) : double
propertyId CaptureProperty property identifier.
return double

Get() public method

Retrieves the specified property of camera or video file.
public Get ( int propertyId ) : double
propertyId int property identifier.
return double

Grab() public method

Grabs the frame from camera or file. The grabbed frame is stored internally. The purpose of this function is to grab frame fast that is important for syncronization in case of reading from several cameras simultaneously. The grabbed frames are not exposed because they may be stored in compressed format (as defined by camera/driver). To retrieve the grabbed frame, cvRetrieveFrame should be used.
public Grab ( ) : bool
return bool

IsOpened() public method

Returns true if video capturing has been initialized already.
public IsOpened ( ) : bool
return bool

Open() public method

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
public Open ( CaptureDevice device ) : void
device CaptureDevice Device type
return void

Open() public method

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
public Open ( CaptureDevice device, int index ) : void
device CaptureDevice Device type
index int Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed.
return void

Open() public method

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
public Open ( int index ) : void
index int Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed.
return void

Open() public method

Opens the specified video file
public Open ( string fileName ) : void
fileName string
return void

Read() public method

Grabs a frame from camera or video file, decompresses and returns it. This function is just a combination of cvGrabFrame and cvRetrieveFrame in one call. The returned image should not be released or modified by user.
public Read ( OpenCvSharp.Mat image ) : bool
image OpenCvSharp.Mat
return bool

Release() public method

Closes video file or capturing device.
public Release ( ) : void
return void

Retrieve() public method

Returns the pointer to the image grabbed with cvGrabFrame function. The returned image should not be released or modified by user.
public Retrieve ( OpenCvSharp.Mat image, CameraChannels streamIdx = CameraChannels.OpenNI_DepthMap ) : bool
image OpenCvSharp.Mat
streamIdx CameraChannels non-zero streamIdx is only valid for multi-head camera live streams
return bool

Retrieve() public method

Decodes and returns the grabbed video frame.
public Retrieve ( OpenCvSharp.Mat image, int channel ) : bool
image OpenCvSharp.Mat
channel int non-zero streamIdx is only valid for multi-head camera live streams
return bool

RetrieveMat() public method

Decodes and returns the grabbed video frame.
public RetrieveMat ( ) : OpenCvSharp.Mat
return OpenCvSharp.Mat

Set() public method

Sets the specified property of video capturing.
public Set ( CaptureProperty propertyId, double value ) : int
propertyId CaptureProperty property identifier.
value double value of the property.
return int

Set() public method

Sets the specified property of video capturing.
public Set ( int propertyId, double value ) : int
propertyId int property identifier.
value double value of the property.
return int

VideoCapture() public method

Initializes empty capture. To use this, you should call Open.
public VideoCapture ( ) : System
return System

VideoCapture() public method

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
public VideoCapture ( CaptureDevice device ) : System
device CaptureDevice Device type
return System

VideoCapture() public method

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
public VideoCapture ( CaptureDevice device, int index ) : System
device CaptureDevice Device type
index int Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed.
return System

VideoCapture() protected method

Initializes from native pointer
protected VideoCapture ( IntPtr ptr ) : System
ptr IntPtr CvCapture*
return System

VideoCapture() public method

Allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
public VideoCapture ( int index ) : System
index int Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed.
return System

VideoCapture() public method

Allocates and initialized the CvCapture structure for reading the video stream from the specified file. After the allocated structure is not used any more it should be released by cvReleaseCapture function.
public VideoCapture ( string fileName ) : System
fileName string Name of the video file.
return System