1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #include <qcameraimageprocessingcontrol.h> |
41 | #include "qmediacontrol_p.h" |
42 | |
43 | QT_BEGIN_NAMESPACE |
44 | |
45 | static void qRegisterCameraImageProcessingControlMetaTypes() |
46 | { |
47 | qRegisterMetaType<QCameraImageProcessingControl::ProcessingParameter>(); |
48 | } |
49 | |
50 | Q_CONSTRUCTOR_FUNCTION(qRegisterCameraImageProcessingControlMetaTypes) |
51 | |
52 | /*! |
53 | \class QCameraImageProcessingControl |
54 | \inmodule QtMultimedia |
55 | |
56 | |
57 | \ingroup multimedia_control |
58 | |
59 | |
60 | \brief The QCameraImageProcessingControl class provides an abstract class |
61 | for controlling image processing parameters, like white balance, |
62 | contrast, saturation, sharpening and denoising. |
63 | |
64 | The interface name of QCameraImageProcessingControl is \c org.qt-project.qt.cameraimageprocessingcontrol/5.0 as |
65 | defined in QCameraImageProcessingControl_iid. |
66 | |
67 | Camera service may choose the parameters of image processing pipeline depending |
68 | on sensor properties camera settings and capture parameters. |
69 | |
70 | This control allows to modify some parameters of image processing pipeline |
71 | to achieve desired results. |
72 | |
73 | Parameters with the "Adjustment" suffix, like ContrastAdjustment, SaturationAdjustment etc |
74 | allows to adjust the parameter values, selected by camera engine, |
75 | while parameters like Contrast and Saturation overwrites them. |
76 | |
77 | For example setting the SharpeningAdjustment parameter to -0.1 |
78 | slightly reduces the amount of sharpening applied, |
79 | while settings the Sharpening parameter to 0 disables sharpening at all. |
80 | |
81 | \sa QMediaService::requestControl(), QCamera |
82 | */ |
83 | |
84 | /*! |
85 | \macro QCameraImageProcessingControl_iid |
86 | |
87 | \c org.qt-project.qt.cameraimageprocessingcontrol/5.0 |
88 | |
89 | Defines the interface name of the QCameraImageProcessingControl class. |
90 | |
91 | \relates QCameraImageProcessingControl |
92 | */ |
93 | |
94 | /*! |
95 | Constructs an image processing control object with \a parent. |
96 | */ |
97 | |
98 | QCameraImageProcessingControl::QCameraImageProcessingControl(QObject *parent): |
99 | QMediaControl(*new QMediaControlPrivate, parent) |
100 | { |
101 | } |
102 | |
103 | /*! |
104 | Destruct the image processing control object. |
105 | */ |
106 | |
107 | QCameraImageProcessingControl::~QCameraImageProcessingControl() |
108 | { |
109 | } |
110 | |
111 | /*! |
112 | \fn bool QCameraImageProcessingControl::isParameterSupported(ProcessingParameter parameter) const |
113 | |
114 | Returns true if the camera supports adjusting image processing \a parameter. |
115 | |
116 | Usually the supported setting is static, |
117 | but some parameters may not be available depending on other |
118 | camera settings, like presets. |
119 | In such case the currently supported parameters should be returned. |
120 | */ |
121 | |
122 | /*! |
123 | \fn bool QCameraImageProcessingControl::isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const |
124 | |
125 | Returns true if the camera supports setting the image processing \a parameter \a value. |
126 | |
127 | It's used only for parameters with a limited set of values, like WhiteBalancePreset. |
128 | */ |
129 | |
130 | |
131 | /*! |
132 | \fn QCameraImageProcessingControl::parameter(ProcessingParameter parameter) const |
133 | |
134 | Returns the image processing \a parameter value. |
135 | */ |
136 | |
137 | /*! |
138 | \fn QCameraImageProcessingControl::setParameter(ProcessingParameter parameter, const QVariant &value) |
139 | |
140 | Sets the image processing \a parameter \a value. |
141 | Passing the null or invalid QVariant value allows |
142 | backend to choose the suitable parameter value. |
143 | |
144 | The valid values range depends on the parameter type. |
145 | For WhiteBalancePreset the value should be one of QCameraImageProcessing::WhiteBalanceMode values; |
146 | for Contrast, Saturation, Brightness, Sharpening and Denoising the value should be |
147 | in [0..1.0] range with invalid QVariant value indicating the default parameter value; |
148 | for ContrastAdjustment, SaturationAdjustment, BrightnessAdjustment, |
149 | SharpeningAdjustment and DenoisingAdjustment the value should be |
150 | in [-1.0..1.0] range with default 0. |
151 | */ |
152 | |
153 | /*! |
154 | \enum QCameraImageProcessingControl::ProcessingParameter |
155 | |
156 | \value WhiteBalancePreset |
157 | The white balance preset. |
158 | \value ColorTemperature |
159 | Color temperature in K. This value is used when the manual white balance mode is selected. |
160 | \value Contrast |
161 | Image contrast. |
162 | \value Saturation |
163 | Image saturation. |
164 | \value Brightness |
165 | Image brightness. |
166 | \value Sharpening |
167 | Amount of sharpening applied. |
168 | \value Denoising |
169 | Amount of denoising applied. |
170 | \value ContrastAdjustment |
171 | Image contrast adjustment. |
172 | \value SaturationAdjustment |
173 | Image saturation adjustment. |
174 | \value BrightnessAdjustment |
175 | Image brightness adjustment. |
176 | \value SharpeningAdjustment |
177 | Adjustment of sharpening applied. |
178 | \value DenoisingAdjustment |
179 | Adjustment of denoising applied. |
180 | \value ColorFilter |
181 | Image filter applied. Since 5.5 |
182 | \value ExtendedParameter |
183 | The base value for platform specific extended parameters. |
184 | */ |
185 | |
186 | #include "moc_qcameraimageprocessingcontrol.cpp" |
187 | QT_END_NAMESPACE |
188 | |
189 | |