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:
27  explicit WebcamReader(const int webcamIndex = 0, const Point<int>& webcamResolution = Point<int>{},
28  const bool throwExceptionIfNoOpened = true, const std::string& cameraParameterPath = "",
29  const bool undistortImage = false);
30 
31  virtual ~WebcamReader();
32 
33  std::string getNextFrameName();
34 
35  bool isOpened() const;
36 
37  double get(const int capProperty);
38 
39  void set(const int capProperty, const double value);
40 
41  private:
42  const int mIndex;
43  long long mFrameNameCounter;
44  bool mThreadOpened;
45  cv::Mat mBuffer;
46  std::mutex mBufferMutex;
47  std::atomic<bool> mCloseThread;
48  std::thread mThread;
49  // Detect camera unplugged
50  double mLastNorm;
51  std::atomic<int> mDisconnectedCounter;
52  Point<int> mResolution;
53 
54  cv::Mat getRawFrame();
55 
56  std::vector<cv::Mat> getRawFrames();
57 
58  void bufferingThread();
59 
60  bool reset();
61 
63  };
64 }
65 
66 #endif // OPENPOSE_PRODUCER_WEBCAM_READER_HPP
#define DELETE_COPY(className)
Definition: macros.hpp:34
Definition: videoCaptureReader.hpp:15
Definition: webcamReader.hpp:15
#define OP_API
Definition: macros.hpp:19
std::string string
Definition: cl2.hpp:574