[Bug 142443] New: red eye correction should change eye colour to an alternate colour

classic Classic list List threaded Threaded
35 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[Bug 142443] red eye correction should change eye colour to an alternate colour

Bugzilla from mikmach@wp.pl
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=142443         




------- Additional Comments From mikmach wp pl  2007-03-05 18:00 -------
> Maybe then even a feathered selection (i.e. one with a smooth
> transparency gradient to the outside) would be needed?
> (just a thought, haven't tried anything like that)

Such selection would be boon for many other plugins.

m.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 142443] red eye correction should change eye colour to an alternate colour

Gilles Caulier-4
In reply to this post by Oliver Dörr
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=142443         
caulier.gilles gmail com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From caulier.gilles gmail com  2007-03-05 22:53 -------
SVN commit 639741 by cgilles:

digiKam from trunk : digiKam 0.9.2 implementation continue here : red eyes correction tool can now coloring the eyes with a custom taint
BUG: 142443

 M  +46 -25    imageeffect_redeye.cpp  
 M  +7 -2      imageeffect_redeye.h  


--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_redeye.cpp #639740:639741
 @ -5,7 +5,7  @
  * Description : Red eyes correction tool for image editor
  *
  * Copyright 2004-2005 by Renchi Raju, Gilles Caulier
- * Copyright 2006 by Gilles Caulier
+ * Copyright 2006-2007 by Gilles Caulier
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
 @ -25,6 +25,8  @
 #include <qvbuttongroup.h>
 #include <qradiobutton.h>
 #include <qlayout.h>
+#include <qhbox.h>
+#include <qlabel.h>
 
 // KDE includes.
 
 @ -34,6 +36,7  @
 #include <kconfig.h>
 #include <kcursor.h>
 #include <kpassivepopup.h>
+#include <kcolorbutton.h>
 
 // Digikam includes.
 
 @ -44,6 +47,7  @
 // Local includes.
 
 #include "imageeffect_redeye.h"
+#include "imageeffect_redeye.moc"
 
 namespace DigikamImagesPluginCore
 {
 @ -53,7 +57,7  @
 public:
 
     RedEyePassivePopup(QWidget* parent)
-        : KPassivePopup(parent), m_parent(parent)          
+        : KPassivePopup(parent), m_parent(parent)
     {
     }
 
 @ -106,15 +110,18  @
     // -- save settings ----------------------------------------------
 
     bool aggressive = (dlg.result() == ImageEffect_RedEyeDlg::Aggressive);
+    QColor coloring = dlg.coloring();
+
     KConfig *config = kapp->config();
     config->setGroup("ImageViewer Settings");
     config->writeEntry("Red Eye Correction Plugin (Mild)", !aggressive);
+    config->writeEntry("Red Eye Correction Plugin (Coloring)", coloring);
     config->sync();
 
     // -- do the actual operations -----------------------------------
 
     parent->setCursor( KCursor::waitCursor() );
-    
+
     struct channel
     {
         float red_gain;
 @ -142,6 +149,10  @
     green_norm = 1.0 / (green_chan.red_gain + green_chan.green_gain + green_chan.blue_gain);
     blue_norm  = 1.0 / (blue_chan.red_gain  + blue_chan.green_gain  + blue_chan.blue_gain);
 
+    red_norm   *= coloring.red();
+    green_norm *= coloring.green();
+    blue_norm  *= coloring.blue();
+
     if (!selection.sixteenBit())         // 8 bits image.
     {
         uchar* ptr  = selection.bits();
 @ -161,11 +172,11  @
                                                  red_chan.green_gain * g +
                                                  red_chan.blue_gain  * b)));
 
-                b1 = QMIN(255, (int)(green_norm * (green_chan.red_gain   * r +
+                g1 = QMIN(255, (int)(green_norm * (green_chan.red_gain   * r +
                                                    green_chan.green_gain * g +
                                                    green_chan.blue_gain  * b)));
 
-                g1 = QMIN(255, (int)(blue_norm * (blue_chan.red_gain   * r +
+                b1 = QMIN(255, (int)(blue_norm * (blue_chan.red_gain   * r +
                                                   blue_chan.green_gain * g +
                                                   blue_chan.blue_gain  * b)));
 
 @ -194,17 +205,17  @
 
             if ( aggressive || r >= ( 2 * g) )
             {
-                r1 = QMIN(65535, (int)(red_norm * (red_chan.red_gain   * r +
-                                                   red_chan.green_gain * g +
-                                                   red_chan.blue_gain  * b)));
+                r1 = QMIN(65535, (int)(red_norm * 256 * (red_chan.red_gain   * r +
+                                                         red_chan.green_gain * g +
+                                                         red_chan.blue_gain  * b)));
 
-                b1 = QMIN(65535, (int)(green_norm * (green_chan.red_gain   * r +
-                                                     green_chan.green_gain * g +
-                                                     green_chan.blue_gain  * b)));
+                g1 = QMIN(65535, (int)(green_norm *  256 * (green_chan.red_gain   * r +
+                                                            green_chan.green_gain * g +
+                                                            green_chan.blue_gain  * b)));
 
-                g1 = QMIN(65535, (int)(blue_norm * (blue_chan.red_gain   * r +
-                                                    blue_chan.green_gain * g +
-                                                    blue_chan.blue_gain  * b)));
+                b1 = QMIN(65535, (int)(blue_norm * 256 * (blue_chan.red_gain   * r +
+                                                          blue_chan.green_gain * g +
+                                                          blue_chan.blue_gain  * b)));
 
                 nptr[0] = b1;
                 nptr[1] = g1;
 @ -232,24 +243,30  @
                                    Help|Ok|Cancel, Ok, parent, 0, true, true)
 {
     setHelp("redeyecorrectiontool.anchor", "digikam");
-    QVBoxLayout *topLayout = new QVBoxLayout( plainPage(), 0, spacingHint());
+    QVBoxLayout *topLayout = new QVBoxLayout(plainPage(), 0, spacingHint());
 
-    QVButtonGroup* buttonGroup = new QVButtonGroup( i18n("Level of Red-Eye Correction"),
-                                                    plainPage() );
-    buttonGroup->setRadioButtonExclusive( true );
+    QVButtonGroup* buttonGroup = new QVButtonGroup(i18n("Level of Red-Eye Correction"), plainPage());
+    buttonGroup->setRadioButtonExclusive(true);
 
-    QRadioButton* mildBtn = new QRadioButton( i18n("Mild (use if other parts of the face are also selected)"),
-                                              buttonGroup );
-    QRadioButton* aggrBtn = new QRadioButton( i18n("Aggressive (use if eye(s) have been selected exactly)" ),
-                                              buttonGroup );
+    QRadioButton* mildBtn = new QRadioButton(i18n("Mild (use if other parts of the face are also selected)"),
+                                             buttonGroup);
+    QRadioButton* aggrBtn = new QRadioButton(i18n("Aggressive (use if eye(s) have been selected exactly)" ),
+                                             buttonGroup);
 
-    topLayout->addWidget( buttonGroup );
-    
+    QHBox *hbox      = new QHBox(plainPage());
+    QLabel *label    = new QLabel(i18n("Eyes Coloring:"), hbox);
+    m_coloringButton = new KColorButton(Qt::black, hbox);
+
+    topLayout->addWidget(buttonGroup);
+    topLayout->addWidget(hbox);
+
     connect( buttonGroup, SIGNAL(clicked(int)),
              this, SLOT(slotClicked(int)) );
 
+    QColor black(Qt::black);
     KConfig *config = kapp->config();
     config->setGroup("ImageViewer Settings");
+    m_coloringButton->setColor(config->readColorEntry("Red Eye Correction Plugin (Coloring)", &black));
     bool mild = config->readBoolEntry("Red Eye Correction Plugin (Mild)", true);
 
     if (mild)
 @ -269,6 +286,11  @
     return (Result)m_selectedId;
 }
 
+QColor ImageEffect_RedEyeDlg::coloring() const
+{
+    return m_coloringButton->color();
+}
+
 void ImageEffect_RedEyeDlg::slotClicked(int id)
 {
     m_selectedId = id;
 @ -276,4 +298,3  @
 
 }  // NameSpace DigikamImagesPluginCore
 
-#include "imageeffect_redeye.moc"
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_redeye.h #639740:639741
 @ -5,7 +5,7  @
  * Description : Red eyes correction tool for image editor
  *
  * Copyright 2004-2005 by Renchi Raju, Gilles Caulier
- * Copyright 2006 by Gilles Caulier
+ * Copyright 2006-2007 by Gilles Caulier
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
 @ -29,6 +29,8  @
 
 class QRadioButton;
 
+class KColorButton;
+
 namespace DigikamImagesPluginCore
 {
 
 @ -53,6 +55,7  @
 
     ImageEffect_RedEyeDlg(QWidget* parent);
     Result result() const;
+    QColor coloring() const;
 
 private slots:
 
 @ -60,7 +63,9  @
 
 private:
 
-    int m_selectedId;
+    int           m_selectedId;
+
+    KColorButton *m_coloringButton;
 };
 
 }  // NameSpace DigikamImagesPluginCore
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 142443] red eye correction should change eye colour to an alternate colour

Gilles Caulier-4
In reply to this post by Oliver Dörr
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=142443         




------- Additional Comments From caulier.gilles gmail com  2007-03-06 12:36 -------
SVN commit 639957 by cgilles:

digikam from trunk : first approach to use a blending level to merge coloring taint in red eyes correction tool. level hardcoded to 64 give good result, but a clean tool dialog with a slider and a preview look better to set this parameter to the right value.

Photographers : please, i need pictures with Red Eyes face to test. Please send me some samples files by private mail (caulier dot gilles at gmail dot com). Thanks in advance...

CCBUGS: 142443




 M  +4 -3      imageeffect_redeye.cpp  


--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_redeye.cpp #639956:639957
 @ -144,14 +144,15  @
     blue_chan.blue_gain   = 1.0;
 
     float red_norm, green_norm, blue_norm;
+    int   level = 64;
 
     red_norm   = 1.0 / (red_chan.red_gain   + red_chan.green_gain   + red_chan.blue_gain);
     green_norm = 1.0 / (green_chan.red_gain + green_chan.green_gain + green_chan.blue_gain);
     blue_norm  = 1.0 / (blue_chan.red_gain  + blue_chan.green_gain  + blue_chan.blue_gain);
 
-    red_norm   *= coloring.red();
-    green_norm *= coloring.green();
-    blue_norm  *= coloring.blue();
+    red_norm   *= coloring.red()   / level;
+    green_norm *= coloring.green() / level;
+    blue_norm  *= coloring.blue()  / level;
 
     if (!selection.sixteenBit())         // 8 bits image.
     {
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 142443] red eye correction should change eye colour to an alternate colour

Gilles Caulier-4
In reply to this post by Oliver Dörr
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=142443         




------- Additional Comments From caulier.gilles gmail com  2007-03-06 12:45 -------
Created an attachment (id=19891)
 --> (http://bugs.kde.org/attachment.cgi?id=19891&action=view)
A red eyes face of my son before to use the tool
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 142443] red eye correction should change eye colour to an alternate colour

Gilles Caulier-4
In reply to this post by Oliver Dörr
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=142443         




------- Additional Comments From caulier.gilles gmail com  2007-03-06 12:46 -------
Created an attachment (id=19892)
 --> (http://bugs.kde.org/attachment.cgi?id=19892&action=view)
A red eyes face of my son after to use the tool with a dark cyan coloring taint
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 142443] red eye correction should change eye colour to an alternate colour

Gilles Caulier-4
In reply to this post by Oliver Dörr
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=142443         




------- Additional Comments From caulier.gilles gmail com  2007-03-06 21:12 -------
SVN commit 640090 by cgilles:

digiKam from trunk : digiKam 0.9.2 implementation continue here : red eyes correction again and again and again...

Now the tool have a dialog with a standard preview effect like other image editor tools. A screenshot can by seen at this url :

http://digikam3rdparty.free.fr/Screenshots/newredeyecorrectiontool.png

TODO :

- make the Red Threshold setting more configurable using a slider to adjust finely the value.
- give another slider setting to adjust the Coloring Taint blending level.

TO STUDY : The content of the eye pupil is destroyed by the flash light reflected on the retinal. Why not use a real eye small pupil photo texture ? This tecture will be in black & white using an alpha channel. We will coloring it using the taint and merge it with the original image to remplace the red area... What do you think about ?

Other implementation patched with this commit : now the image editor plugin interface can render the preview in dialog using the current selection and not only using the full image data.

CCBUGS: 142443

 M  +262 -122  imageplugins/imageeffect_redeye.cpp  
 M  +83 -16    imageplugins/imageeffect_redeye.h  
 M  +17 -1     imageplugins/imageplugin_core.cpp  
 M  +3 -1      libs/widgets/imageplugins/imageguidewidget.cpp  
 M  +2 -1      libs/widgets/imageplugins/imageguidewidget.h  
 M  +3 -2      libs/widgets/imageplugins/imagewidget.cpp  
 M  +2 -1      libs/widgets/imageplugins/imagewidget.h  
 M  +33 -3     utilities/imageeditor/editor/imageiface.cpp  
 M  +10 -0     utilities/imageeditor/editor/imageiface.h
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 142443] red eye correction should change eye colour to an alternate colour

Gilles Caulier-4
In reply to this post by Oliver Dörr
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=142443         




------- Additional Comments From caulier.gilles gmail com  2007-03-07 10:13 -------
SVN commit 640187 by cgilles:

digikam from trunk : Continue to work on Red Eyes correction tool. The dialog provide a fast acess to taint coloring selection using a HSV selector.
A new slider have been added to provide the Taint Level adjustment.

Screenshot is updated :

http://digikam3rdparty.free.fr/Screenshots/newredeyecorrectiontool.png

CCBUGS: 142443




 M  +72 -21    imageeffect_redeye.cpp  
 M  +10 -8     imageeffect_redeye.h  


--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_redeye.cpp #640186:640187
 @ -1,7 +1,7  @
 /* ============================================================
- * Author: Renchi Raju <renchi pooh tam uiuc edu>
+ * Authors: Renchi Raju <renchi pooh tam uiuc edu>
  *         Gilles Caulier <caulier dot gilles at gmail dot com>
- * Date  : 2004-06-06
+ * Date   : 2004-06-06
  * Description : Red eyes correction tool for image editor
  *
  * Copyright 2004-2005 by Renchi Raju, Gilles Caulier
 @ -44,7 +44,7  @
 #include <kconfig.h>
 #include <kcursor.h>
 #include <kstandarddirs.h>
-#include <kcolorbutton.h>
+#include <kcolordialog.h>
 
 // Digikam includes.
 
 @ -79,7 +79,7  @
     // -------------------------------------------------------------
                 
     QWidget *gboxSettings     = new QWidget(plainPage());
-    QGridLayout* gridSettings = new QGridLayout( gboxSettings, 6, 4, marginHint(), spacingHint());
+    QGridLayout* gridSettings = new QGridLayout( gboxSettings, 9, 4, marginHint(), spacingHint());
 
     QLabel *label1 = new QLabel(i18n("Channel:"), gboxSettings);
     label1->setAlignment ( Qt::AlignRight | Qt::AlignVCenter );
 @ -152,12 +152,25  @
     gridSettings->addMultiCellWidget(label2, 3, 3, 0, 4);
     gridSettings->addMultiCellWidget(m_redThreshold, 4, 4, 0, 4);
 
-    QHBox *hbox      = new QHBox(gboxSettings);
-    QLabel *label3   = new QLabel(i18n("Coloring Taint:"), hbox);
-    m_coloringButton = new KColorButton(Qt::black, hbox);
-    gridSettings->addMultiCellWidget(hbox, 5, 5, 0, 4);
+    QLabel *label3 = new QLabel(i18n("Coloring Taint:"), gboxSettings);
+    m_HSSelector   = new KHSSelector(gboxSettings);
+    m_VSelector    = new KValueSelector(gboxSettings);
+    m_HSSelector->setMinimumSize(200, 142);
+    m_VSelector->setMinimumSize(26, 142);
+    gridSettings->addMultiCellWidget(label3, 5, 5, 0, 4);
+    gridSettings->addMultiCellWidget(m_HSSelector, 6, 6, 0, 3);
+    gridSettings->addMultiCellWidget(m_VSelector, 6, 6, 4, 4);
 
-    gridSettings->setRowStretch(6, 10);    
+    QLabel *label4 = new QLabel(i18n("Taint Level:"), gboxSettings);
+    m_taintLevel   = new KIntNumInput(gboxSettings);
+    m_taintLevel->setRange(1, 200, 1, true);
+    m_taintLevel->setValue(0);
+    QWhatsThis::add( m_taintLevel, i18n("<p>Set here the taint level used to coloring red eye."));
+    gridSettings->addMultiCellWidget(label4, 7, 7, 0, 4);
+    gridSettings->addMultiCellWidget(m_taintLevel, 8, 8, 0, 4);
+
+    gridSettings->setRowStretch(9, 10);    
+    gridSettings->setColStretch(3, 10);    
     setUserAreaWidget(gboxSettings);
     
     // -------------------------------------------------------------
 @ -177,8 +190,14  @
     connect(m_redThreshold, SIGNAL(activated(int)),
             this, SLOT(slotEffect()));  
 
-    connect(m_coloringButton, SIGNAL(changed (const QColor&)),
-            this, SLOT(slotEffect()));
+    connect(m_HSSelector, SIGNAL(valueChanged(int, int)),
+            this, SLOT(slotHSChanged(int, int)));
+
+    connect(m_VSelector, SIGNAL(valueChanged(int)),
+            this, SLOT(slotTimer()));
+
+    connect(m_taintLevel, SIGNAL(valueChanged(int)),
+            this, SLOT(slotTimer()));  
 }
 
 ImageEffect_RedEye::~ImageEffect_RedEye()
 @ -192,6 +211,17  @
     delete m_previewWidget;
 }
 
+void ImageEffect_RedEye::slotHSChanged(int h, int s)
+{
+    m_VSelector->blockSignals(true);
+    m_VSelector->setHue(h);
+    m_VSelector->setSaturation(s);
+    m_VSelector->updateContents();
+    m_VSelector->repaint(false);
+    m_VSelector->blockSignals(false);  
+    slotTimer();
+}
+
 void ImageEffect_RedEye::slotChannelChanged(int channel)
 {
     switch(channel)
 @ -233,13 +263,16  @
 
 void ImageEffect_RedEye::readUserSettings()
 {
-    QColor black(Qt::black);
     KConfig* config = kapp->config();
     config->setGroup("redeye Tool Dialog");
-    m_channelCB->setCurrentItem(config->readNumEntry("Histogram Channel", 0));    // Luminosity.
+    m_channelCB->setCurrentItem(config->readNumEntry("Histogram Channel", 0)); // Luminosity.
     m_scaleBG->setButton(config->readNumEntry("Histogram Scale", Digikam::HistogramWidget::LogScaleHistogram));
     m_redThreshold->setCurrentItem(config->readNumEntry("RedThreshold", Mild));
-    m_coloringButton->setColor(config->readColorEntry("ColoringTaint", &black));
+    m_HSSelector->setXValue(config->readNumEntry("HueColoringTaint", 0));
+    m_HSSelector->setYValue(config->readNumEntry("SatColoringTaint", 0));
+    m_VSelector->setValue(config->readNumEntry("ValColoringTaint", 0));
+    m_taintLevel->setValue(config->readNumEntry("TaintLevel", 64));
+    slotHSChanged(m_HSSelector->xValue(), m_HSSelector->yValue());
     slotChannelChanged(m_channelCB->currentItem());
     slotScaleChanged(m_scaleBG->selectedId());
 }
 @ -251,19 +284,33  @
     config->writeEntry("Histogram Channel", m_channelCB->currentItem());
     config->writeEntry("Histogram Scale", m_scaleBG->selectedId());
     config->writeEntry("RedThreshold", m_redThreshold->currentItem());
-    config->writeEntry("ColoringTaint", m_coloringButton->color());
+    config->writeEntry("HueColoringTaint", m_HSSelector->xValue());
+    config->writeEntry("SatColoringTaint", m_HSSelector->yValue());
+    config->writeEntry("ValColoringTaint", m_VSelector->value());
+    config->writeEntry("TaintLevel", m_taintLevel->value());
     config->sync();
 }
 
 void ImageEffect_RedEye::resetValues()
 {
-    QColor black(Qt::black);
     m_redThreshold->blockSignals(true);
-    m_coloringButton->blockSignals(true);
+    m_HSSelector->blockSignals(true);      
+    m_VSelector->blockSignals(true);  
+    m_taintLevel->blockSignals(true);  
+
     m_redThreshold->setCurrentItem(Mild);
-    m_coloringButton->setColor(black);
+
+    // Black color by default
+    m_HSSelector->setXValue(0);
+    m_HSSelector->setYValue(0);
+    m_VSelector->setValue(0);
+
+    m_taintLevel->setValue(64);
+
     m_redThreshold->blockSignals(false);
-    m_coloringButton->blockSignals(false);      
+    m_HSSelector->blockSignals(false);      
+    m_VSelector->blockSignals(false);
+    m_taintLevel->blockSignals(false);        
 }
 
 void ImageEffect_RedEye::slotEffect()
 @ -323,8 +370,12  @
     Digikam::DImg newSelection = selection.copy();
 
     bool aggressive = (m_redThreshold->currentItem() == Mild) ? false : true;
-    QColor coloring = m_coloringButton->color();
 
+    int hue = m_HSSelector->xValue();
+    int sat = m_HSSelector->yValue();
+    int val = m_VSelector->value();
+    QColor coloring(hue, sat, val, QColor::Hsv);
+
     struct channel
     {
         float red_gain;
 @ -347,7 +398,7  @
     blue_chan.blue_gain   = 1.0;
 
     float red_norm, green_norm, blue_norm;
-    int   level = 64;
+    int   level = m_taintLevel->value();
 
     red_norm   = 1.0 / (red_chan.red_gain   + red_chan.green_gain   + red_chan.blue_gain);
     green_norm = 1.0 / (green_chan.red_gain + green_chan.green_gain + green_chan.blue_gain);
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_redeye.h #640186:640187
 @ -1,7 +1,7  @
 /* ============================================================
- * Author: Renchi Raju <renchi pooh tam uiuc edu>
+ * Authors: Renchi Raju <renchi pooh tam uiuc edu>
  *         Gilles Caulier <caulier dot gilles at gmail dot com>
- * Date  : 2004-06-06
+ * Date   : 2004-06-06
  * Description : Red eyes correction tool for image editor
  *
  * Copyright 2004-2005 by Renchi Raju, Gilles Caulier
 @ -34,7 +34,9  @
 class QComboBox;
 class QHButtonGroup;
 
-class KColorButton;
+class KHSSelector;
+class KValueSelector;
+class KIntNumInput;
 
 namespace Digikam
 {
 @ -83,7 +85,8  @
     void slotEffect();
     void slotChannelChanged(int channel);
     void slotScaleChanged(int scale);
-    void slotColorSelectedFromTarget( const Digikam::DColor &color );
+    void slotColorSelectedFromTarget(const Digikam::DColor &color);
+    void slotHSChanged(int h, int s);
 
 private:
 
 @ -122,11 +125,10  @
     
     QHButtonGroup                *m_scaleBG;  
 
-/*    KIntNumInput                 *m_bInput;
-    KIntNumInput                 *m_cInput;
-    KDoubleNumInput              *m_gInput;*/
+    KIntNumInput                 *m_taintLevel;
 
-    KColorButton                 *m_coloringButton;
+    KHSSelector                  *m_HSSelector;
+    KValueSelector               *m_VSelector;
     
     Digikam::ImageWidget         *m_previewWidget;
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 142443] red eye correction should change eye colour to an alternate colour

Gilles Caulier-4
In reply to this post by Oliver Dörr
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=142443         




------- Additional Comments From caulier.gilles gmail com  2007-03-07 12:12 -------
SVN commit 640215 by cgilles:

digikam from trunk : "Et voilà..." The new digiKam 0.9.2 Red Eyes correction tool is complete and ready to use. With this commit, There is a new slider to set the Red Color Threshold adjustment.

The screenshot is updated :

http://digikam3rdparty.free.fr/Screenshots/newredeyecorrectiontool.png

CCBUGS: 142443


 M  +57 -29    imageeffect_redeye.cpp  
 M  +10 -3     imageeffect_redeye.h  


--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_redeye.cpp #640214:640215
 @ -1,6 +1,6  @
 /* ============================================================
  * Authors: Renchi Raju <renchi pooh tam uiuc edu>
- *         Gilles Caulier <caulier dot gilles at gmail dot com>
+ *          Gilles Caulier <caulier dot gilles at gmail dot com>
  * Date   : 2004-06-06
  * Description : Red eyes correction tool for image editor
  *
 @ -33,6 +33,7  @
 #include <qlabel.h>
 #include <qpushbutton.h>
 #include <qcombobox.h>
+#include <qcheckbox.h>
 #include <qwhatsthis.h>
 #include <qtooltip.h>
 
 @ -79,7 +80,7  @
     // -------------------------------------------------------------
                 
     QWidget *gboxSettings     = new QWidget(plainPage());
-    QGridLayout* gridSettings = new QGridLayout( gboxSettings, 9, 4, marginHint(), spacingHint());
+    QGridLayout* gridSettings = new QGridLayout(gboxSettings, 10, 4, marginHint(), spacingHint());
 
     QLabel *label1 = new QLabel(i18n("Channel:"), gboxSettings);
     label1->setAlignment ( Qt::AlignRight | Qt::AlignVCenter );
 @ -142,34 +143,43  @
 
     // -------------------------------------------------------------
 
-    QLabel *label2 = new QLabel(i18n("Red Threshold:"), gboxSettings);
-    m_redThreshold = new QComboBox( false, gboxSettings );
-    m_redThreshold->insertItem( i18n("Mild"), Mild );
-    m_redThreshold->insertItem( i18n("Aggressive"), Aggressive );
-    QWhatsThis::add( m_redThreshold, i18n("<p>Set here red color threshold to use:</p>"
-                     "<b>Mild</b>: use this option if other parts of the face are also selected."
-                     "<b>Aggressive</b>: use this option only if eye(s) have been selected exactly."));
-    gridSettings->addMultiCellWidget(label2, 3, 3, 0, 4);
-    gridSettings->addMultiCellWidget(m_redThreshold, 4, 4, 0, 4);
+    m_aggressiveBox = new QCheckBox(gboxSettings);
+    m_aggressiveBox->setText(i18n("Aggressive"));
+    QWhatsThis::add(m_aggressiveBox, i18n("<p>When this option is on, the filter will use an agressive "
+                                          "red color threshold method. To use only if eye have been "
+                                          "selected exactly.</p>"
+                                          "<p>When this option is off, the filter will use an mild red "
+                                          "color threshold method. A slider will be available in this "
+                                          "case to adjust the threshold value.</p>"));
+    gridSettings->addMultiCellWidget(m_aggressiveBox, 3, 3, 0, 4);
 
+    m_thresholdlabel = new QLabel(i18n("Red Threshold:"), gboxSettings);
+    m_redThreshold   = new KIntNumInput(gboxSettings);
+    m_redThreshold->setRange(10, 90, 1, true);
+    m_redThreshold->setValue(20);
+    QWhatsThis::add(m_redThreshold, i18n("<p>Set here the red color threshold value to use. "
+                                         "Low values will select more red color pixels, high values less."));
+    gridSettings->addMultiCellWidget(m_thresholdlabel, 4, 4, 0, 4);
+    gridSettings->addMultiCellWidget(m_redThreshold, 5, 5, 0, 4);
+
     QLabel *label3 = new QLabel(i18n("Coloring Taint:"), gboxSettings);
     m_HSSelector   = new KHSSelector(gboxSettings);
     m_VSelector    = new KValueSelector(gboxSettings);
     m_HSSelector->setMinimumSize(200, 142);
     m_VSelector->setMinimumSize(26, 142);
-    gridSettings->addMultiCellWidget(label3, 5, 5, 0, 4);
-    gridSettings->addMultiCellWidget(m_HSSelector, 6, 6, 0, 3);
-    gridSettings->addMultiCellWidget(m_VSelector, 6, 6, 4, 4);
+    gridSettings->addMultiCellWidget(label3, 6, 6, 0, 4);
+    gridSettings->addMultiCellWidget(m_HSSelector, 7, 7, 0, 3);
+    gridSettings->addMultiCellWidget(m_VSelector, 7, 7, 4, 4);
 
     QLabel *label4 = new QLabel(i18n("Taint Level:"), gboxSettings);
     m_taintLevel   = new KIntNumInput(gboxSettings);
     m_taintLevel->setRange(1, 200, 1, true);
-    m_taintLevel->setValue(0);
+    m_taintLevel->setValue(128);
     QWhatsThis::add( m_taintLevel, i18n("<p>Set here the taint level used to coloring red eye."));
-    gridSettings->addMultiCellWidget(label4, 7, 7, 0, 4);
-    gridSettings->addMultiCellWidget(m_taintLevel, 8, 8, 0, 4);
+    gridSettings->addMultiCellWidget(label4, 8, 8, 0, 4);
+    gridSettings->addMultiCellWidget(m_taintLevel, 9, 9, 0, 4);
 
-    gridSettings->setRowStretch(9, 10);    
+    gridSettings->setRowStretch(10, 10);    
     gridSettings->setColStretch(3, 10);    
     setUserAreaWidget(gboxSettings);
     
 @ -187,8 +197,8  @
     connect(m_previewWidget, SIGNAL(signalResized()),
             this, SLOT(slotEffect()));    
             
-    connect(m_redThreshold, SIGNAL(activated(int)),
-            this, SLOT(slotEffect()));  
+    connect(m_redThreshold, SIGNAL(valueChanged(int)),
+            this, SLOT(slotTimer()));  
 
     connect(m_HSSelector, SIGNAL(valueChanged(int, int)),
             this, SLOT(slotHSChanged(int, int)));
 @ -198,6 +208,9  @
 
     connect(m_taintLevel, SIGNAL(valueChanged(int)),
             this, SLOT(slotTimer()));  
+
+    connect(m_aggressiveBox, SIGNAL(toggled(bool)),
+            this, SLOT(slotAggressiveToggled(bool)));      
 }
 
 ImageEffect_RedEye::~ImageEffect_RedEye()
 @ -222,6 +235,13  @
     slotTimer();
 }
 
+void ImageEffect_RedEye::slotAggressiveToggled(bool b)
+{
+    m_thresholdlabel->setEnabled(!b);
+    m_redThreshold->setEnabled(!b);
+    slotEffect();
+}
+
 void ImageEffect_RedEye::slotChannelChanged(int channel)
 {
     switch(channel)
 @ -267,11 +287,14  @
     config->setGroup("redeye Tool Dialog");
     m_channelCB->setCurrentItem(config->readNumEntry("Histogram Channel", 0)); // Luminosity.
     m_scaleBG->setButton(config->readNumEntry("Histogram Scale", Digikam::HistogramWidget::LogScaleHistogram));
-    m_redThreshold->setCurrentItem(config->readNumEntry("RedThreshold", Mild));
+    m_aggressiveBox->setChecked(config->readBoolEntry("Aggressive", false));
+    m_redThreshold->setValue(config->readNumEntry("RedThreshold", 20));
     m_HSSelector->setXValue(config->readNumEntry("HueColoringTaint", 0));
     m_HSSelector->setYValue(config->readNumEntry("SatColoringTaint", 0));
     m_VSelector->setValue(config->readNumEntry("ValColoringTaint", 0));
-    m_taintLevel->setValue(config->readNumEntry("TaintLevel", 64));
+    m_taintLevel->setValue(config->readNumEntry("TaintLevel", 128));
+    
+    slotAggressiveToggled(m_aggressiveBox->isChecked());
     slotHSChanged(m_HSSelector->xValue(), m_HSSelector->yValue());
     slotChannelChanged(m_channelCB->currentItem());
     slotScaleChanged(m_scaleBG->selectedId());
 @ -283,7 +306,8  @
     config->setGroup("redeye Tool Dialog");
     config->writeEntry("Histogram Channel", m_channelCB->currentItem());
     config->writeEntry("Histogram Scale", m_scaleBG->selectedId());
-    config->writeEntry("RedThreshold", m_redThreshold->currentItem());
+    config->writeEntry("Aggressive", m_aggressiveBox->isChecked());
+    config->writeEntry("RedThreshold", m_redThreshold->value());
     config->writeEntry("HueColoringTaint", m_HSSelector->xValue());
     config->writeEntry("SatColoringTaint", m_HSSelector->yValue());
     config->writeEntry("ValColoringTaint", m_VSelector->value());
 @ -293,20 +317,23  @
 
 void ImageEffect_RedEye::resetValues()
 {
+    m_aggressiveBox->blockSignals(true);  
     m_redThreshold->blockSignals(true);
     m_HSSelector->blockSignals(true);      
     m_VSelector->blockSignals(true);  
     m_taintLevel->blockSignals(true);  
 
-    m_redThreshold->setCurrentItem(Mild);
+    m_aggressiveBox->setChecked(false);
+    m_redThreshold->setValue(20);
 
     // Black color by default
     m_HSSelector->setXValue(0);
     m_HSSelector->setYValue(0);
     m_VSelector->setValue(0);
 
-    m_taintLevel->setValue(64);
+    m_taintLevel->setValue(128);
 
+    m_aggressiveBox->blockSignals(false);  
     m_redThreshold->blockSignals(false);
     m_HSSelector->blockSignals(false);      
     m_VSelector->blockSignals(false);
 @ -369,7 +396,8  @
 {
     Digikam::DImg newSelection = selection.copy();
 
-    bool aggressive = (m_redThreshold->currentItem() == Mild) ? false : true;
+    bool  aggressive   = m_aggressiveBox->isChecked();
+    float redThreshold = m_redThreshold->value()/10.0;
 
     int hue = m_HSSelector->xValue();
     int sat = m_HSSelector->yValue();
 @ -398,7 +426,7  @
     blue_chan.blue_gain   = 1.0;
 
     float red_norm, green_norm, blue_norm;
-    int   level = m_taintLevel->value();
+    int   level = 201 - m_taintLevel->value();
 
     red_norm   = 1.0 / (red_chan.red_gain   + red_chan.green_gain   + red_chan.blue_gain);
     green_norm = 1.0 / (green_chan.red_gain + green_chan.green_gain + green_chan.blue_gain);
 @ -421,7 +449,7  @
             r = ptr[2];
             a = ptr[3];
 
-            if ( aggressive || r >= ( 2 * g) )
+            if ( aggressive || r >= ( redThreshold * g) )
             {
                 r1 = QMIN(255, (int)(red_norm * (red_chan.red_gain   * r +
                                                  red_chan.green_gain * g +
 @ -458,7 +486,7  @
             r = ptr[2];
             a = ptr[3];
 
-            if ( aggressive || r >= ( 2 * g) )
+            if ( aggressive || r >= ( redThreshold * g) )
             {
                 r1 = QMIN(65535, (int)(red_norm * 256 * (red_chan.red_gain   * r +
                                                          red_chan.green_gain * g +
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_redeye.h #640214:640215
 @ -1,6 +1,6  @
 /* ============================================================
  * Authors: Renchi Raju <renchi pooh tam uiuc edu>
- *         Gilles Caulier <caulier dot gilles at gmail dot com>
+ *          Gilles Caulier <caulier dot gilles at gmail dot com>
  * Date   : 2004-06-06
  * Description : Red eyes correction tool for image editor
  *
 @ -31,7 +31,9  @
 
 #include "imagedlgbase.h"
 
+class QLabel;
 class QComboBox;
+class QCheckBox;
 class QHButtonGroup;
 
 class KHSSelector;
 @ -87,6 +89,7  @
     void slotScaleChanged(int scale);
     void slotColorSelectedFromTarget(const Digikam::DColor &color);
     void slotHSChanged(int h, int s);
+    void slotAggressiveToggled(bool b);
 
 private:
 
 @ -120,12 +123,16  @
 
     uchar                        *m_destinationPreviewData;
 
+    QLabel                       *m_thresholdlabel;
+
     QComboBox                    *m_channelCB;  
-    QComboBox                    *m_redThreshold;
-    
+
+    QCheckBox                    *m_aggressiveBox;    
+
     QHButtonGroup                *m_scaleBG;  
 
     KIntNumInput                 *m_taintLevel;
+    KIntNumInput                 *m_redThreshold;
 
     KHSSelector                  *m_HSSelector;
     KValueSelector               *m_VSelector;
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 142443] red eye correction should change eye colour to an alternate colour

Gilles Caulier-4
In reply to this post by Oliver Dörr
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=142443         




------- Additional Comments From caulier.gilles gmail com  2007-03-07 16:01 -------
SVN commit 640295 by cgilles:

digikam from trunk : Red Eyes correction tool improvements !!!

Gerhard,

I have found an indeep bug into the Renchi algorithm about Alpha channel rule used to merge red pixels mask and original image. With the new implementation, we can use a gaussian blur effect on the mask to polish the pupil border. With the old implementation, all the mask is blured. With the new, only the pupil pixels are blured.

I have add a new "Smooth" adjsutment witch can control the gaussian blur effect. The result are very nice (:=)))...

Question: I think than the "Agressive" settings is obsolete now. What do you think about ?

The screenshot is updated again :

http://digikam3rdparty.free.fr/Screenshots/newredeyecorrectiontool.png

CCBUGS: 142443


 M  +64 -25    imageeffect_redeye.cpp  
 M  +3 -1      imageeffect_redeye.h  


--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_redeye.cpp #640294:640295
 @ -55,6 +55,7  @
 #include "colorgradientwidget.h"
 #include "bcgmodifier.h"
 #include "dimg.h"
+#include "dimgimagefilters.h"
 
 // Local includes.
 
 @ -80,7 +81,7  @
     // -------------------------------------------------------------
                 
     QWidget *gboxSettings     = new QWidget(plainPage());
-    QGridLayout* gridSettings = new QGridLayout(gboxSettings, 10, 4, marginHint(), spacingHint());
+    QGridLayout* gridSettings = new QGridLayout(gboxSettings, 12, 4, marginHint(), spacingHint());
 
     QLabel *label1 = new QLabel(i18n("Channel:"), gboxSettings);
     label1->setAlignment ( Qt::AlignRight | Qt::AlignVCenter );
 @ -146,40 +147,49  @
     m_aggressiveBox = new QCheckBox(gboxSettings);
     m_aggressiveBox->setText(i18n("Aggressive"));
     QWhatsThis::add(m_aggressiveBox, i18n("<p>When this option is on, the filter will use an agressive "
-                                          "red color threshold method. To use only if eye have been "
+                                          "sensitivity. To use only if eye have been "
                                           "selected exactly.</p>"
-                                          "<p>When this option is off, the filter will use an mild red "
-                                          "color threshold method. A slider will be available in this "
-                                          "case to adjust the threshold value.</p>"));
+                                          "<p>When this option is off, the filter will use an mild "
+                                          "sensitivity. Use the slider to adjust the threshold of "
+                                          "red color pixels selection.</p>"));
     gridSettings->addMultiCellWidget(m_aggressiveBox, 3, 3, 0, 4);
 
-    m_thresholdlabel = new QLabel(i18n("Red Threshold:"), gboxSettings);
+    m_thresholdLabel = new QLabel(i18n("Sensitivity:"), gboxSettings);
     m_redThreshold   = new KIntNumInput(gboxSettings);
     m_redThreshold->setRange(10, 90, 1, true);
     m_redThreshold->setValue(20);
-    QWhatsThis::add(m_redThreshold, i18n("<p>Set here the red color threshold value to use. "
+    QWhatsThis::add(m_redThreshold, i18n("<p>Set here the red color pixels selection threshold. "
                                          "Low values will select more red color pixels, high values less."));
-    gridSettings->addMultiCellWidget(m_thresholdlabel, 4, 4, 0, 4);
+    gridSettings->addMultiCellWidget(m_thresholdLabel, 4, 4, 0, 4);
     gridSettings->addMultiCellWidget(m_redThreshold, 5, 5, 0, 4);
 
+    m_smoothLabel  = new QLabel(i18n("Smooth:"), gboxSettings);
+    m_smoothLevel = new KIntNumInput(gboxSettings);
+    m_smoothLevel->setRange(0, 10, 1, true);
+    m_smoothLevel->setValue(3);
+    QWhatsThis::add(m_smoothLevel, i18n("<p>Set here the smootness value used to blur red color "
+                                        "pixels selection."));
+    gridSettings->addMultiCellWidget(m_smoothLabel, 6, 6, 0, 4);
+    gridSettings->addMultiCellWidget(m_smoothLevel, 7, 7, 0, 4);
+
     QLabel *label3 = new QLabel(i18n("Coloring Taint:"), gboxSettings);
     m_HSSelector   = new KHSSelector(gboxSettings);
     m_VSelector    = new KValueSelector(gboxSettings);
     m_HSSelector->setMinimumSize(200, 142);
     m_VSelector->setMinimumSize(26, 142);
-    gridSettings->addMultiCellWidget(label3, 6, 6, 0, 4);
-    gridSettings->addMultiCellWidget(m_HSSelector, 7, 7, 0, 3);
-    gridSettings->addMultiCellWidget(m_VSelector, 7, 7, 4, 4);
+    gridSettings->addMultiCellWidget(label3, 8, 8, 0, 4);
+    gridSettings->addMultiCellWidget(m_HSSelector, 9, 9, 0, 3);
+    gridSettings->addMultiCellWidget(m_VSelector, 9, 9, 4, 4);
 
     QLabel *label4 = new QLabel(i18n("Taint Level:"), gboxSettings);
     m_taintLevel   = new KIntNumInput(gboxSettings);
     m_taintLevel->setRange(1, 200, 1, true);
     m_taintLevel->setValue(128);
     QWhatsThis::add( m_taintLevel, i18n("<p>Set here the taint level used to coloring red eye."));
-    gridSettings->addMultiCellWidget(label4, 8, 8, 0, 4);
-    gridSettings->addMultiCellWidget(m_taintLevel, 9, 9, 0, 4);
+    gridSettings->addMultiCellWidget(label4, 10, 10, 0, 4);
+    gridSettings->addMultiCellWidget(m_taintLevel, 11, 11, 0, 4);
 
-    gridSettings->setRowStretch(10, 10);    
+    gridSettings->setRowStretch(12, 10);    
     gridSettings->setColStretch(3, 10);    
     setUserAreaWidget(gboxSettings);
     
 @ -200,6 +210,9  @
     connect(m_redThreshold, SIGNAL(valueChanged(int)),
             this, SLOT(slotTimer()));  
 
+    connect(m_smoothLevel, SIGNAL(valueChanged(int)),
+            this, SLOT(slotTimer()));  
+
     connect(m_HSSelector, SIGNAL(valueChanged(int, int)),
             this, SLOT(slotHSChanged(int, int)));
 
 @ -237,8 +250,10  @
 
 void ImageEffect_RedEye::slotAggressiveToggled(bool b)
 {
-    m_thresholdlabel->setEnabled(!b);
+    m_thresholdLabel->setEnabled(!b);
     m_redThreshold->setEnabled(!b);
+    m_smoothLabel->setEnabled(!b);
+    m_smoothLevel->setEnabled(!b);
     slotEffect();
 }
 
 @ -289,6 +304,7  @
     m_scaleBG->setButton(config->readNumEntry("Histogram Scale", Digikam::HistogramWidget::LogScaleHistogram));
     m_aggressiveBox->setChecked(config->readBoolEntry("Aggressive", false));
     m_redThreshold->setValue(config->readNumEntry("RedThreshold", 20));
+    m_smoothLevel->setValue(config->readNumEntry("SmoothLevel", 3));
     m_HSSelector->setXValue(config->readNumEntry("HueColoringTaint", 0));
     m_HSSelector->setYValue(config->readNumEntry("SatColoringTaint", 0));
     m_VSelector->setValue(config->readNumEntry("ValColoringTaint", 0));
 @ -308,6 +324,7  @
     config->writeEntry("Histogram Scale", m_scaleBG->selectedId());
     config->writeEntry("Aggressive", m_aggressiveBox->isChecked());
     config->writeEntry("RedThreshold", m_redThreshold->value());
+    config->writeEntry("SmoothLevel", m_smoothLevel->value());
     config->writeEntry("HueColoringTaint", m_HSSelector->xValue());
     config->writeEntry("SatColoringTaint", m_HSSelector->yValue());
     config->writeEntry("ValColoringTaint", m_VSelector->value());
 @ -325,6 +342,7  @
 
     m_aggressiveBox->setChecked(false);
     m_redThreshold->setValue(20);
+    m_smoothLevel->setValue(3);
 
     // Black color by default
     m_HSSelector->setXValue(0);
 @ -394,8 +412,11  @
 
 void ImageEffect_RedEye::redEyeFilter(Digikam::DImg& selection)
 {
-    Digikam::DImg newSelection = selection.copy();
+    Digikam::DImg mask(selection.width(), selection.height(), selection.sixteenBit(), true,
+                       selection.bits(), true);
 
+    selection = mask.copy();
+
     bool  aggressive   = m_aggressiveBox->isChecked();
     float redThreshold = m_redThreshold->value()/10.0;
 
 @ -439,8 +460,8  @
     if (!selection.sixteenBit())         // 8 bits image.
     {
         uchar* ptr  = selection.bits();
-        uchar* nptr = newSelection.bits();
-        uchar  r, g, b, a, r1, g1, b1;
+        uchar* nptr = mask.bits();
+        uchar  r, g, b, a, r1, g1, b1, a1;
 
         for (uint i = 0 ; i < selection.width() * selection.height() ; i++)
         {
 @ -463,12 +484,16  @
                                                   blue_chan.green_gain * g +
                                                   blue_chan.blue_gain  * b)));
 
+                a1 = QMIN( (int)((r-g) / 150.0 * 255.0), 255);
                 nptr[0] = b1;
                 nptr[1] = g1;
                 nptr[2] = r1;
-                nptr[3] = QMIN( (int)((r-g) / 150.0 * 255.0), 255);
+                nptr[3] = a1;
             }
 
+            ptr[3]  = nptr[3];
+            nptr[3] = 255-ptr[3];
+
             ptr += 4;
             nptr+= 4;
         }
 @ -476,8 +501,8  @
     else                                 // 16 bits image.
     {
         unsigned short* ptr  = (unsigned short*)selection.bits();
-        unsigned short* nptr = (unsigned short*)newSelection.bits();
-        unsigned short  r, g, b, a, r1, g1, b1;
+        unsigned short* nptr = (unsigned short*)mask.bits();
+        unsigned short  r, g, b, a, r1, g1, b1, a1;
 
         for (uint i = 0 ; i < selection.width() * selection.height() ; i++)
         {
 @ -500,21 +525,35  @
                                                           blue_chan.green_gain * g +
                                                           blue_chan.blue_gain  * b)));
 
+                a1 = QMIN( (int)((r-g) / 38400.0 * 65535.0), 65535);
+        
                 nptr[0] = b1;
                 nptr[1] = g1;
                 nptr[2] = r1;
-                nptr[3] = QMIN( (int)((r-g) / 38400.0 * 65535.0), 65535);
+                nptr[3] = a1;
             }
 
+            ptr[3]  = nptr[3];
+            nptr[3] = 65535-ptr[3];
+
             ptr += 4;
             nptr+= 4;
         }
     }
 
-    // - Perform pixels blending using alpha channel to blur a little the result.
+    if (!aggressive)
+    {
+        Digikam::DImgImageFilters filter;
+        filter.gaussianBlurImage(mask.bits(), mask.width(), mask.height(),
+                                 mask.sixteenBit(), m_smoothLevel->value());
+    }
 
-    selection.bitBlend_RGBA2RGB(newSelection, 0, 0, selection.width(), selection.height());
+    // - Perform pixels blending using alpha channel.
+
+    Digikam::DColorComposer *composer = Digikam::DColorComposer::getComposer(Digikam::DColorComposer::PorterDuffNone);
+    selection.bitBlendImage(composer, &mask,
+                            0, 0, mask.width(), mask.height(),
+                            0, 0);
 }
 
 }  // NameSpace DigikamImagesPluginCore
-
--- trunk/extragear/graphics/digikam/imageplugins/imageeffect_redeye.h #640294:640295
 @ -123,7 +123,8  @
 
     uchar                        *m_destinationPreviewData;
 
-    QLabel                       *m_thresholdlabel;
+    QLabel                       *m_thresholdLabel;
+    QLabel                       *m_smoothLabel;
 
     QComboBox                    *m_channelCB;  
 
 @ -133,6 +134,7  @
 
     KIntNumInput                 *m_taintLevel;
     KIntNumInput                 *m_redThreshold;
+    KIntNumInput                 *m_smoothLevel;
 
     KHSSelector                  *m_HSSelector;
     KValueSelector               *m_VSelector;
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Bug 142443] red eye correction should change eye colour to an alternate colour

F.J.Cruz-2
El Miércoles, 7 de Marzo de 2007, Gilles Caulier escribió:

> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.
>
> http://bugs.kde.org/show_bug.cgi?id=142443
>
>
>
>
> ------- Additional Comments From caulier.gilles gmail com  2007-03-07 16:01
> ------- SVN commit 640295 by cgilles:
>
> digikam from trunk : Red Eyes correction tool improvements !!!
>
> Gerhard,
>
> I have found an indeep bug into the Renchi algorithm about Alpha channel
> rule used to merge red pixels mask and original image. With the new
> implementation, we can use a gaussian blur effect on the mask to polish the
> pupil border. With the old implementation, all the mask is blured. With the
> new, only the pupil pixels are blured.
>
> I have add a new "Smooth" adjsutment witch can control the gaussian blur
> effect. The result are very nice (:=)))...
>
> Question: I think than the "Agressive" settings is obsolete now. What do
> you think about ?
>
> The screenshot is updated again :
>
> http://digikam3rdparty.free.fr/Screenshots/newredeyecorrectiontool.png

Congratulations Gilles, you have done an _excellent_ work. This plugins needed
a deep review and you have done it.

Paco Cruz.


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Bug 142443] red eye correction should change eye colour to an alternate colour

Gerhard Kulzer
In reply to this post by Gilles Caulier-4
Am Wednesday 07 March 2007 schrieb Gilles Caulier:

>
> digikam from trunk : Red Eyes correction tool improvements !!!
>
> Gerhard,
>
> I have found an indeep bug into the Renchi algorithm about Alpha channel
> rule used to merge red pixels mask and original image. With the new
> implementation, we can use a gaussian blur effect on the mask to polish the
> pupil border. With the old implementation, all the mask is blured. With the
> new, only the pupil pixels are blured.
>
> I have add a new "Smooth" adjsutment witch can control the gaussian blur
> effect. The result are very nice (:=)))...
>
> Question: I think than the "Agressive" settings is obsolete now. What do
> you think about ?
>
> The screenshot is updated again :
>
> http://digikam3rdparty.free.fr/Screenshots/newredeyecorrectiontool.png
>
> CCBUGS: 142443
>
Gilles, I tried it, and it's better than the one we had.
I think the blurring could be stronger, say 20, it still shows relatively hard
edges. I tried it with 20, think it is good.

The aggressive tool can be taken away, I agree.

But the transparency of the blob is too high, it doesn't really cover the red
eye (or something is not yet functioning right, the zoomed image does not
correspond to the flattened image).

Gerhard

--
Hakuna matata
http://www.gerhard.fr

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

[Bug 142443] red eye correction should change eye colour to an alternate colour

Gerhard Kulzer
In reply to this post by Oliver Dörr
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=142443         




------- Additional Comments From gerhard kulzer net  2007-03-07 18:57 -------
Am Wednesday 07 March 2007 schrieb Gilles Caulier:

>
> digikam from trunk : Red Eyes correction tool improvements !!!
>
> Gerhard,
>
> I have found an indeep bug into the Renchi algorithm about Alpha channel
> rule used to merge red pixels mask and original image. With the new
> implementation, we can use a gaussian blur effect on the mask to polish the
> pupil border. With the old implementation, all the mask is blured. With the
> new, only the pupil pixels are blured.
>
> I have add a new "Smooth" adjsutment witch can control the gaussian blur
> effect. The result are very nice (:=)))...
>
> Question: I think than the "Agressive" settings is obsolete now. What do
> you think about ?
>
> The screenshot is updated again :
>
> http://digikam3rdparty.free.fr/Screenshots/newredeyecorrectiontool.png
>
> CCBUGS: 142443
>


Gilles, I tried it, and it's better than the one we had.
I think the blurring could be stronger, say 20, it still shows relatively hard
edges. I tried it with 20, think it is good.

The aggressive tool can be taken away, I agree.

But the transparency of the blob is too high, it doesn't really cover the red
eye (or something is not yet functioning right, the zoomed image does not
correspond to the flattened image).

Gerhard
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 142443] red eye correction should change eye colour to an alternate colour

Gilles Caulier-4
In reply to this post by Oliver Dörr
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=142443         




------- Additional Comments From caulier.gilles gmail com  2007-03-08 16:18 -------
SVN commit 640606 by cgilles:

digikam from trunk: Red Eyes correction tool :

- remove obsolete 'Aggressive' options.
- Adapt Gausian blur radius to real image size and not preview.
- Fix 16 bits color depth Taint Levels to right value
- Blur only the pixels extracted from the Red Color using Alpha Channel informations.
- Preformance optimization of algorithm.

CCBUGS: 142443

 M  +111 -103  imageeffect_redeye.cpp  
 M  +0 -4      imageeffect_redeye.h
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Bug 142443] red eye correction should change eye colour to an alternate colour

Gerhard Kulzer
Am Thursday 08 March 2007 schrieb Gilles Caulier:

> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.
>
> http://bugs.kde.org/show_bug.cgi?id=142443
>
>
>
>
> ------- Additional Comments From caulier.gilles gmail com  2007-03-08 16:18
> ------- SVN commit 640606 by cgilles:
>
> digikam from trunk: Red Eyes correction tool :
>
> - remove obsolete 'Aggressive' options.
> - Adapt Gausian blur radius to real image size and not preview.
> - Fix 16 bits color depth Taint Levels to right value
> - Blur only the pixels extracted from the Red Color using Alpha Channel
> informations. - Preformance optimization of algorithm.
>
> CCBUGS: 142443
>
>  M  +111 -103  imageeffect_redeye.cpp
>  M  +0 -4      imageeffect_redeye.h
> _______________________________________________
Gilles, I try to make sense of the 'Taint Level' parameter in the new and
wonderful red eye plugin to update the documentation and help strings. But i
can't (neither by experimenting nor by reading the code). I see what it does
but can't categorize it. As it is, I think it is too esoteric.
Can you educate me on that one?

Gerhard

--
Hakuna matata
http://www.gerhard.fr

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

[Bug 142443] red eye correction should change eye colour to an alternate colour

Gerhard Kulzer
In reply to this post by Oliver Dörr
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=142443         




------- Additional Comments From gerhard kulzer net  2007-03-10 12:18 -------
Am Thursday 08 March 2007 schrieb Gilles Caulier:
[bugs.kde.org quoted mail]
Gilles, I try to make sense of the 'Taint Level' parameter in the new and
wonderful red eye plugin to update the documentation and help strings. But i
can't (neither by experimenting nor by reading the code). I see what it does
but can't categorize it. As it is, I think it is too esoteric.
Can you educate me on that one?

Gerhard
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
12