-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
89 lines (79 loc) · 2.33 KB
/
main.cpp
File metadata and controls
89 lines (79 loc) · 2.33 KB
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
//
// Created by stephan on 20.03.19.
//
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <QtWidgets>
#include <QtGui>
#include <QVBoxLayout>
#include <QGraphicsView>
#include <QGraphicsTextItem>
#include <QGraphicsScene>
#include <fstream>
#include <iostream>
#include "MainWindow.h"
#include "Blending.h"
using namespace cv;
using namespace std;
static void help() {
cout << "\nThis sample program demonstrates the use of the convexHull() function\n"
<< "Call:\n"
<< "./convexhull\n" << endl;
}
int main(int argc, char **argv) {
/*
//QT Library Dependency Test Code
QApplication a(argc, argv);
QWidget window;
QVBoxLayout *layout = new QVBoxLayout(&window);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsPixmapItem item(QPixmap("img/test.jpg"));
scene.addItem(&item);
layout->addWidget(&view);
window.resize(800, 600);
window.show();
window.setWindowTitle(QApplication::translate("toplevel", "QTWidget Test"));
//OpenCV Library Dependency Test Code
CommandLineParser parser(argc, argv, "{help h||}");
if (parser.has("help")) {
help();
return 0;
}
Mat img(500, 500, CV_8UC3);
RNG &rng = theRNG();
for (;;) {
char key;
int i, count = (unsigned) rng % 100 + 1;
vector<Point> points;
for (i = 0; i < count; i++) {
Point pt;
pt.x = rng.uniform(img.cols / 4, img.cols * 3 / 4);
pt.y = rng.uniform(img.rows / 4, img.rows * 3 / 4);
points.push_back(pt);
}
vector<int> hull;
convexHull(Mat(points), hull, true);
img = Scalar::all(0);
for (i = 0; i < count; i++)
circle(img, points[i], 3, Scalar(0, 0, 255), FILLED, LINE_AA);
int hullcount = (int) hull.size();
Point pt0 = points[hull[hullcount - 1]];
for (i = 0; i < hullcount; i++) {
Point pt = points[hull[i]];
line(img, pt0, pt, Scalar(0, 255, 0), 1, LINE_AA);
pt0 = pt;
}
imshow("hull", img);
key = (char) waitKey();
if (key == 27 || key == 'q' || key == 'Q') // 'ESC'
break;
}
delete layout;
return 0;
*/
QApplication app(argc, argv);
MainWindow window;
window.show();
return app.exec();
}