Logo by miles - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. August 21, 2019, 01:49:40 AM


Login with username, password and session length


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


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: histogram colouring is really streching (not true histogram)  (Read 1924 times)
0 Members and 1 Guest are viewing this topic.
claude
Fractal Bachius
*
Posts: 563



WWW
« 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).

* stretch.c.txt (1.89 KB - downloaded 96 times.)
* histogram.c.txt (2.35 KB - downloaded 121 times.)
* Makefile.txt (0.17 KB - downloaded 83 times.)
Logged
claude
Fractal Bachius
*
Posts: 563



WWW
« 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



WWW
« 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



WWW
« 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
  Print  
 
Jump to:  

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

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.114 seconds with 29 queries. (Pretty URLs adds 0.006s, 2q)