Last change
on this file since 140 was 60, checked in by DHERBOMEZ Gérald, 10 years ago |
Add the module opencv video acquisition (compatible with 0.1.x version of the framework).
|
File size:
1.0 KB
|
Rev | Line | |
---|
[60] | 1 | #ifndef DEF_WEBCAM_WORKER_HPP
|
---|
| 2 | #define DEF_WEBCAM_WORKER_HPP
|
---|
| 3 |
|
---|
| 4 | // Includes, project.
|
---|
| 5 | #include <Pacpus/PacpusTools/AsyncWorkerBase.h>
|
---|
| 6 |
|
---|
| 7 | // Includes, qt.
|
---|
| 8 | #include <QTimer>
|
---|
| 9 |
|
---|
| 10 | // Includes, opencv.
|
---|
| 11 | #include <opencv/cxcore.h>
|
---|
| 12 | #include <opencv/highgui.h>
|
---|
| 13 |
|
---|
| 14 | namespace pacpus
|
---|
| 15 | {
|
---|
| 16 | class WebcamWorker
|
---|
| 17 | : public pacpus::AsyncWorkerBase
|
---|
| 18 | {
|
---|
| 19 | Q_OBJECT
|
---|
| 20 | public:
|
---|
| 21 | /// Ctor of WebcamWorker.
|
---|
| 22 | WebcamWorker();
|
---|
| 23 |
|
---|
| 24 | /// Dtor of WebcamWorker.
|
---|
| 25 | virtual ~WebcamWorker();
|
---|
| 26 |
|
---|
| 27 | /// Open a webcam.
|
---|
| 28 | void open(int device, int width, int height, int msec);
|
---|
| 29 |
|
---|
| 30 | /// Close the webcam.
|
---|
| 31 | void close();
|
---|
| 32 |
|
---|
| 33 | public slots:
|
---|
| 34 | /// Retrieve a frame from the webcam.
|
---|
| 35 | void retrieveFrame();
|
---|
| 36 |
|
---|
| 37 | signals:
|
---|
| 38 | /// Got a new frame.
|
---|
| 39 | void gotFrame(cv::Mat frame);
|
---|
| 40 |
|
---|
| 41 | protected:
|
---|
| 42 | /// Setup the worker.
|
---|
| 43 | virtual void setup();
|
---|
| 44 |
|
---|
| 45 | /// Cleanup the worker.
|
---|
| 46 | virtual void cleanup();
|
---|
| 47 |
|
---|
| 48 | private:
|
---|
| 49 | QTimer* mHeartbeat;
|
---|
| 50 | cv::VideoCapture mWebcam;
|
---|
| 51 | cv::Mat mFrame;
|
---|
| 52 | };
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.