RGB Colours

This is a discussion on RGB Colours within the A Brief History of Cprogramming.com forums, part of the Community Boards category; For most people, three numbers can accurately represent any colors. If you are colorblind, two numbers might be enough. What ...

  1. #16
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    For most people, three numbers can accurately represent any colors. If you are colorblind, two numbers might be enough.

    What it cool is that for some people (mostly women I think) three numbers isn't enough, they see more colors than that. To represent every color, they need four numbers. This is cool.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  2. #17
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,383
    Quote Originally Posted by Sang-drax View Post
    What it cool is that for some people (mostly women I think) three numbers isn't enough, they see more colors than that. To represent every color, they need four numbers. This is cool.
    Hmm... You have any source on this where I could take a look?

    As far as I know all humans share the same number and type of photoreceptor cells. Any variations - which naturally there are (and some for the better!) - are the result of genetic problems. As far as I know, no variations have ever been detected that were attributed to gender, or race for that matter.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #18
    verbose cat
    Join Date
    Jun 2003
    Posts
    209
    Quote Originally Posted by Mario F. View Post
    Hmm... You have any source on this where I could take a look?
    The wiki link DavidP referenced mentions something like this. It is wiki though...

    [EDIT]It appears I followed a link from DavidP's and arrived at something along these lines as the Color entry in wiki doesn't mention it (or I can't find it from my brief review). Being at work, I can't really devote a bunch of time to it, but I did see something about it on wiki in one of the related entries...[/EDIT]

    [EDIT AGAIN] Ok, I should soooo be working right now... the Tetrachromacy article on wiki says that

    One study suggested that 2–3&#37; of the world's women might have the kind of fourth cone that lies between the standard red and green cones, giving, theoretically, a significant increase in color differentiation.[2] However, another study suggests that as many as 50% of women and 8% of men may have four photopigments.[1][/EDIT AGAIN]
    Last edited by jEssYcAt; 04-21-2008 at 05:58 PM.
    abachler: "A great programmer never stops optimizing a piece of code until it consists of nothing but preprocessor directives and comments "

  4. #19
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    435
    There is no such thing as THE primary colors. There are many ways to choose 3 colors as the basis for all other colors we see. The basis that we choose can somewhat arbitrary.
    As someone else pointed out:
    RGB are the primary colors used by our eyes and CRTs. Just the way evolution worked out.
    RBY are the primary colors used by artists. Theoretically, makes more sense.
    CMY are the primary colors used by printers. Mostly for technical reasons.
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

  5. #20
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    Well, it is well known that RGB cannot represent every colour humans can perceive, only most of them. Whether the people are actually capable of distinguishing these colours is not only a function of the eye, but also of the brain that interprets the signals.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #21
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    435
    We have 3 types of color receptors- One for red, green, and blue. On the other hand, I wouldn't have a hard time believing that the rods (cones?- the things that are supposed to only see light/dark) have a non-constant frequency response.
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

  7. #22
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,383
    Quote Originally Posted by jEssYcAt View Post
    One study suggested that 2–3&#37; of the world's women might have the kind of fourth cone that lies between the standard red and green cones, giving, theoretically, a significant increase in color differentiation.[2] However, another study suggests that as many as 50% of women and 8% of men may have four photopigments.[1]
    Thanks. I'll take a look and check those references they seem to be pointing at.

    Quote Originally Posted by CornedBee
    Well, it is well known that RGB cannot represent every colour humans can perceive, only most of them.
    It's actually a little bit more elaborate than that. RGB are indeed primary colors on what concerns the human eye. This isn't really because mixing them produces all other colors. As you pointed out, they don't.

    The reason why RGB are primary colors is because no other colors can produce them. They are pure(?) colors to our eyes exactly because of how our cone cells. Each of the three types peaks at one of those approximate colors.

    And since we perceive color through our eyes, it is actually a mistake to say what I've read here before that RGB are not primary colors despite what text books say. Well, the text books are right.

    EDIT:
    Actually, I do have a question...

    It seems it's a contradiction to say "RGB cannot produce all colors" and at the same time "RGB is essentially how we perceive colors". After all we can see the colors we can't produce with the RGB mathematical model.

    I've always attributed this to two things:
    First, that each cone cell has different frequencies and they do superimpose. RGB (actually should be Red, Green, Violet) are only attained at the peak.
    Second, that the RGB mathematical model is not accurate, or probably even wrong, as a means to produce all the colors we can perceive.

    What do you think?
    Last edited by Mario F.; 04-21-2008 at 06:32 PM.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  8. #23
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,522
    > What do you think?
    The fact that colors in the natural world oft contain wavelengths from the entire spectrum ("superimpose") doesn't seem to be too fantastic at all, it's very realistic. I think though that there should be room for luminosity, hue, and saturation in your criticism.
    The human eye senses this spectrum using a combination of rod and cone cells for vision. Rod cells are better for low-light vision, but can only sense the intensity of light, whereas while cone cells can also discern color, they function best in bright light. Three types of cone cells exist in your eye, each being more sensitive to either short (S), medium (M), or long (L) wavelength light. The set of signals possible at all three cone cells describes the range of colors we can see with our eyes. The example below illustrates the relative sensitivity of each type of cone cell for the entire visible spectrum from ~400 nm to 700 nm.


    Note how each type of cell does not just sense one color, but instead has varying degrees of sensitivity across a broad range of wavelengths. Move your mouse over "luminosity" to see which colors contribute the most towards our perception of brightness. Also note how human color perception is most sensitive to light in the yellow-green region of the spectrum; this is utilized by the bayer array in modern digital cameras.
    http://www.cambridgeincolour.com/tut...perception.htm

    Frankly, I didn't keep my lecture notes when I first learned about this and now I'm disappointed and have to look for other sources. But I'm not quite sure what it means to say that the RGB model doesn't produce all the natural colors. Perhaps the only problem with the model is that the eye isn't perfect and it can be difficult to demonstrate the model for all colors.

    It could be optical illusion:
    Attached Images Attached Images  

  9. #24
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    Quote by ethic:
    Not true in the slightest...

    Red, Yellow and Blue are the primary colors in color theory.
    They're the colors that can't be created by mixing any other
    colors on a palette. RYB being taught as primary colors isn't
    some attempt by elementary schools at dumbing down fact
    so their students can grasp the concepts more easily.

    CMY (and Black) are the primary colors used in color printing,
    not art. No painter has ever mixed CMY (and Black) on their
    palette. Magenta wasn't even created until the late 1800s.
    Cyan isn't even a single color; it encompasses blues and
    greens.

    So as far as art theory goes, Red Yellow and Blue are the
    primary colors.

    This is very false. RYB have never been (and never will be) the primary colors. They were thought to be the primary colors. Red, yellow, and blue lend themselves to a very small portion of the color gamot. The reason we use RGB and CMY is because they form much larger portions of the color gamot: see the Color Cube. Notice how RGB and CMY are each on the corners.

    Please read the following portion from wikipedia:
    During the 18th century, as theorists became aware of Isaac Newton’s scientific experiments with light and prisms, red, yellow, and blue became the canonical primary colors—supposedly the fundamental sensory qualities that are blended in the perception of all physical colors and equally in the physical mixture of pigments or dyes. This theory became dogma, despite abundant evidence that red, yellow, and blue primaries cannot mix all other colors, and has survived in color theory to the present day.

    Using red, yellow, and blue as primaries yields a relatively small gamut
    , in which, among other problems, colorful greens, cyans, and magentas are impossible to mix, because red, yellow, and blue are not well-spaced around a perceptually uniform color wheel. For this reason, modern three- or four-color printing processes, as well as color photography, use cyan, yellow, and magenta as primaries instead.
    The article goes on to say that many painters also now use the CMY color model as well. For those who don't they keep many colors on their palette that cannot be formed by RYB.
    Last edited by DavidP; 04-21-2008 at 09:48 PM.
    My Website

    "Circular logic is good because it is."

  10. #25
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Quote Originally Posted by Mario F. View Post
    Hmm... You have any source on this where I could take a look?
    [...] As far as I know, no variations have ever been detected that were attributed to gender, or race for that matter.
    Apart from what is mentioned above, I'll add Forsyth & Ponce's Computer Vision: A modern approach, chapter 6.2: Human color perception . Also, men have much more problem with color blindness, so there's definately a gender bias, but I don't have a source in front of me. Wikipedia probably addresses that too, though.

    In the mathematical language I like so much: A color is practically an infinite-dimensional vector (function), giving the intesity of each wavelength. As it turns out, with good choices of basis functions, we can project this space down to a three dimensional space. This is because most humans have three difference types of coor receptors. RGB is a good choice of basis. The reason RGB cannot represent every color distinguishable is because we must have non-negative coefficients. If we allowed negative coefficients, for example (40,-10,40), RGB would be able to match any color to a human.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  11. #26
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    And finally, let's not forget physical limitations of our display screens. No screen can display a black blacker than it looks when switched off. Few, if any, screens can produce a really blinding white (or a blinding anything), because they can't emit that much light.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  12. #27
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,167
    Quote Originally Posted by citizen View Post
    It could be optical illusion:
    The left picture actually seems darker than the right one. It may just be an optical illusion or the computer screen itself that gives the illusion, but that's about what it seems to me.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  13. #28
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,522
    I experience the reverse, before they eventually become the same color. I don't think the difference is really there.

  14. #29
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,158
    Quote Originally Posted by citizen View Post
    I experience the reverse, before they eventually become the same color. I don't think the difference is really there.
    The difference is immediately apparent to me.

    The stupid picture says it itself -- the AVERAGE eye cannot see the difference. Last I checked, we're not all average.

    But I guess I'm some kind of ".........."

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting RGB to Hex.
    By mintsmike in forum C Programming
    Replies: 2
    Last Post: 03-23-2009, 12:22 PM
  2. OpenGL: Pixel addition
    By Hunter2 in forum Game Programming
    Replies: 4
    Last Post: 12-15-2008, 01:36 PM
  3. Stopwatch program (need help!)
    By modnar in forum C Programming
    Replies: 9
    Last Post: 03-21-2004, 11:42 PM
  4. Colours in DOS box
    By denizengt in forum Tech Board
    Replies: 1
    Last Post: 09-10-2003, 06:53 AM
  5. Changing Text/Background colours for window controls ...
    By Shag in forum Windows Programming
    Replies: 1
    Last Post: 11-16-2002, 10:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21