digiKam
facepipelinepackage.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2010-09-03
7  * Description : Integrated, multithread face detection / recognition
8  *
9  * Copyright (C) 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2012-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_FACE_PIPELINE_PACKAGE_H
26 #define DIGIKAM_FACE_PIPELINE_PACKAGE_H
27 
28 // Qt includes
29 
30 #include <QFlags>
31 #include <QThread>
32 
33 // Local includes
34 
35 #include "identity.h"
36 #include "digikam_debug.h"
37 #include "facetagsiface.h"
38 #include "dimg.h"
39 #include "loadingdescription.h"
40 #include "iteminfo.h"
41 //#include "recognitiondatabase.h"
42 
43 namespace Digikam
44 {
45 
46 class DetectionBenchmarker;
47 class RecognitionBenchmarker;
48 class DetectionWorker;
49 class RecognitionWorker;
50 class TrainerWorker;
51 class DatabaseWriter;
52 class FacePreviewLoader;
53 class FaceItemRetriever;
54 class ParallelPipes;
55 class ScanStateFilter;
56 
58 {
59 public:
60 
61  enum Role
62  {
63  NoRole = 0,
64 
66  GivenAsArgument = 1 << 0,
67  ReadFromDatabase = 1 << 1,
69 
71  ForRecognition = 1 << 10,
72  ForConfirmation = 1 << 11,
73  ForTraining = 1 << 12,
74  ForEditing = 1 << 13,
75 
77  Confirmed = 1 << 20,
78  Trained = 1 << 21,
79  Edited = 1 << 22
80  };
81  Q_DECLARE_FLAGS(Roles, Role)
82 
83 public:
84 
86  explicit FacePipelineFaceTagsIface(const FaceTagsIface& face);
88 
89 public:
90 
91  Roles roles;
94 };
95 
96 // ------------------------------------------------------------------------------------
97 
98 class FacePipelineFaceTagsIfaceList : public QList<FacePipelineFaceTagsIface>
99 {
100 public:
101 
105 
107 
108 public:
109 
110  void setRole(FacePipelineFaceTagsIface::Roles role);
111  void clearRole(FacePipelineFaceTagsIface::Roles role);
112  void replaceRole(FacePipelineFaceTagsIface::Roles remove,
113  FacePipelineFaceTagsIface::Roles add);
114 
116 
117  FacePipelineFaceTagsIfaceList facesForRole(FacePipelineFaceTagsIface::Roles role) const;
118 };
119 
120 // ------------------------------------------------------------------------------------
121 
123 {
124 public:
125 
127  {
133  ProcessedByTrainer = 1 << 4
134  };
135  Q_DECLARE_FLAGS(ProcessFlags, ProcessFlag)
136 
137 public:
138 
139  explicit FacePipelinePackage();
141 
142 public:
143 
149 
150  ProcessFlags processFlags;
151 };
152 
153 // ------------------------------------------------------------------------------------
154 
156  public QSharedData
157 {
158 public:
159 
160  explicit FacePipelineExtendedPackage();
162 
163  bool operator==(const LoadingDescription& description) const;
164 
165 public:
166 
167  QString filePath;
168  typedef QExplicitlySharedDataPointer<FacePipelineExtendedPackage> Ptr;
169 };
170 
171 // ----------------------------------------------------------------------------------------
172 
173 class Q_DECL_HIDDEN PackageLoadingDescriptionList : public QList<FacePipelineExtendedPackage::Ptr>
174 {
175 public:
176 
179 
180  FacePipelineExtendedPackage::Ptr take(const LoadingDescription& description);
181 };
182 
183 } // namespace Digikam
184 
185 Q_DECLARE_METATYPE(Digikam::FacePipelinePackage)
186 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::FacePipelineFaceTagsIface::Roles)
187 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::FacePipelinePackage::ProcessFlags)
188 
189 #endif // DIGIKAM_FACE_PIPELINE_PACKAGE_H
Definition: dimg.h:62
Definition: facepipelinepackage.h:157
QExplicitlySharedDataPointer< FacePipelineExtendedPackage > Ptr
Definition: facepipelinepackage.h:168
QString filePath
Definition: facepipelinepackage.h:167
Definition: facepipelinepackage.h:99
void clearRole(FacePipelineFaceTagsIface::Roles role)
Definition: facepipelinepackage.cpp:94
void setRole(FacePipelineFaceTagsIface::Roles role)
Definition: facepipelinepackage.cpp:86
FacePipelineFaceTagsIfaceList & operator=(const QList< FaceTagsIface > &faces)
Definition: facepipelinepackage.cpp:76
void replaceRole(FacePipelineFaceTagsIface::Roles remove, FacePipelineFaceTagsIface::Roles add)
Definition: facepipelinepackage.cpp:102
FacePipelineFaceTagsIfaceList()
Definition: facepipelinepackage.cpp:63
~FacePipelineFaceTagsIfaceList()
Definition: facepipelinepackage.cpp:67
FacePipelineFaceTagsIfaceList facesForRole(FacePipelineFaceTagsIface::Roles role) const
Definition: facepipelinepackage.cpp:127
QList< FaceTagsIface > toFaceTagsIfaceList() const
Definition: facepipelinepackage.cpp:115
Definition: facepipelinepackage.h:58
~FacePipelineFaceTagsIface()
Definition: facepipelinepackage.cpp:57
TagRegion assignedRegion
Definition: facepipelinepackage.h:93
int assignedTagId
Definition: facepipelinepackage.h:92
FacePipelineFaceTagsIface()
Definition: facepipelinepackage.cpp:44
Roles roles
Definition: facepipelinepackage.h:91
Role
Definition: facepipelinepackage.h:62
@ GivenAsArgument
Source.
Definition: facepipelinepackage.h:66
@ DetectedFromImage
Definition: facepipelinepackage.h:68
@ Trained
Definition: facepipelinepackage.h:78
@ ForEditing
Add, Change or remove.
Definition: facepipelinepackage.h:74
@ ReadFromDatabase
Definition: facepipelinepackage.h:67
@ ForTraining
Definition: facepipelinepackage.h:73
@ Edited
Definition: facepipelinepackage.h:79
@ ForConfirmation
Definition: facepipelinepackage.h:72
@ NoRole
Definition: facepipelinepackage.h:63
@ Confirmed
Executed action (task is cleared)
Definition: facepipelinepackage.h:77
@ ForRecognition
Task.
Definition: facepipelinepackage.h:71
Definition: facepipelinepackage.h:123
ProcessFlag
Definition: facepipelinepackage.h:127
@ ProcessedByDetector
Definition: facepipelinepackage.h:130
@ WrittenToDatabase
Definition: facepipelinepackage.h:132
@ ProcessedByTrainer
Definition: facepipelinepackage.h:133
@ ProcessedByRecognizer
Definition: facepipelinepackage.h:131
@ PreviewImageLoaded
Definition: facepipelinepackage.h:129
@ NotProcessed
Definition: facepipelinepackage.h:128
DImg image
Definition: facepipelinepackage.h:145
QList< Identity > recognitionResults
Definition: facepipelinepackage.h:147
FacePipelineFaceTagsIfaceList databaseFaces
Definition: facepipelinepackage.h:148
ProcessFlags processFlags
Definition: facepipelinepackage.h:150
ItemInfo info
Definition: facepipelinepackage.h:144
QList< QRectF > detectedFaces
Definition: facepipelinepackage.h:146
~FacePipelinePackage()
Definition: facepipelinepackage.cpp:149
FacePipelinePackage()
Definition: facepipelinepackage.cpp:144
Definition: facetagsiface.h:44
Definition: iteminfo.h:78
Definition: loadingdescription.h:45
Definition: facepipelinepackage.h:174
Definition: tagregion.h:47
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43
bool operator==(const SearchTextSettings &a, const SearchTextSettings &b)
Definition: searchtextbar.cpp:49