OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
webcamReader.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_PRODUCER_WEBCAM_READER_HPP
2 #define OPENPOSE_PRODUCER_WEBCAM_READER_HPP
3 
4 #include <atomic>
5 #include <mutex>
8 
9 namespace op
10 {
16  {
17  public:
26  explicit WebcamReader(const int webcamIndex = 0, const Point<int>& webcamResolution = Point<int>{},
27  const double fps = 30., const bool throwExceptionIfNoOpened = true);
28 
29  virtual ~WebcamReader();
30 
31  std::vector<cv::Mat> getCameraMatrices();
32 
33  std::vector<cv::Mat> getCameraExtrinsics();
34 
35  std::vector<cv::Mat> getCameraIntrinsics();
36 
37  std::string getNextFrameName();
38 
39  bool isOpened() const;
40 
41  double get(const int capProperty);
42 
43  void set(const int capProperty, const double value);
44 
45  private:
46  const int mIndex;
47  double mFps;
48  long long mFrameNameCounter;
49  bool mThreadOpened;
50  cv::Mat mBuffer;
51  std::mutex mBufferMutex;
52  std::atomic<bool> mCloseThread;
53  std::thread mThread;
54  // Detect camera unplugged
55  double mLastNorm;
56  std::atomic<int> mDisconnectedCounter;
57  Point<int> mResolution;
58 
59  cv::Mat getRawFrame();
60 
61  std::vector<cv::Mat> getRawFrames();
62 
63  void bufferingThread();
64 
65  bool reset();
66 
68  };
69 }
70 
71 #endif // OPENPOSE_PRODUCER_WEBCAM_READER_HPP
#define DELETE_COPY(className)
Definition: macros.hpp:33
Definition: videoCaptureReader.hpp:15
Definition: webcamReader.hpp:15
#define OP_API
Definition: macros.hpp:18
std::string string
Definition: cl2.hpp:574