OpenPose  1.7.0
The first real-time multi-person system to jointly detect human body, hand, facial, and foot keypoints
op::WebcamReader Class Reference

#include <webcamReader.hpp>

Inheritance diagram for op::WebcamReader:
op::VideoCaptureReader op::Producer

Public Member Functions

 WebcamReader (const int webcamIndex=0, const Point< int > &webcamResolution=Point< int >{}, const bool throwExceptionIfNoOpened=true, const std::string &cameraParameterPath="", const bool undistortImage=false)
 
virtual ~WebcamReader ()
 
std::string getNextFrameName ()
 
bool isOpened () const
 
double get (const int capProperty)
 
void set (const int capProperty, const double value)
 
- Public Member Functions inherited from op::VideoCaptureReader
 VideoCaptureReader (const int index, const bool throwExceptionIfNoOpened, const std::string &cameraParameterPath, const bool undistortImage, const int numberViews)
 
 VideoCaptureReader (const std::string &path, const ProducerType producerType, const std::string &cameraParameterPath, const bool undistortImage, const int numberViews)
 
virtual ~VideoCaptureReader ()
 
void release ()
 
- Public Member Functions inherited from op::Producer
 Producer (const ProducerType type, const std::string &cameraParameterPath, const bool undistortImage, const int mNumberViews)
 
virtual ~Producer ()
 
Matrix getFrame ()
 
std::vector< MatrixgetFrames ()
 
virtual std::vector< MatrixgetCameraMatrices ()
 
virtual std::vector< MatrixgetCameraExtrinsics ()
 
virtual std::vector< MatrixgetCameraIntrinsics ()
 
void setProducerFpsMode (const ProducerFpsMode fpsMode)
 
ProducerType getType ()
 
double get (const ProducerProperty property)
 
void set (const ProducerProperty property, const double value)
 

Additional Inherited Members

- Protected Member Functions inherited from op::VideoCaptureReader
void resetWebcam (const int index, const bool throwExceptionIfNoOpened)
 
- Protected Member Functions inherited from op::Producer
void checkFrameIntegrity (Matrix &frame)
 
void ifEndedResetOrRelease ()
 
void keepDesiredFrameRate ()
 

Detailed Description

WebcamReader is a wrapper of the cv::VideoCapture class for webcam. It allows controlling a video (extracting frames, setting resolution & fps, seeking to a particular frame, etc).

Definition at line 15 of file webcamReader.hpp.

Constructor & Destructor Documentation

◆ WebcamReader()

op::WebcamReader::WebcamReader ( const int  webcamIndex = 0,
const Point< int > &  webcamResolution = Point< int >{},
const bool  throwExceptionIfNoOpened = true,
const std::string &  cameraParameterPath = "",
const bool  undistortImage = false 
)
explicit

Constructor of WebcamReader. It opens the webcam as a wrapper of cv::VideoCapture. It includes an argument to indicate the desired resolution.

Parameters
webcamIndexconst int indicating the camera source (see the OpenCV documentation about cv::VideoCapture for more details), in the range [0, 9].
webcamResolutionconst Point<int> parameter which specifies the desired camera resolution.
throwExceptionIfNoOpenedBool parameter which specifies whether to throw an exception if the camera cannot be opened.

◆ ~WebcamReader()

virtual op::WebcamReader::~WebcamReader ( )
virtual

Member Function Documentation

◆ get()

double op::WebcamReader::get ( const int  capProperty)
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
capPropertyint indicating the property to be modified.
Returns
double returning the property value.

Implements op::VideoCaptureReader.

◆ getNextFrameName()

std::string op::WebcamReader::getNextFrameName ( )
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::VideoCaptureReader.

◆ isOpened()

bool op::WebcamReader::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.

Reimplemented from op::VideoCaptureReader.

◆ set()

void op::WebcamReader::set ( const int  capProperty,
const double  value 
)
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
capPropertyint indicating the property to be modified.
valuedouble indicating the new value to be assigned.

Implements op::VideoCaptureReader.


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