News: Did you know ? you can use LaTex inside Postings on fractalforums.com!

## The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!

 Pages: [1]   Go Down
 Author Topic: histogram colouring is really streching (not true histogram)  (Read 1949 times) Description: 0 Members and 1 Guest are viewing this topic.
claude
Fractal Bachius

Posts: 563

 « on: December 14, 2014, 05:34:26 PM »

What you call histogram colouring is implemented by:

Code:
else if(m_nColorMethod==4){
int nMin, nMax;
GetIterations(nMin,nMax);
iter = (double)1024 * ((double)iter-(double)nMin) / ((double)nMax-(double)nMin);
}

This isn't histogram colouring, it's just linearly stretching the range between min and max.

Here's a comparison of stretch colouring vs true histogram colouring:

You can see that true histogram colouring really does give a flat histogram in these screenshots from GIMP:

True histogram colouring can look too bright, here's some darker versions made by squaring, cubing, and raising to fourth power (operations applied to colour values):

Attached is the source code and makefile I used to implement these methods.  True histogram colouring is quite a lot slower than stretch colouring as it needs to sort the whole image by smoothed iteration count, then binary search for the index of each pixel.  This is O(N log N) compared to most colouring methods O(N).
claude
Fractal Bachius

Posts: 563

 « Reply #1 on: December 14, 2014, 06:17:55 PM »

using histogram for hue, combined with (multiplied by) pseudo-de:

(made in GIMP, slight layer misalignment fubar..)
 Logged
Botond Kósa
Fractal Lover

Posts: 233

 « Reply #2 on: December 14, 2014, 11:08:12 PM »

True histogram colouring can look too bright, here's some darker versions made by squaring, cubing, and raising to fourth power (operations applied to colour values):

The histogram coloring in your example looks too bright because the the colors are evenly distributed on all pixels of the image, while the area of main interest is in the middle and contains the high iteration counts from the right side of the histogram and gets colored accordingly. To change the even distribution you can apply a function to the color index that maps the [0,1] interval to itself and is nonlinear. I did lots of experiments with different functions and found that squaring, cubing and other polinomials are not ideal because of two reasons:
• Their derivative at 0 is 0, meaning they completely wash out features with the lowest iteration counts (on the left end of the histogram)
• When rendering a minibrot, the iteration count approaching its edge tends to infinity. In order to make features near the edge visible, the derivative at 1 needs to be high, ideally infinite.

Functions of the form 1-(1-x)^(1/m) satisfy both criteria when m>1. When m=2, the function is the x^2 function reflected across the line y=1-x. m=1 turns the function linear, while higher m values increase the nonlinearity of the function:

In Mandel Machine, the Color density parameter controls the value of m when histogram coloring is used.
 « Last Edit: December 14, 2014, 11:10:40 PM by Botond Kósa » Logged

Check out my Mandelbrot set explorer:
http://web.t-online.hu/kbotond/mandelmachine/
claude
Fractal Bachius

Posts: 563

 « Reply #3 on: December 14, 2014, 11:34:00 PM »

Functions of the form 1-(1-x)^(1/m) satisfy both criteria when m>1.

Very nice analysis!  I added your curve to my histogram program in this commit:
https://gitorious.org/maximus/kf-extras/commit/bf85641fdc0d19196788236b7e5db74c1bd86600
http://code.mathr.co.uk/kf-extras/commitdiff/bf85641fdc0d19196788236b7e5db74c1bd86600
 « Last Edit: March 10, 2015, 03:08:31 AM by claude, Reason: gitorious.org is closing » Logged
 Pages: [1]   Go Down

 Related Topics Subject Started by Replies Views Last post Histogram jitter test 1 FractalWorks Gallery Duncan C 0 613 December 20, 2008, 03:57:59 AM by Duncan C Histogram jitter test 2 FractalWorks Gallery Duncan C 0 696 December 20, 2008, 03:58:00 AM by Duncan C Histogram Coloring Issue Programming clonexpert 9 2542 February 21, 2010, 04:29:28 AM by Duncan C Histogram/Sort equalization Help & Support SeryZone 13 404 May 05, 2014, 07:02:31 PM by SeryZone Histogram equalization tests Images Showcase (Rate My Fractal) SeryZone 0 395 May 02, 2014, 07:58:02 PM by SeryZone

 Dilber MC Theme by HarzeM
Page created in 0.14 seconds with 29 queries. (Pretty URLs adds 0.01s, 2q)