Thread: Conceptually Designing HSL Algorithm

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    162

    Conceptually Designing HSL Algorithm

    edit: nvm
    Last edited by simpleid; 11-20-2007 at 07:25 PM.

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    The relationship between HSV and RGB is defined. If you implement it any other way, you are no longer dealing with HSV, but some weird "simpleid space." If you somehow come up with a mathematical expression that gives the same results in all cases, then good for you, but it's not going to be anywhere near as efficient as the typical method.

    HSV is a defined concept, not an observed one, because it is based on human perception. We perceive the violet end of the spectrum to "wrap around" back onto the red end. But this is a psychological phenomenon, not a physical one. There is nothing in the universe that would indicate HSV as a "natural" way of representing color values. So if you diverge from what is defined, you are no longer working with HSV.

    EDIT: In other words, HSV is NOT some ugly-looking approximation of some beautiful underlying concept. It IS the concept.
    Last edited by brewbuck; 11-20-2007 at 12:46 PM.

  3. #3
    Registered User
    Join Date
    Jul 2006
    Posts
    162
    edit: nvm
    Last edited by simpleid; 11-20-2007 at 07:25 PM.

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by simpleid View Post
    i am in fact trying to redefine it.

    that's the point. i specifically mentioned 'i simply don't like it', not 'it's not defined by the laws of nature' and i didn't say that i was going to define it as such, that i did only want a solution that 'felt more natural' despite the fact that it isn't
    The HSV solution is completely elegant. The math appears unintuitive because it is the end result of a few very elegant looking diagrams. The Hue_to_RGB() function is just switching between a few linear functions depending on the actual value of hue.

    i also didn't want to debate something trivial, just wanted to spark a discussion on finding a relationship between what does exist and something more potentially interesting.

    i was just making an art of it. i thought some people might enjoy that.
    The design of the HSV space is already pretty cool. Please, try reading a little more about it instead of just staring at the equations.

    but specifically i was asking help on an aspect of redefining it, so if you can contribute then do, please. otherwise making any arguments against my little venture will be futile so you might as well end it with that. :-P
    Well, to address your questions on saturation, consider the variance in the differences from the mean of R, G, B, in other words, this value:

    Code:
    double square(double x) { return x * x; }
    
    double mean = (R + G + B) / 3.0;
    double variance = square(R - mean) + square(G - mean) + square(B - mean);
    But that's not really good enough, because it assigns different values to (128, 64, 32) and (64, 32, 16) when these values obviously only differ in intensity, not saturation. There is an adjustment you can make to eliminate this difference, think about what it is.

    Also, are your RGB values calibrated to the human eye, or are you using absolute intensities? Or are you using some form of gamma? This stuff all matters too.

  5. #5
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    Forgive me if I am wrong (I have only been looking at your sample image for about a minute now), but it seems like there is some flaw in your logic.

    Let's take your image:

    Attachment 7651

    Now, according to my understanding of how you explained it, if we take that blue vertical line that you drew in the image, and we slide it horizontally to the right, we can take a sample of the RGB values at that corresponding "h" value. In other words, at some value "x" along the X-axis, the values of the 3 sine waves at that "x" position will be our RGB values.

    The fundamental problem is the simple fact that under your example, you can never have "black" or "white" (RGB = 0 0 0 or RGB = 255 255 255), because there is never a moment in all of infinity when all 3 sine waves will all reach a trough or crest. So you cannot represent all colors.

    That's my observation....but sorry if I am wrong. I am not well versed on the subject of HSL/HSV.
    My Website

    "Circular logic is good because it is."

  6. #6
    Registered User
    Join Date
    Jul 2006
    Posts
    162
    edit: nvm
    Last edited by simpleid; 11-20-2007 at 07:25 PM.

  7. #7
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by simpleid View Post
    i have done my research, and have found other implementations which encompass trig functions to come up with solutions. ;-)
    Well yes, mapping an inherently polar space to a linear one is going to involve trig. That doesn't have anything to do with waves though.

    i'm just working on my own, for an intellectual exercise. the point is, i want to *realize* a solution by *myself*. i already told you, you can't convince me to stop, so either aid in the discussion or ignore it. thanks!
    I'm not convincing you to stop what you're doing. You asked for a discussion and you seem to want to exclude my opinion specifically. Okay...

    i feel that if i can discover new ways to achieve the same effect, then i am doing something worth while. for that reason i prefer to keep doing these things, so that my software can be truly unique. :-)
    I was trying to play along by bringing up a potential method for defining "saturation."

  8. #8
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Color spaces and the math behind them are very well documented, defined, and proven. Anything else is reinventing the wheel.

  9. #9
    Registered User
    Join Date
    Jul 2006
    Posts
    162
    edit: nvm
    Last edited by simpleid; 11-20-2007 at 07:26 PM.

  10. #10
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Okay, I give up. I have no idea what this thread is about. Are we supposed to bow down to your independent spirit or something? Anything actually on the topic of color spaces seems to get shot down.

  11. #11
    Registered User
    Join Date
    Jul 2006
    Posts
    162
    don't be such an .............., my request for help was very clear

    i couldn't think of a way to incorporate saturation in to the way i was
    trying to figure this out.

    you didn't have to say half of what you did, and i was only rightfully defending
    the purpose of my post. which was meaningless for you to question.

    the only thing that mattered was i was looking for some thoughts, just offering
    thoughts on incorporating saturation would have been PLENTY.

    and now for all of this you'll turn it on me to make me look like some kind of arrogant
    ass when it was only my intent to justify.

    i wish a mod would just lock this or delete it.
    Last edited by simpleid; 11-20-2007 at 07:25 PM.

  12. #12
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by simpleid View Post
    don't be such an .............., my request for help was very clear
    No, you were droning on and on about how "artistic" you are, made some vague request for ideas, then stomped on everybody who decided to respond.

    i couldn't think of a way to incorporate saturation in to the way i was
    trying to figure this out.
    Possibly because the entire idea is bogus. I tried to provide a fresh idea about saturation, you are still completely ignoring it, probably because you don't understand it.

    you didn't have to say half of what you did, and i was only rightfully defending
    the purpose of my post. which was meaningless for you to question.
    You are a crackpot.

    the only thing that mattered was i was looking for some thoughts, just offering
    thoughts on incorporating saturation would have been PLENTY.
    I did. You're too busy foaming at the mouth over the fact that somebody out there might be smarter than you, to notice it.

    and now for all of this you'll turn it on me to make me look like some kind of arrogant ass when it was only my intent to justify.
    First you say it's just an intellectual exercise, which requires no justification. Then you try to justify it. Make up your mind.

    i wish a mod would just lock this or delete it.
    I'm willing to discuss the original topic if you're willing to LISTEN.

  13. #13
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I think this thread has derailed significantly.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Implement of a Fast Time Series Evaluation Algorithm
    By BiGreat in forum C Programming
    Replies: 7
    Last Post: 12-04-2007, 02:30 AM
  2. Replies: 4
    Last Post: 12-10-2006, 07:08 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM