source: flair-src/trunk/lib/FlairSensorActuator/src/Camera.h

Last change on this file was 348, checked in by Sanahuja Guillaume, 19 months ago

update v4l cam, ok on gcs

File size: 3.0 KB
Line 
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 <Image.h>
19
20namespace flair {
21        namespace gui {
22                class GroupBox;
23                class Tab;
24                class TabWidget;
25                class Picture;
26                class GridLayout;
27        }
28}
29
30namespace flair {
31namespace sensor {
32/*! \class Camera
33*
34* \brief Base class for Camera
35*
36* Use this class to define a custom Camera.
37*
38*/
39class Camera : public core::IODevice {
40public:
41  /*!
42  * \brief Constructor
43  *
44  * Construct a Camera.
45  * It will be child of the FrameworkManager.
46        *
47  * \param name name
48  * \param width width
49  * \param height height
50  * \param format image format
51  */
52  Camera(std::string name, uint16_t width,
53         uint16_t height, core::Image::Type::Format format);
54
55  /*!
56  * \brief Destructor
57  *
58  */
59  ~Camera();
60
61  /*!
62  * \brief Use default plot
63  *
64  * \param image image to display
65  */
66  void UseDefaultPlot(const core::Image *image);
67
68  /*!
69  * \brief get Layout
70  *
71  * \return a Layout available
72  */
73  gui::GridLayout *GetLayout(void) const;
74
75  /*!
76  * \brief plot tab
77  *
78  * \return plot tab
79  */
80  gui::Tab *GetPlotTab(void) const;
81
82  /*!
83  * \brief Save raw picture to file
84  *
85  * \param filename filename
86  */
87  void SaveRawPictureToFile(std::string filename) const;
88       
89        /*!
90  * \brief Save picture to file
91  *
92  * \param filename filename; if ommitted, current time is used and file is saved in current directory with jpg compression
93  */
94  void SavePictureToFile(std::string filename="") const;
95
96  /*!
97  * \brief Width
98  *
99  * \return width
100  */
101  uint16_t Width(void) const;
102
103  /*!
104  * \brief Height
105  *
106  * \return height
107  */
108  uint16_t Height(void) const;
109
110  /*!
111 * \brief Output matrix
112 *
113 * Output matrix is of the same size as declared in constructor. \n
114 *
115 * \return the output matrix
116 */
117  core::Image *Output(void);
118
119  core::DataType const &GetOutputDataType() const;
120       
121        /*!
122        \enum LogFormat
123        \brief log formats
124        */
125        enum class LogFormat {
126                NONE, /*!< by default, no logging */
127                RAW, /*!< raw format */
128                JPG, /*!< jpg format */
129        };
130       
131        /*!
132        * \brief Set log format
133        *
134        * Set the log format. \n
135        * Logging of the camera will be disabled if this method is not called. \n
136        * Calling this method enables logging of camera.
137        *
138        * \param LogFormat log format
139        */
140  void SetLogFormat(LogFormat logFormat);
141  void ProcessUpdate(core::io_data* data);
142protected:
143  /*!
144  * \brief get GroupBox
145  *
146  * \return a GroupBox available
147  */
148  gui::GroupBox *GetGroupBox(void) const;
149
150  core::Image *output;
151
152private:
153  gui::Tab *main_tab, *sensor_tab, *plot_tab;
154  gui::TabWidget *tab;
155  gui::GroupBox *setup_groupbox;
156  gui::GridLayout *setup_layout;
157        LogFormat logFormat;
158};
159} // end namespace sensor
160} // end namespace flair
161#endif // CAMERA_H
Note: See TracBrowser for help on using the repository browser.