digiKam
facialrecognition_wrapper_p.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam
4  *
5  * Date : 2010-06-16
6  * Description : The private implementation of recognition wrapper
7  *
8  * Copyright (C) 2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
9  * Copyright (C) 2010 by Aditya Bhatt <adityabhatt1991 at gmail dot com>
10  * Copyright (C) 2010-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2019 by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com>
12  * Copyright (C) 2020 by Nghia Duong <minhnghiaduong997 at gmail dot com>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option)
18  * any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * ============================================================ */
26 
27 #ifndef FACIAL_RECOGNITION_WRAPPER_P_H
28 #define FACIAL_RECOGNITION_WRAPPER_P_H
29 
31 
32 // Qt includes
33 
34 #include <QMutexLocker>
35 #include <QUuid>
36 #include <QDir>
37 #include <QStandardPaths>
38 #include <QRecursiveMutex>
39 
40 // Local includes
41 
42 #include "digikam_config.h"
43 #include "digikam_debug.h"
46 #include "coredbaccess.h"
47 #include "dbengineparameters.h"
48 #include "facedbaccess.h"
49 #include "facedboperationgroup.h"
50 #include "facedb.h"
51 #include "identity.h"
52 
53 namespace Digikam
54 {
55 
56 class Q_DECL_HIDDEN FacialRecognitionWrapper::Private
57 {
58 public:
59 
60  explicit Private();
61  ~Private();
62 
63 public:
64 
65  // --- Backend parameters (facesengine_interface_setup.cpp) --------------------------
66 
67  void applyParameters();
68 
69 public:
70 
71  // --- Faces Training management (facesengine_interface_training.cpp) ----------------------------------
72 
73  void trainIdentityBatch(const QList<Identity>& identitiesToBeTrained,
74  TrainingDataProvider* const data,
75  const QString& trainingContext);
76 
77  void clear(const QList<int>& idsToClear, const QString& trainingContext);
78 
79  // --- Identity management (facesengine_interface_identity.cpp) -----------------------------------------
80 
81  static bool identityContains(const Identity& identity,
82  const QString& attribute,
83  const QString& value);
84 
85  Identity findByAttribute(const QString& attribute,
86  const QString& value) const;
87 
88  Identity findByAttributes(const QString& attribute,
89  const QMultiMap<QString, QString>& valueMap) const;
90 
91 public:
92 
94  int ref;
95  mutable QRecursiveMutex mutex;
96  QVariantMap parameters;
97  QHash<int, Identity> identityCache;
99 };
100 
101 } // namespace Digikam
102 
103 #endif // FACIAL_RECOGNITION_WRAPPER_P_H
Definition: facialrecognition_wrapper_p.h:57
QHash< int, Identity > identityCache
Definition: facialrecognition_wrapper_p.h:97
QVariantMap parameters
Definition: facialrecognition_wrapper_p.h:96
OpenCVDNNFaceRecognizer * recognizer
Definition: facialrecognition_wrapper_p.h:98
bool dbAvailable
Definition: facialrecognition_wrapper_p.h:93
QRecursiveMutex mutex
Definition: facialrecognition_wrapper_p.h:95
int ref
Definition: facialrecognition_wrapper_p.h:94
Definition: facialrecognition_wrapper.h:47
Definition: identity.h:41
Definition: opencvdnnfacerecognizer.h:42
Definition: dataproviders.h:127
Definition: piwigotalker.h:48
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43