digiKam
facialrecognition_wrapper.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 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) 2020 by Nghia Duong <minhnghiaduong997 at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef FACIAL_RECOGNITION_WRAPPER_H
27 #define FACIAL_RECOGNITION_WRAPPER_H
28 
29 // Qt includes
30 
31 #include <QExplicitlySharedDataPointer>
32 #include <QImage>
33 #include <QList>
34 #include <QMultiMap>
35 #include <QVariant>
36 
37 // Local includes
38 
39 #include "digikam_export.h"
40 #include "identity.h"
41 #include "dataproviders.h"
42 
43 namespace Digikam
44 {
45 
46 class DIGIKAM_GUI_EXPORT FacialRecognitionWrapper
47 {
48 public:
49 
50  explicit FacialRecognitionWrapper();
52 
54 
55 public:
56 
60  bool integrityCheck();
61 
65  void vacuum();
66 
67 public:
68 
69  // --- Backend parameters (facesengine_interface_setup.cpp) --------------------------
78  void setParameter(const QString& parameter, const QVariant& value);
79  void setParameters(const QVariantMap& parameters);
80  QVariantMap parameters() const;
81 
82  // --- Identity management (facesengine_interface_identity.cpp) -----------------------------------------
83 
85 
89  QList<Identity> allIdentities() const;
90  Identity identity(int id) const;
91 
96  Identity findIdentity(const QString& attribute, const QString& value) const;
97 
104  Identity findIdentity(const QMultiMap<QString, QString>& attributes) const;
105 
110  Identity addIdentity(const QMultiMap<QString, QString>& attributes);
111 
116  Identity addIdentityDebug(const QMultiMap<QString, QString>& attributes);
117 
121  void addIdentityAttributes(int id, const QMultiMap<QString, QString>& attributes);
122  void addIdentityAttribute(int id, const QString& attribute, const QString& value);
123  void setIdentityAttributes(int id, const QMultiMap<QString, QString>& attributes);
124 
128  void deleteIdentity(const Identity& identityToBeDeleted);
129 
133  void deleteIdentities(QList<Identity> identitiesToBeDeleted);
134 
135  // --- Faces Training management (facesengine_interface_training.cpp) ----------------------------------------------------
148  void train(const QList<Identity>& identitiesToBeTrained,
149  TrainingDataProvider* const data,
150  const QString& trainingContext);
151  void train(const Identity& identityToBeTrained,
152  TrainingDataProvider* const data,
153  const QString& trainingContext);
154 
162  void train(const Identity& identityToBeTrained,
163  QImage* image,
164  const QString& trainingContext);
165  void train(const Identity& identityToBeTrained,
166  const QList<QImage*>& images,
167  const QString& trainingContext);
168 
173  void clearAllTraining(const QString& trainingContext = QString());
174 
179  void clearTraining(const QList<Identity>& identitiesToClean,
180  const QString& trainingContext = QString());
181 
182  // --- Recognition management (facesengine_interface_recognize.cpp) -------------------
183 
188  // TODO : review to see if this function is necessary
189  //int recommendedImageSize(const QSize& availableSize = QSize()) const;
190 
197  QList<Identity> recognizeFaces(ImageListProvider* const images);
198  QList<Identity> recognizeFaces(const QList<QImage*>& images);
199  Identity recognizeFace(QImage* const image);
200 
201 private:
202 
203  // Disable
204  FacialRecognitionWrapper& operator=(const FacialRecognitionWrapper&) = delete;
205 
206 private:
207 
208  class Private;
209  static Private* d;
210 };
211 
212 } // namespace Digikam
213 
214 #endif // FACIAL_RECOGNITION_WRAPPER_H
Definition: facialrecognition_wrapper_p.h:57
Definition: facialrecognition_wrapper.h:47
Definition: identity.h:41
Definition: dataproviders.h:46
Definition: dataproviders.h:127
Definition: piwigotalker.h:48
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43