Skip to content

Latest commit

 

History

History
266 lines (196 loc) · 17.7 KB

FAQ.md

File metadata and controls

266 lines (196 loc) · 17.7 KB

FAQ

How to choose gradient for your data?

Note that :

Examples:

How to choose test image for your colormap?

  • find colour map / gradient type
  • choose (to do !)

How to convert data to the function ( how to fit curve to the data)?

Tools:

How to convert between gradient files?

How to choose colorspace?

How to convert between color spaces?

How to create a gradient?

colormap generation techniques:

  • procedural methods focused on addressing data perception problems
  • user-study based methods
  • rule-based methods
  • data-driven methods;

continous

between 2 colors

discrete

/*
https://stackoverflow.com/questions/470690/how-to-automatically-generate-n-distinct-colors
You can use the HSL color model to create your distinct colors.
If all you want is differing hues (likely), and slight variations on lightness or saturation, you can distribute the hues like so:
assumes hue [0, 360), saturation [0, 100), lightness [0, 100)
*/
for(i = 0; i < 360; i += 360 / num_colors) {
    HSLColor c;
    c.hue = i;
    c.saturation = 90 + randf() * 10;
    c.lightness = 50 + randf() * 10;

    addColor(c);
}

How to test

colourspace

colourmap

How to apply gradient ?

"separate the calculation phase from the colouring phase" Claude Heiland-Allen

  • compute data
  • compute choose gradient
  • apply gradient to the data = output image

Image Magic convert

Method by Paul Tol

  • data in pgm file
  • gradient as a clut in ppm file
  • use Image magic convert to apply gradient using options:
    • clut : replace the channel values in the first image using each corresponding channel in the second image as a color lookup table
    • interpolate: Set the pixel color interpolation method. Good settings for this are the 'bilinear' and 'bicubic' interpolation settings, which give smooth color gradients, and the 'integer' setting for a direct , unsmoothed lookup of color values.
convert input.pgm -level 0,65532 clut.ppm -interpolate integer -clut -depth 8 output.png

Where the gradient can be applied ?

How to interpolate between colors?

linear interpolation

// Precise method, which guarantees v = v1 when t = 1.
double lerp(double v0, double v1, doublet t) {
  return (1 - t) * v0 + t * v1; 

How to choose color?

How to extract color gradient from image?

Papers: