1 | // %flair:license{
|
---|
2 | // This file is part of the Flair framework distributed under the
|
---|
3 | // CECILL-C License, Version 1.0.
|
---|
4 | // %flair:license}
|
---|
5 | /*!
|
---|
6 | * \file Camera.h
|
---|
7 | * \brief Base class for Camera
|
---|
8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
9 | * \date 2014/03/06
|
---|
10 | * \version 4.0
|
---|
11 | */
|
---|
12 |
|
---|
13 | #ifndef CAMERA_H
|
---|
14 | #define CAMERA_H
|
---|
15 |
|
---|
16 | #include <IODevice.h>
|
---|
17 | #include <stdint.h>
|
---|
18 | #include <cvimage.h>
|
---|
19 |
|
---|
20 | namespace flair {
|
---|
21 | namespace gui {
|
---|
22 | class GroupBox;
|
---|
23 | class Tab;
|
---|
24 | class TabWidget;
|
---|
25 | class Picture;
|
---|
26 | class GridLayout;
|
---|
27 | }
|
---|
28 | namespace core {
|
---|
29 | class Buffer;
|
---|
30 | }
|
---|
31 | }
|
---|
32 |
|
---|
33 | namespace flair {
|
---|
34 | namespace sensor {
|
---|
35 | /*! \class Camera
|
---|
36 | *
|
---|
37 | * \brief Base class for Camera
|
---|
38 | *
|
---|
39 | * Use this class to define a custom Camera.
|
---|
40 | *
|
---|
41 | */
|
---|
42 | class Camera : public core::IODevice {
|
---|
43 | public:
|
---|
44 | /*!
|
---|
45 | * \brief Constructor
|
---|
46 | *
|
---|
47 | * Construct a Camera.
|
---|
48 | *
|
---|
49 | * \param parent parent
|
---|
50 | * \param name name
|
---|
51 | * \param width width
|
---|
52 | * \param height height
|
---|
53 | * \param format image format
|
---|
54 | */
|
---|
55 | Camera(const core::FrameworkManager *parent, std::string name, uint16_t width,
|
---|
56 | uint16_t height, core::cvimage::Type::Format format);
|
---|
57 |
|
---|
58 | /*!
|
---|
59 | * \brief Constructor
|
---|
60 | *
|
---|
61 | * Construct a Camera. \n
|
---|
62 | * This contructor must only be called for a simulated device.
|
---|
63 | *
|
---|
64 | * \param parent parent
|
---|
65 | * \param name name
|
---|
66 | */
|
---|
67 | Camera(const core::IODevice *parent, std::string name);
|
---|
68 |
|
---|
69 | /*!
|
---|
70 | * \brief Destructor
|
---|
71 | *
|
---|
72 | */
|
---|
73 | ~Camera();
|
---|
74 |
|
---|
75 | /*!
|
---|
76 | * \brief Use default plot
|
---|
77 | *
|
---|
78 | * \param image image to display
|
---|
79 | */
|
---|
80 | void UseDefaultPlot(const core::cvimage *image);
|
---|
81 |
|
---|
82 | /*!
|
---|
83 | * \brief get Layout
|
---|
84 | *
|
---|
85 | * \return a Layout available
|
---|
86 | */
|
---|
87 | gui::GridLayout *GetLayout(void) const;
|
---|
88 |
|
---|
89 | /*!
|
---|
90 | * \brief plot tab
|
---|
91 | *
|
---|
92 | * \return plot tab
|
---|
93 | */
|
---|
94 | gui::Tab *GetPlotTab(void) const;
|
---|
95 |
|
---|
96 | /*!
|
---|
97 | * \brief Save picture to file
|
---|
98 | *
|
---|
99 | * \param filename filename
|
---|
100 | */
|
---|
101 | void SaveToFile(std::string filename) const;
|
---|
102 |
|
---|
103 | /*!
|
---|
104 | * \brief Width
|
---|
105 | *
|
---|
106 | * \return width
|
---|
107 | */
|
---|
108 | uint16_t Width(void) const;
|
---|
109 |
|
---|
110 | /*!
|
---|
111 | * \brief Height
|
---|
112 | *
|
---|
113 | * \return height
|
---|
114 | */
|
---|
115 | uint16_t Height(void) const;
|
---|
116 |
|
---|
117 | /*!
|
---|
118 | * \brief Output matrix
|
---|
119 | *
|
---|
120 | * Output matrix is of the same size as declared in constructor. \n
|
---|
121 | *
|
---|
122 | * \return the output matrix
|
---|
123 | */
|
---|
124 | core::cvimage *Output(void);
|
---|
125 |
|
---|
126 | core::DataType const &GetOutputDataType() const;
|
---|
127 |
|
---|
128 | /*!
|
---|
129 | \enum LogFormat
|
---|
130 | \brief log formats
|
---|
131 | */
|
---|
132 | enum class LogFormat {
|
---|
133 | NONE, /*!< by default, no logging */
|
---|
134 | RAW, /*!< raw format */
|
---|
135 | JPG, /*!< jpg format */
|
---|
136 | };
|
---|
137 |
|
---|
138 | /*!
|
---|
139 | * \brief Set log format
|
---|
140 | *
|
---|
141 | * Set the log format. \n
|
---|
142 | * Logging of the camera will be disabled if this method is not called. \n
|
---|
143 | * Calling this method enables logging of camera.
|
---|
144 | *
|
---|
145 | * \param LogFormat log format
|
---|
146 | */
|
---|
147 | void SetLogFormat(LogFormat logFormat);
|
---|
148 | void ProcessUpdate(core::io_data* data);
|
---|
149 | protected:
|
---|
150 | /*!
|
---|
151 | * \brief get GroupBox
|
---|
152 | *
|
---|
153 | * \return a GroupBox available
|
---|
154 | */
|
---|
155 | gui::GroupBox *GetGroupBox(void) const;
|
---|
156 |
|
---|
157 | core::cvimage *output;
|
---|
158 |
|
---|
159 | private:
|
---|
160 | gui::Tab *main_tab, *sensor_tab, *plot_tab;
|
---|
161 | gui::TabWidget *tab;
|
---|
162 | gui::GroupBox *setup_groupbox;
|
---|
163 | gui::GridLayout *setup_layout;
|
---|
164 | LogFormat logFormat;
|
---|
165 | core::Buffer *jpgBuffer;
|
---|
166 | };
|
---|
167 | } // end namespace sensor
|
---|
168 | } // end namespace flair
|
---|
169 | #endif // CAMERA_H
|
---|