-
Notifications
You must be signed in to change notification settings - Fork 1
/
webcamwidget.h
50 lines (40 loc) · 1.02 KB
/
webcamwidget.h
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
#ifndef WEBCAMWIDGET_H
#define WEBCAMWIDGET_H
#include <QFileDialog>
#include <QTimer>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "opencv2/opencv.hpp"
#include "glwidget.h"
#include "facedetector.h"
class QTimer;
class WebcamWidget : public GLWidget
{
Q_OBJECT
public:
WebcamWidget();
WebcamWidget(Facedet *det);
cv::Mat &frame();
void setImage(cv::Mat &img);
void saveDelaunay(cv::Mat &frame, QVector<QVector2D> imagePoints);
void saveTexCoords(cv::Mat &frame, QVector<QVector2D> &imagePoints);
int getPointIdx(cv::Point2f pt, std::vector<cv::Point2f> &imagePoints);
QHBoxLayout *menu();
public slots:
void startStream();
void stopStream();
void drawLandmarks();
void loadImage();
void setImage(QString imageName);
signals:
void frameUpdated();
private:
void createCanvas(int imgW, int imgH);
void renderWebcam();
cv::Mat m_frame;
Facedet *detector;
QTimer *m_timer;
cv::VideoCapture cap;
};
#endif // WEBCAMWIDGET_H