Skip to content

Navigation Menu

Sign in
Sign up

Commit 8dfd3a9

Browse files
在图像设置中增加检测帧率和阈值选项
1 parent e54e01c commit 8dfd3a9

5 files changed

Lines changed: 73 additions & 12 deletions

File tree

‎identification/camera.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,17 @@ void Camera::configureImageSettings()
281281

282282
settingsDialog.setImageSettings(m_imageSettings);
283283

284+
// 设置检测频率和阈值
285+
settingsDialog.setDetectInterval(this->m_videocliper->frameInterval());
286+
settingsDialog.setThreshold(this->m_facerecognizer->threshold());
287+
284288
if (settingsDialog.exec()) {
285289
m_imageSettings = settingsDialog.imageSettings();
286290
m_imageCapture->setEncodingSettings(m_imageSettings);
291+
292+
// 设置检测频率和人脸检测阈值
293+
this->m_videocliper->setFrameInterval(settingsDialog.detectInterval());
294+
this->m_facerecognizer->setThreshold(settingsDialog.threshold());
287295
}
288296
}
289297

‎identification/facerecognizer.cpp‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,6 @@ void faceRecognizer::faceRecognition(QImage image)
255255
<< " Distance: " << distance;
256256
}
257257

258-
259-
260-
261-
262258
emit recongnitionResult(face_region, face_info);
263259

264260
qDebug() << "Up Detected faces: " << dets.size()

‎identification/imagesettings.cpp‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,26 @@ void ImageSettings::setImageSettings(const QImageEncoderSettings &imageSettings)
116116
ui->imageQualitySlider->setValue(imageSettings.quality());
117117
}
118118

119+
int ImageSettings::detectInterval() const
120+
{
121+
return ui->detectInterval->value();
122+
}
123+
124+
void ImageSettings::setDetectInterval(const int interval)
125+
{
126+
ui->detectInterval->setValue(interval);
127+
}
128+
129+
float ImageSettings::threshold() const
130+
{
131+
return (float)ui->threshold->value();
132+
}
133+
134+
void ImageSettings::setThreshold(const float threshold)
135+
{
136+
ui->threshold->setValue(threshold);
137+
}
138+
119139
QVariant ImageSettings::boxValue(const QComboBox *box) const
120140
{
121141
int idx = box->currentIndex();

‎identification/imagesettings.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ class ImageSettings : public QDialog
7575
QImageEncoderSettings imageSettings() const;
7676
void setImageSettings(const QImageEncoderSettings &settings);
7777

78+
int detectInterval() const;
79+
void setDetectInterval(const int interval);
80+
81+
float threshold() const;
82+
void setThreshold(const float threshold);
83+
7884
QString format() const;
7985
void setFormat(const QString &format);
8086

‎identification/imagesettings.ui‎

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,34 @@
2020
<string>Image</string>
2121
</property>
2222
<layout class="QGridLayout" name="gridLayout_2">
23-
<item row="0" column="0"colspan="2">
24-
<widget class="QLabel" name="label_8">
23+
<item row="6" column="0">
24+
<widget class="QLabel" name="label">
2525
<property name="text">
26-
<string>Resolution:</string>
26+
<string>检测间隔</string>
2727
</property>
2828
</widget>
2929
</item>
30-
<item row="1" column="0"colspan="2">
31-
<widget class="QComboBox" name="imageResolutionBox"/>
30+
<item row="8" column="1">
31+
<widget class="QDoubleSpinBox" name="threshold"/>
3232
</item>
33-
<item row="2" column="0" colspan="2">
33+
<item row="2" column="0" colspan="3">
3434
<widget class="QLabel" name="label_6">
3535
<property name="text">
3636
<string>Image Format:</string>
3737
</property>
3838
</widget>
3939
</item>
40-
<item row="3" column="0" colspan="2">
40+
<item row="8" column="0">
41+
<widget class="QLabel" name="label_2">
42+
<property name="text">
43+
<string>人脸识别阈值</string>
44+
</property>
45+
</widget>
46+
</item>
47+
<item row="1" column="0" colspan="3">
48+
<widget class="QComboBox" name="imageResolutionBox"/>
49+
</item>
50+
<item row="3" column="0" colspan="3">
4151
<widget class="QComboBox" name="imageCodecBox"/>
4252
</item>
4353
<item row="4" column="0">
@@ -47,7 +57,7 @@
4757
</property>
4858
</widget>
4959
</item>
50-
<item row="4" column="1">
60+
<item row="4" column="1"colspan="2">
5161
<widget class="QSlider" name="imageQualitySlider">
5262
<property name="maximum">
5363
<number>4</number>
@@ -57,6 +67,27 @@
5767
</property>
5868
</widget>
5969
</item>
70+
<item row="0" column="0" colspan="3">
71+
<widget class="QLabel" name="label_8">
72+
<property name="text">
73+
<string>Resolution:</string>
74+
</property>
75+
</widget>
76+
</item>
77+
<item row="6" column="2">
78+
<widget class="QLabel" name="label_3">
79+
<property name="text">
80+
<string>ms</string>
81+
</property>
82+
</widget>
83+
</item>
84+
<item row="6" column="1">
85+
<widget class="QSpinBox" name="detectInterval">
86+
<property name="maximum">
87+
<number>5000</number>
88+
</property>
89+
</widget>
90+
</item>
6091
</layout>
6192
</widget>
6293
</item>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /