source: pacpussensors/trunk/OpencvVideo/CVWebcamComponent.hpp@ 96

Last change on this file since 96 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.9 KB
Line 
1#ifndef DEF_CVWEBCAM_COMPONENT_HPP
2#define DEF_CVWEBCAM_COMPONENT_HPP
3
4// Includes, project.
5#include "WebcamWorker.hpp"
6
7// Includes, qt.
8#include <QObject>
9
10// Includes, pacpus.
11#include <Pacpus/kernel/ComponentBase.h>
12#include <Pacpus/kernel/DbiteFile.h>
13#include <Pacpus/kernel/pacpus.h>
14#include <Pacpus/PacpusTools/ShMem.h>
15
16// Includes, opencv.
17#include <opencv/cv.h>
18#include <opencv/highgui.h>
19
20#ifdef WIN32
21# ifdef CVWEBCAM_COMPONENT_EXPORTS
22# define CVWEBCAM_COMPONENT_API __declspec(dllexport)
23# else
24# define CVWEBCAM_COMPONENT_API __declspec(dllimport)
25# endif
26#else
27# define CVWEBCAM_COMPONENT_API
28#endif
29
30namespace pacpus
31{
32 class CVWEBCAM_COMPONENT_API CVWebcamComponent
33 : public QObject
34 , public ComponentBase
35 {
36 Q_OBJECT
37 public:
38 /// Ctor of CVWebcamComponent.
39 CVWebcamComponent(QString const& name);
40
41 /// Dtor of CVWebcamComponent
42 ~CVWebcamComponent();
43
44 /// Stop the processing thread.
45 virtual void stopActivity();
46
47 /// Start the processing thread.
48 virtual void startActivity();
49
50 /// Configure the component.
51 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
52
53 public slots:
54 /// Receive a new frame.
55 void receiveFrame(cv::Mat frame);
56
57 private:
58 /// Display a frame.
59 void displayFrame(cv::Mat const& frame);
60
61 /// Save a frame.
62 void saveFrame(cv::Mat const& frame);
63
64 // Working thread, grabbing frame from a webcam.
65 WebcamWorker mWebcam;
66
67 // Webcam information
68 int mDevice;
69 int mWidth;
70 int mHeight;
71 int mHasUI;
72 int mFramerate;
73
74 // Recording object.
75 bool mIsRecording;
76 DbiteFile mDBTFile;
77 unsigned int mImageCounter;
78 QString mFilenameTemplate;
79
80 // Shared memory segment
81 ShMem * mShMem;
82 bool firstTime;
83 };
84}
85
86#endif
Note: See TracBrowser for help on using the repository browser.