Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
GridClassifier.h
1 #ifndef GRID_CLASSIFIER_H
2 #define GRID_CLASSIFIER_H
3 
4 #include "ColorFilterHistogram.h"
5 
6 class QPixmap;
7 class Transformation;
8 
21 {
22 public:
25 
27  void classify (bool isGnuplot,
28  const QPixmap &originalPixmap,
29  const Transformation &transformation,
30  int &countX,
31  double &startX,
32  double &stepX,
33  int &countY,
34  double &startY,
35  double &stepY);
36 
37 private:
38 
39  // Number of histogram bins could be so large that each bin corresponds to one pixel, but computation time may then be
40  // too slow when doing the correleations later on
41  static int NUM_PIXELS_PER_HISTOGRAM_BINS;
42 
43  static int MIN_STEP_PIXELS;
44  static double PEAK_HALF_WIDTH;
45  static int BIN_START_UNSHIFTED;
46 
47  int binFromCoordinate (double coord,
48  double coordMin,
49  double coordMax) const; // Inverse of coordinateFromBin
50  void classify();
51  void computeGraphCoordinateLimits (const QImage &image,
52  const Transformation &transformation,
53  double &xMin,
54  double &xMax,
55  double &yMin,
56  double &yMax);
57  double coordinateFromBin (int bin,
58  double coordMin,
59  double coordMax) const; // Inverse of binFromCoordinate
60  void copyVectorToVector (const double from [],
61  double to []) const;
62  void dumpGnuplotCoordinate (const QString &coordinateLabel,
63  double corr,
64  const double *bins,
65  double coordinateMin,
66  double coordinateMax,
67  int binStart,
68  int binStep) const;
69  void dumpGnuplotCorrelations (const QString &coordinateLabel,
70  double valueMin,
71  double valueMax,
72  const double signalA [],
73  const double signalB [],
74  const double correlationsMax []);
75  void initializeHistogramBins ();
76  void loadPicketFence (double picketFence [],
77  int binStart,
78  int binStep,
79  int count,
80  bool isCount) const;
81  void populateHistogramBins (const QImage &image,
82  const Transformation &transformation,
83  double xMin,
84  double xMax,
85  double yMin,
86  double yMax);
87  void searchCountSpace (double bins [],
88  double binStart,
89  double binStep,
90  int &countMax);
91  void searchStartStepSpace (bool isGnuplot,
92  double bins [],
93  const QString &coordinateLabel,
94  double valueMin,
95  double valueMax,
96  double &start,
97  double &step,
98  double &binStart,
99  double &binStep);
100 
101  double *m_binsX;
102  double *m_binsY;
103 
104  int m_numHistogramBins; // More bins improve accuracy but slow computation. Controlled by NUM_PIXELS_PER_HISTOGRAM_BINS
105 };
106 
107 #endif // GRID_CLASSIFIER_H
Affine transformation between screen and graph coordinates, based on digitized axis points...
GridClassifier()
Single constructor.
Classify the grid pattern in an original image.
void classify(bool isGnuplot, const QPixmap &originalPixmap, const Transformation &transformation, int &countX, double &startX, double &stepX, int &countY, double &startY, double &stepY)
Classify the specified image, and return the most probably x and y grid settings. ...