Bug 128135

Summary: WISH: Adjust exposure etc. in terms of EV
Product: [Applications] digikam Reporter: Adrian Baugh <mail>
Component: Plugin-Editor-WhiteBalanceAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: caulier.gilles
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 7.6.0
Sentry Crash Report:

Description Adrian Baugh 2006-05-27 16:41:05 UTC
Version:           0.8.2-rc1 (using KDE KDE 3.5.2)
Installed from:    Ubuntu Packages
OS:                Linux

Digikam (along with most other apps such as Gimp, Krita etc.) uses various sliders to adjust colours, brightness etc. These are all labelled in non-photographic units. It would be much nicer (particularly for digikam, which is supposedly a photo-centric piece of software) if, as much as possible, adjustment could be done in terms of camera-related parameters. So, adjust exposure in EVs (+/-1EV corresponding to +/-1 stop of aperture or exposure time) etc. It's not a biggie, and mostly I am fairly happy with digikam, but the little bit of extra familiarity would be nice.
Comment 1 caulier.gilles 2007-01-10 16:24:34 UTC
SVN commit 622055 by cgilles:

digikam from trunk : Improvement of Brighness/Contrast/gamma image editor tool : 

- Simplification of BCG filter algorithm.
- Speed-up computation of filter.
- Fix Over-Exposure indicator prediction.
- Fix BCG matrix computation with negative values (it's a side-effect bug with old algorithm introduced by Renchi Raju)
- Add  a new feature : Under-Exposure indicator!
- All settings value excursions are now the same than Photoshop.

CCBUGS: 128135

 M  +37 -28    imageplugins/imageeffect_bcg.cpp  
 M  +20 -18    imageplugins/imageeffect_bcg.h  
 M  +60 -106   libs/dimg/filters/bcgmodifier.cpp  
 M  +7 -9      libs/dimg/filters/bcgmodifier.h  
Comment 2 caulier.gilles 2007-01-10 16:32:02 UTC
SVN commit 622058 by cgilles:

digikam from trunk : Adjust Levels image editor tool : Fix Gamma excursion values to be homogenous with BCG image editor tool.
CCBUGS: 128135

 M  +6 -7      adjustlevels.cpp  
 M  +31 -33    adjustlevels.h  


--- trunk/extragear/graphics/digikamimageplugins/adjustlevels/adjustlevels.cpp #622057:622058
@@ -1,10 +1,9 @@
 /* ============================================================
- * File  : adjustlevels.cpp
- * Author: Gilles Caulier <caulier dot gilles at kdemail dot net>
- * Date  : 2004-07-20
+ * Authors: Gilles Caulier <caulier dot gilles at kdemail dot net>
+ * Date   : 2004-07-20
  * Description : image histogram adjust levels.
  *
- * Copyright 2004-2006 by Gilles Caulier
+ * Copyright 2004-2007 by Gilles Caulier
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -64,6 +63,7 @@
 
 #include "version.h"
 #include "adjustlevels.h"
+#include "adjustlevels.moc"
 
 namespace DigikamAdjustLevelsImagesPlugin
 {
@@ -92,7 +92,7 @@
                                        digikamimageplugins_version,
                                        I18N_NOOP("An image-histogram-levels adjustment plugin for digiKam."),
                                        KAboutData::License_GPL,
-                                       "(c) 2004-2006, Gilles Caulier",
+                                       "(c) 2004-2007, Gilles Caulier",
                                        0,
                                        "http://extragear.kde.org/apps/digikamimageplugins");
 
@@ -207,7 +207,7 @@
     QToolTip::add( m_minInput, i18n( "Minimal intensity input." ) );
     m_gammaInput = new KDoubleNumInput(gboxSettings);
     m_gammaInput->setPrecision(2);
-    m_gammaInput->setRange(0.1, 10.0, 0.1);
+    m_gammaInput->setRange(0.1, 3.0, 0.01);
     m_gammaInput->setValue(1.0);
     QToolTip::add( m_gammaInput, i18n( "Gamma input value." ) );
     QWhatsThis::add( m_gammaInput, i18n("<p>Select here the gamma input value."));
@@ -730,5 +730,4 @@
 
 }  // NameSpace DigikamAdjustLevelsImagesPlugin
 
-#include "adjustlevels.moc"
 
--- trunk/extragear/graphics/digikamimageplugins/adjustlevels/adjustlevels.h #622057:622058
@@ -1,10 +1,9 @@
 /* ============================================================
- * File  : adjustlevels.h
- * Author: Gilles Caulier <caulier dot gilles at kdemail dot net>
- * Date  : 2004-07-20
+ * Authors: Gilles Caulier <caulier dot gilles at kdemail dot net>
+ * Date   : 2004-07-20
  * Description : image histogram adjust levels. 
  * 
- * Copyright 2004-2006 by Gilles Caulier
+ * Copyright 2004-2007 by Gilles Caulier
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -48,8 +47,36 @@
     AdjustLevelDialog(QWidget *parent, QString title, QFrame* banner);
     ~AdjustLevelDialog();
 
+protected:
+
+    void finalRendering();    
+
 private:
+
+    void adjustSliders(int minIn, double gamIn, int maxIn, int minOut, int maxOut);
     
+private slots:
+
+    void slotDefault();
+    void slotUser2();
+    void slotUser3();
+    void slotEffect();
+    void slotResetCurrentChannel();
+    void slotAutoLevels();
+    void slotChannelChanged(int channel);
+    void slotScaleChanged(int scale);
+    void slotAdjustSliders();
+    void slotGammaInputchanged(double val);
+    void slotAdjustMinInputSpinBox(int val);
+    void slotAdjustMaxInputSpinBox(int val);
+    void slotAdjustMinOutputSpinBox(int val);
+    void slotAdjustMaxOutputSpinBox(int val);
+    void slotSpotColorChanged(const Digikam::DColor &color);
+    void slotColorSelectedFromTarget(const Digikam::DColor &color);
+    void slotPickerColorButtonActived();    
+
+private:
+    
     enum HistogramScale
     {
         Linear=0,
@@ -109,35 +136,6 @@
     
     Digikam::ImageLevels      *m_levels;
     Digikam::DImg              m_originalImage;
-
-protected:
-
-    void finalRendering();    
-
-private:
-
-    void adjustSliders(int minIn, double gamIn, int maxIn, int minOut, int maxOut);
-    
-private slots:
-
-    void slotDefault();
-    void slotUser2();
-    void slotUser3();
-    void slotEffect();
-    void slotResetCurrentChannel();
-    void slotAutoLevels();
-    void slotChannelChanged(int channel);
-    void slotScaleChanged(int scale);
-    void slotAdjustSliders();
-    void slotGammaInputchanged(double val);
-    void slotAdjustMinInputSpinBox(int val);
-    void slotAdjustMaxInputSpinBox(int val);
-    void slotAdjustMinOutputSpinBox(int val);
-    void slotAdjustMaxOutputSpinBox(int val);
-    void slotSpotColorChanged(const Digikam::DColor &color);
-    void slotColorSelectedFromTarget(const Digikam::DColor &color);
-    void slotPickerColorButtonActived();    
-
 };
 
 }  // NameSpace DigikamAdjustLevelsImagesPlugin
Comment 3 caulier.gilles 2007-01-10 16:38:21 UTC
SVN commit 622059 by cgilles:

digikam from trunk : White Balance image editor tool : 

- Fix Gamma excursion values to be homogenous with BCG image editor tool.
- Annotate than Exposure settings is in E.V
- Annotate than Temperature settings is in °K

CCBUGS: 128135

 M  +9 -10     imageeffect_whitebalance.cpp   [UTF-8 ENCODING PROBLEMS]
 M  +29 -30    imageeffect_whitebalance.h  


--- trunk/extragear/graphics/digikamimageplugins/whitebalance/imageeffect_whitebalance.cpp #622058:622059
@@ -1,11 +1,10 @@
 /* ============================================================
- * File  : imageeffect_whitebalance.cpp
- * Author: Gilles Caulier <caulier dot gilles at kdemail dot net>
- * Date  : 2005-03-11
+ * Authors: Gilles Caulier <caulier dot gilles at kdemail dot net>
+ * Date   : 2005-03-11
  * Description : a digiKam image editor plugin to correct 
  *               image white balance 
  * 
- * Copyright 2005-2006 by Gilles Caulier
+ * Copyright 2005-2007 by Gilles Caulier
  *
  * Some parts are inspired from RawPhoto implementation copyrighted 
  * 2004-2005 by Pawel T. Jochym <jochym at ifj edu pl>
@@ -67,8 +66,9 @@
 // Local includes.
 
 #include "version.h"
-#include "imageeffect_whitebalance.h"
 #include "blackbody.h"
+#include "imageeffect_whitebalance.h"
+#include "imageeffect_whitebalance.moc"
 
 namespace DigikamWhiteBalanceImagesPlugin
 {
@@ -98,7 +98,7 @@
                                        digikamimageplugins_version,
                                        I18N_NOOP("A digiKam image plugin to correct white color balance."),
                                        KAboutData::License_GPL,
-                                       "(c) 2005-2006, Gilles Caulier", 
+                                       "(c) 2005-2007, Gilles Caulier", 
                                        0,
                                        "http://extragear.kde.org/apps/digikamimageplugins");
 
@@ -188,7 +188,7 @@
     QGridLayout *grid2 = new QGridLayout( layout2, 10, 5, spacingHint());
     KIconLoader icon;
     
-    m_exposureLabel = new QLabel(i18n("Exposure:"), gboxSettings);
+    m_exposureLabel = new QLabel(i18n("Exposure (EV):"), gboxSettings);
     m_autoAdjustExposure = new QPushButton(gboxSettings);
     m_autoAdjustExposure->setPixmap( icon.loadIcon( "run", (KIcon::Group)KIcon::Toolbar ) );
     QToolTip::add( m_autoAdjustExposure, i18n( "Auto exposure adjustments" ) );
@@ -220,12 +220,12 @@
     m_gammaLabel = new QLabel(i18n("Gamma:"), gboxSettings);
     m_gammaInput = new KDoubleNumInput(gboxSettings);
     m_gammaInput->setPrecision(2);
-    m_gammaInput->setRange(0.01, 1.5, 0.01, true);
+    m_gammaInput->setRange(0.1, 3.0, 0.01, true);
     QWhatsThis::add( m_gammaInput, i18n("<p>Set here the gamma correction value."));
 
     KSeparator *line = new KSeparator (Horizontal, gboxSettings);
             
-    m_temperatureLabel = new QLabel(i18n("Temperature:"), gboxSettings);
+    m_temperatureLabel = new QLabel(i18n("Temperature (
Comment 4 caulier.gilles 2007-03-28 10:14:51 UTC
SVN commit 647417 by cgilles:

digikam from trunk : White Balance tool : Exposure compensation settings improvement :

- Added new slider to set fine exposure adjustments using a small EV excursion.
- Old slider still exist to set main exposure adjustments using large EV excursion. Exposure compensation value is the sum of both value.
- Add an active web link to wikipedia Exposure Compensation page.

BUG: 128135

 M  +70 -37    imageeffect_whitebalance.cpp  
 M  +7 -2      imageeffect_whitebalance.h  


--- trunk/extragear/graphics/digikam/imageplugins/whitebalance/imageeffect_whitebalance.cpp #647416:647417
@@ -54,6 +54,7 @@
 #include <kfiledialog.h>
 #include <kseparator.h>
 #include <kconfig.h>
+#include <kactivelabel.h>
 
 // Local includes.
 
@@ -180,7 +181,7 @@
     
     // -------------------------------------------------------------
 
-    QGridLayout *grid2 = new QGridLayout(layout2, 9, 5, spacingHint());
+    QGridLayout *grid2 = new QGridLayout(layout2, 12, 5, spacingHint());
 
     m_temperatureLabel = new QLabel(i18n("Temperature (K):"), gboxSettings);
     m_temperatureInput = new KDoubleNumInput(gboxSettings);
@@ -258,17 +259,30 @@
     QWhatsThis::add(m_greenInput, i18n("<p>Set here the green component to set magenta color "
                                        "cast removal level."));
 
-    m_exposureLabel      = new QLabel(i18n("Exposure (EV):"), gboxSettings);
+    KSeparator *line2 = new KSeparator (Horizontal, gboxSettings);
+
+    // -------------------------------------------------------------
+
+    m_exposureLabel      = new KActiveLabel(i18n("<qt><a href='http://en.wikipedia.org/wiki/Exposure_value'>Exposure Compensation</a> "
+                                                 " (E.V): </qt>"), gboxSettings);
+    m_mainExposureLabel  = new QLabel(i18n("Main:"), gboxSettings);
     m_autoAdjustExposure = new QPushButton(gboxSettings);
     m_autoAdjustExposure->setPixmap(kapp->iconLoader()->loadIcon("run", (KIcon::Group)KIcon::Toolbar));
     QToolTip::add( m_autoAdjustExposure, i18n( "Auto exposure adjustments" ) );
     QWhatsThis::add( m_autoAdjustExposure, i18n("<p>With this button, you can automatically adjust Exposure "
                                                 "and Black Point values."));
-    m_exposureInput = new KDoubleNumInput(gboxSettings);
-    m_exposureInput->setPrecision(2);
-    m_exposureInput->setRange(-6.0, 8.0, 0.01, true);
-    QWhatsThis::add( m_exposureInput, i18n("<p>Set here the Exposure Value (EV)."));
+    m_mainExposureInput = new KDoubleNumInput(gboxSettings);
+    m_mainExposureInput->setPrecision(2);
+    m_mainExposureInput->setRange(-6.0, 8.0, 0.1, true);
+    QWhatsThis::add( m_mainExposureInput, i18n("<p>Set here the main exposure compensation value in E.V."));
 
+    m_fineExposureLabel = new QLabel(i18n("Fine:"), gboxSettings);
+    m_fineExposureInput = new KDoubleNumInput(gboxSettings);
+    m_fineExposureInput->setPrecision(2);
+    m_fineExposureInput->setRange(-0.5, 0.5, 0.01, true);
+    QWhatsThis::add( m_fineExposureInput, i18n("<p>This value in E.V will be added to main exposure "
+                                               "compensation value to set fine exposure adjustment."));
+
     // -------------------------------------------------------------
 
     grid2->addMultiCellWidget(m_temperatureLabel, 0, 0, 0, 0);
@@ -289,10 +303,16 @@
     grid2->addMultiCellWidget(m_gammaInput, 6, 6, 1, 5);
     grid2->addMultiCellWidget(m_greenLabel, 7, 7, 0, 0);
     grid2->addMultiCellWidget(m_greenInput, 7, 7, 1, 5);
-    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);
+
+    grid2->addMultiCellWidget(line2, 8, 8, 0, 5);
+
+    grid2->addMultiCellWidget(m_exposureLabel, 9, 9, 0, 5);
+    grid2->addMultiCellWidget(m_mainExposureLabel, 10, 10, 0, 0);
+    grid2->addMultiCellWidget(m_autoAdjustExposure, 10, 10, 1, 1);
+    grid2->addMultiCellWidget(m_mainExposureInput, 10, 10, 2, 5);
+    grid2->addMultiCellWidget(m_fineExposureLabel, 11, 11, 0, 1);
+    grid2->addMultiCellWidget(m_fineExposureInput, 11, 11, 2, 5);
+    grid2->setRowStretch(12, 10);
             
     setUserAreaWidget(gboxSettings);
             
@@ -328,8 +348,11 @@
     connect(m_blackInput, SIGNAL(valueChanged (double)),
             this, SLOT(slotTimer()));                       
     
-    connect(m_exposureInput, SIGNAL(valueChanged (double)),
+    connect(m_mainExposureInput, SIGNAL(valueChanged (double)),
             this, SLOT(slotTimer()));                       
+
+    connect(m_fineExposureInput, SIGNAL(valueChanged (double)),
+            this, SLOT(slotTimer()));                       
     
     connect(m_gammaInput, SIGNAL(valueChanged (double)),
             this, SLOT(slotTimer()));                       
@@ -541,7 +564,8 @@
     delete [] data;        
 
     m_blackInput->setValue(blackLevel);
-    m_exposureInput->setValue(exposureLevel);
+    m_mainExposureInput->setValue(exposureLevel);
+    m_fineExposureInput->setValue(0.0);
     
     parentWidget()->unsetCursor();
     slotEffect();  
@@ -563,17 +587,18 @@
 
     m_destinationPreviewData = new uchar[w*h*(sb ? 8 : 4)];
 
-    double temperature = m_temperatureInput->value()/1000.0;
-    double dark        = m_darkInput->value();
-    double black       = m_blackInput->value();
-    double exposition  = m_exposureInput->value();
-    double gamma       = 2.0-m_gammaInput->value();
-    double saturation  = m_saturationInput->value();
-    double green       = m_greenInput->value();
+    double temperature  = m_temperatureInput->value()/1000.0;
+    double dark         = m_darkInput->value();
+    double black        = m_blackInput->value();
+    double mainExposure = m_mainExposureInput->value();
+    double fineExposure = m_fineExposureInput->value();
+    double gamma        = 2.0-m_gammaInput->value();
+    double saturation   = m_saturationInput->value();
+    double green        = m_greenInput->value();
             
     Digikam::WhiteBalance wbFilter(sb);
     wbFilter.whiteBalance(data, w, h, sb, 
-                          black, exposition,
+                          black, mainExposure + fineExposure,
                           temperature, green, dark, 
                           gamma, saturation);
      
@@ -595,17 +620,18 @@
     int h                      = iface->originalHeight();
     bool sb                    = iface->originalSixteenBit();
 
-    double temperature = m_temperatureInput->value()/1000.0;
-    double dark        = m_darkInput->value();
-    double black       = m_blackInput->value();
-    double exposition  = m_exposureInput->value();
-    double gamma       = 2.0-m_gammaInput->value();
-    double saturation  = m_saturationInput->value();
-    double green       = m_greenInput->value();
+    double temperature  = m_temperatureInput->value()/1000.0;
+    double dark         = m_darkInput->value();
+    double black        = m_blackInput->value();
+    double mainExposure = m_mainExposureInput->value();
+    double fineExposure = m_fineExposureInput->value();
+    double gamma        = 2.0-m_gammaInput->value();
+    double saturation   = m_saturationInput->value();
+    double green        = m_greenInput->value();
             
     Digikam::WhiteBalance wbFilter(sb);
     wbFilter.whiteBalance(data, w, h, sb, 
-                          black, exposition,
+                          black, mainExposure + fineExposure,
                           temperature, green, dark, 
                           gamma, saturation);
 
@@ -619,7 +645,8 @@
 {
     m_darkInput->blockSignals(true);
     m_blackInput->blockSignals(true);
-    m_exposureInput->blockSignals(true);
+    m_mainExposureInput->blockSignals(true);
+    m_fineExposureInput->blockSignals(true);
     m_gammaInput->blockSignals(true);
     m_saturationInput->blockSignals(true);  
     m_greenInput->blockSignals(true);
@@ -628,7 +655,8 @@
     // Neutral color temperature settings.
     m_darkInput->setValue(0.5);
     m_blackInput->setValue(0.0);
-    m_exposureInput->setValue(0.0);
+    m_mainExposureInput->setValue(0.0);
+    m_fineExposureInput->setValue(0.0);
     m_gammaInput->setValue(1.0);  
     m_saturationInput->setValue(1.0);  
     m_greenInput->setValue(1.2);  
@@ -643,7 +671,8 @@
     
     m_darkInput->blockSignals(false);
     m_blackInput->blockSignals(false);
-    m_exposureInput->blockSignals(false);
+    m_mainExposureInput->blockSignals(false);
+    m_fineExposureInput->blockSignals(false);
     m_gammaInput->blockSignals(false);
     m_saturationInput->blockSignals(false);  
     m_greenInput->blockSignals(false);
@@ -660,7 +689,8 @@
 
     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_mainExposureInput->setValue(config->readDoubleNumEntry("MainExposure", 0.0));
+    m_fineExposureInput->setValue(config->readDoubleNumEntry("FineExposure", 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));  
@@ -679,7 +709,8 @@
 
     config->writeEntry("Dark", m_darkInput->value());
     config->writeEntry("Black", m_blackInput->value());
-    config->writeEntry("Exposure", m_exposureInput->value());
+    config->writeEntry("MainExposure", m_mainExposureInput->value());
+    config->writeEntry("FineExposure", m_fineExposureInput->value());
     config->writeEntry("Gamma", m_gammaInput->value());
     config->writeEntry("Saturation", m_saturationInput->value());
     config->writeEntry("Green", m_greenInput->value());
@@ -702,7 +733,7 @@
     {
         QTextStream stream( &file );
 
-        if ( stream.readLine() != "# White Color Balance Configuration File" )
+        if ( stream.readLine() != "# White Color Balance Configuration File V2" )
         {
            KMessageBox::error(this, 
                         i18n("\"%1\" is not a White Color Balance settings text file.")
@@ -715,7 +746,8 @@
         m_temperatureInput->setValue( stream.readLine().toDouble() );
         m_darkInput->setValue( stream.readLine().toDouble() );
         m_blackInput->setValue( stream.readLine().toDouble() );
-        m_exposureInput->setValue( stream.readLine().toDouble() );
+        m_mainExposureInput->setValue( stream.readLine().toDouble() );
+        m_fineExposureInput->setValue( stream.readLine().toDouble() );
         m_gammaInput->setValue( stream.readLine().toDouble() );
         m_saturationInput->setValue( stream.readLine().toDouble() );
         m_greenInput->setValue( stream.readLine().toDouble() );
@@ -743,11 +775,12 @@
     if ( file.open(IO_WriteOnly) )   
     {
         QTextStream stream( &file );        
-        stream << "# White Color Balance Configuration File\n";    
+        stream << "# White Color Balance Configuration File V2\n";    
         stream << m_temperatureInput->value() << "\n";    
         stream << m_darkInput->value() << "\n";    
         stream << m_blackInput->value() << "\n";    
-        stream << m_exposureInput->value() << "\n";    
+        stream << m_mainExposureInput->value() << "\n";    
+        stream << m_fineExposureInput->value() << "\n";    
         stream << m_gammaInput->value() << "\n";    
         stream << m_saturationInput->value() << "\n";    
         stream << m_greenInput->value() << "\n";    
--- trunk/extragear/graphics/digikam/imageplugins/whitebalance/imageeffect_whitebalance.h #647416:647417
@@ -37,6 +37,7 @@
 class QHButtonGroup;
 
 class KDoubleNumInput;
+class KActiveLabel;
 
 namespace Digikam
 {
@@ -128,15 +129,19 @@
     QLabel                       *m_temperaturePresetLabel;
     QLabel                       *m_darkLabel;
     QLabel                       *m_blackLabel;
-    QLabel                       *m_exposureLabel;
+    QLabel                       *m_mainExposureLabel;
+    QLabel                       *m_fineExposureLabel;
     QLabel                       *m_gammaLabel;
     QLabel                       *m_saturationLabel;
     QLabel                       *m_greenLabel;
     
+    KActiveLabel                 *m_exposureLabel;
+
     KDoubleNumInput              *m_temperatureInput;
     KDoubleNumInput              *m_darkInput;
     KDoubleNumInput              *m_blackInput;
-    KDoubleNumInput              *m_exposureInput;
+    KDoubleNumInput              *m_mainExposureInput;
+    KDoubleNumInput              *m_fineExposureInput;
     KDoubleNumInput              *m_gammaInput;
     KDoubleNumInput              *m_saturationInput;
     KDoubleNumInput              *m_greenInput;