Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mapping function values to colors

  1. Dec 9, 2008 #1
    Hi,

    I'm trying to write a score function.
    The score function is applied to each cell of a grid
    and because the grid has many cells ( 400x600 or 800x600 )
    If I want to experiment with different score functions to
    see which one is best I'd have to see some kind of visual results.
    I thought of plotting that score function to the screen
    (because viewing just numbers isn't enough any more)
    and all it's values will be colors of pixels on a grid.
    The problem is choosing the colors and the transition between low-values to
    big values of the score function so that they show up as beeing relevant
    and smooth to the eye.
    Let's take euclidean distance as the score function for example.
    If we have 2 objects,one fixed at the bottom right of the screen and one
    starting in the upper left and moving towards upper right,then a transition of colors should
    be made for the area where the fixed object is , and the signification of this will be
    that the distance between these objects is getting smaller and smaller.
    I have tried getting the euclidean distance normalized to fit in the color spectrum and then
    plotting but that turns out to not be so good either.
    I'm having difficulties finding the best mapping between colors->distance.

    Has anyone tried this ?

    Thank you
     
  2. jcsd
  3. Dec 11, 2008 #2
    SPX,

    I don't know if this is actually helpful but have you looked into generating HSV colors? HSV is a numerical representation of color that is a lot closer to what we might think of as how a color is defined intuitively.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?