Bug 145442 - Contrast mask image tool
Summary: Contrast mask image tool
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Editor-LocalContrast (show other bugs)
Version: 1.0.0
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-15 01:34 UTC by Jan Kybic
Modified: 2018-02-04 22:31 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.0.0
Sentry Crash Report:


Attachments
Local contrast patch to support 16 bits color depth... (3.57 KB, patch)
2009-10-05 16:26 UTC, caulier.gilles
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kybic 2007-05-15 01:34:09 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Gentoo Packages

It would be nice to have a contrast mask plugin in Digikam. Its purpose is to change intensity locally - dark zones get brighter and bright zones darker. It is the most frequent reason why I still have to open images in Gimp when working with Digikam.

Yours,
        Jan

Links:

http://www.photozone.de/7Digital/contrastmask.htm
http://www.gimpguru.org/Tutorials/ContrastMask/
http://registry.gimp.org/plugin?id=3840
Comment 1 Mikolaj Machowski 2007-08-05 22:25:33 UTC
*** Bug 148538 has been marked as a duplicate of this bug. ***
Comment 2 Dik Takken 2007-10-22 11:49:26 UTC
Just a hint: You can manually do 16-bit contrast masking in Linux using Krita. It's really amazing what it can do to your prints.

Another great info page about the subject:

http://www.normankoren.com/PWP_contrast_masking.html
Comment 3 Dotan Cohen 2009-05-20 21:27:14 UTC
*** Bug 193336 has been marked as a duplicate of this bug. ***
Comment 4 Julien Narboux 2009-08-09 14:35:32 UTC
A new "Local contrast" Digikam plugin has been introduced by Julien Pontabry based on code by Nasca Octavian (http://zynaddsubfx.sourceforge.net/other/tonemapping/). This plugins appears in svn version of 1.0.0beta4. Please give us your opinion about the gui and the result you can get.

Warning: this plugin is not yet finished, it does not work with 16bits pictures and progress bar does not work.

Here are some tests results and screenshots:

http://www.flickr.com/photos/julien_narboux/3802975521/
http://www.flickr.com/photos/digikam/3771531595/in/pool-digikam-labs
http://www.flickr.com/photos/mikmach/3782299455/

Julien Narboux
Comment 5 Dik Takken 2009-08-13 18:54:01 UTC
Wow, good to hear that this has gone into DigiKam. It looks like it is exactly the same thing as I'm doing manually using ImageMagick right now. Having this work in 16-bit color is vital for this process, if you want high quality output. Having more than one stage is an interesting idea, I only apply the procedure once.

Unfortunately my production machine runs KDE 3.5, so I cannot easily try this plugin. I'll test as soon as I dare to jump to KDE4. GUI looks nice, good work!
Comment 6 caulier.gilles 2009-09-09 15:48:19 UTC
To Julien Pontabry, 

Do you have already started to port Local Contrast plugin to 16 bits color depth ?

Gilles Caulier
Comment 7 Julien Pontabry 2009-09-10 08:51:09 UTC
To Gilles Caulier,

Not yet. But I start working on it. It should be quick.

Julien
Comment 8 caulier.gilles 2009-10-05 16:26:44 UTC
Created attachment 37382 [details]
Local contrast patch to support 16 bits color depth...

Julien,

See this patch against svn trunk to start 16 bits color depth support.

- ToneMappingFloat is used now, for 8 and 16 bits.
- 8 bits work.
- 16 bits give a black hole image. I don't know why.
- Fast mode is disabled. I think this option is not yet available for 16 bits. In fact ToneMappingInt do not have process_rgb_image(). this is wshy float method is used instead.
- in original code d->toneMapping container is not deleted from memory and end.

Gilles Caulier
Comment 9 caulier.gilles 2009-10-05 17:50:35 UTC
Julien,

Another problem in code is missing alpha channel support. It's removed completely.

The solution is simple : restore alpha channel from original as well...

Gilles
Comment 10 Julien Narboux 2009-10-05 18:30:24 UTC
SVN commit 1031632 by jnarboux:

Modified version of the patch by Gilles Caullier for 16 bits support for local contrast plugin.

CCBUGS: 145442



 M  +30 -0     ToneMappingFloat.cpp  
 M  +1 -0      ToneMappingFloat.h  
 M  +46 -14    localcontrast.cpp  
 M  +1 -0      localcontrasttool.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1031632
Comment 11 caulier.gilles 2009-10-06 10:51:45 UTC
SVN commit 1031836 by cgilles:

implement cancel handlin in LDR tone mapping algorithm


 M  +144 -135  ToneMappingFloat.cpp
 M  +34 -33    ToneMappingFloat.h
 M  +8 -8      ToneMappingInt.h
 M  +14 -0     ToneMappingParameters.cpp
 M  +17 -9     ToneMappingParameters.h
 M  +3 -1      localcontrast.cpp


http://websvn.kde.org/?view=rev&revision=1031836
Comment 12 caulier.gilles 2009-10-06 16:23:57 UTC
SVN commit 1031957 by cgilles:

implement tone mapping progress information.
CCBUGS: 145442


 M  +85 -74    ToneMappingFloat.cpp  
 M  +5 -0      ToneMappingParameters.cpp  
 M  +1 -0      ToneMappingParameters.h  
 M  +11 -0     localcontrast.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1031957
Comment 13 caulier.gilles 2009-10-06 16:29:16 UTC
Julien,

Plugin now support 16 bits color depth images, dispatch progress info, and is cancelable...

Still "Fast Mode" option which is not implemented...

If i have understand old code Fast mode is to compute all tonemapping using integer instead float values. Right ?

If yes, what's ToneMappingParameters::info_fast_mode variable ? It's never used in code...

ToneMappingFloat code is fine now. If we want to do the same in ToneMappingInt to implement Fast Mode, just take a look in ToneMappingFloat...

Gilles
Comment 14 Julien Pontabry 2009-10-06 17:59:52 UTC
Great Gilles !

If you select the fast mode, the ToneMappingInt class is used. If not, the ToneMappingFloat class is used. Both herit from ToneMappingBase. So in the control class, we switch from one to another, depending on the fast mode's value (enable or disable).

Julien
Comment 15 caulier.gilles 2009-10-06 20:42:27 UTC
To Julien Pontabry,

Yes, i have seen the difference between ToneMappingInt and ToneMappingFloat to compute faster local contrast effects

My patches only use now Float, especially to support 16 bits color depth. Fast Mode is now disabled. ToneMAppingInt do not have rgb16bits method and a lots of code need to be written. Julien Narboux, if you is motivated, let's go (:=)))...

My test with float give good speed results, especially with Raw images in 16 bits. I think it can be enough.

I will cache this option from gui for the moment, and close this file. If you think that we need to provide this, feel free to show it again...

Gilles
Comment 16 Julien Narboux 2009-10-06 21:30:22 UTC
Gilles,

To be honest, I think the code contains too many duplicated functions,  it contains another implementation of unsharp mask, saturation and gaussian blur...  
It is working now and give good results and I thank Julien Pontabry for that !
but I think we should not spend time to optimize but rather try to reuse the functions from digiKam and build a nicer framework for image processing in digikam. I will try to do something if I have some free time...

Julien
Comment 17 caulier.gilles 2009-10-06 22:03:20 UTC
SVN commit 1032086 by cgilles:

hide Fast option from gui.
BUGS: 145442


 M  +1 -2      localcontrasttool.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1032086
Comment 18 Julien Pontabry 2009-10-07 17:41:30 UTC
I agree with Julien. If I had more time, that's what I did...

Julien