Skip to content
Snippets Groups Projects
Commit 47a7fed4 authored by Fabien Mottier's avatar Fabien Mottier
Browse files

clean project

parent f9ddf337
No related branches found
No related tags found
No related merge requests found
Showing
with 77 additions and 30 deletions
......@@ -19,6 +19,7 @@ MainWindow::MainWindow(QWidget *parent)
parent->connect(ui->btnReload, SIGNAL (released()),this, SLOT(reloadListRealSenseDevices()));
parent->connect(ui->btnSave, SIGNAL (released()),this, SLOT(saveConfiguration()));
parent->connect(ui->btnConfig, SIGNAL (released()),this, SLOT(configure()));
parent->connect(ui->btnAction, SIGNAL (released()),this, SLOT(makeAction()));
parent->connect(ui->lblImage, SIGNAL (mousePos()),this, SLOT(moveEdgeBorder()));
parent->connect(ui->lblImage, SIGNAL (mouseLeft()),this, SLOT(deselectEdgeBorder()));
......@@ -38,7 +39,6 @@ MainWindow::MainWindow(QWidget *parent)
*/
MainWindow::~MainWindow()
{
sandbox.stopCamera();
delete ui;
}
......@@ -140,22 +140,26 @@ void MainWindow::configure() {
nbCurrentCapturedPoint = 0;
nbCurrentRegressionLine = 0;
ui->btnSave->setEnabled(false);
ui->btnAction->setText("Reload frame");
ui->btnAction->setEnabled(true);
sandbox.startCamera();
// Draw border
Mat coloredFrame = sandbox.generateBorder();
ui->lblImage->setPixmap(QPixmap::fromImage(QImage(coloredFrame.data, coloredFrame.cols, coloredFrame.rows, coloredFrame.step, QImage::Format_RGB888)));
pteConsole_cursor.insertText("Ready to define the deformation matrix \n");
pteConsole_cursor.insertText("Ready to define the rotation matrix \n");
pteConsole_cursor.insertText("Adapt the border with the projection of the beamer \n \n");
ui->btnConfig->setText("Generate matrix");
stepConfiguration = 1; // Change function of the button for the next step of calibration
break;
}
case 1: // Valid the border for the deformation matrix and start beamer detection
case 1: // Valid the border for the rotation matrix and start beamer detection
{
ui->btnAction->setText("Clear captured points");
sandbox.applyBorder(); // Generate the deformation matrix
sandbox.applyBorder(); // Generate the rotation matrix
bool intersectionFound = false;
do {
......@@ -187,6 +191,7 @@ void MainWindow::configure() {
ui->lblImage->setPixmap(QPixmap());
stepConfiguration = 0;
ui->btnSave->setEnabled(true);
ui->btnAction->setEnabled(false);
sandbox.stopCamera();
break;
}
......@@ -194,20 +199,21 @@ void MainWindow::configure() {
{
if (validDetection) // Capture the point only if there is exactly one circle
{
sandbox.capturePointToDetectBeamer(listCircleDetected);
sandbox.capturePoint(listCircleDetected);
nbCurrentCapturedPoint++;
pteConsole_cursor.insertText(QString::number(nbCurrentCapturedPoint) + " on 3 points captured \n");
if (nbCurrentCapturedPoint == nbTotalCapturedPoint) {
sandbox.makeRegression();
nbCurrentCapturedPoint = 0;
nbCurrentRegressionLine++;
pteConsole_cursor.insertText(QString::number(nbCurrentRegressionLine) + " on 3 regression lines \n");
pteConsole_cursor.insertText("\n");
}
pteConsole_cursor.insertText(QString::number(nbCurrentRegressionLine) + " on 3 regression lines \n");
pteConsole_cursor.insertText(QString::number(nbCurrentCapturedPoint) + " on 3 points captured \n");
}
break;
}
default:
break;
......@@ -220,7 +226,7 @@ void MainWindow::configure() {
* selected the edge of border the nearest of the mouse
*/
void MainWindow::moveEdgeBorder() {
if (stepConfiguration == 1) { // Method activated only on the step for the deformation matrix
if (stepConfiguration == 1) { // Method activated only on the step for the rotation matrix
if (selectedEdge == -1) { // Select the edge
selectedEdge = sandbox.findEdgeBorder(ui->lblImage->x, ui->lblImage->y); // Select rectangle's edge
} else {
......@@ -239,3 +245,28 @@ void MainWindow::deselectEdgeBorder() {
selectedEdge = -1; // Deselect rectangle's edge
}
}
void MainWindow::makeAction() {
switch (stepConfiguration) {
case 1: // Reload the frame
{
// Draw border
Mat coloredFrame = sandbox.redrawFrameWithBorder();
ui->lblImage->setPixmap(QPixmap());
ui->lblImage->setPixmap(QPixmap::fromImage(QImage(coloredFrame.data, coloredFrame.cols, coloredFrame.rows, coloredFrame.step, QImage::Format_RGB888)));
break;
}
case 2: // Forget captured points
{
nbCurrentCapturedPoint = 0;
nbCurrentRegressionLine = 0;
pteConsole_cursor.insertText(QString::number(nbCurrentRegressionLine) + " on 3 regression lines \n");
pteConsole_cursor.insertText(QString::number(nbCurrentCapturedPoint) + " on 3 points captured \n");
break;
}
default:
break;
}
}
......@@ -33,7 +33,7 @@ private:
QTextCursor pteConsole_cursor; // Cursor to write on the application's console
device_list listRealSenseDevices;
Sandbox sandbox; // Interface of the library
int selectedEdge = -1; // Index of the selected edge border for the deformation matrix step
int selectedEdge = -1; // Index of the selected edge border for the rotation matrix step
int stepConfiguration = 0;
vector<Vec3f> listCircleDetected; // List of detected circle to find the tool to calculate the distance of the captured point
int nbCurrentRegressionLine = 0;
......@@ -54,5 +54,6 @@ private slots:
void configure();
void moveEdgeBorder();
void deselectEdgeBorder();
void makeAction();
};
#endif // MAINWINDOW_H
......@@ -165,6 +165,16 @@ border-style: solid;</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnAction">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Reload frame</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnSave">
<property name="text">
......
No preview for this file type
......@@ -359,7 +359,7 @@ moc_mainwindow.cpp: ../sandbox/sandbox.h \
../sandbox/serializable.h \
../sandbox/camera.h \
../sandbox/beamer.h \
../sandbox/calibrate.h \
../sandbox/transformframe.h \
../sandbox/borderedit.h \
../Calibration/reactivelabel.h \
../Calibration/mainwindow.h \
......@@ -397,7 +397,7 @@ main.o: ../Calibration/main.cpp ../Calibration/mainwindow.h \
../sandbox/serializable.h \
../sandbox/camera.h \
../sandbox/beamer.h \
../sandbox/calibrate.h \
../sandbox/transformframe.h \
../sandbox/borderedit.h \
../Calibration/reactivelabel.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../Calibration/main.cpp
......@@ -407,7 +407,7 @@ mainwindow.o: ../Calibration/mainwindow.cpp ../Calibration/mainwindow.h \
../sandbox/serializable.h \
../sandbox/camera.h \
../sandbox/beamer.h \
../sandbox/calibrate.h \
../sandbox/transformframe.h \
../sandbox/borderedit.h \
../Calibration/reactivelabel.h \
ui_mainwindow.h
......
840412061564 1487.81 0 0.265 -0.205 3 2 6 0 0 0 0 0 0
\ No newline at end of file
840412061564 1704.43 0 0.265 -0.205 3 2 6 0 0 0 0 0 0
\ No newline at end of file
No preview for this file type
No preview for this file type
......@@ -21,8 +21,8 @@ QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_MainWindow_t {
QByteArrayData data[10];
char stringdata0[156];
QByteArrayData data[11];
char stringdata0[167];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
......@@ -40,13 +40,15 @@ QT_MOC_LITERAL(5, 67, 26), // "reloadListRealSenseDevices"
QT_MOC_LITERAL(6, 94, 17), // "saveConfiguration"
QT_MOC_LITERAL(7, 112, 9), // "configure"
QT_MOC_LITERAL(8, 122, 14), // "moveEdgeBorder"
QT_MOC_LITERAL(9, 137, 18) // "deselectEdgeBorder"
QT_MOC_LITERAL(9, 137, 18), // "deselectEdgeBorder"
QT_MOC_LITERAL(10, 156, 10) // "makeAction"
},
"MainWindow\0quitApplication\0\0"
"selectRealSenseDevice\0QListWidgetItem*\0"
"reloadListRealSenseDevices\0saveConfiguration\0"
"configure\0moveEdgeBorder\0deselectEdgeBorder"
"configure\0moveEdgeBorder\0deselectEdgeBorder\0"
"makeAction"
};
#undef QT_MOC_LITERAL
......@@ -56,7 +58,7 @@ static const uint qt_meta_data_MainWindow[] = {
7, // revision
0, // classname
0, 0, // classinfo
7, 14, // methods
8, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
......@@ -64,13 +66,14 @@ static const uint qt_meta_data_MainWindow[] = {
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 0, 49, 2, 0x08 /* Private */,
3, 1, 50, 2, 0x08 /* Private */,
5, 0, 53, 2, 0x08 /* Private */,
6, 0, 54, 2, 0x08 /* Private */,
7, 0, 55, 2, 0x08 /* Private */,
8, 0, 56, 2, 0x08 /* Private */,
9, 0, 57, 2, 0x08 /* Private */,
1, 0, 54, 2, 0x08 /* Private */,
3, 1, 55, 2, 0x08 /* Private */,
5, 0, 58, 2, 0x08 /* Private */,
6, 0, 59, 2, 0x08 /* Private */,
7, 0, 60, 2, 0x08 /* Private */,
8, 0, 61, 2, 0x08 /* Private */,
9, 0, 62, 2, 0x08 /* Private */,
10, 0, 63, 2, 0x08 /* Private */,
// slots: parameters
QMetaType::Void,
......@@ -79,6 +82,7 @@ static const uint qt_meta_data_MainWindow[] = {
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
0 // eod
......@@ -97,6 +101,7 @@ void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id,
case 4: _t->configure(); break;
case 5: _t->moveEdgeBorder(); break;
case 6: _t->deselectEdgeBorder(); break;
case 7: _t->makeAction(); break;
default: ;
}
}
......@@ -127,13 +132,13 @@ int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 7)
if (_id < 8)
qt_static_metacall(this, _c, _id, _a);
_id -= 7;
_id -= 8;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 7)
if (_id < 8)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 7;
_id -= 8;
}
return _id;
}
......
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment