[Bug 170169] New: Idea for high quality 8-bit curve adjustments

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

[Bug 170169] New: Idea for high quality 8-bit curve adjustments

Dik Takken-2
http://bugs.kde.org/show_bug.cgi?id=170169

           Summary: Idea for high quality 8-bit curve adjustments
           Product: digikamimageplugins
           Version: unspecified
          Platform: Gentoo Packages
        OS/Version: Linux
            Status: NEW
          Severity: wishlist
          Priority: NOR
         Component: Adjust Curves
        AssignedTo: [hidden email]
        ReportedBy: [hidden email]


Version:           0.9.4 (using KDE 3.5.9)
OS:                Linux
Installed from:    Gentoo Packages

When doing curve adjustment on 8-bit images, the histogram will get damaged
pretty quickly: Holes appear, which leads to banding effects.

This problem might be fixable by doing the calculation in 16-bit and using
noise. Let me explain.

When converting an 8-bit image to 16-bit, the 16-bit image will still have 256
discrete brightness levels. So, the histogram of the 16-bit image looks like
uniformly distributed spikes, placed (2^16)/256 = 256 apart.

By adding noise with an amplitude of 256, the 16-bit histogram will become
continuous: The spaces between spikes are gone. Applying a curve will yield a
relatively smooth histogram, which can be converted back to 8-bit.

In pseudo C code, applying a curve to a 8-bit brightness value looks like this:

INT8 Curve8(INT8 inputvalue)
{
value16bit = ((INT16)(inputvalue)) + Random() - 128;

return (INT8)(Curve16(value16bit));
}

Where Random() is a random value between 0 and 255 and Curve16() is the 16-bit
version of the adjust curves algorithm. Some bounds checking should be added to
make sure the addition and subtraction will not yield funny results near the
black and white ends of the scale.

At least the above technique allows the user to choose between banding and
noise. The technique might also be useful in other plugins that tend to tear
8-bit histograms apart.


--
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Gilles Caulier-4
http://bugs.kde.org/show_bug.cgi?id=170169





--- Comment #1 from Gilles Caulier <caulier gilles gmail com>  2008-09-01 11:27:01 ---
Dik,

Sound like this feature:

http://www.powerretouche.com/Histogram_Repair_plugin_tutorial.htm

I have tried to find an algorithm to perform hiistogram repair, but time
missing (:=))

Gilles Caulier


--
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Dik Takken-2
In reply to this post by Dik Takken-2
http://bugs.kde.org/show_bug.cgi?id=170169





--- Comment #2 from Dik Takken <d h j takken xs4all nl>  2008-09-01 11:52:36 ---
Hehe, yes, this looks like the same thing. Too bad they won't say how their
magical repair tool works.. Hmm, wait.. I think I can guess... :D

I had no idea that even a simple plugin/algorithm like this can be used to make
money... :D


--
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Bugzilla from mikmach@wp.pl
In reply to this post by Dik Takken-2
http://bugs.kde.org/show_bug.cgi?id=170169





--- Comment #3 from Mikolaj Machowski <mikmach wp pl>  2008-09-01 19:59:04 ---
ImageMagick doesn't damage histogram when making such adjustments.


--
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Gilles Caulier-4
In reply to this post by Dik Takken-2
http://bugs.kde.org/show_bug.cgi?id=170169


Gilles Caulier caulier gilles gmail com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]




--- Comment #4 from Gilles Caulier <caulier gilles gmail com>  2008-09-01 20:09:43 ---
Mik,

How are tested that. can you give me an ex.

Gilles


--
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Bugzilla from mikmach@wp.pl
In reply to this post by Dik Takken-2
http://bugs.kde.org/show_bug.cgi?id=170169





--- Comment #5 from Mikolaj Machowski <mikmach wp pl>  2008-09-01 23:49:44 ---
Created an attachment (id=27182)
 --> (http://bugs.kde.org/attachment.cgi?id=27182)
Example of histogram "before"

This is an original image.


--
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Bugzilla from mikmach@wp.pl
In reply to this post by Dik Takken-2
http://bugs.kde.org/show_bug.cgi?id=170169





--- Comment #6 from Mikolaj Machowski <mikmach wp pl>  2008-09-01 23:55:52 ---
Created an attachment (id=27183)
 --> (http://bugs.kde.org/attachment.cgi?id=27183)
Example of histogram "after"

This image was created with IM command:
convert hist-before.jpg -contrast-stretch 0 hist-after.jpg


--
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Gilles Caulier-4
In reply to this post by Dik Takken-2
http://bugs.kde.org/show_bug.cgi?id=170169





--- Comment #7 from Gilles Caulier <caulier gilles gmail com>  2008-12-06 18:31:07 ---
Mik,

ImageMagick always use 16 bits color depth internally to process image
correction.

I think than 8 bits image is converted to 16 bits, processed, and downgraded to
8 bits.

Can you check if this workflow solve the problem here ? (You can change color
depth in editor 8->16 and 16->8)

Gilles Caulier


--
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Gilles Caulier-4
In reply to this post by Dik Takken-2
http://bugs.kde.org/show_bug.cgi?id=170169


Gilles Caulier caulier gilles gmail com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |0.9.4




--
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Bugzilla from mikmach@wp.pl
In reply to this post by Dik Takken-2
http://bugs.kde.org/show_bug.cgi?id=170169





--- Comment #8 from Mikolaj Machowski <mikmach wp pl>  2008-12-06 21:58:23 ---
No, I don't see improvement by going 8-16-8. (0.10-beta7svn)


--
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Dik Takken-2
In reply to this post by Dik Takken-2
http://bugs.kde.org/show_bug.cgi?id=170169





--- Comment #9 from Dik Takken <d h j takken xs4all nl>  2008-12-15 10:16:46 ---
Just converting an image from 8-bit to 16-bit will not work. The reason is that
you will get a histogram with holes in it. Not really an improvement. The holes
have to be fixed first, by blurring the histogram. Adding noise to the image
will do exactly that.


--
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Milan Knizek
In reply to this post by Dik Takken-2
https://bugs.kde.org/show_bug.cgi?id=170169


Milan Knizek <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]




--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Gilles Caulier-4
In reply to this post by Dik Takken-2
https://bugs.kde.org/show_bug.cgi?id=170169





--- Comment #10 from Gilles Caulier <caulier gilles gmail com>  2011-12-17 19:12:27 ---
Dik,

With digiKam 2.x, 8 to 16 bits alogirthm add noise to fill histogram holes.
Please try again with this version

Gilles Caulier

--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Dik Takken-2
In reply to this post by Dik Takken-2
https://bugs.kde.org/show_bug.cgi?id=170169

--- Comment #11 from Dik Takken <[hidden email]> ---
Tested on 2.6.0, and it works beautifully if you

1. Convert to 16-bit depth
2. Apply curves
3. Convert back to 8-bit

This yields a smooth output histogram. Maybe it would be nice to do this
conversion in the curves adjustment function itself, that would yield high
quality curve adjustments out of the box.

See also bug #310211 which suggests a solution for the same problem, for 16-bit
images.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Idea for high quality 8-bit curve adjustments

Dik Takken-2
In reply to this post by Dik Takken-2
https://bugs.kde.org/show_bug.cgi?id=170169

--- Comment #12 from Dik Takken <[hidden email]> ---
*** Bug 310211 has been marked as a duplicate of this bug. ***

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Curves adjustment requires higher bit depth

Dik Takken-2
In reply to this post by Dik Takken-2
https://bugs.kde.org/show_bug.cgi?id=170169

Dik Takken <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Idea for high quality 8-bit |Curves adjustment requires
                   |curve adjustments           |higher bit depth

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[Bug 170169] Curves adjustment requires higher bit depth

Dik Takken-2
In reply to this post by Dik Takken-2
https://bugs.kde.org/show_bug.cgi?id=170169

--- Comment #13 from Dik Takken <[hidden email]> ---
Changed title to reflect the more generic problem described in both this report
and in Bug #310211.

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 170169] Curves adjustment requires higher bit depth

bugzilla_noreply
In reply to this post by Dik Takken-2
https://bugs.kde.org/show_bug.cgi?id=170169

[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Adjust Curves               |Tool-Curves
            Product|digikamimageplugins         |digikam

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel