digiKam
lensfunfilter.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * Date : 2008-02-10
4  * Description : a tool to fix automatically camera lens aberrations
5  *
6  * Copyright (C) 2008 by Adrian Schroeter <adrian at suse dot de>
7  * Copyright (C) 2008-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
8  *
9  * This program is free software; you can redistribute it
10  * and/or modify it under the terms of the GNU General
11  * Public License as published by the Free Software Foundation;
12  * either version 2, or (at your option)
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * ============================================================ */
21 
22 #ifndef DIGIKAM_LENS_FUN_FILTER_H
23 #define DIGIKAM_LENS_FUN_FILTER_H
24 
25 // Local includes
26 
27 #include "digikam_config.h"
28 #include "dimgthreadedfilter.h"
29 #include "digikam_export.h"
30 
31 namespace Digikam
32 {
33 
34 class DIGIKAM_EXPORT LensFunContainer
35 {
36 
37 public:
38 
39  explicit LensFunContainer()
40  : filterCCA (true),
41  filterVIG (true),
42  filterDST (true),
43  filterGEO (true),
44  cropFactor (-1.0),
45  focalLength (-1.0),
46  aperture (-1.0),
47  subjectDistance (-1.0),
48  cameraMake (QString()),
49  cameraModel (QString()),
50  lensModel (QString())
51  {
52  };
53 
55  {
56  };
57 
58 public:
59 
60  bool filterCCA;
61  bool filterVIG;
62  bool filterDST;
63  bool filterGEO;
64 
65  double cropFactor;
66  double focalLength;
67  double aperture;
69 
70  QString cameraMake;
71  QString cameraModel;
72  QString lensModel;
73 };
74 
75 // -----------------------------------------------------------------
76 
77 class DIGIKAM_EXPORT LensFunFilter : public DImgThreadedFilter
78 {
79  Q_OBJECT
80 
81 public:
82 
83  explicit LensFunFilter(QObject* const parent = nullptr);
84  explicit LensFunFilter(DImg* const origImage,
85  QObject* const parent,
86  const LensFunContainer& settings);
87  ~LensFunFilter() override;
88 
89  bool registerSettingsToXmp(MetaEngineData& data) const;
90  void readParameters(const FilterAction& action) override;
91 
92  static QString FilterIdentifier()
93  {
94  return QLatin1String("digikam:LensFunFilter");
95  }
96 
97  static QString DisplayableName();
98 
100  {
101  return QList<int>() << 1 << 2;
102  }
103 
104  static int CurrentVersion()
105  {
106  return 2;
107  }
108 
109  QString filterIdentifier() const override
110  {
111  return FilterIdentifier();
112  }
113 
114  FilterAction filterAction() override;
115 
116 private:
117 
118  void filterImage() override;
119  void filterCCAMultithreaded(uint start, uint stop);
120  void filterVIGMultithreaded(uint start, uint stop);
121  void filterDSTMultithreaded(uint start, uint stop);
122 
123 private:
124 
125  class Private;
126  Private* const d;
127 };
128 
129 } // namespace Digikam
130 
131 #endif // DIGIKAM_LENS_FUN_FILTER_H
Definition: dimgthreadedfilter.h:41
Definition: dimg.h:62
Definition: filteraction.h:43
Definition: lensfunfilter.h:35
bool filterDST
Distortion Corrections.
Definition: lensfunfilter.h:62
bool filterGEO
Geometry Corrections.
Definition: lensfunfilter.h:63
~LensFunContainer()
Definition: lensfunfilter.h:54
double focalLength
Definition: lensfunfilter.h:66
QString lensModel
Definition: lensfunfilter.h:72
bool filterCCA
Chromatic Aberration Corrections.
Definition: lensfunfilter.h:56
bool filterVIG
Vignetting Corrections.
Definition: lensfunfilter.h:61
QString cameraMake
Definition: lensfunfilter.h:70
double cropFactor
Definition: lensfunfilter.h:65
double subjectDistance
Definition: lensfunfilter.h:68
QString cameraModel
Definition: lensfunfilter.h:71
double aperture
Definition: lensfunfilter.h:67
LensFunContainer()
Definition: lensfunfilter.h:39
Definition: lensfunfilter.h:78
static QList< int > SupportedVersions()
Definition: lensfunfilter.h:99
QString filterIdentifier() const override
Definition: lensfunfilter.h:109
static QString FilterIdentifier()
Definition: lensfunfilter.h:92
static int CurrentVersion()
Definition: lensfunfilter.h:104
Definition: metaengine_data.h:41
Definition: datefolderview.cpp:43