Class Capture
Represents a video capture stream.
Namespace: OpenCV.Net
Assembly: OpenCV.Net.dll
Syntax
public sealed class Capture : SafeHandleZeroOrMinusOneIsInvalid
Properties
| Improve this Doc View SourceCaptureDomain
Gets the capture back end used for image acquisition.
Declaration
public CaptureDomain CaptureDomain { get; }
Property Value
| Type | Description |
|---|---|
| CaptureDomain |
Methods
| Improve this Doc View SourceCreateCameraCapture(Int32)
Initializes capturing a video from a camera.
Declaration
public static Capture CreateCameraCapture(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | Index of the camera to be used. If there is only one camera or it does not matter what camera is used -1 may be passed. |
Returns
| Type | Description |
|---|---|
| Capture | A newly created Capture instance representing image acquisition from a camera. |
CreateCameraCapture(Int32, CaptureDomain)
Initializes capturing a video from a camera using the specified domain.
Declaration
public static Capture CreateCameraCapture(int index, CaptureDomain domain)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | Index of the camera to be used. If there is only one camera or it does not matter what camera is used -1 may be passed. |
| CaptureDomain | domain | The capture domain used to indicate what kind of camera source should be acquired. |
Returns
| Type | Description |
|---|---|
| Capture | A newly created Capture instance representing image acquisition from a camera. |
CreateFileCapture(String)
Initializes capturing a video from the specified file. Which codecs and file formats are supported depends on the back end library.
Declaration
public static Capture CreateFileCapture(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | fileName | The path to the video file. |
Returns
| Type | Description |
|---|---|
| Capture | A newly created Capture instance representing image acquisition from a video file. |
GetProperty(CaptureProperty)
Gets video capture properties.
Declaration
public double GetProperty(CaptureProperty propertyId)
Parameters
| Type | Name | Description |
|---|---|---|
| CaptureProperty | propertyId | The property identifier as specified by CaptureProperty. |
Returns
| Type | Description |
|---|---|
| Double | The value of the specified property. |
GrabFrame()
Grabs a frame from a camera or file. The grabbed frame is stored internally and can be retrieved by calling RetrieveFrame(Int32).
Declaration
public bool GrabFrame()
Returns
| Type | Description |
|---|---|
| Boolean | A value indicating whether a new frame was grabbed. |
QueryFrame()
Grabs and returns a frame from a camera or file.
Declaration
public IplImage QueryFrame()
Returns
| Type | Description |
|---|---|
| IplImage | The reference to the newly captured frame. The returned image should not be released or modified by the user. In the event of an error, the return value may be null. |
ReleaseHandle()
Executes the code required to free the native Capture handle.
Declaration
protected override bool ReleaseHandle()
Returns
| Type | Description |
|---|---|
| Boolean | true if the handle is released successfully; otherwise, in the event of a catastrophic failure, false. |
RetrieveFrame(Int32)
Gets the image grabbed with GrabFrame().
Declaration
public IplImage RetrieveFrame(int streamIdx = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | streamIdx | The index of the stream from which to retrieve the frame. |
Returns
| Type | Description |
|---|---|
| IplImage | The reference to the newly captured frame. The returned image should not be released or modified by the user. In the event of an error, the return value may be null. |
SetProperty(CaptureProperty, Double)
Sets video capture properties.
Declaration
public void SetProperty(CaptureProperty propertyId, double value)
Parameters
| Type | Name | Description |
|---|---|---|
| CaptureProperty | propertyId | The property identifier as specified by CaptureProperty. |
| Double | value | The new value of the specified property. |