-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecognizedfaceslist.cpp
47 lines (40 loc) · 1.12 KB
/
recognizedfaceslist.cpp
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
#include "recognizedfaceslist.h"
RecognizedFacesList::RecognizedFacesList()
{
add(box);
set_policy(Gtk::POLICY_NEVER,Gtk::POLICY_AUTOMATIC);
box.set_spacing(4);
box.property_margin() = 4;
box.set_size_request( RecognizedFaceRow::width );
Glib::signal_timeout().connect( sigc::mem_fun(*this, &RecognizedFacesList::updateRecognized), 120 );
}
RecognizedFacesList::~RecognizedFacesList()
{
for (RecognizedFaceRow *&row : rowsAdded) {
delete row;
}
for (RecognizedFaceRow *&row : rows) {
delete row;
}
}
bool RecognizedFacesList::updateRecognized(){
for (RecognizedFaceRow *&row : rowsAdded) {
box.remove(*row);
delete row;
}
rowsAdded.clear();
vecLock.lock();
for (RecognizedFaceRow *&row : rows) {
box.pack_start( *row, Gtk::PACK_SHRINK, 0 );
rowsAdded.push_back( row );
row->show_all();
}
rows.clear();
vecLock.unlock();
return true;
}
void RecognizedFacesList::addFace(cv::Mat &image, Glib::ustring label){
vecLock.lock();
rows.push_back( new RecognizedFaceRow(image,label) );
vecLock.unlock();
}