1 | #ifndef LADYBUGCOMPONENT_H
|
---|
2 | #define LADYBUGCOMPONENT_H
|
---|
3 |
|
---|
4 | //#include "Pacpus/kernel/pacpus.h"
|
---|
5 | #include "Pacpus/kernel/ComponentBase.h"
|
---|
6 | //#include "Pacpus/kernel/DbiteFile.h"
|
---|
7 | //#include "../NMEA0183/include/nmea0183.h"
|
---|
8 |
|
---|
9 | #include <QSemaphore>
|
---|
10 | #include <QThread>
|
---|
11 |
|
---|
12 | #include "ladybug.h"
|
---|
13 | #include <ladybuggeom.h>
|
---|
14 | #include <ladybugrenderer.h>
|
---|
15 | #include <ladybugstream.h>
|
---|
16 | #include <ladybugGPS.h>
|
---|
17 |
|
---|
18 | #include "opencv2\core\core.hpp"
|
---|
19 | #include "opencv2\imgproc\imgproc.hpp"
|
---|
20 | #include "opencv2\highgui\highgui.hpp"
|
---|
21 |
|
---|
22 | //#include "Pacpus/PacpusTools/ShMem.h"
|
---|
23 |
|
---|
24 | //#include "qstring.h"
|
---|
25 |
|
---|
26 | // Export macro for PluginTest DLL for Windows only
|
---|
27 | #ifdef WIN32
|
---|
28 | #ifdef LADYBUG_EXPORTS
|
---|
29 | // make DLL
|
---|
30 | #define LADYBUG_API __declspec(dllexport)
|
---|
31 | #else
|
---|
32 | // use DLL
|
---|
33 | # define LADYBUG_API __declspec(dllimport)
|
---|
34 | #endif
|
---|
35 | #else
|
---|
36 | // On other platforms, simply ignore this
|
---|
37 | # define LADYBUG_API /* nothing */
|
---|
38 | #endif
|
---|
39 |
|
---|
40 | #define _DISPLAY_ERROR_MSG_AND_RETURN \
|
---|
41 | if( error != LADYBUG_OK ) \
|
---|
42 | { \
|
---|
43 | printf( "Ladybug library reported %s\n", \
|
---|
44 | ::ladybugErrorToString( error ) ); \
|
---|
45 | return; \
|
---|
46 | } \
|
---|
47 |
|
---|
48 | #define PANORAMIC_IMAGE_WIDTH 2048
|
---|
49 | #define PANORAMIC_IMAGE_HEIGHT 1024
|
---|
50 |
|
---|
51 | namespace pacpus
|
---|
52 | {
|
---|
53 | class LADYBUG_API LadybugComponent : public QThread, public ComponentBase
|
---|
54 | {
|
---|
55 | //Q_OBJECT
|
---|
56 |
|
---|
57 | public:
|
---|
58 | //============================= DEFAULT ELEMENTS ===============================================
|
---|
59 | LadybugComponent(QString name);
|
---|
60 | ~LadybugComponent();
|
---|
61 |
|
---|
62 | void StartCamera();
|
---|
63 | void CreateImageBuffers();
|
---|
64 | void run();
|
---|
65 | void HandleError(LadybugError error);
|
---|
66 | void SaveVideoStream(LadybugImage* image);
|
---|
67 | void SaveJPGImages(LadybugImage* image);
|
---|
68 | void SavePanoImage(LadybugImage* image);
|
---|
69 |
|
---|
70 | virtual void stopActivity(); /*!< to stop the processing thread */
|
---|
71 | virtual void startActivity(); /*!< to start the processing thread */
|
---|
72 | virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
|
---|
73 | //==============================================================================================
|
---|
74 |
|
---|
75 | protected:
|
---|
76 | //bool is_running; /* *Indicates that thread is running*/
|
---|
77 |
|
---|
78 | public:
|
---|
79 | void InitDefault(); /* *Initialize default values*/
|
---|
80 |
|
---|
81 |
|
---|
82 | private:
|
---|
83 | bool THREAD_ALIVE;
|
---|
84 |
|
---|
85 | /* Cameras variables*/
|
---|
86 | //LadybugError error;
|
---|
87 | LadybugContext lbContext;
|
---|
88 | LadybugCameraInfo lbCamInfo;
|
---|
89 | LadybugStreamContext lbStreamContext;
|
---|
90 | LadybugImage lbImageCurrent, lbImagePrev;
|
---|
91 |
|
---|
92 | LadybugTriggerModeInfo triggerModeInfo;
|
---|
93 | LadybugTriggerMode triggerMode;
|
---|
94 |
|
---|
95 | unsigned char* lbArpBuffers[LADYBUG_NUM_CAMERAS];
|
---|
96 |
|
---|
97 | double lbFrameCount;
|
---|
98 | double lbCurrentTime;
|
---|
99 | double lbElapsedTime;
|
---|
100 | double lbLastUpdateTime;
|
---|
101 |
|
---|
102 |
|
---|
103 | /* Config variables*/
|
---|
104 | //int lbDataFormat;
|
---|
105 | //int lbColorProcessingMethod;
|
---|
106 | //int lbDisplayType;
|
---|
107 | int lbSavePanoImage;
|
---|
108 | int lbSaveVideoStream;
|
---|
109 | int lbSaveJPGImages;
|
---|
110 | int lbTriggerOn;
|
---|
111 | int lbTriggerMode;
|
---|
112 | int lbTriggerSource;
|
---|
113 | int lbTriggerParam;
|
---|
114 | int lbTriggerPolarity;
|
---|
115 |
|
---|
116 |
|
---|
117 | /* Control variables*/
|
---|
118 | bool lbIsRecording;
|
---|
119 | double lbTotalMBWritten;
|
---|
120 | unsigned long lbTotalNumberOfImagesWritten;
|
---|
121 | int lbNumOfFrames;
|
---|
122 |
|
---|
123 | };
|
---|
124 | }
|
---|
125 |
|
---|
126 | #endif // LADYBUGCOMPONENT_H |
---|