Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 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. QSpinBox* spinbox1;
  60. QSpinBox* spinbox2;
  61. QSpinBox* spinbox3;
  62. QSpinBox* spinbox4;
  63. QSpinBox* spinbox5;
  64. QTableWidget* table;
  65. QLabel* mittlereHelligkeit;
  66. QLabel* varianz;
  67. QLabel* filterSize;
  68. QLabel* gausFilter;
  69. QSlider* slider1;
  70. QSlider* slider2;
  71. QLabel* helligkeitSlider;
  72. QLabel* kontrastSlider;
  73.  
  74. // hier können weitere GUI Objekte hin wie Buttons Slider etc.
  75.  
  76.  
  77. private slots:
  78.  
  79. // Beispiel für einen Algorithmus
  80. void applyExampleAlgorithm();
  81. void doSmth();
  82. void resetImage();
  83. void inkWidthX(int i);
  84. void erstelleHistogramm();
  85. void kontrastAnpassen(int h);
  86. void helligkeitAnpassen(int h);
  87. void AktualesiereKontrast(int i);
  88. void AktualesiereHell(int i);
  89. void autoKontrast();
  90. void getMittlereHelligkeit();
  91. void getVarianz();
  92. void restoreImage();
  93. void filterAnwenden();
  94. void gausFilterAnwenden();
  95. void kantDetSobel();
  96. void updateColomn(int i);
  97. void updateRow(int i);
  98. // hier können weitere als SLOTS definierte Funktionen hin, die auf Knopfdruck etc. aufgerufen werden.
  99.  
  100. void open();
  101. void print();
  102. void zoomIn();
  103. void zoomOut();
  104. void normalSize();
  105. void fitToWindow();
  106. void about();
  107.  
  108.  
  109. // eigene methoden
  110.  
  111.  
  112.  
  113.  
  114. public:
  115. ImageViewer();
  116. bool loadFile(const QString &);
  117. bool loadFileExt(const QString &);
  118. void updateImageDisplay();
  119.  
  120. protected:
  121.  
  122. void resizeEvent(QResizeEvent * event);
  123.  
  124. private:
  125.  
  126. // in diesen Beiden Methoden sind Änderungen nötig bzw. sie dienen als
  127. // Vorlage für eigene Methoden.
  128. void generateControlPanels();
  129.  
  130.  
  131. // Ab hier technische Details die nicht für das Verständnis notwendig sind.
  132. void startLogging();
  133. void generateMainGui();
  134.  
  135.  
  136. void createActions();
  137. void createMenus();
  138. void updateActions();
  139. void scaleImage(double factor);
  140. void adjustScrollBar(QScrollBar *scrollBar, double factor);
  141. void renewLogging();
  142.  
  143. QTabWidget* tabWidget;
  144. QTextEdit* logBrowser;
  145. QWidget* centralwidget;
  146. QLabel* imageLabel;
  147. QScrollArea* scrollArea;
  148. double scaleFactor;
  149. QImage* image;
  150. QImage* tempImage2;
  151. QImage tempImage;
  152. QImage filteredImage;
  153. QImage* PfilteredImage;
  154. QImage sobelXImage;
  155. QImage sobelYImage;
  156. QRgb tempXSobelPixel;
  157. QRgb tempYSobelPixel;
  158. QString imageOld;
  159. QRgb value;
  160. QRgb tempPixel;
  161. QTableWidgetItem* pTableItem;
  162. int tRed;
  163. int tGreen;
  164. int tBlue;
  165. int y;
  166. int Cb;
  167. int Cr;
  168. double mult;
  169. int aLow;
  170. int aHigh;
  171. int sigma;
  172. double sigma2;
  173. int center;
  174. double faktor;
  175. std::vector<float> ho;
  176. int hSize;
  177. double expVar;
  178. double sumFaktor;
  179. int tempMaxX;
  180. int tempMaxY;
  181.  
  182. int sobelFakt;
  183. int sobelWidth;
  184. int tableItem;
  185.  
  186. int widthX;
  187. int tempLightness;
  188. int tempVarianz;
  189. QMap<int, int> histogramm;
  190. QString tempstr;
  191. QString origImage;
  192.  
  193.  
  194. std::fstream logFile;
  195.  
  196. #ifndef QT_NO_PRINTER
  197. QPrinter printer;
  198. #endif
  199.  
  200. QAction *openAct;
  201. QAction *printAct;
  202. QAction *exitAct;
  203. QAction *zoomInAct;
  204. QAction *zoomOutAct;
  205. QAction *normalSizeAct;
  206. QAction *fitToWindowAct;
  207. QAction *aboutAct;
  208. QAction *aboutQtAct;
  209.  
  210. QMenu *fileMenu;
  211. QMenu *viewMenu;
  212. QMenu *helpMenu;
  213. };
  214.  
  215. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement