-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.cpp
138 lines (115 loc) · 3.7 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#include "debugmacros.h"
#include "glpicviewerwithcommands.h"
#include "histowitheditboxes.h"
#include "histogramcalculator.h"
#include "pichistogrammanager.h"
#include "Shared/openglpicviewer.h"
#include "singlehistogram.h"
#include <QApplication>
#include <QtWidgets>
#include <opencv2/opencv.hpp>
int openCVbasicDemo(QApplication *app);
int graphicSceneDemo(QApplication *app);
int main(int argc, char *argv[])
{
QApplication app (argc, argv);
PicHistogramManager histmgr;
SingleHistogram hist;
HistoWithEditboxes histBoxed;
OpenGLPicViewer * openGLPic;
OpenGLPicViewer * openGLPicIgnoreAR;
OpenGLPicViewer * openGLPicKeepAR;
OpenGLPicViewer * openGLPicKeepARExpand;
GLPicViewerWithCommands * picViewCmds;
HistogramCalculator * histCalc;
cv::Mat * mat;
int demoSelect = 9;
switch (demoSelect)
{
case 0:
// All histogram widgets
// histmgr.show();
hist.show();
// histBoxed.show();
return app.exec();
break;
case 1:
// Histogram manager only
histmgr.show();
return app.exec();
break;
case 2:
// OpenCV basic demo
return openCVbasicDemo(&app);
break;
case 3:
// Basic QGraphicScene demo
return graphicSceneDemo(&app);
break;
case 4:
// Basic QOpenGLWidget demo
openGLPic = new OpenGLPicViewer();
openGLPic->show();
return app.exec();
break;
case 5:
// 3 QOpenGLWidgets with 3 aspect ratios
openGLPicIgnoreAR = new OpenGLPicViewer();
openGLPicKeepAR = new OpenGLPicViewer();
openGLPicKeepARExpand = new OpenGLPicViewer();
openGLPicIgnoreAR->setPixmapWithPath("D:/temp/Uluru.jpg");
openGLPicKeepAR->setPixmapWithPath("D:/temp/Uluru.jpg");
openGLPicKeepARExpand->setPixmapWithPath("D:/temp/Uluru.jpg");
openGLPicIgnoreAR->setAspectRatioMode(Qt::IgnoreAspectRatio);
openGLPicKeepAR->setAspectRatioMode(Qt::KeepAspectRatio);
openGLPicKeepARExpand->setAspectRatioMode(Qt::KeepAspectRatioByExpanding);
openGLPicIgnoreAR->show();
openGLPicKeepAR->show();
openGLPicKeepARExpand->show();
return app.exec();
break;
case 6:
// GL pic viewer with commands demo
picViewCmds = new GLPicViewerWithCommands(0, Qt::KeepAspectRatio);
picViewCmds->setPixmapWithPath("D:/temp/Uluru.jpg");
picViewCmds->show();
picViewCmds->setPixmapWithPath("D:/temp/lena.png");
return app.exec();
break;
case 7:
// cv::Mat convertion in GL pic viewer with commands demo
picViewCmds = new GLPicViewerWithCommands(
0, Qt::KeepAspectRatioByExpanding);
mat = new cv::Mat();
*mat = cv::imread("D:/temp/Uluru.jpg");
picViewCmds->setCvMat(*mat);
picViewCmds->show();
picViewCmds->setPixmapWithPath("D:/temp/lena.png");
return app.exec();
break;
case 8:
// Histogram computing
mat = new cv::Mat();
*mat = cv::imread("D:/temp/Uluru.jpg");
histCalc = new HistogramCalculator(mat);
histCalc->configure();
histCalc->computeHist();
hist.setHist(histCalc->blueX, histCalc->blueY);
hist.show();
return app.exec();
break;
case 9:
// Histogram computing
mat = new cv::Mat();
*mat = cv::imread("D:/temp/P1070216.JPG");
histCalc = new HistogramCalculator(mat);
histCalc->configure();
histCalc->computeHist();
// Histogram manager only
histmgr.setHist(histCalc);
histmgr.show();
return app.exec();
break;
}
return 0;
}