-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
40 lines (33 loc) · 1.33 KB
/
mainwindow.cpp
File metadata and controls
40 lines (33 loc) · 1.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
#include <QPainter>
#include "mainwindow.h"
#include "cameracapture.h"
#include "virtualcamera.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
videoLabel = new QLabel(this);
videoLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
videoLabel->setScaledContents(true);
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(videoLabel);
QWidget *centralWidget = new QWidget(this);
centralWidget->setLayout(layout);
setCentralWidget(centralWidget);
virtualCamera = new VirtualCamera(this);
virtualCamera->setup();
cameraCapture = new CameraCapture(this);
videoProcessing = new VideoProcessing(this);
connect(cameraCapture, &CameraCapture::frameCaptured, videoProcessing, &VideoProcessing::processFrame);
connect(videoProcessing, &VideoProcessing::imageGenerated, this, &MainWindow::updateImage);
connect(videoProcessing, &VideoProcessing::imageGeneratedWithoutBlur, virtualCamera, &VirtualCamera::updateVirtualFrame);
//connect(cameraCapture, &CameraCapture::frameCaptured, this, &MainWindow::updateImage); //test de la camera
}
MainWindow::~MainWindow() {
cameraCapture->capture.release();
virtualCamera->stop();
}
void MainWindow::updateImage(const QImage &image)
{
videoLabel->setPixmap(QPixmap::fromImage(image));
}