haardetector.h
4.7 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
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* Webcamoid, webcam capture application.
* Copyright (C) 2016 Gonzalo Exequiel Pedone
*
* Webcamoid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Webcamoid is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Webcamoid. If not, see <http://www.gnu.org/licenses/>.
*
* Web-Site: http://webcamoid.github.io/
*/
#ifndef HAARDETECTOR_H
#define HAARDETECTOR_H
#include <QImage>
class HaarDetectorPrivate;
class HaarDetector: public QObject
{
Q_OBJECT
Q_PROPERTY(bool equalize
READ equalize
WRITE setEqualize
RESET resetEqualize
NOTIFY equalizeChanged)
Q_PROPERTY(int denoiseRadius
READ denoiseRadius
WRITE setDenoiseRadius
RESET resetDenoiseRadius
NOTIFY denoiseRadiusChanged)
Q_PROPERTY(int denoiseMu
READ denoiseMu
WRITE setDenoiseMu
RESET resetDenoiseMu
NOTIFY denoiseMuChanged)
Q_PROPERTY(int denoiseSigma
READ denoiseSigma
WRITE setDenoiseSigma
RESET resetDenoiseSigma
NOTIFY denoiseSigmaChanged)
Q_PROPERTY(bool cannyPruning
READ cannyPruning
WRITE setCannyPruning
RESET resetCannyPruning
NOTIFY cannyPruningChanged)
Q_PROPERTY(qreal lowCannyThreshold
READ lowCannyThreshold
WRITE setLowCannyThreshold
RESET resetLowCannyThreshold
NOTIFY lowCannyThresholdChanged)
Q_PROPERTY(qreal highCannyThreshold
READ highCannyThreshold
WRITE setHighCannyThreshold
RESET resetHighCannyThreshold
NOTIFY highCannyThresholdChanged)
Q_PROPERTY(int minNeighbors
READ minNeighbors
WRITE setMinNeighbors
RESET resetMinNeighbors
NOTIFY minNeighborsChanged)
public:
HaarDetector(QObject *parent=nullptr);
~HaarDetector();
Q_INVOKABLE bool equalize() const;
Q_INVOKABLE bool &equalize();
Q_INVOKABLE int denoiseRadius() const;
Q_INVOKABLE int &denoiseRadius();
Q_INVOKABLE int denoiseMu() const;
Q_INVOKABLE int &denoiseMu();
Q_INVOKABLE int denoiseSigma() const;
Q_INVOKABLE int &denoiseSigma();
Q_INVOKABLE bool cannyPruning() const;
Q_INVOKABLE bool &cannyPruning();
Q_INVOKABLE qreal lowCannyThreshold() const;
Q_INVOKABLE qreal &lowCannyThreshold();
Q_INVOKABLE qreal highCannyThreshold() const;
Q_INVOKABLE qreal &highCannyThreshold();
Q_INVOKABLE int minNeighbors() const;
Q_INVOKABLE int &minNeighbors();
Q_INVOKABLE bool loadCascade(const QString &fileName);
Q_INVOKABLE QVector<QRect> detect(const QImage &image,
qreal scaleFactor=1.1,
QSize minObjectSize=QSize(),
QSize maxObjectSize=QSize()) const;
private:
HaarDetectorPrivate *d;
signals:
void equalizeChanged(bool equalize);
void denoiseRadiusChanged(int denoiseRadius);
void denoiseMuChanged(int denoiseMu);
void denoiseSigmaChanged(int denoiseSigma);
void cannyPruningChanged(bool cannyPruning);
void lowCannyThresholdChanged(qreal lowCannyThreshold);
void highCannyThresholdChanged(qreal highCannyThreshold);
void minNeighborsChanged(int minNeighbors);
public slots:
void setEqualize(bool equalize);
void setDenoiseRadius(int denoiseRadius);
void setDenoiseMu(int denoiseMu);
void setDenoiseSigma(int denoiseSigma);
void setCannyPruning(bool cannyPruning);
void setLowCannyThreshold(qreal lowCannyThreshold);
void setHighCannyThreshold(qreal highCannyThreshold);
void setMinNeighbors(int minNeighbors);
void resetEqualize();
void resetDenoiseRadius();
void resetDenoiseMu();
void resetDenoiseSigma();
void resetCannyPruning();
void resetLowCannyThreshold();
void resetHighCannyThreshold();
void resetMinNeighbors();
};
#endif // HAARDETECTOR_H