Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.71 KB | None | 0 0
  1. #ifndef IMAGEVIEWER_H
  2. #define IMAGEVIEWER_H
  3.  
  4. #include <QMainWindow>
  5. #ifndef QT_NO_PRINTER
  6. #include <QPrinter>
  7. #include <QMap>
  8. #include <QSlider>
  9. #include <QVector>
  10. #include <QColor>
  11. #include <QTableWidget>
  12. #include <QtMath>
  13. #include <math.h>
  14. #endif
  15.  
  16. #include "fstream"
  17.  
  18. class QAction;
  19. class QLabel;
  20. class QMenu;
  21. class QScrollArea;
  22. class QScrollBar;
  23. class QTextEdit;
  24. class QVBoxLayout;
  25. class QTabWidget;
  26. class QPushButton;
  27. class QSpinBox;
  28.  
  29. class ImageViewer : public QMainWindow
  30. {
  31. Q_OBJECT
  32.  
  33. private:
  34.  
  35. // Beispiel für GUI Elemente
  36. QWidget* m_option_panel1;
  37. QVBoxLayout* m_option_layout1;
  38.  
  39. QWidget* m_option_panel2;
  40. QVBoxLayout* m_option_layout2;
  41.  
  42. QWidget* m_option_panel3;
  43. QVBoxLayout* m_option_layout3;
  44.  
  45. QWidget* m_option_panel4;
  46. QVBoxLayout* m_option_layout4;
  47.  
  48. QPushButton* button1;
  49. QPushButton* button2;
  50. QPushButton* button3;
  51. QPushButton* button4;
  52. QPushButton* button5;
  53. QPushButton* button6;
  54. QPushButton* button7;
  55. QPushButton* button8;
  56. QPushButton* button9;
  57. QPushButton* button10;
  58. QPushButton* button11;
  59. QPushButton* button12;
  60. QSpinBox* spinbox1;
  61. QSpinBox* spinbox2;
  62. QSpinBox* spinbox3;
  63. QSpinBox* spinbox4;
  64. QSpinBox* spinbox5;
  65. QSpinBox* spinbox6;
  66. QSpinBox* spinbox7;
  67. QTableWidget* table;
  68. QLabel* mittlereHelligkeit;
  69. QLabel* varianz;
  70. QLabel* filterSize;
  71. QLabel* gausFilter;
  72. QSlider* slider1;
  73. QSlider* slider2;
  74. QLabel* helligkeitSlider;
  75. QLabel* kontrastSlider;
  76.  
  77. // hier können weitere GUI Objekte hin wie Buttons Slider etc.
  78.  
  79.  
  80. private slots:
  81.  
  82. // Beispiel für einen Algorithmus
  83. void applyExampleAlgorithm();
  84. void doSmth();
  85. void resetImage();
  86. void inkWidthX(int i);
  87. void erstelleHistogramm();
  88. void kontrastAnpassen(int h);
  89. void helligkeitAnpassen(int h);
  90. void AktualesiereKontrast(int i);
  91. void AktualesiereHell(int i);
  92. void autoKontrast();
  93. void getMittlereHelligkeit();
  94. void getVarianz();
  95. void restoreImage();
  96. void filterAnwenden();
  97. void gausFilterAnwenden();
  98. void kantDetSobel();
  99. void kantDetSobel2();
  100. void updateColomn(int i);
  101. void updateRow(int i);
  102. // hier können weitere als SLOTS definierte Funktionen hin, die auf Knopfdruck etc. aufgerufen werden.
  103.  
  104. void open();
  105. void print();
  106. void zoomIn();
  107. void zoomOut();
  108. void normalSize();
  109. void fitToWindow();
  110. void about();
  111.  
  112.  
  113. // eigene methoden
  114.  
  115.  
  116.  
  117.  
  118. public:
  119. ImageViewer();
  120. bool loadFile(const QString &);
  121. bool loadFileExt(const QString &);
  122. void updateImageDisplay();
  123.  
  124. protected:
  125.  
  126. void resizeEvent(QResizeEvent * event);
  127.  
  128. private:
  129.  
  130. // in diesen Beiden Methoden sind Änderungen nötig bzw. sie dienen als
  131. // Vorlage für eigene Methoden.
  132. void generateControlPanels();
  133.  
  134.  
  135. // Ab hier technische Details die nicht für das Verständnis notwendig sind.
  136. void startLogging();
  137. void generateMainGui();
  138.  
  139.  
  140. void createActions();
  141. void createMenus();
  142. void updateActions();
  143. void scaleImage(double factor);
  144. void adjustScrollBar(QScrollBar *scrollBar, double factor);
  145. void renewLogging();
  146.  
  147. QTabWidget* tabWidget;
  148. QTextEdit* logBrowser;
  149. QWidget* centralwidget;
  150. QLabel* imageLabel;
  151. QScrollArea* scrollArea;
  152. double scaleFactor;
  153. QImage* image;
  154. QImage* tempImage2;
  155. QImage tempImage;
  156. QImage filteredImage;
  157. QImage* PfilteredImage;
  158. QImage sobelXImage;
  159. QImage sobelYImage;
  160. QRgb tempXSobelPixel;
  161. QRgb tempYSobelPixel;
  162. QString imageOld;
  163. QRgb value;
  164. QRgb tempPixel;
  165. QTableWidgetItem* pTableItem;
  166. int tRed;
  167. int tGreen;
  168. int tBlue;
  169. int y;
  170. int Cb;
  171. int Cr;
  172. double mult;
  173. int aLow;
  174. int aHigh;
  175. int sigma;
  176. double sigma2;
  177. int center;
  178. double faktor;
  179. std::vector<float> ho;
  180. int hSize;
  181. double expVar;
  182. double sumFaktor;
  183. int tempMaxX;
  184. int tempMaxY;
  185.  
  186. int sobelFakt;
  187. int sobelWidth;
  188. int tableItem;
  189.  
  190. int widthX;
  191. int tempLightness;
  192. int tempVarianz;
  193. QMap<int, int> histogramm;
  194. QString tempstr;
  195. QString origImage;
  196.  
  197.  
  198. std::fstream logFile;
  199.  
  200. #ifndef QT_NO_PRINTER
  201. QPrinter printer;
  202. #endif
  203.  
  204. QAction *openAct;
  205. QAction *printAct;
  206. QAction *exitAct;
  207. QAction *zoomInAct;
  208. QAction *zoomOutAct;
  209. QAction *normalSizeAct;
  210. QAction *fitToWindowAct;
  211. QAction *aboutAct;
  212. QAction *aboutQtAct;
  213.  
  214. QMenu *fileMenu;
  215. QMenu *viewMenu;
  216. QMenu *helpMenu;
  217. };
  218.  
  219. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement