QT_BEGIN_NAMESPACE CameraBinImageProcessing::CameraBinImageProcessing(CameraBinSession *session) : QCameraImageProcessingControl(session) , m_session(session) , m_whiteBalanceMode(QCameraImageProcessing::WhiteBalanceAuto) #ifdef USE_V4L , m_v4lImageControl(Q_NULLPTR) #endif { #ifdef HAVE_GST_PHOTOGRAPHY if (m_session->photography()) { m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_AUTO] = QCameraImageProcessing::WhiteBalanceAuto; m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT] = QCameraImageProcessing::WhiteBalanceSunlight; m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_CLOUDY] = QCameraImageProcessing::WhiteBalanceCloudy; m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_SUNSET] = QCameraImageProcessing::WhiteBalanceSunset; m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN] = QCameraImageProcessing::WhiteBalanceTungsten; m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT] = QCameraImageProcessing::WhiteBalanceFluorescent; unlockWhiteBalance(); } #if GST_CHECK_VERSION(1, 0, 0) m_filterMap.insert(QCameraImageProcessing::ColorFilterNone, GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL); if (m_session->photography()) { m_filterMap.insert(QCameraImageProcessing::ColorFilterSepia, GST_PHOTOGRAPHY_COLOR_TONE_MODE_SEPIA); m_filterMap.insert(QCameraImageProcessing::ColorFilterGrayscale, GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRAYSCALE); m_filterMap.insert(QCameraImageProcessing::ColorFilterNegative, GST_PHOTOGRAPHY_COLOR_TONE_MODE_NEGATIVE); m_filterMap.insert(QCameraImageProcessing::ColorFilterSolarize, GST_PHOTOGRAPHY_COLOR_TONE_MODE_SOLARIZE); #if GST_CHECK_VERSION(1, 2, 0) m_filterMap.insert(QCameraImageProcessing::ColorFilterPosterize, GST_PHOTOGRAPHY_COLOR_TONE_MODE_POSTERIZE); m_filterMap.insert(QCameraImageProcessing::ColorFilterWhiteboard, GST_PHOTOGRAPHY_COLOR_TONE_MODE_WHITEBOARD); m_filterMap.insert(QCameraImageProcessing::ColorFilterBlackboard, GST_PHOTOGRAPHY_COLOR_TONE_MODE_BLACKBOARD); m_filterMap.insert(QCameraImageProcessing::ColorFilterAqua, GST_PHOTOGRAPHY_COLOR_TONE_MODE_AQUA); #endif } #else m_filterMap.insert(QCameraImageProcessing::ColorFilterNone, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL); if (m_session->photography()) { m_filterMap.insert(QCameraImageProcessing::ColorFilterSepia, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SEPIA); m_filterMap.insert(QCameraImageProcessing::ColorFilterGrayscale, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_GRAYSCALE); m_filterMap.insert(QCameraImageProcessing::ColorFilterNegative, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NEGATIVE); m_filterMap.insert(QCameraImageProcessing::ColorFilterSolarize, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SOLARIZE); } #endif #endif #ifdef USE_V4L m_v4lImageControl = new CameraBinV4LImageProcessing(m_session); connect(m_session, &CameraBinSession::statusChanged, m_v4lImageControl, &CameraBinV4LImageProcessing::updateParametersInfo); #endif updateColorBalanceValues(); }
CameraBinImageProcessing::CameraBinImageProcessing(CameraBinSession *session) :QCameraImageProcessingControl(session), m_session(session) { m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_AUTO] = QCameraImageProcessing::WhiteBalanceAuto; m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT] = QCameraImageProcessing::WhiteBalanceSunlight; m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_CLOUDY] = QCameraImageProcessing::WhiteBalanceCloudy; m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_SUNSET] = QCameraImageProcessing::WhiteBalanceSunset; m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN] = QCameraImageProcessing::WhiteBalanceTungsten; m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT] = QCameraImageProcessing::WhiteBalanceFluorescent; updateColorBalanceValues(); }
void CameraBinImageProcessing::setProcessingParameter( QCameraImageProcessingControl::ProcessingParameter parameter, QVariant value) { switch (parameter) { case Contrast: setColorBalanceValue("contrast", value.toInt()); break; case Brightness: setColorBalanceValue("brightness", value.toInt()); break; case Saturation: setColorBalanceValue("saturation", value.toInt()); break; default: break; } updateColorBalanceValues(); }
void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::ProcessingParameter parameter, const QVariant &value) { switch (parameter) { case ContrastAdjustment: setColorBalanceValue("contrast", value.toReal()); break; case BrightnessAdjustment: setColorBalanceValue("brightness", value.toReal()); break; case SaturationAdjustment: setColorBalanceValue("saturation", value.toReal()); break; case WhiteBalancePreset: setWhiteBalanceMode(value.value<QCameraImageProcessing::WhiteBalanceMode>()); break; case QCameraImageProcessingControl::ColorFilter: #ifdef HAVE_GST_PHOTOGRAPHY if (GstPhotography *photography = m_session->photography()) { #if GST_CHECK_VERSION(1, 0, 0) gst_photography_set_color_tone_mode(photography, m_filterMap.value( value.value<QCameraImageProcessing::ColorFilter>(), GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL)); #else gst_photography_set_colour_tone_mode(photography, m_filterMap.value( value.value<QCameraImageProcessing::ColorFilter>(), GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL)); #endif } #endif break; default: break; } updateColorBalanceValues(); }