Click or drag to resize

VideoCapture Class

Video capturing class
Inheritance Hierarchy

Namespace:  OpenCvSharp
Assembly:  OpenCvSharp (in OpenCvSharp.dll) Version: 1.0.0
Syntax
public class VideoCapture : DisposableCvObject

The VideoCapture type exposes the following members.

Constructors
  NameDescription
Public methodVideoCapture
Initializes empty capture. To use this, you should call Open.
Protected methodVideoCapture(IntPtr)
Initializes from native pointer
Public methodVideoCapture(Int32, VideoCaptureAPIs)
Opens a camera for video capturing
Public methodVideoCapture(String, VideoCaptureAPIs)
Opens a video file or a capturing device or an IP video stream for video capturing with API Preference
Top
Properties
  NameDescription
Protected propertyAllocatedMemory
Gets or sets a memory address allocated by AllocMemory.
(Inherited from DisposableObject.)
Protected propertyAllocatedMemorySize
Gets or sets the byte length of the allocated memory
(Inherited from DisposableObject.)
Public propertyAutoExposure
exposure control done by camera, user can adjust refernce level using this feature [CV_CAP_PROP_AUTO_EXPOSURE]
Public propertyAutoFocus
Public propertyBackLight
Public propertyBrightness
Gets or sets brightness of image (only for cameras)
Public propertyBufferSize
Public propertyCaptureType
Gets the capture type (File or Camera)
Public propertyContrast
Gets or sets contrast of image (only for cameras)
Public propertyConvertRgb
Boolean flags indicating whether images should be converted to RGB
Public propertyCvPtr
Native pointer of OpenCV structure
(Inherited from DisposableCvObject.)
Protected propertyDataHandle
Gets or sets a handle which allocates using cvSetData.
(Inherited from DisposableObject.)
Public propertyExposure
Exposure (only for cameras)
Public propertyFocus
Public propertyFormat
The format of the Mat objects returned by retrieve()
Public propertyFourCC
Gets or sets 4-character code of codec
Public propertyFps
Gets or sets frame rate
Public propertyFrameCount
Gets number of frames in video file
Public propertyFrameHeight
Gets or sets height of frames in the video stream
Public propertyFrameWidth
Gets or sets width of frames in the video stream
Public propertyGain
Gain of the image (only for cameras)
Public propertyGamma
Public propertyGStreamerQueueLength
default is 1 [CV_CAP_GSTREAMER_QUEUE_LENGTH]
Public propertyGuid
Public propertyHue
Gets or sets hue of image (only for cameras)
Public propertyIris
Public propertyIsDisposed
Gets a value indicating whether this instance has been disposed.
(Inherited from DisposableObject.)
Public propertyIsEnabledDispose
Gets or sets a value indicating whether you permit disposing this instance.
(Inherited from DisposableObject.)
Public propertyIsoSpeed
Public propertyMode
A backend-specific value indicating the current capture mode
Public propertyMonocrome
Public propertyOpenNI_Baseline
in mm [CV_CAP_PROP_OPENNI_BASELINE]
Public propertyOpenNI_DepthGeneratorBaseline
[CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE]
Public propertyOpenNI_DepthGeneratorFocalLength
[CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH]
Public propertyOpenNI_DepthGeneratorRegistrationON
[CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON]
Public propertyOpenNI_FocalLength
in pixels [CV_CAP_PROP_OPENNI_FOCAL_LENGTH]
Public propertyOpenNI_FrameMaxDepth
in mm [CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH]
Public propertyOpenNI_ImageGeneratorOutputMode
[CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE]
Public propertyOpenNI_OutputMode
[CV_CAP_PROP_OPENNI_OUTPUT_MODE]
Public propertyOpenNI_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]
Public propertyPan
Public propertyPosAviRatio
Gets or sets relative position of video file
Public propertyPosFrames
Gets or sets 0-based index of the frame to be decoded/captured next
Public propertyPosMsec
Gets or sets film current position in milliseconds or video capture timestamp
Public propertyPvAPIMulticastIP
ip for anable multicast master mode. 0 for disable multicast [CV_CAP_PROP_PVAPI_MULTICASTIP]
Public propertyRectification
TOWRITE (note: only supported by DC1394 v 2.x backend currently)
Public propertyRoll
Public propertySaturation
Gets or sets saturation of image (only for cameras)
Public propertySettings
Public propertySharpness
Public propertyTemperature
[CV_CAP_PROP_TEMPERATURE]
Public propertyTilt
Public propertyTrigger
Public propertyTriggerDelay
Public propertyWhiteBalanceBlueU
Public propertyWhiteBalanceRedV
Public propertyXI_AEAG
Automatic exposure/gain [CV_CAP_PROP_XI_AEAG]
Public propertyXI_AEAGLevel
default is 1 [CV_CAP_PROP_XI_AEAG_LEVEL]
Public propertyXI_AEMaxLimit
Maximum limit of exposure in AEAG procedure [CV_CAP_PROP_XI_AE_MAX_LIMIT]
Public propertyXI_AGMaxLimit
Maximum limit of gain in AEAG procedure [CV_CAP_PROP_XI_AG_MAX_LIMIT]
Public propertyXI_AutoWB
Automatic white balance [CV_CAP_PROP_XI_AUTO_WB]
Public propertyXI_DataFormat
Output data format. [CV_CAP_PROP_XI_DATA_FORMAT]
Public propertyXI_Downsampling
Change image resolution by binning or skipping. [CV_CAP_PROP_XI_DOWNSAMPLING]
Public propertyXI_ExpPriority
Exposure priority (0.5 - exposure 50%, gain 50%). [CV_CAP_PROP_XI_EXP_PRIORITY]
Public propertyXI_GpiLevel
Get general purpose level [CV_CAP_PROP_XI_GPI_LEVEL]
Public propertyXI_GpiMode
Set general purpose input mode [CV_CAP_PROP_XI_GPI_MODE]
Public propertyXI_GpiSelector
Selects general purpose input [CV_CAP_PROP_XI_GPI_SELECTOR]
Public propertyXI_GpoMode
Set general purpose output mode [CV_CAP_PROP_XI_GPO_MODE]
Public propertyXI_GpoSelector
Selects general purpose output [CV_CAP_PROP_XI_GPO_SELECTOR]
Public propertyXI_LedMode
Define camera signalling LED functionality [CV_CAP_PROP_XI_LED_MODE]
Public propertyXI_LedSelector
Selects camera signalling LED [CV_CAP_PROP_XI_LED_SELECTOR]
Public propertyXI_ManualWB
Calculates White Balance(must be called during acquisition) [CV_CAP_PROP_XI_MANUAL_WB]
Public propertyXI_OffsetX
Horizontal offset from the origin to the area of interest (in pixels). [CV_CAP_PROP_XI_OFFSET_X]
Public propertyXI_OffsetY
Vertical offset from the origin to the area of interest (in pixels). [CV_CAP_PROP_XI_OFFSET_Y]
Public propertyXI_Timeout
default is 1 [CV_CAP_PROP_XI_TIMEOUT]
Public propertyXI_TrgSoftware
Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. [CV_CAP_PROP_XI_TRG_SOFTWARE]
Public propertyXI_TrgSource
Defines source of trigger. [CV_CAP_PROP_XI_TRG_SOURCE]
Public propertyZoom
Top
Methods
  NameDescription
Protected methodAllocGCHandle
Pins the object to be allocated by cvSetData.
(Inherited from DisposableObject.)
Protected methodAllocMemory
Allocates the specified size of memory.
(Inherited from DisposableObject.)
Public methodDispose
Releases the resources
(Inherited from DisposableObject.)
Protected methodDispose(Boolean)
Releases the resources
(Inherited from DisposableObject.)
Protected methodDisposeManaged
Releases managed resources
(Inherited from DisposableObject.)
Protected methodDisposeUnmanaged
Releases unmanaged resources
(Overrides DisposableCvObjectDisposeUnmanaged.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Destructor
(Inherited from DisposableObject.)
Public methodStatic memberFromCamera
Opens a camera for video capturing
Public methodStatic memberFromFile
Opens a video file or a capturing device or an IP video stream for video capturing with API Preference
Public methodGet(Int32)
Returns the specified VideoCapture property
Public methodGet(VideoCaptureProperties)
Returns the specified VideoCapture property
Public methodGetBackendName
Returns used backend API name. Note that stream should be opened.
Public methodGetExceptionMode
query if exception mode is active
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGrab
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.
Public methodIsOpened
Returns true if video capturing has been initialized already.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodNotifyMemoryPressure
Notifies the allocated size of memory.
(Inherited from DisposableObject.)
Public methodOpen(Int32, VideoCaptureAPIs)
Opens a camera for video capturing
Public methodOpen(String, VideoCaptureAPIs)
Opens a video file or a capturing device or an IP video stream for video capturing.
Public methodRead(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()).
Public methodRead(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()).
Public methodRelease
Closes video file or capturing device.
Public methodRetrieve(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()).
Public methodRetrieve(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()).
Public methodRetrieve(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()).
Public methodRetrieve(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()).
Public methodRetrieveMat
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()).
Public methodSet(Int32, Double)
Sets a property in the VideoCapture.
Public methodSet(VideoCaptureProperties, Double)
Sets a property in the VideoCapture.
Public methodSetExceptionMode
Switches exceptions mode. methods raise exceptions if not successful instead of returning an error code
Public methodThrowIfDisposed
If this object is disposed, then ObjectDisposedException is thrown.
(Inherited from DisposableObject.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Fields
  NameDescription
Protected fieldptr
Data pointer
(Inherited from DisposableCvObject.)
Top
See Also