:: Re: [Frei0r] [PATCH] Add "colgate",…
Top Page
Delete this message
Reply to this message
Author: Steinar H. Gunderson
Date:  
To: Minimalistic plugin API for video effects
Subject: Re: [Frei0r] [PATCH] Add "colgate", a new color correction plugin.
On Fri, Sep 14, 2012 at 04:25:09PM +0200, Marko Cebokli wrote:
> Also, we DO NOT want to keep neither saturation nor luminance constant. With
> saturation that is obvious: if a grey object has a color cast, it's saturation
> is nonzero, but we want it to be zero after compensation. It is similar with
> luminance: if we recorded a blue object in blue deficient light (like
> tungsten), it will be rendered too dark, so we want our white point
> compensation to lighten it up.


I agree that you don't want it exactly constant, and especially not for every
point in your color space (if so, you couldn't change anything at all).
However, for a general scene you generally won't want to change it too much.

Take a look at the following motivating example:

http://storage.sesse.net/grill-orig3.png

This is what it looks like in balanc0r after I picked a spot on the grill as
the gray color:

http://storage.sesse.net/grill-old3.png

This does not make sense. The gray color cast here is very small; it
shouldn't be boosting the scene and colors to death. (I have tried dropping
many different places on the grill; the screenshot is representative of my
results.) Notice how the highlights on the grill are all blown out, for
instance, and how everything is much lighter.

By contrast, colgate does a small adjustment (yes, I know, the color dropped
is not exactly the same, but again, I can promise you it's representative of
the different ones I tried :-) ):

http://storage.sesse.net/grill-lms3.png

> For the beginning let's assume there is no gamma correction, and the video is
> linear to light.
> The signal in each camera channel (R,G,B) will be proportional to the product
> of illumination and reflectivity of the object. If we assume that white light
> is (100,100,100), and we record with tungsten light, say (100,80,30), then the
> signal in the G and B channels will simply be proportionally smaller, for all
> colors by the same factor.


In which color space are you talking about now? Camera RGB? sRGB? CIE XYZ 1931?
Something else?

Your comment is correct if your tungsten light is (100,80,30) in (linear)
sRGB and you are sampling in exactly (linear) sRGB. In practice, you are not;
you are sampling in some camera color space.

You could argue that one should be balancing in camera color space, but
in general, this color space is (as you say) unknown. Also, remember that the
camera has also made its own white-balancing adjustment on the way, so unless
you have access to the raw pixels, which I doubt you'd have for consumer
video, it's hard to recover this space. (I'd guess the REDs would give out
this kind of information; no DSLR I know of does.)

> One could also convert video to linear (de-gamma), apply the simple scaling
> described above, and apply gamma again (re-gamma). The problem with this
> method is, that the exact gamma used in the camera is often unknown.


If you don't have any “color cross-talk” as you describe it, and a constant
gamma curve (e.g. constant 2.2), you don't need to gamma-correct before
multiplication; the scaling factors will cancel out. (For sRGB, which uses a
more complex curve, this will only be approximately true.)

/* Steinar */
--
Homepage: http://www.sesse.net/