OpenPose 1.0.0rc2 OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | List of all members
op::Producer Class Referenceabstract

`#include <producer.hpp>`

Inherited by op::FlirReader, op::ImageDirectoryReader, and op::VideoCaptureReader.

## Public Member Functions
| Producer (const ProducerType type, const std::string &cameraParameterPath, const bool undistortImage, const int mNumberViews)
virtual | ~Producer ()
cv::Mat | getFrame ()
std::vector< cv::Mat > | getFrames ()
virtual std::vector< cv::Mat > | getCameraMatrices ()
virtual std::vector< cv::Mat > | getCameraExtrinsics ()
virtual std::vector< cv::Mat > | getCameraIntrinsics ()
virtual std::string | getNextFrameName ()=0
void | setProducerFpsMode (const ProducerFpsMode fpsMode)
ProducerType | getType ()
virtual bool | isOpened () const =0
virtual void | release ()=0
virtual double | get (const int capProperty)=0
virtual void | set (const int capProperty, const double value)=0
double | get (const ProducerProperty property)
void | set (const ProducerProperty property, const double value)

## Protected Member Functions
void | checkFrameIntegrity (cv::Mat &frame)
void | flipAndRotate (cv::Mat &cvMat) const
void | ifEndedResetOrRelease ()
void | keepDesiredFrameRate ()
virtual cv::Mat | getRawFrame ()=0
virtual std::vector< cv::Mat > | getRawFrames ()=0

## Detailed Description

Producer is an abstract class to extract frames from a source (image directory, video file, webcam stream, etc.). It has the basic and common functions (e.g., getFrame, release & isOpened).

## Constructor & Destructor Documentation

op::Producer::Producer | ( | const ProducerType | type,
|  | const std::string & | cameraParameterPath,
|  | const bool | undistortImage,
|  | const int | mNumberViews
| ) |  |
| explicit

Constructor of Producer.

virtual op::Producer::~Producer | ( |  | ) |
| virtual

Destructor of Producer. It is virtual so that any children class can implement its own destructor.

## Member Function Documentation

void op::Producer::checkFrameIntegrity | ( | cv::Mat & | frame | ) |
| protected

Protected function which checks that the frames keeps their integry (some OpenCV versions might return corrupted frames within a video or webcam with a size different to the standard resolution). If the frame is corrupted, it is set to an empty cv::Mat.

Parameters

  frame | cv::Mat with the frame matrix to be checked and modified.

void op::Producer::flipAndRotate | ( | cv::Mat & | cvMat | ) | const
| protected

It performs flipping and rotation over the desired cv::Mat.

Parameters

  cvMat | cv::Mat with the frame matrix to be flipped and/or rotated.

virtual double op::Producer::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.

Implemented in op::VideoCaptureReader, op::ImageDirectoryReader, op::FlirReader, op::VideoReader, op::WebcamReader, and op::IpCameraReader.

double op::Producer::get | ( | const ProducerProperty | property | ) |

Extra attributes that VideoCapture::get/set do not contain.

Parameters

  property | ProducerProperty indicating the property to be modified.

virtual std::vector<cv::Mat> op::Producer::getCameraExtrinsics | ( |  | ) |
| virtual

It retrieves and returns the camera extrinsic parameters from the frames producer. Virtual class because FlirReader implements their own.

Returns
  std::vector<cv::Mat> with the camera extrinsic parameters.

Reimplemented in op::FlirReader.

virtual std::vector<cv::Mat> op::Producer::getCameraIntrinsics | ( |  | ) |
| virtual

It retrieves and returns the camera intrinsic parameters from the frames producer. Virtual class because FlirReader implements their own.

Returns
  std::vector<cv::Mat> with the camera intrinsic parameters.

Reimplemented in op::FlirReader.

virtual std::vector<cv::Mat> op::Producer::getCameraMatrices | ( |  | ) |
| virtual

It retrieves and returns the camera matrixes from the frames producer. Virtual class because FlirReader implements their own.

Returns
  std::vector<cv::Mat> with the camera matrices.

Reimplemented in op::FlirReader.

cv::Mat op::Producer::getFrame | ( |  | ) |

Main function of Producer, it retrieves and returns a new frame from the frames producer.

Returns
  cv::Mat with the new frame.

std::vector<cv::Mat> op::Producer::getFrames | ( |  | ) |

Analogous to getFrame, but it could return > 1 frame.

Returns
  std::vector<cv::Mat> with the new frame(s).

virtual std::string op::Producer::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.

Implemented in op::VideoCaptureReader, op::WebcamReader, op::FlirReader, op::ImageDirectoryReader, op::VideoReader, and op::IpCameraReader.

virtual cv::Mat op::Producer::getRawFrame | ( |  | ) |
| protected pure 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.

Implemented in op::VideoCaptureReader.

virtual std::vector<cv::Mat> op::Producer::getRawFrames | ( |  | ) |
| protected pure 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.

Implemented in op::VideoCaptureReader.

ProducerType op::Producer::getType | ( |  | ) |
| inline

This function returns the type of producer (video, webcam, ...).

Returns
  ProducerType with the kind of producer.

void op::Producer::ifEndedResetOrRelease | ( |  | ) |
| protected

Protected function which checks that the frame producer has ended. If so, if resets or releases the producer according to mRepeatWhenFinished.

virtual bool op::Producer::isOpened | ( |  | ) | const
| pure 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.

Implemented in op::VideoCaptureReader, op::WebcamReader, op::FlirReader, op::ImageDirectoryReader, op::VideoReader, and op::IpCameraReader.

void op::Producer::keepDesiredFrameRate | ( |  | ) |
| protected

Protected function which forces the producer to get frames at the rate of get(CV_CAP_PROP_FPS).

virtual void op::Producer::release | ( |  | ) |
| pure virtual

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

Implemented in op::VideoCaptureReader, op::ImageDirectoryReader, and op::FlirReader.

virtual void op::Producer::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.

Implemented in op::VideoCaptureReader, op::ImageDirectoryReader, op::FlirReader, op::VideoReader, op::WebcamReader, and op::IpCameraReader.

void op::Producer::set | ( | const ProducerProperty | property,
|  | const double | value
| ) |  |

Extra attributes that VideoCapture::get/set do not contain.

Parameters

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

void op::Producer::setProducerFpsMode | ( | const ProducerFpsMode | fpsMode | ) |

This function sets whether the producer must keep the original fps frame rate or extract the frames as quick as possible.

Parameters

  fpsMode | ProducerFpsMode parameter specifying the new value.

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

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