digiKam
redeyecorrectionfilter.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 : 16/08/2016
7  * Description : A Red-Eye automatic detection and correction filter.
8  *
9  * Copyright (C) 2005-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2016 by Omar Amin <Omar dot moh dot amin 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_RED_EYE_CORRECTION_FILTER_H
26 #define DIGIKAM_RED_EYE_CORRECTION_FILTER_H
27 
28 // Local includes
29 
30 #include "digikam_export.h"
31 #include "dimgthreadedfilter.h"
32 #include "digikam_globals.h"
33 #include "digikam_opencv.h"
35 
36 namespace Digikam
37 {
38 
39 class DIGIKAM_EXPORT RedEyeCorrectionFilter : public DImgThreadedFilter
40 {
41  Q_OBJECT
42 
43 public:
44 
45  explicit RedEyeCorrectionFilter(QObject* const parent = nullptr);
46  explicit RedEyeCorrectionFilter(DImg* const orgImage,
47  QObject* const parent = nullptr,
49 
53  explicit RedEyeCorrectionFilter(const RedEyeCorrectionContainer& settings,
54  DImgThreadedFilter* const parentFilter,
55  const DImg& orgImage,
56  const DImg& destImage,
57  int progressBegin = 0,
58  int progressEnd = 100);
59 
60  ~RedEyeCorrectionFilter() override;
61 
62  static QString FilterIdentifier()
63  {
64  return QLatin1String("digikam:RedEyeCorrectionFilter");
65  }
66 
67  static QString DisplayableName();
68 
70  {
71  return QList<int>() << 1;
72  }
73 
74  static int CurrentVersion()
75  {
76  return 1;
77  }
78 
79  QString filterIdentifier() const override
80  {
81  return FilterIdentifier();
82  }
83 
84  FilterAction filterAction() override;
85 
86 private:
87 
88  void filterImage() override;
89  void readParameters(const FilterAction&) override;
90 
91  void correctRedEye(uchar* data,
92  int type,
93  const cv::Rect& eyerect,
94  const cv::Rect& imgRect);
95  void QRectFtocvRect(const QList<QRect>& faces,
96  std::vector<cv::Rect>& result);
97 
98 private:
99 
100  class Private;
101  Private* const d;
102 };
103 
104 } // namespace Digikam
105 
106 #endif // DIGIKAM_RED_EYE_CORRECTION_FILTER_H
Definition: dimgthreadedfilter.h:41
Definition: dimg.h:62
Definition: filteraction.h:43
Definition: redeyecorrectioncontainer.h:42
Definition: redeyecorrectionfilter.h:40
static QString FilterIdentifier()
Definition: redeyecorrectionfilter.h:62
static QList< int > SupportedVersions()
Definition: redeyecorrectionfilter.h:69
QString filterIdentifier() const override
Definition: redeyecorrectionfilter.h:79
static int CurrentVersion()
Definition: redeyecorrectionfilter.h:74
Definition: datefolderview.cpp:43