| 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 | \obsolete |
| 55 | \inmodule QtMultimedia |
| 56 | |
| 57 | |
| 58 | \ingroup multimedia_control |
| 59 | |
| 60 | |
| 61 | \brief The QCameraImageProcessingControl class provides an abstract class |
| 62 | for controlling image processing parameters, like white balance, |
| 63 | contrast, saturation, sharpening and denoising. |
| 64 | |
| 65 | The interface name of QCameraImageProcessingControl is \c org.qt-project.qt.cameraimageprocessingcontrol/5.0 as |
| 66 | defined in QCameraImageProcessingControl_iid. |
| 67 | |
| 68 | Camera service may choose the parameters of image processing pipeline depending |
| 69 | on sensor properties camera settings and capture parameters. |
| 70 | |
| 71 | This control allows to modify some parameters of image processing pipeline |
| 72 | to achieve desired results. |
| 73 | |
| 74 | Parameters with the "Adjustment" suffix, like ContrastAdjustment, SaturationAdjustment etc |
| 75 | allows to adjust the parameter values, selected by camera engine, |
| 76 | while parameters like Contrast and Saturation overwrites them. |
| 77 | |
| 78 | For example setting the SharpeningAdjustment parameter to -0.1 |
| 79 | slightly reduces the amount of sharpening applied, |
| 80 | while settings the Sharpening parameter to 0 disables sharpening at all. |
| 81 | |
| 82 | \sa QMediaService::requestControl(), QCamera |
| 83 | */ |
| 84 | |
| 85 | /*! |
| 86 | \macro QCameraImageProcessingControl_iid |
| 87 | |
| 88 | \c org.qt-project.qt.cameraimageprocessingcontrol/5.0 |
| 89 | |
| 90 | Defines the interface name of the QCameraImageProcessingControl class. |
| 91 | |
| 92 | \relates QCameraImageProcessingControl |
| 93 | */ |
| 94 | |
| 95 | /*! |
| 96 | Constructs an image processing control object with \a parent. |
| 97 | */ |
| 98 | |
| 99 | QCameraImageProcessingControl::QCameraImageProcessingControl(QObject *parent): |
| 100 | QMediaControl(*new QMediaControlPrivate, parent) |
| 101 | { |
| 102 | } |
| 103 | |
| 104 | /*! |
| 105 | Destruct the image processing control object. |
| 106 | */ |
| 107 | |
| 108 | QCameraImageProcessingControl::~QCameraImageProcessingControl() |
| 109 | { |
| 110 | } |
| 111 | |
| 112 | /*! |
| 113 | \fn bool QCameraImageProcessingControl::isParameterSupported(ProcessingParameter parameter) const |
| 114 | |
| 115 | Returns true if the camera supports adjusting image processing \a parameter. |
| 116 | |
| 117 | Usually the supported setting is static, |
| 118 | but some parameters may not be available depending on other |
| 119 | camera settings, like presets. |
| 120 | In such case the currently supported parameters should be returned. |
| 121 | */ |
| 122 | |
| 123 | /*! |
| 124 | \fn bool QCameraImageProcessingControl::isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const |
| 125 | |
| 126 | Returns true if the camera supports setting the image processing \a parameter \a value. |
| 127 | |
| 128 | It's used only for parameters with a limited set of values, like WhiteBalancePreset. |
| 129 | */ |
| 130 | |
| 131 | |
| 132 | /*! |
| 133 | \fn QCameraImageProcessingControl::parameter(ProcessingParameter parameter) const |
| 134 | |
| 135 | Returns the image processing \a parameter value. |
| 136 | */ |
| 137 | |
| 138 | /*! |
| 139 | \fn QCameraImageProcessingControl::setParameter(ProcessingParameter parameter, const QVariant &value) |
| 140 | |
| 141 | Sets the image processing \a parameter \a value. |
| 142 | Passing the null or invalid QVariant value allows |
| 143 | backend to choose the suitable parameter value. |
| 144 | |
| 145 | The valid values range depends on the parameter type. |
| 146 | For WhiteBalancePreset the value should be one of QCameraImageProcessing::WhiteBalanceMode values; |
| 147 | for Contrast, Saturation, Brightness, Sharpening and Denoising the value should be |
| 148 | in [0..1.0] range with invalid QVariant value indicating the default parameter value; |
| 149 | for ContrastAdjustment, SaturationAdjustment, BrightnessAdjustment, |
| 150 | SharpeningAdjustment and DenoisingAdjustment the value should be |
| 151 | in [-1.0..1.0] range with default 0. |
| 152 | */ |
| 153 | |
| 154 | /*! |
| 155 | \enum QCameraImageProcessingControl::ProcessingParameter |
| 156 | |
| 157 | \value WhiteBalancePreset |
| 158 | The white balance preset. |
| 159 | \value ColorTemperature |
| 160 | Color temperature in K. This value is used when the manual white balance mode is selected. |
| 161 | \value Contrast |
| 162 | Image contrast. |
| 163 | \value Saturation |
| 164 | Image saturation. |
| 165 | \value Brightness |
| 166 | Image brightness. |
| 167 | \value Sharpening |
| 168 | Amount of sharpening applied. |
| 169 | \value Denoising |
| 170 | Amount of denoising applied. |
| 171 | \value ContrastAdjustment |
| 172 | Image contrast adjustment. |
| 173 | \value SaturationAdjustment |
| 174 | Image saturation adjustment. |
| 175 | \value BrightnessAdjustment |
| 176 | Image brightness adjustment. |
| 177 | \value SharpeningAdjustment |
| 178 | Adjustment of sharpening applied. |
| 179 | \value DenoisingAdjustment |
| 180 | Adjustment of denoising applied. |
| 181 | \value ColorFilter |
| 182 | Image filter applied. Since 5.5 |
| 183 | \value ExtendedParameter |
| 184 | The base value for platform specific extended parameters. |
| 185 | */ |
| 186 | |
| 187 | QT_END_NAMESPACE |
| 188 | |
| 189 | #include "moc_qcameraimageprocessingcontrol.cpp" |
| 190 | |