-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdialog.cpp
68 lines (52 loc) · 1.54 KB
/
dialog.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
/**
* Author: Suryansh Kumar
*
**/
#include "dialog.h"
#include "ui_dialog.h"
#include "trackfeature.h"
#include <QtCore>
Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog)
{
ui->setupUi(this);
vid.open(0); //Use attached camera to take the feed.
if(vid.isOpened()==false){return ;}
tmr = new QTimer(this);
connect(tmr, SIGNAL(timeout()), this, SLOT(PauseorRun()));
tmr->start(10);
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::PauseorRun(){
vid >>InputFrame2;
InputFrame2.copyTo(InputFrame1);
for(int i = 0; i<2; i++)
{
vid>>InputFrame2;
}
trackfeature tf(InputFrame1, InputFrame2);
OutputFrame = tf.drawfeatureTrack();
WarpOutput = tf.getWarpImage();
cv::absdiff(InputFrame1, WarpOutput, WarpOutput);
cv::cvtColor(InputFrame1, InputFrame1, CV_BGR2RGB);
cv::cvtColor(OutputFrame, OutputFrame, CV_BGR2RGB);
//cv::cvtColor(WarpOutput, WarpOutput, CV_BGR2RGB);
QImage qInputFrame((uchar*) InputFrame1.data, InputFrame1.cols, InputFrame1.rows, InputFrame1.step, QImage::Format_RGB888 );
QImage qOutputFrame((uchar*) OutputFrame.data, OutputFrame.cols, OutputFrame.rows, OutputFrame.step, QImage::QImage::Format_RGB888);
ui->lblInputVideo->setPixmap(QPixmap::fromImage(qInputFrame));
ui->lblOuputVideo->setPixmap(QPixmap::fromImage(qOutputFrame));
}
void Dialog::on_pushButton_Track_clicked()
{
if(tmr->isActive()==true)
{
tmr->stop();
ui->pushButton_Track->setText("Resume");
}else
{
tmr->start(10);
ui->pushButton_Track->setText("Pause");
}
}