Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
ColorFilter.h
1 #ifndef COLOR_FILTER_H
2 #define COLOR_FILTER_H
3 
4 #include "ColorFilterEntry.h"
5 #include "ColorFilterMode.h"
6 #include <QList>
7 #include <QRgb>
8 
9 class QImage;
10 
13 {
14 public:
16  ColorFilter();
17 
19  bool colorCompare (QRgb rgb1,
20  QRgb rgb2) const;
21 
23  void filterImage (const QImage &imageOriginal,
24  QImage &imageFiltered,
25  ColorFilterMode colorFilterMode,
26  double low,
27  double high,
28  QRgb rgbBackground);
29 
33  QRgb marginColor(const QImage *image) const;
34 
36  bool pixelFilteredIsOn (const QImage &image,
37  int x,
38  int y) const;
39 
42  double pixelToZeroToOneOrMinusOne (ColorFilterMode colorFilterMode,
43  const QColor &pixel,
44  QRgb rgbBackground) const;
45 
47  bool pixelUnfilteredIsOn (ColorFilterMode colorFilterMode,
48  const QColor &pixel,
49  QRgb rgbBackground,
50  double low0To1,
51  double high0To1) const;
52 
54  int zeroToOneToValue (ColorFilterMode colorFilterMode,
55  double s) const;
56 
57 private:
58 
59  typedef QList<ColorFilterEntry> ColorList;
60 
61  void mergePixelIntoColorCounts (QRgb pixel,
62  ColorList &colorCounts) const;
63 };
64 
65 #endif // COLOR_FILTER_H
double pixelToZeroToOneOrMinusOne(ColorFilterMode colorFilterMode, const QColor &pixel, QRgb rgbBackground) const
Return pixel converted according to the current filter parameter, normalized to zero to one...
Class for filtering image to remove unimportant information.
Definition: ColorFilter.h:12
int zeroToOneToValue(ColorFilterMode colorFilterMode, double s) const
Inverse of pixelToZeroToOneOrMinusOne.
QRgb marginColor(const QImage *image) const
Identify the margin color of the image, which is defined as the most common color in the four margins...
Definition: ColorFilter.cpp:52
ColorFilter()
Single constructor.
Definition: ColorFilter.cpp:9
bool colorCompare(QRgb rgb1, QRgb rgb2) const
See if the two color values are close enough to be considered to be the same.
Definition: ColorFilter.cpp:13
bool pixelFilteredIsOn(const QImage &image, int x, int y) const
Return true if specified filtered pixel is on.
bool pixelUnfilteredIsOn(ColorFilterMode colorFilterMode, const QColor &pixel, QRgb rgbBackground, double low0To1, double high0To1) const
Return true if specified unfiltered pixel is on.
void filterImage(const QImage &imageOriginal, QImage &imageFiltered, ColorFilterMode colorFilterMode, double low, double high, QRgb rgbBackground)
Filter the original image according to the specified filtering parameters.
Definition: ColorFilter.cpp:20