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