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