5

I have a bespoke Image Capture & processing flow, wherein I do the following operations:-

Capture Raw data-->De-Bayer(Get RGB)-->Color Balance-->RGB-to-YCbCr-->Image sharpening-->Denoise filtering-->YCbCr-to-RGB-->Gamma correction(Gamma encoding)-->Store the file as BMP.

But now as some new requirement, I need to store the final output file in YUV/YCbCr format. So the new flow would be:

Capture Raw data-->De-Bayer(Get RGB)-->Color processing-->RGB-to-YCbCr-->Image sharpening-->Denoise filtering

My questions is now where should I apply the Gamma correction, since there is no conversion back to RGB space after the image sharpening and denoise filtering in YCbCr space?

Will it yield same/similar image quality when viewed, if I apply gamma correction in RGB space after Color balance, before it is converted to YCbCr space and thus before Image sharpening and denoising?

Any pointers appreciated.

thank you.

-AD

1

Gamma should be applied on luminance (Y in your case) as it pertains to contrast.

There should be no reason to do it in RGB. I suspect many programs do it independently on each channel rather than on luminance to avoid converting back and forth. Results should actually be at least a little better doing it on luminance.

  • But then Gamma also means how colors look on the screen. So why not apply on chrominance channels(Cb,Cr)? – goldenmean Feb 18 '11 at 14:42
  • @goldenman - Not really. Think about the standard gamma test where you have a solid block of color near alternating stripes of color and black. The relation between the solid color and the way our eye sees the average of the stripes is about the luminance curve of the display (or medium in case of prints). – Itai Feb 18 '11 at 15:57
  • And I guess Gamma should be related to brightness (perceived intensity), rather than contrast.Correct me if wrong. But got your point about Gamma related more to Luminance component than chrominance component. – goldenmean Feb 18 '11 at 16:12
  • @goldenmean - Yes! Note that brightness and contrast are correlated on most displays. It is hard to change contrast or brightness without affecting the other. That is why the contrast ratio of a display is computed at a specific brightness. – Itai Feb 18 '11 at 16:23
1

The BT.709 standard as does the sRGB standard define that gamma correction should be applied to each RGB channel independently, not only on the Luma channel as the first answer implies.

0

Brightening gamma in Luminance channel tend to change the perception of colour. Satuaration seems to increase, particularly yellow, since yellow maxes out luminance next to white.

Left column: RGB

Right column: Y in YUV

Top: brightening gamma

Bottom: darkening gamma.

gamma in rgb vs y in yuv

I think RGB gamma is more pleasing/intuitive when brightening and Y gamma when darkening.

Original:

original

Other notes: WB and noise reduction is normally done on the raw before demosaicing when that data is available.

  • I am intrigued by your last note. Why do you believe this is true? Do you have any references on your claim? – Martijn Courteaux Jan 6 '17 at 9:44
  • I see it done in dcraw as well as in firmware of machine vision cameras – Michael Nielsen Feb 20 '17 at 22:54
  • it also makes sense to do it at that point, where you know the balancing will be correct - it is a pretty linear task to rebalance the light, if we ignore the fact that blue is not perfectly only sensitive to blue. You want to wipe out the fact that the sensor is more sensitive to green than blue, and the light has a bit more red than green. After that , that flat white has r,g,b pixels all flattened. If you wait till after demosaicking you'll be balancing on artifacted material. you risk enhancing the errors. – Michael Nielsen Feb 20 '17 at 23:03
-2

Consider Capture Raw data--> white balance --> gamma --> De-Bayer(Get RGB)

  • Why that order? And what about the YCbCr conversion? Not really a helpful answer without at least some explanation. – MikeW Sep 1 '14 at 21:46
  • The order allows to handle white balance while still in linear space, and not be concerned with gamma at later stages. YCbCr conversion goes the standard way, as YCbCr conversion starts with gamma-encoded RGB. In case you want to go with linear encoding, it is YcCbcCrc. – Iliah Borg Sep 1 '14 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.