[Digikam-devel] extragear/graphics/digikam/imageplugins/noisereduction

Gilles Caulier caulier.gilles at gmail.com
Wed Jul 4 13:33:12 BST 2007


SVN commit 683229 by cgilles:

digiKam from trunk: complete KDE4 port of NoiseReduction image plugin.
CCMAIL: digikam-devel at kde.org


 M  +10 -17    CMakeLists.txt  
 M  +47 -56    imageeffect_noisereduction.cpp  
 M  +3 -3      imageplugin_noisereduction.cpp  
 M  +1 -2      imageplugin_noisereduction.h  


--- trunk/extragear/graphics/digikam/imageplugins/noisereduction/CMakeLists.txt #683228:683229
@@ -1,23 +1,16 @@
 
-include_directories( ${CMAKE_SOURCE_DIR}/digikam/utilities/imageeditor/editor ${CMAKE_SOURCE_DIR}/digikam/utilities/imageeditor/canvas ${CMAKE_SOURCE_DIR}/digikam/libs/histogram ${CMAKE_SOURCE_DIR}/digikam/libs/levels ${CMAKE_SOURCE_DIR}/digikam/libs/curves ${CMAKE_SOURCE_DIR}/digikam/libs/whitebalance ${CMAKE_SOURCE_DIR}/digikam/libs/widgets/common ${CMAKE_SOURCE_DIR}/digikam/libs/widgets/iccprofiles ${CMAKE_SOURCE_DIR}/digikam/libs/widgets/imageplugins ${CMAKE_SOURCE_DIR}/digikam/libs/dialogs ${CMAKE_SOURCE_DIR}/digikam/libs/dimg ${CMAKE_SOURCE_DIR}/digikam/libs/dmetadata ${CMAKE_SOURCE_DIR}/digikam/libs/dimg/filters ${CMAKE_SOURCE_DIR}/digikam/digikam   )
+SET(digikamimageplugin_noisereduction_PART_SRCS imageplugin_noisereduction.cpp
+                                                imageeffect_noisereduction.cpp
+                                                noisereduction.cpp 
+   )
 
+KDE4_AUTOMOC(${digikamimageplugin_noisereduction_PART_SRCS})
 
-########### next target ###############
+KDE4_ADD_PLUGIN(digikamimageplugin_noisereduction ${digikamimageplugin_noisereduction_PART_SRCS})
 
-set(digikamimageplugin_noisereduction_PART_SRCS imageplugin_noisereduction.cpp imageeffect_noisereduction.cpp noisereduction.cpp )
+TARGET_LINK_LIBRARIES(digikamimageplugin_noisereduction digikam)
 
-kde4_automoc(${digikamimageplugin_noisereduction_PART_SRCS})
+INSTALL(TARGETS digikamimageplugin_noisereduction DESTINATION ${PLUGIN_INSTALL_DIR})
 
-kde4_add_plugin(digikamimageplugin_noisereduction ${digikamimageplugin_noisereduction_PART_SRCS})
-
-target_link_libraries(digikamimageplugin_noisereduction  digikam )
-
-install(TARGETS digikamimageplugin_noisereduction DESTINATION ${PLUGIN_INSTALL_DIR} )
-
-
-########### install files ###############
-
-install( FILES  digikamimageplugin_noisereduction_ui.rc DESTINATION ${DATA_INSTALL_DIR}/digikam )
-install( FILES  digikamimageplugin_noisereduction.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
-
-
+INSTALL(FILES digikamimageplugin_noisereduction_ui.rc DESTINATION ${DATA_INSTALL_DIR}/digikam)
+INSTALL(FILES digikamimageplugin_noisereduction.desktop DESTINATION ${SERVICES_INSTALL_DIR})
--- trunk/extragear/graphics/digikam/imageplugins/noisereduction/imageeffect_noisereduction.cpp #683228:683229
@@ -23,19 +23,15 @@
 
 // Qt includes.
 
-#include <qlabel.h>
+#include <QLabel>
+#include <QCheckBox>
+#include <QString>
+#include <QTabWidget>
+#include <QImage>
+#include <QFile>
+#include <QTextStream>
+#include <QGridLayout>
 
-#include <qtooltip.h>
-#include <qcheckbox.h>
-#include <qstring.h>
-#include <qtabwidget.h>
-#include <qimage.h>
-#include <qlayout.h>
-#include <qfile.h>
-#include <q3textstream.h>
-//Added by qt3to4:
-#include <Q3GridLayout>
-
 // KDE includes.
 
 #include <klocale.h>
@@ -90,15 +86,15 @@
    
     // -------------------------------------------------------------
 
-    QTabWidget *mainTab = new QTabWidget(m_imagePreviewWidget);
-    
-    QWidget* firstPage = new QWidget( mainTab );
-    Q3GridLayout* gridSettings = new Q3GridLayout( firstPage, 6, 1, spacingHint());    
+    QTabWidget *mainTab       = new QTabWidget(m_imagePreviewWidget);
+    QWidget* firstPage        = new QWidget( mainTab );
+    QGridLayout* gridSettings = new QGridLayout(firstPage);
+
     mainTab->addTab( firstPage, i18n("Details") );
     
     QLabel *label1 = new QLabel(i18n("Radius:"), firstPage);
     
-    m_radiusInput = new KDoubleNumInput(firstPage);
+    m_radiusInput  = new KDoubleNumInput(firstPage);
     m_radiusInput->setPrecision(1);
     m_radiusInput->setRange(0.0, 10.0, 0.1, true);
     m_radiusInput->setWhatsThis( i18n("<p><b>Radius</b>: this control selects the "
@@ -110,12 +106,9 @@
                                          "or somewhat more. If it is set higher than necessary, then it "
                                          "can cause unwanted blur."));
 
-    gridSettings->addMultiCellWidget(label1, 0, 0, 0, 0);
-    gridSettings->addMultiCellWidget(m_radiusInput, 0, 0, 1, 1);
-    
     // -------------------------------------------------------------
 
-    QLabel *label3 = new QLabel(i18n("Threshold:"), firstPage);
+    QLabel *label3   = new QLabel(i18n("Threshold:"), firstPage);
     
     m_thresholdInput = new KDoubleNumInput(firstPage);
     m_thresholdInput->setPrecision(2);
@@ -128,9 +121,6 @@
                      "\"smooth\", and \"blur\" is very small. Adjust it as carefully as you would adjust "
                      "the focus of a camera."));
 
-    gridSettings->addMultiCellWidget(label3, 1, 1, 0, 0);
-    gridSettings->addMultiCellWidget(m_thresholdInput, 1, 1, 1, 1);
-                                                      
     // -------------------------------------------------------------
   
     QLabel *label4 = new QLabel(i18n("Texture:"), firstPage);
@@ -143,12 +133,9 @@
                 "then noise and texture are blurred out, when increased then texture is "
                 "amplified, but also noise will increase. It has almost no effect on image edges."));
 
-    gridSettings->addMultiCellWidget(label4, 2, 2, 0, 0);
-    gridSettings->addMultiCellWidget(m_textureInput, 2, 2, 1, 1);
-
     // -------------------------------------------------------------
 
-    QLabel *label7 = new QLabel(i18n("Sharpness:"), firstPage);  // Filter setting "Lookahead".
+    QLabel *label7   = new QLabel(i18n("Sharpness:"), firstPage);  // Filter setting "Lookahead".
     
     m_sharpnessInput = new KDoubleNumInput(firstPage);
     m_sharpnessInput->setPrecision(2);
@@ -159,12 +146,9 @@
             "Set it near to maximum, if you want to remove very weak noise or JPEG-artifacts, "
             "without losing detail."));
        
-    gridSettings->addMultiCellWidget(label7, 3, 3, 0, 0);
-    gridSettings->addMultiCellWidget(m_sharpnessInput, 3, 3, 1, 1);
-
     // -------------------------------------------------------------
 
-    QLabel *label5 = new QLabel(i18n("Edge Lookahead:"), firstPage);     // Filter setting "Sharp".
+    QLabel *label5   = new QLabel(i18n("Edge Lookahead:"), firstPage);     // Filter setting "Sharp".
     
     m_lookaheadInput = new KDoubleNumInput(firstPage);
     m_lookaheadInput->setPrecision(2);
@@ -176,32 +160,41 @@
            "When this value is too high, the adaptive filter can no longer accurately track "
            "image details, and noise or blurring can occur."));
 
-    gridSettings->addMultiCellWidget(label5, 4, 4, 0, 0);
-    gridSettings->addMultiCellWidget(m_lookaheadInput, 4, 4, 1, 1);
-
     // -------------------------------------------------------------
 
     QLabel *label10 = new QLabel(i18n("Erosion:"), firstPage);
     
-    m_phaseInput = new KDoubleNumInput(firstPage);
+    m_phaseInput    = new KDoubleNumInput(firstPage);
     m_phaseInput->setPrecision(1);
     m_phaseInput->setRange(0.5, 20.0, 0.5, true);
     m_phaseInput->setWhatsThis( i18n("<p><b>Erosion</b>: "
                 "Use this to increase edge noise erosion and spike noise erosion "
                 "(noise is removed by erosion)."));
     
+    gridSettings->addMultiCellWidget(label1, 0, 0, 0, 0);
+    gridSettings->addMultiCellWidget(m_radiusInput, 0, 0, 1, 1);
+    gridSettings->addMultiCellWidget(label3, 1, 1, 0, 0);
+    gridSettings->addMultiCellWidget(m_thresholdInput, 1, 1, 1, 1);
+    gridSettings->addMultiCellWidget(label4, 2, 2, 0, 0);
+    gridSettings->addMultiCellWidget(m_textureInput, 2, 2, 1, 1);
+    gridSettings->addMultiCellWidget(label7, 3, 3, 0, 0);
+    gridSettings->addMultiCellWidget(m_sharpnessInput, 3, 3, 1, 1);
+    gridSettings->addMultiCellWidget(label5, 4, 4, 0, 0);
+    gridSettings->addMultiCellWidget(m_lookaheadInput, 4, 4, 1, 1);
     gridSettings->addMultiCellWidget(label10, 5, 5, 0, 0);
     gridSettings->addMultiCellWidget(m_phaseInput, 5, 5, 1, 1);
-    gridSettings->setColStretch(1, 10);
+    gridSettings->setColumnStretch(1, 10);
     gridSettings->setRowStretch(6, 10);
+    gridSettings->setMargin(spacingHint());    
+    gridSettings->setSpacing(0);    
 
     // -------------------------------------------------------------
 
-    QWidget* secondPage = new QWidget( mainTab );
-    Q3GridLayout* gridSettings2 = new Q3GridLayout( secondPage, 4, 1, spacingHint());    
+    QWidget* secondPage        = new QWidget( mainTab );
+    QGridLayout* gridSettings2 = new QGridLayout( secondPage );    
     mainTab->addTab( secondPage, i18n("Advanced") );
     
-    QLabel *label2 = new QLabel(i18n("Luminance:"), secondPage);
+    QLabel *label2      = new QLabel(i18n("Luminance:"), secondPage);
     
     m_lumToleranceInput = new KDoubleNumInput(secondPage);
     m_lumToleranceInput->setPrecision(1);
@@ -211,10 +204,7 @@
                 "to make an image correction, not both at the same time. These settings "
                 "do not influence the main smoothing process controlled by the <b>Details</b> "
                 "settings."));
-
-    gridSettings2->addMultiCellWidget(label2, 0, 0, 0, 0);
-    gridSettings2->addMultiCellWidget(m_lumToleranceInput, 0, 0, 1, 1);                         
-    
+   
     // -------------------------------------------------------------
 
     QLabel *label6 = new QLabel(i18n("Color:"), secondPage);
@@ -227,24 +217,18 @@
                 "to make image correction, not both at the same time. These settings "
                 "do not influence the main smoothing process controlled by the <b>Details</b> "
                 "settings."));
-
-    gridSettings2->addMultiCellWidget(label6, 1, 1, 0, 0);
-    gridSettings2->addMultiCellWidget(m_csmoothInput, 1, 1, 1, 1);
-    
+   
     // -------------------------------------------------------------
 
     QLabel *label8 = new QLabel(i18n("Gamma:"), secondPage);
     
-    m_gammaInput = new KDoubleNumInput(secondPage);
+    m_gammaInput   = new KDoubleNumInput(secondPage);
     m_gammaInput->setPrecision(1);
     m_gammaInput->setRange(0.3, 3.0, 0.1, true);
     m_gammaInput->setWhatsThis( i18n("<p><b>Gamma</b>: this control sets the gamma tolerance of the image. This value "
                 "can be used to increase the tolerance values for darker areas (which commonly "
                 "are noisier). This results in more blur for shadow areas."));
     
-    gridSettings2->addMultiCellWidget(label8, 2, 2, 0, 0);
-    gridSettings2->addMultiCellWidget(m_gammaInput, 2, 2, 1, 1);
-
     // -------------------------------------------------------------
 
     QLabel *label9 = new QLabel(i18n("Damping:"), secondPage);
@@ -259,10 +243,18 @@
                 "can suppress spike noise when increased, and this is the preferred method to "
                 "remove it."));
     
+    gridSettings2->addMultiCellWidget(label2, 0, 0, 0, 0);
+    gridSettings2->addMultiCellWidget(m_lumToleranceInput, 0, 0, 1, 1);                         
+    gridSettings2->addMultiCellWidget(label6, 1, 1, 0, 0);
+    gridSettings2->addMultiCellWidget(m_csmoothInput, 1, 1, 1, 1);
+    gridSettings2->addMultiCellWidget(label8, 2, 2, 0, 0);
+    gridSettings2->addMultiCellWidget(m_gammaInput, 2, 2, 1, 1);
     gridSettings2->addMultiCellWidget(label9, 3, 3, 0, 0);
     gridSettings2->addMultiCellWidget(m_dampingInput, 3, 3, 1, 1);
-    gridSettings2->setColStretch(1, 10);
+    gridSettings2->setColumnStretch(1, 10);
     gridSettings2->setRowStretch(4, 10);
+    gridSettings2->setMargin(spacingHint());    
+    gridSettings2->setSpacing(0);    
 
     m_imagePreviewWidget->setUserAreaWidget(mainTab);
     
@@ -490,7 +482,7 @@
     
     if ( file.open(QIODevice::ReadOnly) )   
     {
-        Q3TextStream stream( &file );
+        QTextStream stream( &file );
         if ( stream.readLine() != "# Photograph Noise Reduction Configuration File" )
         {
            KMessageBox::error(this, 
@@ -532,7 +524,7 @@
     
     if ( file.open(QIODevice::WriteOnly) )   
     {
-        Q3TextStream stream( &file );        
+        QTextStream stream( &file );        
         stream << "# Photograph Noise Reduction Configuration File\n";    
         stream << m_radiusInput->value() << "\n";    
         stream << m_lumToleranceInput->value() << "\n";    
@@ -553,4 +545,3 @@
 }
 
 }  // NameSpace DigikamNoiseReductionImagesPlugin
-
--- trunk/extragear/graphics/digikam/imageplugins/noisereduction/imageplugin_noisereduction.cpp #683228:683229
@@ -45,7 +45,9 @@
 {
     m_noiseReductionAction  = new KAction(KIcon("noisereduction"), i18n("Noise Reduction..."), this);
     actionCollection()->addAction("imageplugin_noisereduction", m_noiseReductionAction );
-    connect(m_noiseReductionAction, SIGNAL(triggered(bool) ), SLOT(slotFilmGrain()));
+
+    connect(m_noiseReductionAction, SIGNAL(triggered(bool)), 
+            this, SLOT(slotNoiseReduction()));
                 
     setXMLFile("digikamimageplugin_noisereduction_ui.rc");                
 
@@ -66,5 +68,3 @@
     DigikamNoiseReductionImagesPlugin::ImageEffect_NoiseReduction dlg(parentWidget());
     dlg.exec();
 }
-
-
--- trunk/extragear/graphics/digikam/imageplugins/noisereduction/imageplugin_noisereduction.h #683228:683229
@@ -37,8 +37,7 @@
     
 public:
 
-    ImagePlugin_NoiseReduction(QObject *parent,
-                               const QStringList &args);
+    ImagePlugin_NoiseReduction(QObject *parent, const QStringList &args);
     ~ImagePlugin_NoiseReduction();
 
     void setEnabledActions(bool enable);



More information about the Digikam-devel mailing list