This repository was archived by the owner on Apr 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcalibration.cpp
More file actions
52 lines (41 loc) · 1.52 KB
/
Copy pathcalibration.cpp
File metadata and controls
52 lines (41 loc) · 1.52 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
#include "calibration.h"
#define RECT_SIZE 40
Calibration::Calibration(QWidget *parent) : QWidget(parent)
{
resize(780, 500);
viewfinder = new QCameraViewfinder(this);
viewfinder->setGeometry(130, 10, 640, 480);
cSettings.setResolution(QSize(640, 480));
camera = new QCamera(this);
camera->setViewfinder(viewfinder);
camera->setViewfinderSettings(cSettings);
QPixmap overlay(640, 480);
overlay.fill(Qt::transparent);
p.begin(&overlay);
p.setPen(QPen(Qt::green, 2));
p.drawLine(320, 0, 320, 480);
p.setPen(QPen(Qt::darkRed, 2));
p.setFont(QFont("Sans Serif" , 16, 50, false));
p.drawRect(1, 1, RECT_SIZE, RECT_SIZE);
p.drawRect(640 - RECT_SIZE, 1, RECT_SIZE - 1, RECT_SIZE);
p.drawText(QRect(0, RECT_SIZE + 10, 640, 200), Qt::AlignHCenter | Qt::AlignTop,
"Please align the two crosses with the two red squares."
"\nThe crosses should be on the same height and inside the squares!"
"\n\nThe two buttons should be separated by the green line!");
p.end();
lblOverlay = new QLabel(this);
lblOverlay->setGeometry(130, 10, 640, 480);
lblOverlay->setPixmap(overlay);
btnConfirm = new QPushButton(this);
btnConfirm->setGeometry(10, 10, 100, 30);
btnConfirm->setText("Confirm calibration");
connect(btnConfirm, SIGNAL(clicked()), this, SLOT(close()));
camera->load();
camera->start();
}
void Calibration::closeEvent(QCloseEvent *event)
{
camera->stop();
camera->unload();
emit formClosing();
}