All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
op::VideoCaptureReader Class Referenceabstract

`#include <videoCaptureReader.hpp>`

Inherits op::Producer.

Inherited by op::IpCameraReader, op::VideoReader, and op::WebcamReader.

## Public Member Functions

| VideoCaptureReader (const int index, const bool throwExceptionIfNoOpened)
| VideoCaptureReader (const std::string &path, const ProducerType producerType)
virtual | ~VideoCaptureReader ()
virtual std::string | getNextFrameName ()=0
virtual bool | isOpened () const
void | release ()
virtual double | get (const int capProperty)=0
virtual void | set (const int capProperty, const double value)=0
Public Member Functions inherited from op::Producer
| Producer (const ProducerType type)
virtual | ~Producer ()
cv::Mat | getFrame ()
std::vector< cv::Mat > | getFrames ()
virtual std::vector< cv::Mat > | getCameraMatrices ()=0
virtual std::vector< cv::Mat > | getCameraExtrinsics ()=0
virtual std::vector< cv::Mat > | getCameraIntrinsics ()=0
void | setProducerFpsMode (const ProducerFpsMode fpsMode)
ProducerType | getType ()
double | get (const ProducerProperty property)
void | set (const ProducerProperty property, const double value)

## Protected Member Functions

virtual cv::Mat | getRawFrame ()=0
virtual std::vector< cv::Mat > | getRawFrames ()=0
void | resetWebcam (const int index, const bool throwExceptionIfNoOpened)
Protected Member Functions inherited from op::Producer
void | checkFrameIntegrity (cv::Mat &frame)
void | flipAndRotate (cv::Mat &cvMat) const
void | ifEndedResetOrRelease ()
void | keepDesiredFrameRate ()

## Detailed Description

VideoCaptureReader is an abstract class to extract frames from a cv::VideoCapture source (video file, webcam stream, etc.). It has the basic and common functions of the cv::VideoCapture class (e.g., get, set, etc.).

## Constructor & Destructor Documentation

op::VideoCaptureReader::VideoCaptureReader | ( | const int | index,
|  | const bool | throwExceptionIfNoOpened
| ) |  |

explicit

This constructor of VideoCaptureReader wraps cv::VideoCapture(const int).

Parameters

  index | const int indicating the cv::VideoCapture constructor int argument, in the range [0, 9].

op::VideoCaptureReader::VideoCaptureReader | ( | const std::string & | path,
|  | const ProducerType | producerType
| ) |  |

explicit

This constructor of VideoCaptureReader wraps cv::VideoCapture(const std::string).

Parameters

  path | const std::string indicating the cv::VideoCapture constructor string argument.
  producerType | const std::string indicating whether the frame source is an IP camera or video.

virtual op::VideoCaptureReader::~VideoCaptureReader | ( |  | ) |

virtual

Destructor of VideoCaptureReader. It releases the cv::VideoCapture member. It is virtual so that any children class can implement its own destructor.

## Member Function Documentation

virtual double op::VideoCaptureReader::get | ( | const int | capProperty | ) |

pure virtual

This function is a wrapper of cv::VideoCapture::get. It allows getting different properties of the Producer (fps, width, height, etc.). See the OpenCV documentation for all the available properties.

Parameters

  capProperty | int indicating the property to be modified.

Returns
  double returning the property value.

Implements op::Producer.

Implemented in op::VideoReader, op::WebcamReader, and op::IpCameraReader.

virtual std::string op::VideoCaptureReader::getNextFrameName | ( |  | ) |

pure virtual

This function returns a unique frame name (e.g., the frame number for video, the frame counter for webcam, the image name for image directory reader, etc.).

Returns
  std::string with an unique frame name.

Implements op::Producer.

Implemented in op::VideoReader, op::WebcamReader, and op::IpCameraReader.

virtual cv::Mat op::VideoCaptureReader::getRawFrame | ( |  | ) |

protectedpure virtual

Function to be defined by its children class. It retrieves and returns a new frame from the frames producer.

Returns
  cv::Mat with the new frame.

Implements op::Producer.

virtual std::vector<cv::Mat> op::VideoCaptureReader::getRawFrames | ( |  | ) |

protectedpure virtual

Function to be defined by its children class. It retrieves and returns a new frame from the frames producer. It is equivalent to getRawFrame when more than 1 image can be returned.

Returns
  std::vector<cv::Mat> with the new frames.

Implements op::Producer.

virtual bool op::VideoCaptureReader::isOpened | ( |  | ) | const

virtual

This function returns whether the Producer instance is still opened and able to retrieve more frames.

Returns
  bool indicating whether the Producer is opened.

Implements op::Producer.

Reimplemented in op::VideoReader, op::WebcamReader, and op::IpCameraReader.

void op::VideoCaptureReader::release | ( |  | ) |

virtual

This function releases and closes the Producer. After it is called, no more frames can be retrieved from Producer::getFrames.

Implements op::Producer.

void op::VideoCaptureReader::resetWebcam | ( | const int | index,
|  | const bool | throwExceptionIfNoOpened
| ) |  |

protected

virtual void op::VideoCaptureReader::set | ( | const int | capProperty,
|  | const double | value
| ) |  |

pure virtual

This function is a wrapper of cv::VideoCapture::set. It allows setting different properties of the Producer (fps, width, height, etc.). See the OpenCV documentation for all the available properties.

Parameters

  capProperty | int indicating the property to be modified.
  value | double indicating the new value to be assigned.

Implements op::Producer.

Implemented in op::VideoReader, op::WebcamReader, and op::IpCameraReader.

The documentation for this class was generated from the following file:

- /home/travis/build/CMU-Perceptual-Computing-Lab/openpose/include/openpose/producer/videoCaptureReader.hpp