camera_interface
BrightnessIndicator.h
Go to the documentation of this file.
1 #ifndef BRIGHTNESSINDICATOR_H
2 #define BRIGHTNESSINDICATOR_H
3 
4 #include <cv.h>
5 #include <vector>
6 #include <base/samples/Frame.hpp>
7 
8 
9 class WeightedRect {
10  public:
11  float x1, y1;
12  float x2, y2;
13  int weight;
14 
15  WeightedRect(float _x1, float _y1, float _x2, float _y2, int _weight);
16 
17  private:
18  bool inRange(int number);
19 };
20 
22  public:
23  /* Returns a number indicating how bright the image is in the range from 0 - 255 */
24  virtual int getBrightness(const cv::Mat &frame) = 0;
26 };
27 
28 /*
29  * Uses the mean value of all pixels as brightness indicator for the image
30  */
32  public:
33  virtual int getBrightness(const cv::Mat &frame);
34 };
35 
36 /*
37  * Uses the weighted sum of the brightness in different regions in the picture
38  * as brightness indicator. The brightness in the picture is calculated by the
39  * mean value of all pixels in it.
40  */
42  private:
43  std::vector<WeightedRect> weightedRegions;
44  public:
45  WeightedBoxesBrightnessIndicator(std::vector<WeightedRect> _weightedRegions) : weightedRegions(_weightedRegions) {};
46  void setWeightedRegions(std::vector<WeightedRect> _weightedRegions);
47  virtual int getBrightness(const cv::Mat &frame);
48 
49  const static std::vector<WeightedRect> REGION_SPOT;
50  const static std::vector<WeightedRect> REGION_BOTTOM_DOUBLE;
51 };
52 
53 #endif /* end of include guard: BRIGHTNESSINDICATOR_H */
virtual ~AbstractBrightnessIndicator()
Definition: BrightnessIndicator.h:25
float x1
Definition: BrightnessIndicator.h:11
static const std::vector< WeightedRect > REGION_SPOT
Definition: BrightnessIndicator.h:49
float y1
Definition: BrightnessIndicator.h:11
float y2
Definition: BrightnessIndicator.h:12
WeightedBoxesBrightnessIndicator(std::vector< WeightedRect > _weightedRegions)
Definition: BrightnessIndicator.h:45
Definition: BrightnessIndicator.h:9
float x2
Definition: BrightnessIndicator.h:12
WeightedRect(float _x1, float _y1, float _x2, float _y2, int _weight)
Definition: BrightnessIndicator.cpp:28
int weight
Definition: BrightnessIndicator.h:13
static const std::vector< WeightedRect > REGION_BOTTOM_DOUBLE
Definition: BrightnessIndicator.h:50
Definition: BrightnessIndicator.h:21
Definition: BrightnessIndicator.h:31
Definition: BrightnessIndicator.h:41