-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathlaufacialfeaturedetectorglwidget.h
65 lines (54 loc) · 1.79 KB
/
laufacialfeaturedetectorglwidget.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef LAUFACIALFEATUREDETECTORGLWIDGET_H
#define LAUFACIALFEATUREDETECTORGLWIDGET_H
#include <QtCore>
#include <QObject>
#include <QSettings>
#include <QFileDialog>
#ifdef USEVISAGE
#include "visageVision.h"
#include "VisageTracker.h"
#endif
#include "opencv2/face.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "lauvideoglwidget.h"
/****************************************************************************/
/****************************************************************************/
/****************************************************************************/
class LAUFacialFeatureDetectorGLWidget : public LAUVideoGLWidget
{
public:
explicit LAUFacialFeatureDetectorGLWidget(QWidget *parent = nullptr);
~LAUFacialFeatureDetectorGLWidget();
QImage grabImage()
{
if (videoTexture) {
makeCurrent();
QImage image(videoTexture->width(), videoTexture->height(), QImage::Format_ARGB32);
videoTexture->bind();
glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_BYTE, (void *)image.constBits());
return (image);
}
return (QImage());
}
void initialize();
void process();
void paint();
private:
QOpenGLBuffer faceVertexBuffer, faceIndexBuffer;
QOpenGLFramebufferObject *frameBufferObject;
QOpenGLShaderProgram programA, programB;
#ifdef USEVISAGE
VsImage *inputImage;
VisageSDK::VisageTracker *visageTracker;
VisageSDK::FaceData faceData[16];
#else
QObject *visageTracker;
cv::Ptr<cv::Subdiv2D> subDivide;
cv::Ptr<cv::CascadeClassifier> faceDetector;
cv::Ptr<cv::face::Facemark> facemark;
#endif
cv::Mat videoFrame, grayFrame;
};
#endif // LAUFACIALFEATUREDETECTORGLWIDGET_H