[Digikam-devel] [patch SVN 0.9.0] imageeffect_noisereduction.cpp

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

[Digikam-devel] [patch SVN 0.9.0] imageeffect_noisereduction.cpp

Peter Heckert
1. Set default radius to 5.0.
Reason: previous default value  1.0 has almost no effect for typical noise.
Value 5.0 is good for medium noise in almost all cases.
That does not mean, that always radius 5 is used, because radius is
dynamically adapted while filtering.
This means that radius /can/ grow until 5.0. The amount of growing
depends from "threshold" setting.
That is: /Maximum/ radius is 5.0.

This value is good for the "baby.jpg" image that I almost use for testing.
 

2.
Interchanged "Sharpness" and "Lookahead".

3.
Cleaned up some "Whats this?" hints for briefness and clarity.



Index: imageeffect_noisereduction.cpp
===================================================================
--- imageeffect_noisereduction.cpp (Revision 534213)
+++ imageeffect_noisereduction.cpp (Arbeitskopie)
@@ -78,7 +78,7 @@
     about->addAuthor("Gilles Caulier", I18N_NOOP("Author and maintainer"),
                      "caulier dot gilles at kdemail dot net");
 
-    about->addAuthor("Peter Heckert", I18N_NOOP("Noise Reduction algorithm. Developper"),
+    about->addAuthor("Peter Heckert", I18N_NOOP("Noise Reduction algorithm. Developer"),
                      "peter dot heckert at arcor dot de");
                     
     setAboutData(about);
@@ -118,9 +118,8 @@
     QWhatsThis::add( m_thresholdInput, i18n("<p><b>Threshold</b>: use the slider for coarse adjustment, "
                      "and the spin control for fine adjustment. This controls edge detection sensitivity. "
                      "This value should be set so that edges and details are clearly visible "
-                     "and noise is smoothed out. This value is not bound to any intensity value, it is "
-                     "bound to the second derivative of intensity values. Simply adjust it and watch the "
-                     "preview. Adjustment must be made carefully, because the gap between \"noisy\", "
+                     "and noise is smoothed out."
+                     "Adjustment must be made carefully, because the gap between \"noisy\", "
                      "\"smooth\", and \"blur\" is very small. Adjust it as carefully as you would adjust "
                      "the focus of a camera."));
 
@@ -137,12 +136,7 @@
     QWhatsThis::add( m_textureInput, i18n("<p><b>Texture</b>: this control set the texture accuracy. "
                 "This value can be used, to get more or less texture accuracy. When decreased, "
                 "then noise and texture are blurred out, when increased then texture is "
-                "amplified, but also noise will increase. It has almost no effect to image edges, "
-                "opposed to filter <b>Edge</b>, which would blur edges, when increased. "
-                "If <b>Edge</b> is adjusted in away so that edges are sharp, and there "
-                "is still too much area noise, then texture detail could be used to reduce noise "
-                "without blurring edges. Another way would be to decrease <b>Radius</b> and to increase "
-                "<b>Edge</b>."));
+                "amplified, but also noise will increase. It has almost no effect to image edges."));
 
     gridSettings->addMultiCellWidget(label4, 2, 2, 0, 0);
     gridSettings->addMultiCellWidget(m_textureInput, 2, 2, 1, 1);
@@ -151,34 +145,34 @@
 
     QLabel *label7 = new QLabel(i18n("Sharpness:"), firstPage);  // Filter setting "Lookahead".
     
-    m_lookaheadInput = new KDoubleNumInput(firstPage);
-    m_lookaheadInput->setPrecision(1);
-    m_lookaheadInput->setRange(0.5, 10.0, 0.5, true);
-    QWhatsThis::add( m_lookaheadInput, i18n("<p><b>Sharpness</b>: this control set the sharpness level. "
-                "This value defines the pixel distance in which the filter looks ahead for luminance "
-                "variations. When this value is increased, then spikenoise is erased. "
-                "You can eventually readjust filter <b>Edge</b>, when you changed this setting. "
-                "When this value is to high, then the adaptive filter cannot longer accurately track "
-                "image details, and noise can reappear or blur can occur."));
-    
+    m_sharpnessInput = new KDoubleNumInput(firstPage);
+    m_sharpnessInput->setPrecision(2);
+    m_sharpnessInput->setRange(0.0, 1.0, 0.1, true);
+    QWhatsThis::add( m_sharpnessInput, i18n("<p><b>Sharpness</b>: "
+            "This value improves the frequency response for the filter. "
+            "When it is too strong then not all noise can be removed, or spike noise may appear. "
+            "Set it near to maximum, if you want to remove very weak noise or JPEG-artifacts, "
+            "without loosing detail."));
+      
     gridSettings->addMultiCellWidget(label7, 3, 3, 0, 0);
-    gridSettings->addMultiCellWidget(m_lookaheadInput, 3, 3, 1, 1);
+    gridSettings->addMultiCellWidget(m_sharpnessInput, 3, 3, 1, 1);
 
     // -------------------------------------------------------------
 
-    QLabel *label5 = new QLabel(i18n("Edge:"), firstPage);     // Filter setting "Sharp".
+    QLabel *label5 = new QLabel(i18n("Edge Lookahead:"), firstPage);     // Filter setting "Sharp".
     
-    m_sharpnessInput = new KDoubleNumInput(firstPage);
-    m_sharpnessInput->setPrecision(2);
-    m_sharpnessInput->setRange(0.0, 2.0, 0.01, true);
-    QWhatsThis::add( m_sharpnessInput, i18n("<p><b>Edge</b>: this control set the edge accuracy for sharpness. "
-                "This value improves the frequency response for the filter. "
-                "When it is too strong then not all noise can be removed, or spike noise may appear. "
-                "Set it near to maximum, if you want to remove weak noise or JPEG-artifacts, "
-                "without loosing detail."));
+    m_lookaheadInput = new KDoubleNumInput(firstPage);
+    m_lookaheadInput->setPrecision(2);
+    m_lookaheadInput->setRange(0.0, 20.0, 0.01, true);
+    QWhatsThis::add( m_lookaheadInput, i18n("<p><b>Edge</b>: "
+           "This value defines the pixel distance in which the filter looks ahead for Edges. "
+            "When this value is increased, then spikenoise is erased. "
+            "You can eventually readjust filter <b>Edge</b>, when you changed this setting. "
+            "When this value is to high, then the adaptive filter cannot longer accurately track "
+            "image details, and noise can reappear or blur can occur."));
 
     gridSettings->addMultiCellWidget(label5, 4, 4, 0, 0);
-    gridSettings->addMultiCellWidget(m_sharpnessInput, 4, 4, 1, 1);
+    gridSettings->addMultiCellWidget(m_lookaheadInput, 4, 4, 1, 1);
 
     // -------------------------------------------------------------
 
@@ -187,13 +181,9 @@
     m_phaseInput = new KDoubleNumInput(firstPage);
     m_phaseInput->setPrecision(1);
     m_phaseInput->setRange(0.5, 20.0, 0.5, true);
-    QWhatsThis::add( m_phaseInput, i18n("<p><b>Erosion</b>: this control set the phase shift for edges. "
-                "This value can be used to erodes singular spikes and it has a smooth effect to edges, "
-                "and sharpens edges by erosion, so noise at edges is eroded. The effect is dependant "
-                "from <b>Sharpness</b>, <b>Damping</b>, and <b>Edges</b>. Set it to minimum, "
-                "if you want to remove weak noise or JPEG-artifacts. When this value is increased, "
-                "then also increasing <b>Damping</b> is often useful. This setting can provides "
-                "sharpening and antialiasing effect to edges when spike noise is corrected."));
+    QWhatsThis::add( m_phaseInput, i18n("<p><b>Erosion</b>: "
+                "Use this to increase edge noise erosion and spike noise erosion. "
+                "(noise is removed by erosion)"));
     
     gridSettings->addMultiCellWidget(label10, 5, 5, 0, 0);
     gridSettings->addMultiCellWidget(m_phaseInput, 5, 5, 1, 1);
@@ -240,7 +230,7 @@
     
     m_gammaInput = new KDoubleNumInput(secondPage);
     m_gammaInput->setPrecision(1);
-    m_gammaInput->setRange(1.0, 5.0, 0.1, true);
+    m_gammaInput->setRange(0.3, 3.0, 0.1, true);
     QWhatsThis::add( m_gammaInput, i18n("<p><b>Gamma</b>: this control set the gamma tolerance of image. This value "
                 "can be used to increase the tolerance values for darker areas (which commonly "
                 "are more noisy). This results in more blur for shadow areas."));
@@ -332,14 +322,14 @@
     m_dampingInput->setEnabled(true);
     m_phaseInput->setEnabled(true);
                     
-    m_radiusInput->setValue(1.0);
+    m_radiusInput->setValue(5.0);
     m_lumToleranceInput->setValue(1.0);
     m_thresholdInput->setValue(0.08);
     m_textureInput->setValue(0.0);
     m_sharpnessInput->setValue(0.25);
     m_csmoothInput->setValue(1.0);
     m_lookaheadInput->setValue(2.0);
-    m_gammaInput->setValue(1.0);
+    m_gammaInput->setValue(1.4);
     m_dampingInput->setValue(5.0);
     m_phaseInput->setValue(1.0);
     

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

Re: [Digikam-devel] [patch SVN 0.9.0] imageeffect_noisereduction.cpp

Peter Heckert
Peter Heckert wrote:

> 1. Set default radius to 5.0.
> Reason: previous default value  1.0 has almost no effect for typical
> noise.
> Value 5.0 is good for medium noise in almost all cases.
> That does not mean, that always radius 5 is used, because radius is
> dynamically adapted while filtering.
> This means that radius /can/ grow until 5.0. The amount of growing
> depends from "threshold" setting.
> That is: /Maximum/ radius is 5.0.
>
> This value is good for the "baby.jpg" image that I almost use for
> testing.
>
>
> 2.
> Interchanged "Sharpness" and "Lookahead".
>
Ooops, I just have seen, that this patch makes noisereduction crash,
when I set "Color" to zero.
Possibly I have done something wrong here. Please review it carefully.
I cannot see any error, but I dont understand the userinterface code.

If you can see, what is wrong, please give me a hint.
Would be very helpful for me, so I can continue porting the improved
filter code.

greetings,

Peter

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

Re: [Digikam-devel] [patch SVN 0.9.0] imageeffect_noisereduction.cpp

Peter Heckert
Peter Heckert wrote:

>>    
> Ooops, I just have seen, that this patch makes noisereduction crash,
> when I set "Color" to zero.
> Possibly I have done something wrong here. Please review it carefully.
> I cannot see any error, but I dont understand the userinterface code.
>
> If you can see, what is wrong, please give me a hint.
> Would be very helpful for me, so I can continue porting the improved
> filter code.
>  
I have reverted all my modifications and it still crashs. (segmentation
fault)
Currently I am unable to track this down.

Is it possible, that crash comes from floating point errors, such as
calling pow(-1,x)?

peter

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

Re: [Digikam-devel] [patch SVN 0.9.0] imageeffect_noisereduction.cpp

Gilles Caulier-2
Le Jeudi 27 Avril 2006 10:07 PM, Peter Heckert a écrit :

> Peter Heckert wrote:
> > Ooops, I just have seen, that this patch makes noisereduction crash,
> > when I set "Color" to zero.
> > Possibly I have done something wrong here. Please review it carefully.
> > I cannot see any error, but I dont understand the userinterface code.
> >
> > If you can see, what is wrong, please give me a hint.
> > Would be very helpful for me, so I can continue porting the improved
> > filter code.
>
> I have reverted all my modifications and it still crashs. (segmentation
> fault)
> Currently I am unable to track this down.
>
> Is it possible, that crash comes from floating point errors, such as
> calling pow(-1,x)?
>
> peter

Peter, i will take a look in your code tomorrow morning...

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

Re: [Digikam-devel] [patch SVN 0.9.0] imageeffect_noisereduction.cpp

Gilles Caulier-2
In reply to this post by Peter Heckert
On Thursday 27 April 2006 10:07 pm, Peter Heckert wrote:

> Peter Heckert wrote:
> > Ooops, I just have seen, that this patch makes noisereduction crash,
> > when I set "Color" to zero.
> > Possibly I have done something wrong here. Please review it carefully.
> > I cannot see any error, but I dont understand the userinterface code.
> >
> > If you can see, what is wrong, please give me a hint.
> > Would be very helpful for me, so I can continue porting the improved
> > filter code.
>
> I have reverted all my modifications and it still crashs. (segmentation
> fault)
> Currently I am unable to track this down.
>
> Is it possible, that crash comes from floating point errors, such as
> calling pow(-1,x)?

I remember a bug into your code when i have backport your implemention in
digiKam plugins. The probelm is a divide by 0 somewhere.

You have changed :

m_lookaheadInput->setRange(0.5, 10.0, 0.5, true);

to

m_lookaheadInput->setRange(0.0, 20.0, 0.01, true);

Check this point...

If you want a backtrace after a crash, run digikam into gdb...

VERY IMPORTANT : If you change something into option description, please
change it too into plugin handbook :

http://docs.kde.org/development/en/extragear-graphics/digikamimageplugins/despeckle.html

The code of this manual is in svn at this place :

http://websvn.kde.org/trunk/extragear/graphics/doc/digikamimageplugins/despeckle.docbook?rev=524367&view=auto

You can find this file into your computer if you have downloaded the
extragear/graphics/doc/digikamimageplugins folder from svn (include with
digikam source)

It's a docbook file. It's easy to fix. Just create a patch to commit into svn.
Thanks in advance

Gilles

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

[Digikam-devel] Bugs observed, was Re: [patch SVN 0.9.0] imageeffect_noisereduction.cpp

Peter Heckert
Gilles Caulier wrote:

> On Thursday 27 April 2006 10:07 pm, Peter Heckert wrote:
>  
>> I have reverted all my modifications and it still crashs. (segmentation
>> fault)
>> Currently I am unable to track this down.
>>
>> Is it possible, that crash comes from floating point errors, such as
>> calling pow(-1,x)?
>>    
>
> I remember a bug into your code when i have backport your implemention in
> digiKam plugins. The probelm is a divide by 0 somewhere.
>
> You have changed :
>
> m_lookaheadInput->setRange(0.5, 10.0, 0.5, true);
>
> to
>
> m_lookaheadInput->setRange(0.0, 20.0, 0.01, true);
>
>  
I changed this to zero, because this makes sense with the new filter
code, which
accepts arbitrary float values for "lookahead". I hope I can send the
improved filter code soon.

This shouldnt cause crashing. Division by zero  doesnt cause crash, it
causes odd results. (This depends on compiler options)
log(0) or sqrt(-1) causes exceptions, so far I know.
NaN values (Not a Number, uninitilized float variables) cause crashes.
Therefore I set all buffers to zero before I use them.

> Check this point...
>
> If you want a backtrace after a crash, run digikam into gdb...
>  
Until now I got the message, that backtrace is of little value. Today I
had more luck.
(Backtrace appended)
Steps to reproduce:
Open image. Size doesnt matter. Open noisereduction. Open 2nd tab. Move
"Color" rubber a little bit to left direction.
If it doesnt crash, move it a little bit more to left.
Reproducibility: 100%

Also I still have another bug:
Steps to reproduce:
Open image. Size doesnt matter. Open noisereduction. Open 2nd tab. Move  
"Luminance" rubber a little bit.
Remove mouse, wait until preview is filtered. Put mouse again over the
rubber.
Effect happening: The rubber is  still connected to moue movement, it
has focus without mouse button pressed.
Effect expected:  You know ;-)
Reproducibility: 30%
 
Another bug:
Progress bar is very narrow. It is only 2-3 mm long on my screen.

I have this problems, since userinterface got the new look. (I liked the
old look more and had no problems with it;-)
Yesterday I downloaded a completely fresh copy from SVN, this didnt cure
the problems.

Would be helpful to know, if other people observe the same effects.
I have made a completely fresh user account; when I invoke digikam from
there, then I get the same effects.
So it shouldnt depend on user preferences.

Possibly it depends on compilation. My compiler is:

gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3)
g++ (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3)

> VERY IMPORTANT : If you change something into option description, please
> change it too into plugin handbook :
>  
Will do this. That means, I dont change another thing in near future,
default settings excepted ;-)

greetings,

Peter


Using host libthread_db library "/lib/libthread_db.so.1".
`shared object read from target memory' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1209080144 (LWP 21274)]
[New Thread -1228514400 (LWP 21284)]
[New Thread -1213912160 (LWP 21280)]
0x0027a402 in __kernel_vsyscall ()
#0  0x0027a402 in __kernel_vsyscall ()
#1  0x00bc8c19 in ioctl () from /lib/libc.so.6
#2  0x00cb176f in _X11TransGetConnectionNumber () from /usr/lib/libX11.so.6
#3  0x00cb1398 in _X11TransBytesReadable () from /usr/lib/libX11.so.6
#4  0x00cb7e89 in _XEventsQueued () from /usr/lib/libX11.so.6
#5  0x00ca3b22 in XPending () from /usr/lib/libX11.so.6
#6  0x021ee00a in QEventLoop::processEvents ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#7  0x0225f135 in QEventLoop::enterLoop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#8  0x022455cf in QApplication::enter_loop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#9  0x02455345 in QDialog::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#10 0x00edd1b0 in ImagePlugin_NoiseReduction::slotNoiseReduction (
    this=0x9be8338) at imageplugin_noisereduction.cpp:67
#11 0x00edd221 in ImagePlugin_NoiseReduction::qt_invoke (this=0x9be8338,
    _id=2, _o=0xbf813c38) at imageplugin_noisereduction.moc:82
#12 0x022ae2aa in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#13 0x022aec3d in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#14 0x041d7ef9 in KAction::activated () from /usr/lib/libkdeui.so.4
#15 0x04218392 in KAction::slotActivated () from /usr/lib/libkdeui.so.4
#16 0x042fe5dd in KAction::slotPopupActivated () from /usr/lib/libkdeui.so.4
#17 0x042fe8a1 in KAction::qt_invoke () from /usr/lib/libkdeui.so.4
#18 0x022ae2aa in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#19 0x0263769e in QSignal::signal () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#20 0x022cc6c7 in QSignal::activate () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#21 0x023c9c35 in QPopupMenu::mouseReleaseEvent ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#22 0x041e338e in KPopupMenu::mouseReleaseEvent () from /usr/lib/libkdeui.so.4
#23 0x022ea665 in QWidget::event () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#24 0x02245a1b in QApplication::internalNotify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#25 0x0224721a in QApplication::notify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#26 0x03fc6393 in KApplication::notify () from /usr/lib/libkdecore.so.4
#27 0x021ddffc in QETWidget::translateMouseEvent ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#28 0x021dc14f in QApplication::x11ProcessEvent ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#29 0x021ee07b in QEventLoop::processEvents ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#30 0x0225f135 in QEventLoop::enterLoop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#31 0x0225efde in QEventLoop::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#32 0x0224565f in QApplication::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#33 0x0804aa3c in main (argc=10625804, argv=0x9927b62) at main.cpp:273

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