[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 V4LCamera.h
|
---|
| 7 | * \brief Base class for V4l camera
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2014/07/17
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef V4LCamera_H
|
---|
| 14 | #define V4LCamera_H
|
---|
| 15 |
|
---|
| 16 | #include <Thread.h>
|
---|
| 17 | #include "Camera.h"
|
---|
| 18 | #include <highgui.h>
|
---|
| 19 |
|
---|
[13] | 20 | namespace flair {
|
---|
| 21 | namespace core {
|
---|
| 22 | class cvimage;
|
---|
| 23 | class FrameworkManager;
|
---|
[4] | 24 | }
|
---|
[13] | 25 | namespace gui {
|
---|
| 26 | class GridLayout;
|
---|
| 27 | class DoubleSpinBox;
|
---|
| 28 | class CheckBox;
|
---|
| 29 | class Label;
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
[4] | 32 |
|
---|
[13] | 33 | namespace flair {
|
---|
| 34 | namespace sensor {
|
---|
| 35 | /*! \class V4LCamera
|
---|
| 36 | *
|
---|
| 37 | * \brief Base class for V4l camera
|
---|
| 38 | */
|
---|
| 39 | class V4LCamera : public core::Thread, public Camera {
|
---|
| 40 | public:
|
---|
| 41 | /*!
|
---|
| 42 | * \brief Constructor
|
---|
| 43 | *
|
---|
| 44 | * Construct a Camera.
|
---|
| 45 | *
|
---|
| 46 | * \param parent parent
|
---|
| 47 | * \param name name
|
---|
| 48 | * \param camera_index camera index
|
---|
| 49 | * \param width width
|
---|
| 50 | * \param height height
|
---|
| 51 | * \param format image format
|
---|
| 52 | * \param priority priority of the Thread
|
---|
| 53 | */
|
---|
| 54 | V4LCamera(const core::FrameworkManager *parent, std::string name,
|
---|
| 55 | uint8_t camera_index, uint16_t width, uint16_t height,
|
---|
| 56 | core::cvimage::Type::Format format, uint8_t priority);
|
---|
[4] | 57 |
|
---|
[13] | 58 | /*!
|
---|
| 59 | * \brief Destructor
|
---|
| 60 | *
|
---|
| 61 | */
|
---|
| 62 | ~V4LCamera();
|
---|
[4] | 63 |
|
---|
[13] | 64 | protected:
|
---|
| 65 | /*!
|
---|
| 66 | * \brief Set Gain
|
---|
| 67 | *
|
---|
| 68 | * \param value value between 0 and 1
|
---|
| 69 | */
|
---|
| 70 | virtual void SetGain(float value);
|
---|
[4] | 71 |
|
---|
[13] | 72 | /*!
|
---|
| 73 | * \brief Set Auto Gain
|
---|
| 74 | *
|
---|
| 75 | * \param value value
|
---|
| 76 | */
|
---|
| 77 | virtual void SetAutoGain(bool value);
|
---|
[4] | 78 |
|
---|
[13] | 79 | /*!
|
---|
| 80 | * \brief Set Exposure
|
---|
| 81 | *
|
---|
| 82 | * \param value value between 0 and 1
|
---|
| 83 | */
|
---|
| 84 | virtual void SetExposure(float value);
|
---|
[4] | 85 |
|
---|
[13] | 86 | /*!
|
---|
| 87 | * \brief Set Auto Exposure
|
---|
| 88 | *
|
---|
| 89 | * \param value value
|
---|
| 90 | */
|
---|
| 91 | virtual void SetAutoExposure(bool value);
|
---|
[4] | 92 |
|
---|
[13] | 93 | /*!
|
---|
| 94 | * \brief Set Brightness
|
---|
| 95 | *
|
---|
| 96 | * \param value value between 0 and 1
|
---|
| 97 | */
|
---|
| 98 | virtual void SetBrightness(float value);
|
---|
[4] | 99 |
|
---|
[13] | 100 | /*!
|
---|
| 101 | * \brief Set Saturation
|
---|
| 102 | *
|
---|
| 103 | * \param value value between 0 and 1
|
---|
| 104 | */
|
---|
| 105 | virtual void SetSaturation(float value);
|
---|
[4] | 106 |
|
---|
[13] | 107 | /*!
|
---|
| 108 | * \brief Set Hue
|
---|
| 109 | *
|
---|
| 110 | * \param value value between 0 and 1
|
---|
| 111 | */
|
---|
| 112 | virtual void SetHue(float value);
|
---|
[4] | 113 |
|
---|
[13] | 114 | /*!
|
---|
| 115 | * \brief Set Contrast
|
---|
| 116 | *
|
---|
| 117 | * \param value value between 0 and 1
|
---|
| 118 | */
|
---|
| 119 | virtual void SetContrast(float value);
|
---|
[4] | 120 |
|
---|
[13] | 121 | private:
|
---|
| 122 | /*!
|
---|
| 123 | * \brief Update using provided datas
|
---|
| 124 | *
|
---|
| 125 | * Reimplemented from IODevice.
|
---|
| 126 | *
|
---|
| 127 | * \param data data from the parent to process
|
---|
| 128 | */
|
---|
| 129 | void UpdateFrom(const core::io_data *data){};
|
---|
[4] | 130 |
|
---|
[13] | 131 | /*!
|
---|
| 132 | * \brief Run function
|
---|
| 133 | *
|
---|
| 134 | * Reimplemented from Thread.
|
---|
| 135 | *
|
---|
| 136 | */
|
---|
| 137 | void Run(void);
|
---|
[4] | 138 |
|
---|
[13] | 139 | CvCapture *capture;
|
---|
[4] | 140 |
|
---|
[13] | 141 | gui::Tab *sensor_tab;
|
---|
| 142 | gui::DoubleSpinBox *bright, *exposure, *gain, *contrast, *hue, *sharpness,
|
---|
| 143 | *sat;
|
---|
| 144 | gui::CheckBox *autogain, *awb, *autoexposure;
|
---|
| 145 | gui::Label *fps;
|
---|
| 146 | };
|
---|
[4] | 147 | } // end namespace sensor
|
---|
| 148 | } // end namespace flair
|
---|
| 149 | #endif // V4LCamera_H
|
---|