OpenCVWidget
 All Classes Files Functions Variables
opencvcapture.h
Go to the documentation of this file.
1 #ifndef OPENCVCAPTURE_H
2 #define OPENCVCAPTURE_H
3 
4 #include <QObject>
5 #include <QTimer>
6 #include <QDebug>
7 #include <opencv2/highgui/highgui.hpp>
8 #include <opencv2/core/core.hpp>
9 #include <math.h>
10 
11 
24 class OpenCVCapture : public QObject
25 {
26  Q_OBJECT
27 
28 public:
35  OpenCVCapture();
37 
45  virtual void startCapture();
46 
56  void startCapture(QString source, int frameRate = -1);
57 
64  void setSource(QString source);
65 
71  QString getSource();
72 
78  void setFrameRate(int rate);
79 
89  int getFrameRate();
90 
97  void stopCapture();
98 
104  void pauseCapture();
105 
112  void resumeCapture();
113 
120  void advanceCapture();
121 
130  void grab();
131 
141  void loadImage(int loadFlag = 1);
142 
152  void loadImage(QString source, int loadFlag = 1);
153 
162  cv::Mat getImage();
163 
174  double getCaptureProperty(int propId);
175 
187  bool setCaptureProperty(int propId, double value);
188 
194  bool isOpened();
195 
196 
197 protected:
198  QTimer *timer;
199  cv::VideoCapture capture;
200  cv::Mat image;
201  QString captureSource;
202  int frameRate;
203 
204 protected slots:
205  void captureFrame();
206 
207 signals:
208  void frameCaptured(cv::Mat image);
209 };
210 
211 #endif