[3] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[3] | 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>
|
---|
[338] | 18 | #include <Image.h>
|
---|
[3] | 19 |
|
---|
[15] | 20 | namespace flair {
|
---|
[121] | 21 | namespace gui {
|
---|
| 22 | class GroupBox;
|
---|
| 23 | class Tab;
|
---|
| 24 | class TabWidget;
|
---|
| 25 | class Picture;
|
---|
| 26 | class GridLayout;
|
---|
| 27 | }
|
---|
[3] | 28 | }
|
---|
| 29 |
|
---|
[15] | 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.
|
---|
[137] | 45 | * It will be child of the FrameworkManager.
|
---|
| 46 | *
|
---|
[15] | 47 | * \param name name
|
---|
| 48 | * \param width width
|
---|
| 49 | * \param height height
|
---|
| 50 | * \param format image format
|
---|
| 51 | */
|
---|
[137] | 52 | Camera(std::string name, uint16_t width,
|
---|
[338] | 53 | uint16_t height, core::Image::Type::Format format);
|
---|
[3] | 54 |
|
---|
[15] | 55 | /*!
|
---|
| 56 | * \brief Destructor
|
---|
| 57 | *
|
---|
| 58 | */
|
---|
| 59 | ~Camera();
|
---|
[3] | 60 |
|
---|
[15] | 61 | /*!
|
---|
| 62 | * \brief Use default plot
|
---|
| 63 | *
|
---|
| 64 | * \param image image to display
|
---|
| 65 | */
|
---|
[338] | 66 | void UseDefaultPlot(const core::Image *image);
|
---|
[3] | 67 |
|
---|
[15] | 68 | /*!
|
---|
| 69 | * \brief get Layout
|
---|
| 70 | *
|
---|
| 71 | * \return a Layout available
|
---|
| 72 | */
|
---|
| 73 | gui::GridLayout *GetLayout(void) const;
|
---|
[3] | 74 |
|
---|
[15] | 75 | /*!
|
---|
| 76 | * \brief plot tab
|
---|
| 77 | *
|
---|
| 78 | * \return plot tab
|
---|
| 79 | */
|
---|
| 80 | gui::Tab *GetPlotTab(void) const;
|
---|
[3] | 81 |
|
---|
[15] | 82 | /*!
|
---|
[124] | 83 | * \brief Save raw picture to file
|
---|
| 84 | *
|
---|
| 85 | * \param filename filename
|
---|
| 86 | */
|
---|
| 87 | void SaveRawPictureToFile(std::string filename) const;
|
---|
| 88 |
|
---|
| 89 | /*!
|
---|
[15] | 90 | * \brief Save picture to file
|
---|
| 91 | *
|
---|
[128] | 92 | * \param filename filename; if ommitted, current time is used and file is saved in current directory with jpg compression
|
---|
[15] | 93 | */
|
---|
[128] | 94 | void SavePictureToFile(std::string filename="") const;
|
---|
[3] | 95 |
|
---|
[15] | 96 | /*!
|
---|
| 97 | * \brief Width
|
---|
| 98 | *
|
---|
| 99 | * \return width
|
---|
| 100 | */
|
---|
| 101 | uint16_t Width(void) const;
|
---|
[3] | 102 |
|
---|
[15] | 103 | /*!
|
---|
| 104 | * \brief Height
|
---|
| 105 | *
|
---|
| 106 | * \return height
|
---|
| 107 | */
|
---|
| 108 | uint16_t Height(void) const;
|
---|
[3] | 109 |
|
---|
[15] | 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 | */
|
---|
[338] | 117 | core::Image *Output(void);
|
---|
[3] | 118 |
|
---|
[15] | 119 | core::DataType const &GetOutputDataType() const;
|
---|
[121] | 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);
|
---|
[348] | 141 | void ProcessUpdate(core::io_data* data);
|
---|
[15] | 142 | protected:
|
---|
| 143 | /*!
|
---|
| 144 | * \brief get GroupBox
|
---|
| 145 | *
|
---|
| 146 | * \return a GroupBox available
|
---|
| 147 | */
|
---|
| 148 | gui::GroupBox *GetGroupBox(void) const;
|
---|
[3] | 149 |
|
---|
[338] | 150 | core::Image *output;
|
---|
[3] | 151 |
|
---|
[15] | 152 | private:
|
---|
| 153 | gui::Tab *main_tab, *sensor_tab, *plot_tab;
|
---|
| 154 | gui::TabWidget *tab;
|
---|
| 155 | gui::GroupBox *setup_groupbox;
|
---|
| 156 | gui::GridLayout *setup_layout;
|
---|
[121] | 157 | LogFormat logFormat;
|
---|
[15] | 158 | };
|
---|
[3] | 159 | } // end namespace sensor
|
---|
| 160 | } // end namespace flair
|
---|
| 161 | #endif // CAMERA_H
|
---|