Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
GridHealer.h
1 #ifndef GRID_HEALER_H
2 #define GRID_HEALER_H
3 
4 #include <QMap>
5 #include <QPointF>
6 #include <QVector>
7 
9 class QImage;
10 
11 enum PixelState {
12  PIXEL_STATE_BACKGROUND,
13  PIXEL_STATE_FOREGROUND,
14  PIXEL_STATE_REMOVED,
15  PIXEL_STATE_ADJACENT,
16  PIXEL_STATE_HEALED,
17  NUM_PIXEL_STATES
18 };
19 
21 typedef int BoundaryGroup;
22 
24 typedef int PixelStateOrBoundaryGroup;
25 
27 typedef QMap<BoundaryGroup, QPointF> GroupNumberToPoint;
28 
32 {
33  public:
35  GridHealer(const QImage &imageBefore,
36  const DocumentModelGridRemoval &modelGridRemoval);
37 
40  void erasePixel (int xCol,
41  int yRow);
42 
44  void heal (QImage &imageToHeal);
45 
46  private:
47  GridHealer();
48 
49  void connectCloseGroups(QImage &imageToHeal);
50  void groupContiguousAdjacentPixels();
51  void recursiveSearchForAdjacentPixels (int boundaryGroup,
52  int row,
53  int col,
54  int &centroidCount,
55  double &rowCentroidSum,
56  double &colCentroidSum);
57 
58  // Mirror of original image
59  QVector<QVector<PixelStateOrBoundaryGroup> > m_pixels;
60 
61  BoundaryGroup m_boundaryGroupNext;
62 
64  GroupNumberToPoint m_groupNumberToCentroid;
65 
67  GroupNumberToPoint m_groupNumberToPixel;
68 
69  DocumentModelGridRemoval m_modelGridRemoval;
70 };
71 
72 #endif // GRID_HEALER_H
void erasePixel(int xCol, int yRow)
Remember that pixel was erased since it belongs to an grid line.
Definition: GridHealer.cpp:90
Class that &#39;heals&#39; the curves after grid lines have been removed.
Definition: GridHealer.h:31
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
void heal(QImage &imageToHeal)
Heal the broken curve lines by spanning the gaps across the newly-removed grid lines.
Definition: GridHealer.cpp:147