digiKam
Loading...
Searching...
No Matches
greycstorationfilter.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 : 2007-12-03
7 * Description : Greycstoration interface.
8 *
9 * SPDX-FileCopyrightText: 2007-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 2010 by Martin Klapetek <martin dot klapetek at gmail dot com>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Qt includes
19
20#include <QImage>
21
22// Local includes
23
24#include "dimg.h"
25#include "dimgthreadedfilter.h"
26#include "digikam_export.h"
27
28class QObject;
29
30namespace Digikam
31{
32
33class DIGIKAM_EXPORT GreycstorationContainer
34{
35
36public:
37
39 {
40 NearestNeighbor = 0,
42 RungeKutta
43 };
44
45public:
46
49
51 {
52 fastApprox = true;
53
54 tile = 256;
55 btile = 4;
56
57 nbIter = 1;
58 interp = NearestNeighbor;
59
60 amplitude = 60.0F;
61 sharpness = 0.7F;
62 anisotropy = 0.3F;
63 alpha = 0.6F;
64 sigma = 1.1F;
65 gaussPrec = 2.0F;
66 dl = 0.8F;
67 da = 30.0F;
68 }
69
71 {
72 fastApprox = true;
73
74 tile = 256;
75 btile = 4;
76
77 nbIter = 30;
78 interp = NearestNeighbor;
79
80 amplitude = 20.0F;
81 sharpness = 0.3F;
82 anisotropy = 1.0F;
83 alpha = 0.8F;
84 sigma = 2.0F;
85 gaussPrec = 2.0F;
86 dl = 0.8F;
87 da = 30.0F;
88 }
89
91 {
92 fastApprox = true;
93
94 tile = 256;
95 btile = 4;
96
97 nbIter = 3;
98 interp = NearestNeighbor;
99
100 amplitude = 20.0F;
101 sharpness = 0.2F;
102 anisotropy = 0.9F;
103 alpha = 0.1F;
104 sigma = 1.5F;
105 gaussPrec = 2.0F;
106 dl = 0.8F;
107 da = 30.0F;
108 }
109
110public:
111
112 bool fastApprox = true;
113
114 int tile = 256;
115 int btile = 4;
116
117 uint nbIter = 1;
118 uint interp = NearestNeighbor;
119
120 float amplitude = 60.0F;
121 float sharpness = 0.7F;
122 float anisotropy = 0.3F;
123 float alpha = 0.6F;
124 float sigma = 1.1F;
125 float gaussPrec = 2.0F;
126 float dl = 0.6F;
127 float da = 30.0F;
128};
129
130// --------------------------------------------------------------------------
131
132class DIGIKAM_EXPORT GreycstorationFilter : public DImgThreadedFilter
133{
134 Q_OBJECT
135
136public:
137
138 enum MODE
139 {
140 Restore = 0,
143 SimpleResize
144 };
145
146public:
147
153 explicit GreycstorationFilter(QObject* const parent = nullptr);
154
158 GreycstorationFilter(DImg* const orgImage,
159 const GreycstorationContainer& settings,
160 int mode = Restore,
161 int newWidth = 0, int newHeight = 0,
162 const QImage& inPaintingMask = QImage(),
163 QObject* const parent = nullptr);
164
165 ~GreycstorationFilter() override;
166
167 void setMode(int mode, int newWidth = 0, int newHeight = 0);
168 void setSettings(const GreycstorationContainer& settings);
169 void setInPaintingMask(const QImage& inPaintingMask);
170
171 void setup();
172
173 void cancelFilter() override;
174
175 static QString cimgVersionString();
176
177 static QString FilterIdentifier()
178 {
179 return QLatin1String("digikam:GreycstorationFilter");
180 }
181
182 static QString DisplayableName();
183
184 static QList<int> SupportedVersions()
185 {
186 return QList<int>() << 1;
187 }
188
189 static int CurrentVersion()
190 {
191 return 1;
192 }
193
194 QString filterIdentifier() const override
195 {
196 return FilterIdentifier();
197 }
198
199 FilterAction filterAction() override;
200 void readParameters(const FilterAction& action) override;
201
202private:
203
204 void computeChildrenThreads();
205 void restoration();
206 void inpainting();
207 void resize();
208 void simpleResize();
209 void iterationLoop(uint iter);
210
211 void initFilter() override;
212 void filterImage() override;
213
214private:
215
216 class Private;
217 Private* const d = nullptr;
218};
219
220} // namespace Digikam
Definition dimgthreadedfilter.h:31
Definition dimg.h:52
Definition filteraction.h:33
Definition greycstorationfilter.h:34
void setRestorationDefaultSettings()
Definition greycstorationfilter.h:50
void setResizeDefaultSettings()
Definition greycstorationfilter.h:90
void setInpaintingDefaultSettings()
Definition greycstorationfilter.h:70
INTERPOLATION
Definition greycstorationfilter.h:39
@ Linear
Definition greycstorationfilter.h:41
Definition greycstorationfilter.h:133
static int CurrentVersion()
Definition greycstorationfilter.h:189
static QList< int > SupportedVersions()
Definition greycstorationfilter.h:184
QString filterIdentifier() const override
Definition greycstorationfilter.h:194
MODE
Definition greycstorationfilter.h:139
@ Resize
Definition greycstorationfilter.h:142
@ InPainting
Definition greycstorationfilter.h:141
static QString FilterIdentifier()
Definition greycstorationfilter.h:177
Definition datefolderview.cpp:34