|
CV_WRAP | VideoCapture () |
| Default constructor.
|
|
CV_WRAP | VideoCapture (const String &filename, int apiPreference=CAP_ANY) |
| Opens a video file or a capturing device or an IP video stream for video capturing with API Preference.
|
|
CV_WRAP | VideoCapture (const String &filename, int apiPreference, const std::vector< int > ¶ms) |
| Opens a video file or a capturing device or an IP video stream for video capturing with API Preference and parameters.
|
|
CV_WRAP | VideoCapture (int index, int apiPreference=CAP_ANY) |
| Opens a camera for video capturing.
|
|
CV_WRAP | VideoCapture (int index, int apiPreference, const std::vector< int > ¶ms) |
| Opens a camera for video capturing with API Preference and parameters.
|
|
virtual | ~VideoCapture () |
| Default destructor.
|
|
virtual CV_WRAP bool | open (const String &filename, int apiPreference=CAP_ANY) |
| Opens a video file or a capturing device or an IP video stream for video capturing.
|
|
virtual CV_WRAP bool | open (const String &filename, int apiPreference, const std::vector< int > ¶ms) |
| Opens a video file or a capturing device or an IP video stream for video capturing with API Preference and parameters.
|
|
virtual CV_WRAP bool | open (int index, int apiPreference=CAP_ANY) |
| Opens a camera for video capturing.
|
|
virtual CV_WRAP bool | open (int index, int apiPreference, const std::vector< int > ¶ms) |
| Opens a camera for video capturing with API Preference and parameters.
|
|
virtual CV_WRAP bool | isOpened () const |
| Returns true if video capturing has been initialized already.
|
|
virtual CV_WRAP void | release () |
| Closes video file or capturing device.
|
|
virtual CV_WRAP bool | grab () |
| Grabs the next frame from video file or capturing device.
|
|
virtual CV_WRAP bool | retrieve (OutputArray image, int flag=0) |
| Decodes and returns the grabbed video frame.
|
|
virtual VideoCapture & | operator>> (CV_OUT Mat &image) |
| Stream operator to read the next video frame.
|
|
virtual VideoCapture & | operator>> (CV_OUT UMat &image) |
|
virtual CV_WRAP bool | read (OutputArray image) |
| Grabs, decodes and returns the next video frame.
|
|
virtual CV_WRAP bool | set (int propId, double value) |
| Sets a property in the VideoCapture.
|
|
virtual CV_WRAP double | get (int propId) const |
| Returns the specified VideoCapture property.
|
|
CV_WRAP String | getBackendName () const |
| Returns used backend API name.
|
|
CV_WRAP void | setExceptionMode (bool enable) |
|
CV_WRAP bool | getExceptionMode () const |
| query if exception mode is active
|
|
Class for video capturing from video files, image sequences or cameras.
The class provides C++ API for capturing video from cameras or for reading video files and image sequences.
Here is how the class can be used:
- Note
- In C API the black-box structure
CvCapture
is used instead of VideoCapture.
-
- (C++) A basic sample on using the VideoCapture interface can be found at
OPENCV_SOURCE_CODE/samples/cpp/videocapture_starter.cpp
- (Python) A basic sample on using the VideoCapture interface can be found at
OPENCV_SOURCE_CODE/samples/python/video.py
- (Python) A multi threaded video processing sample can be found at
OPENCV_SOURCE_CODE/samples/python/video_threaded.py
- (Python) VideoCapture sample showcasing some features of the Video4Linux2 backend
OPENCV_SOURCE_CODE/samples/python/video_v4l2.py
CV_WRAP cv::VideoCapture::VideoCapture |
( |
const String & |
filename, |
|
|
int |
apiPreference, |
|
|
const std::vector< int > & |
params |
|
) |
| |
|
explicit |
Opens a video file or a capturing device or an IP video stream for video capturing with API Preference and parameters.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The params
parameter allows to specify extra parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ...)
. See cv::VideoCaptureProperties
CV_WRAP cv::VideoCapture::VideoCapture |
( |
int |
index, |
|
|
int |
apiPreference, |
|
|
const std::vector< int > & |
params |
|
) |
| |
|
explicit |
Opens a camera for video capturing with API Preference and parameters.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The params
parameter allows to specify extra parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ...)
. See cv::VideoCaptureProperties
virtual CV_WRAP bool cv::VideoCapture::grab |
( |
| ) |
|
|
virtual |
Grabs the next frame from video file or capturing device.
- Returns
true
(non-zero) in the case of success.
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.
tutorial_kinect_openni
virtual CV_WRAP bool cv::VideoCapture::open |
( |
const String & |
filename, |
|
|
int |
apiPreference, |
|
|
const std::vector< int > & |
params |
|
) |
| |
|
virtual |
Opens a video file or a capturing device or an IP video stream for video capturing with API Preference and parameters.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The params
parameter allows to specify extra parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ...)
. See cv::VideoCaptureProperties
- Returns
true
if the file has been successfully opened
The method first calls VideoCapture::release to close the already opened file or camera.
virtual CV_WRAP bool cv::VideoCapture::open |
( |
const String & |
filename, |
|
|
int |
apiPreference = CAP_ANY |
|
) |
| |
|
virtual |
Opens a video file or a capturing device or an IP video stream for video capturing.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Parameters are same as the constructor VideoCapture(const String& filename, int apiPreference = CAP_ANY)
- Returns
true
if the file has been successfully opened
The method first calls VideoCapture::release to close the already opened file or camera.
virtual CV_WRAP bool cv::VideoCapture::open |
( |
int |
index, |
|
|
int |
apiPreference, |
|
|
const std::vector< int > & |
params |
|
) |
| |
|
virtual |
Opens a camera for video capturing with API Preference and parameters.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The params
parameter allows to specify extra parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ...)
. See cv::VideoCaptureProperties
- Returns
true
if the camera has been successfully opened.
The method first calls VideoCapture::release to close the already opened file or camera.
virtual CV_WRAP bool cv::VideoCapture::open |
( |
int |
index, |
|
|
int |
apiPreference = CAP_ANY |
|
) |
| |
|
virtual |
Opens a camera for video capturing.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Parameters are same as the constructor VideoCapture(int index, int apiPreference = CAP_ANY)
- Returns
true
if the camera has been successfully opened.
The method first calls VideoCapture::release to close the already opened file or camera.