digiKam
openfacepreprocessor.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 : 2019-07-09
7  * Description : Preprocessor for openface nn model
8  *
9  * Copyright (C) 2019 by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com>
10  * Copyright (C) 2019-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_OPENFACE_PREPROCESSOR_H
26 #define DIGIKAM_OPENFACE_PREPROCESSOR_H
27 
28 // C++ includes
29 
30 #include <array>
31 
32 // Qt includes
33 
34 #include <QMutex>
35 
36 // Local includes
37 
38 #include "digikam_opencv.h"
39 #include "shapepredictor.h"
40 
41 namespace Digikam
42 {
43 
45 {
46 
47 public:
48 
49  explicit OpenfacePreprocessor();
51 
55  bool loadModels();
56 
57  cv::Mat process(const cv::Mat& image);
58 
59 private:
60 
61  cv::Size outImageSize;
62 
63  cv::Mat faceTemplate;
64  std::array<int, 3> outerEyesNosePositions;
65 
67 
68  QMutex mutex;
69 
70 private:
71 
72  // Disable
74  OpenfacePreprocessor& operator=(const OpenfacePreprocessor&) = delete;
75 };
76 
77 } // namespace Digikam
78 
79 #endif // DIGIKAM_OPENFACE_PREPROCESSOR_H
Definition: openfacepreprocessor.h:45
~OpenfacePreprocessor()
Definition: openfacepreprocessor.cpp:67
bool loadModels()
Definition: openfacepreprocessor.cpp:71
cv::Mat process(const cv::Mat &image)
Definition: openfacepreprocessor.cpp:110
OpenfacePreprocessor()
Definition: openfacepreprocessor.cpp:60
Definition: shapepredictor.h:190
Definition: datefolderview.cpp:43