19

I am writing some computer code to convert color pixels to grayscale. There are many algorithms. I will be using the algorithm from the HDTV standard.

Unfortunately, my maths are a little weak, so I want someone (stronger in maths or physics) to explain the correct way to apply gamut (de)compress and how it affects the HDTV formula to convert color to grayscale, e.g, Y = 0.2126 R + 0.7152 G + 0.0722 B

Is it best to ask this question on (i) StackOverflow, (ii) Photography, (iii) Maths, or (iv) Physics sites? Please advise.

Update

Here are some quotes that appear to disagree from Wikipedia (my main source for learning about colorspace theory... probably not the best!). Specifically, I see discrepancies with how Y (linear / gamma decompressed) and Y' (non-linear / gamma compressed) are used.

Ref1

For the ITU-R BT.709 primaries, as used in sRGB, the weighting Y = 0.2126 R + 0.7152 G + 0.0722 B gives the CIE 1931 luminance, Y, as the result. Linear luminance typically needs to be gamma compressed to get back to a conventional grayscale representation. ... This is not the method used to obtain the luma in the Y'UV and related color models, used in standard color TV and video systems as PAL, SECAM, and NTSC. These systems directly compute a gamma-compressed luma as a linear combination of gamma-compressed primary intensities, rather than use linearization via gamma expansion and compression.

Ref2: See the conversion matrix between Y'UV and RGB.

Ref3

Y' stands for the luma component (the brightness) and U and V are the chrominance (color) components; luminance is denoted by Y and luma by Y' – the prime symbols (') denote gamma compression, with "luminance" meaning perceptual (color science) brightness, while "luma" is electronic (voltage of display) brightness.

8
  • 7
    If I read "colorspace theory" as "conspiracy theory", should I go to the psychologist's?
    – H2CO3
    Aug 22, 2013 at 15:21
  • 1
    Well, certainly not Stack Overflow.
    – asheeshr
    Aug 22, 2013 at 15:43
  • 5
    I'm wondering if the DSP SE might support such questions dsp.stackexchange.com Perhaps ask them...
    – Bart
    Aug 22, 2013 at 15:44
  • 4
    Could you expand on your desired answer a bit? Having someone "explain the correct way to apply [gamma (de)compression] and how it affects the HDTV formula" is somewhat ambiguous. What kind of explanation are you after: an implementation, perceptual differences, mathematical channel conversions? It seems to me that you're asking about how to implement the Wikipedia formula in code, which indicates SO, but Bart and AsheeshR are reading it differently. Aug 22, 2013 at 15:48
  • 1
    This question fits on none of those exchanges. Break it apart and ask it in separate, on topic, pieces. It should become more evident where specific pieces should reside.
    – Travis J
    Aug 28, 2013 at 22:14
  • I would try gamedev.stackexchange.com because that is where many graphics specialists hang out. Sep 1, 2013 at 6:30
  • @PieterGeerkens: This is definitely off-topic there. "...because that is where many graphics specialists hang out..." by that definition I'd be allowed to ask parenting questions on SO...because there are many parents there. Sep 2, 2013 at 7:16
  • did you try the suggestions? Sep 9, 2013 at 17:40

2 Answers 2

1

...to explain the correct way to apply gamut (de)compress and how it affects the HDTV formula to convert color to grayscale, e.g, Y = 0.2126 R + 0.7152 G + 0.0722 B

I'm not good at all those physics and stuff (heck, I'd be happy if I could finally remember the formula to calculate the circumference of a circle) but this question sounds like a mix of several problems which might need to be tackled individually.

...the correct way to apply gamut (de)compress...

Sounds like a mathematical problem, and therefor should be on Mathematics.

...and how it affects the HDTV formula to convert color to grayscale...

Sounds like something that should be on Mathematics and/or Computer Science.

Actually, Computer Science would be my best bet for this kind of question. But I'm not familiar with the scope of the site, so I suggest that you re-ask this question on their Meta, I'm sure they're able to point you into the right direction. Also don't forget to actually include the question you want to ask, that makes it a lot easier to tell you if it is on-topic or not.

1
  • 3
    Cherry Pi Delicious (C = π * d); Apple Pi aRe Two (A = π * r^2); Just a little something my Geometry teacher taught us. Another way of thinking about it is that r^2 would square your dimension (1d length to 2d area).
    – Cole Tobin
    Sep 1, 2013 at 6:05
-1

I dont think we have any special dedicated stackexchange network for your queries. The only way would be to break your questions in to chunks and asking it on appropriate network.

Besides this,here is my answer.

Since you are asking logic based question...I think SO will be a good choice.You just need to provide accurate tagging.

  1. there are questions previously asked based on conversions.(with specific tagging eg.image processing,if you dont have any its ok.).
  2. People have accepted it as answers
  3. Stack Overflow do provide the tags you need.

sample question:

  1. Correct conversion from rec. 709 to sRGB
  2. How to deal with RGB to YUV conversion

Math.stackexchange-as I have searched does not have any tags related to your interest.So framing the question and targetting the relative audience becomes more of a problem.

There are plenty other questions that you can google.

search here:https://stackoverflow.com/tags

You will get all the tags you need.And since SO is providing these tags,its likely that SO folks will come up with some decent answers.

math.stackexchange -i am not that optimistic when it comes to your question.It will be difficult to frame your question.Use this only if there are some high level pure math question(sample:how many permutaion and combination does a rubik cube have?.. perfectly legit question)

I searched RGB,YUV,grayscale,pixel all have plenty of support on SO.Zero when it comes to math.stackexchange.

MySuggestion: SO

Besides:you need to be a little more discriptive about your field.

Hope my answer helped.

UPDATE:

As per comments below,its not clear that your concerns are for theory question or logical questions.

Here is my take take after a short discussion.

If you just want to know what the basic theory,you can use https://graphicdesign.stackexchange.com/questions/ Though its a website for graphic designers,their folks have some idea about what these color-space,RGB,yuv and all those complex thing do.for complex mathematical question you must prefer math.stackexchange framing it properly.

Have a look:

  1. Color space term? (RGB / I values)
  2. What is the difference between CMYK and RGB? Are there other color spaces I should know?
9
  • check the graphicdesign stackexchange network,electrical engineering and dsp that travis mentioned..but Stackoverflow is obvious first choice if you give perfectly valid explanations to your questions. Aug 29, 2013 at 11:01
  • go ahead and ask this question..if its not accepted by the community we will all learn something..but with what we have right now..it SO Aug 29, 2013 at 11:05
  • @kevinarpe:i hope the answer helps.. Aug 30, 2013 at 6:18
  • The OP seems to want some explanation about the colorspace theory, rather than coding. I think SO is not a good choice here.
    – nhahtdh
    Aug 30, 2013 at 6:39
  • @nhahtdh:naa..if you read the question properly,he is asking about some math problem...thats why i recomended it..there is no other resource..its ok if you dont agree,but my stance is SO..I think OP's concern is about where to ask these question..he already knows what they are learning it from wiki.. Aug 30, 2013 at 6:47
  • He sees some discrepancies in Wikipedia sources, that's why he wants to ask about theory. It is not even about coding.
    – nhahtdh
    Aug 30, 2013 at 7:00
  • ok..let me edit my answer.. Aug 30, 2013 at 7:10
  • "Since you are writing computer codes,that deal with logic...SO will be the way to go." Your answer seems to rely on the assumption that it is On-Topic on SO because OP needs help with writing code for it...that assumption is not correct. Aug 30, 2013 at 7:59
  • @kevinarpe:there is still one day left for bounty,you can try posting your questions on networks suggested by different answers,you will know which is the most appropriate by their responses.. Aug 31, 2013 at 14:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .