MythTV  master
Histogram.h
Go to the documentation of this file.
1 #ifndef HISTOGRAM_H
2 #define HISTOGRAM_H
3 
4 #include "libmythtv/mythframe.h"
5 
6 class Histogram
7 {
8 public:
9  Histogram() = default;
10  ~Histogram() = default;
11 
12  void generateFromImage(MythVideoFrame* frame, unsigned int frameWidth,
13  unsigned int frameHeight, unsigned int minScanX,
14  unsigned int maxScanX, unsigned int minScanY,
15  unsigned int maxScanY, unsigned int XSpacing,
16  unsigned int YSpacing);
17  float calculateSimilarityWith(const Histogram &other) const;
18  unsigned int getAverageIntensity() const;
19  unsigned int getThresholdForPercentageOfPixels(float percentage) const;
20 
21  // do not override default copy constructor, as the default copy
22  // constructor will do just fine.
23 private:
24  std::array<int,256> m_data {0};
25 
26  // prevent division by 0 in case a virgin histogram gets used.
27  unsigned int m_numberOfSamples {1};
28 };
29 
30 #endif // HISTOGRAM_H
31 
32 /* vim: set expandtab tabstop=4 shiftwidth=4: */
Histogram::~Histogram
~Histogram()=default
mythframe.h
Histogram::generateFromImage
void generateFromImage(MythVideoFrame *frame, unsigned int frameWidth, unsigned int frameHeight, unsigned int minScanX, unsigned int maxScanX, unsigned int minScanY, unsigned int maxScanY, unsigned int XSpacing, unsigned int YSpacing)
Definition: Histogram.cpp:10
Histogram::calculateSimilarityWith
float calculateSimilarityWith(const Histogram &other) const
Definition: Histogram.cpp:65
Histogram::m_numberOfSamples
unsigned int m_numberOfSamples
Definition: Histogram.h:27
Histogram::getAverageIntensity
unsigned int getAverageIntensity() const
Definition: Histogram.cpp:34
Histogram::m_data
std::array< int, 256 > m_data
Definition: Histogram.h:24
Histogram::getThresholdForPercentageOfPixels
unsigned int getThresholdForPercentageOfPixels(float percentage) const
Definition: Histogram.cpp:49
Histogram
Definition: Histogram.h:6
Histogram::Histogram
Histogram()=default
MythVideoFrame
Definition: mythframe.h:88