SVN commit 624129 by cgilles:
digiKam from trunk : White Balance stuff : * Move White Balance filter algorithm from DigiKamImagePlugins to digiKam core. * Export a new class Digikam::WhiteBalance. * Fix White Balance Image Plugin to use the new class from digiKam core. * White Balance Image plugin will remember the settings between plugin session. Nota : advantages to include white balance algoritm into digiKam core : - We will create a new Auto-Exposure filter in Auto-Color Correction tool. - We will use later the white balance algoritm to fix RAW files color temperature when we import pictures to editor ! CCMAIL: [hidden email] M +3 -2 digikam/libs/Makefile.am M +11 -10 digikam/libs/dimg/Makefile.am A digikam/libs/whitebalance (directory) A digikam/libs/whitebalance/Makefile.am A digikam/libs/whitebalance/blackbody.h digikamimageplugins/whitebalance/blackbody.h#623950 [License: GPL] A digikam/libs/whitebalance/whitebalance.cpp digikamimageplugins/whitebalance/whitebalance.cpp#624124 [License: GPL] A digikam/libs/whitebalance/whitebalance.h digikamimageplugins/whitebalance/whitebalance.h#624124 [License: GPL] M +3 -1 digikamimageplugins/common/include/digikamheaders.h M +1 -1 digikamimageplugins/configure.in.in M +1 -1 digikamimageplugins/whitebalance/Makefile.am D digikamimageplugins/whitebalance/blackbody.h M +44 -39 digikamimageplugins/whitebalance/imageeffect_whitebalance.cpp M +6 -1 digikamimageplugins/whitebalance/imageeffect_whitebalance.h D digikamimageplugins/whitebalance/whitebalance.cpp D digikamimageplugins/whitebalance/whitebalance.h --- trunk/extragear/graphics/digikam/libs/Makefile.am #624128:624129 @@ -1,2 +1,3 @@ -SUBDIRS = lprof dcraw histogram levels curves dmetadata dimg threadimageio themeengine widgets \ - thumbbar jpegutils imageproperties dialogs +SUBDIRS = lprof dcraw histogram levels curves whitebalance dmetadata \ + dimg threadimageio themeengine widgets \ + thumbbar jpegutils imageproperties dialogs --- trunk/extragear/graphics/digikam/libs/dimg/Makefile.am #624128:624129 @@ -8,18 +8,19 @@ libdimg_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LCMS_LIBS) libdimg_la_LIBADD = $(top_builddir)/digikam/libs/dcraw/libdcraw.la \ - $(top_builddir)/digikam/libs/histogram/libhistogram.la \ - $(top_builddir)/digikam/libs/levels/liblevels.la \ - $(top_builddir)/digikam/libs/curves/libcurves.la \ - $(top_builddir)/digikam/libs/dimg/loaders/libdimgloaders.la \ - $(top_builddir)/digikam/libs/dimg/filters/libdimgfilters.la \ - $(top_builddir)/digikam/libs/dmetadata/libdmetadata.la + $(top_builddir)/digikam/libs/histogram/libhistogram.la \ + $(top_builddir)/digikam/libs/levels/liblevels.la \ + $(top_builddir)/digikam/libs/curves/libcurves.la \ + $(top_builddir)/digikam/libs/whitebalance/libwhitebalance.la \ + $(top_builddir)/digikam/libs/dimg/loaders/libdimgloaders.la \ + $(top_builddir)/digikam/libs/dimg/filters/libdimgfilters.la \ + $(top_builddir)/digikam/libs/dmetadata/libdmetadata.la INCLUDES = $(all_includes) -I$(top_srcdir)/digikam/libs/dimg/loaders \ - -I$(top_srcdir)/digikam/libs/dimg/filters \ - -I$(top_srcdir)/digikam/libs/dmetadata \ - -I$(top_srcdir)/digikam/libs/dcraw \ - -I$(top_srcdir)/digikam/digikam + -I$(top_srcdir)/digikam/libs/dimg/filters \ + -I$(top_srcdir)/digikam/libs/dmetadata \ + -I$(top_srcdir)/digikam/libs/dcraw \ + -I$(top_srcdir)/digikam/digikam digikaminclude_HEADERS = dimg.h dcolor.h dcolorpixelaccess.h dcolorcomposer.h \ dcolorblend.h rawdecodingsettings.h ddebug.h --- trunk/extragear/graphics/digikamimageplugins/common/include/digikamheaders.h #624128:624129 @@ -4,7 +4,7 @@ * Date : 2004-12-22 * * Copyright 2004 by Renchi Raju - * Copyright 2005-2006 by Gilles Caulier + * Copyright 2005-2007 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General @@ -39,6 +39,7 @@ #include <imagelevels.h> #include <imageplugin.h> #include <imagecurves.h> +#include <whitebalance.h> #include <thumbbar.h> #include <colorgradientwidget.h> #include <histogramwidget.h> @@ -69,6 +70,7 @@ #include <digikam/imagelevels.h> #include <digikam/imageplugin.h> #include <digikam/imagecurves.h> +#include <digikam/whitebalance.h> #include <digikam/thumbbar.h> #include <digikam/colorgradientwidget.h> #include <digikam/histogramwidget.h> --- trunk/extragear/graphics/digikamimageplugins/configure.in.in #624128:624129 @@ -15,7 +15,7 @@ have_digikam_toplevel=yes have_digikam=yes have_digikamheader=yes - LIBDIGIKAM_CFLAGS='-I$(top_srcdir)/digikam/digikam -I$(top_srcdir)/digikam/utilities/imageeditor/editor -I$(top_srcdir)/digikam/utilities/imageeditor/canvas -I$(top_srcdir)/digikam/libs/guibuilder -I$(top_srcdir)/digikam/libs/curves -I$(top_srcdir)/digikam/libs/histogram -I$(top_srcdir)/digikam/libs/levels -I$(top_srcdir)/digikam/libs/filters -I$(top_srcdir)/digikam/libs/widgets/common -I$(top_srcdir)/digikam/libs/widgets/imageplugins -I$(top_srcdir)/digikam/libs/thumbbar -I$(top_srcdir)/digikam/libs/dimg -I$(top_srcdir)/digikam/libs/dimg/filters -I$(top_srcdir)/digikam/libs/dialogs -I$(top_srcdir)/digikam/libs/dmetadata' + LIBDIGIKAM_CFLAGS='-I$(top_srcdir)/digikam/digikam -I$(top_srcdir)/digikam/utilities/imageeditor/editor -I$(top_srcdir)/digikam/utilities/imageeditor/canvas -I$(top_srcdir)/digikam/libs/guibuilder -I$(top_srcdir)/digikam/libs/curves -I$(top_srcdir)/digikam/libs/histogram -I$(top_srcdir)/digikam/libs/levels -I$(top_srcdir)/digikam/libs/whitebalance -I$(top_srcdir)/digikam/libs/filters -I$(top_srcdir)/digikam/libs/widgets/common -I$(top_srcdir)/digikam/libs/widgets/imageplugins -I$(top_srcdir)/digikam/libs/thumbbar -I$(top_srcdir)/digikam/libs/dimg -I$(top_srcdir)/digikam/libs/dimg/filters -I$(top_srcdir)/digikam/libs/dialogs -I$(top_srcdir)/digikam/libs/dmetadata' LIBDIGIKAM_LIBS='$(top_builddir)/digikam/digikam/libdigikam.la' LIBDIGIKAM_LIBS_DEP='$(LIBDIGIKAM_LIBS)' AC_SUBST(LIBDIGIKAM_CFLAGS) --- trunk/extragear/graphics/digikamimageplugins/whitebalance/Makefile.am #624128:624129 @@ -8,7 +8,7 @@ kde_module_LTLIBRARIES = digikamimageplugin_whitebalance.la digikamimageplugin_whitebalance_la_SOURCES = imageplugin_whitebalance.cpp \ - imageeffect_whitebalance.cpp whitebalance.cpp + imageeffect_whitebalance.cpp digikamimageplugin_whitebalance_la_LIBADD = $(LIB_KPARTS) $(LIBDIGIKAM_LIBS)\ $(top_builddir)/digikamimageplugins/common/widgets/libdigikamimagepluginswidget.la --- trunk/extragear/graphics/digikamimageplugins/whitebalance/imageeffect_whitebalance.cpp #624128:624129 @@ -19,12 +19,6 @@ * * ============================================================ */ -// C++ includes. - -#include <cstdio> -#include <cmath> -#include <cstring> - // Qt includes. #include <qhgroupbox.h> @@ -58,6 +52,7 @@ #include <kglobalsettings.h> #include <kfiledialog.h> #include <kseparator.h> +#include <kconfig.h> // Local includes. @@ -279,17 +274,11 @@ grid2->addMultiCellWidget(m_exposureLabel, 8, 8, 0, 0); grid2->addMultiCellWidget(m_autoAdjustExposure, 8, 8, 1, 1); grid2->addMultiCellWidget(m_exposureInput, 8, 8, 2, 5); - grid2->setRowStretch(9, 10); setUserAreaWidget(gboxSettings); // ------------------------------------------------------------- - - // Reset all parameters to the default values. - QTimer::singleShot(0, this, SLOT(slotDefault())); - - // ------------------------------------------------------------- connect(m_channelCB, SIGNAL(activated(int)), this, SLOT(slotChannelChanged(int))); @@ -463,7 +452,7 @@ QColor tc = dc.getQColor(); double temperatureLevel, greenLevel; - WhiteBalance::autoWBAdjustementFromColor(tc, temperatureLevel, greenLevel); + Digikam::WhiteBalance::autoWBAdjustementFromColor(tc, temperatureLevel, greenLevel); m_temperatureInput->setValue(temperatureLevel); m_greenInput->setValue(greenLevel); @@ -530,7 +519,7 @@ double blackLevel; double exposureLevel; - WhiteBalance::autoExposureAdjustement(data, width, height, sb, blackLevel, exposureLevel); + Digikam::WhiteBalance::autoExposureAdjustement(data, width, height, sb, blackLevel, exposureLevel); delete [] data; m_blackInput->setValue(blackLevel); @@ -559,23 +548,15 @@ double temperature = m_temperatureInput->value()/1000.0; double dark = m_darkInput->value(); double black = m_blackInput->value(); - double exposure = m_exposureInput->value(); + double exposition = m_exposureInput->value(); double gamma = 2.0-m_gammaInput->value(); double saturation = m_saturationInput->value(); double green = m_greenInput->value(); - WhiteBalance wbFilter(sb); + Digikam::WhiteBalance wbFilter(sb); wbFilter.whiteBalance(data, w, h, sb, - temperature, dark, black, exposure, + temperature, dark, black, exposition, gamma, saturation, green); - -/* - // Set preview lut. - setRGBmult(); - m_mg = 1.0; - setLUTv(); - setRGBmult(); - */ iface->putPreviewImage(data); m_previewWidget->updatePreview(); @@ -598,33 +579,23 @@ double temperature = m_temperatureInput->value()/1000.0; double dark = m_darkInput->value(); double black = m_blackInput->value(); - double exposure = m_exposureInput->value(); + double exposition = m_exposureInput->value(); double gamma = 2.0-m_gammaInput->value(); double saturation = m_saturationInput->value(); double green = m_greenInput->value(); - WhiteBalance wbFilter(sb); + Digikam::WhiteBalance wbFilter(sb); wbFilter.whiteBalance(data, w, h, sb, - temperature, dark, black, exposure, + temperature, dark, black, exposition, gamma, saturation, green); -/* - // Set final lut. - setRGBmult(); - m_mr = m_mb = 1.0; - if (m_clipSat) m_mg = 1.0; - setLUTv(); - setRGBmult(); - */ - iface->putOriginalImage(i18n("White Balance"), data); delete [] data; kapp->restoreOverrideCursor(); accept(); } -// Reset all settings. -void ImageEffect_WhiteBalance::slotDefault() +void ImageEffect_WhiteBalance::resetValues() { m_darkInput->blockSignals(true); m_blackInput->blockSignals(true); @@ -660,6 +631,40 @@ slotEffect(); } +void ImageEffect_WhiteBalance::readUserSettings() +{ + KConfig* config = kapp->config(); + config->setGroup("whitebalance Tool Dialog"); + m_channelCB->setCurrentItem(config->readNumEntry("Histogram Channel", 0)); // Luminosity. + m_scaleBG->setButton(config->readNumEntry("Histogram Scale", Digikam::HistogramWidget::LogScaleHistogram)); + + m_darkInput->setValue(config->readDoubleNumEntry("Dark", 0.5)); + m_blackInput->setValue(config->readDoubleNumEntry("Black", 0.0)); + m_exposureInput->setValue(config->readDoubleNumEntry("Exposure", 0.0)); + m_gammaInput->setValue(config->readDoubleNumEntry("Gamma", 1.0)); + m_saturationInput->setValue(config->readDoubleNumEntry("Saturation", 1.0)); + m_greenInput->setValue(config->readDoubleNumEntry("Green", 1.2)); + m_temperatureInput->setValue(config->readDoubleNumEntry("Temperature", 4750.0)); + slotTemperatureChanged(m_temperatureInput->value()); +} + +void ImageEffect_WhiteBalance::writeUserSettings() +{ + KConfig* config = kapp->config(); + config->setGroup("whitebalance Tool Dialog"); + config->writeEntry("Histogram Channel", m_channelCB->currentItem()); + config->writeEntry("Histogram Scale", m_scaleBG->selectedId()); + + config->writeEntry("Dark", m_darkInput->value()); + config->writeEntry("Black", m_blackInput->value()); + config->writeEntry("Exposure", m_exposureInput->value()); + config->writeEntry("Gamma", m_gammaInput->value()); + config->writeEntry("Saturation", m_saturationInput->value()); + config->writeEntry("Green", m_greenInput->value()); + config->writeEntry("Temperature", m_temperatureInput->value()); + config->sync(); +} + // Load all settings. void ImageEffect_WhiteBalance::slotUser3() { --- trunk/extragear/graphics/digikamimageplugins/whitebalance/imageeffect_whitebalance.h #624128:624129 @@ -56,7 +56,6 @@ private slots: - void slotDefault(); void slotUser2(); void slotUser3(); void slotEffect(); @@ -69,6 +68,12 @@ void slotAutoAdjustExposure(void); void slotPickerColorButtonActived(); +private: + + void readUserSettings(); + void writeUserSettings(); + void resetValues(); + private: enum HistogramScale _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |