All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
producer.hpp
Go to the documentation of this file.
#ifndef OPENPOSE_PRODUCER_PRODUCER_HPP
#define OPENPOSE_PRODUCER_PRODUCER_HPP
#include <opencv2/core/core.hpp> // cv::Mat
#include <opencv2/highgui/highgui.hpp> // capProperties of OpenCV
#include <openpose/core/common.hpp>
#include <openpose/producer/enumClasses.hpp>
namespace op
{
class OP_API Producer
{
public:
explicit 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;
virtual std::string getNextFrameName() = 0;
void setProducerFpsMode(const ProducerFpsMode fpsMode);
inline ProducerType getType()
{
return mType;
}
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:
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;
private:
const ProducerType mType;
ProducerFpsMode mProducerFpsMode;
std::array<double, (int)ProducerProperty::Size> mProperties;
unsigned int mNumberEmptyFrames;
// For ProducerFpsMode::OriginalFps
bool mTrackingFps;
unsigned long long mFirstFrameTrackingFps;
unsigned long long mNumberFramesTrackingFps;
unsigned int mNumberSetPositionTrackingFps;
std::chrono::high_resolution_clock::time_point mClockTrackingFps;
DELETE_COPY(Producer);
};
OP_API std::shared_ptr<Producer> createProducer(
const ProducerType producerType = ProducerType::None, const std::string& producerString = "",
const Point<int>& cameraResolution = Point<int>{-1,-1}, const double webcamFps = 30.,
const std::string& cameraParameterPath = "models/cameraParameters/", const bool undistortImage = true,
const unsigned int imageDirectoryStereo = -1);
}
#endif // OPENPOSE_PRODUCER_PRODUCER_HPP
DELETE_COPY
#define DELETE_COPY(className)
Definition: macros.hpp:34
op::RenderMode::None
op::createProducer
OP_API std::shared_ptr< Producer > createProducer(const ProducerType producerType=ProducerType::None, const std::string &producerString="", const Point< int > &cameraResolution=Point< int >{-1,-1}, const double webcamFps=30., const std::string &cameraParameterPath="models/cameraParameters/", const bool undistortImage=true, const unsigned int imageDirectoryStereo=-1)
op::ProducerFpsMode
ProducerFpsMode
Definition: enumClasses.hpp:6
op::ProducerProperty
ProducerProperty
Definition: enumClasses.hpp:14
op::Producer
Definition: producer.hpp:15
common.hpp
op::Producer::getType
ProducerType getType()
Definition: producer.hpp:79
op::ProducerType
ProducerType
Definition: enumClasses.hpp:28
OP_API
#define OP_API
Definition: macros.hpp:19
enumClasses.hpp
cl::string
std::string string
Definition: cl2.hpp:574