Converting between RGB and HSV colorspaces -- lose Hue steps?

    May 21 2013 | 7:42 pm

    • May 21 2013 | 10:19 pm
      It's not losing steps, it's scaling them. To scale back, either [scale 0. 255. 0. 359.] or simply [* 1.41176]. (You probably want float scaling, although there might be an argument for int scaling.)
      FWIW, I've typically seen HSV as all values normalized to floats in the unit range.
    • May 21 2013 | 10:21 pm
      Alternately, there's plenty of code online for HSV-to-RGB conversion. It's a pretty straightforward programming exercise to get whatever output convention you want.
    • May 21 2013 | 10:23 pm
      I think I'm correct when I say that one loses steps in this situation. For example, if you are scaling from 0-9 to 0-99, you lose the ability to have the number 7, or 77, for example. It's less precise. If there is no way to do this within jitter (which there should be, imo!) then you're right about turning to the math. Maybe I should write a LUA object for this and gift it to the community.
    • May 21 2013 | 11:02 pm
      You original message sounded as if you thought you were losing the values 256 to 359, which you're not.
      Yes, you're losing granularity. OTOH, you're gaining the ability to store HSV values in a char matrix, which is not to be sneezed at.
      Sorry if there was any misunderstanding.
      I don't have time right now to check your patch, nor the Max docs, but I would double-check to see if you can't get jit.colorspace to work with float and/or double values. That will get you far more granularity than you can in any integer domain.
      But, by all means, write this in Lua if you are so inclined. I wrote RGB-to-HSV-to-RGB in Javascript a few years back, but unfortunately I don't own the code to share. It was, however, a straightforward exercise.
    • May 21 2013 | 11:17 pm
      I see I see. Thanks. I'll check out the float avenue and hopefully remember to report here for future MAXers...
    • May 21 2013 | 11:58 pm
      This is a little idiosyncratic but it takes a hue and spits out RGB. The floating trick works.