Color balance calculated incorrectly

Bugs found in XnView Classic. Please report only one bug per topic!

Moderators: XnTriq, helmut, xnview

Post Reply
robijn
Posts: 9
Joined: Sun Sep 09, 2007 9:04 pm
Location: Netherlands

Color balance calculated incorrectly

Post by robijn »

Hello,

I have been trying to correct the color balance on photo's but the result is not what I expected. It turns out this has to do with the way the color balance sliders work.

Color balance is a very wide concept, however, it often primarily refers to white balance. This is the most important color balance parameter. When no color shifting is performed, but only R, G and B values are linearly adjusted, there are 2 parameters that can be changed: black balance and white balance. When white balance is adjusted, black remains as it is, and the color of brighter colors is adjusted. When black balance is adjusted, white stays as it is, and the color of darker colors is adjusted. White balance is used to correct for incorrect light source colors for light that shines on the subjects. Black balance can be used to correct for a camera's non-zero value for black, or for when a secondary light source is giving an addition of light over the entire image (e.g. photographing through glass or haze).

The setting on the Image->Adjust->Brightness/Contrast/Gamma/Balance called Color Balance are neither of these. They perform a shift of the color values up or down only. So if we have 2 pixels, number one has a red value of 45 and number 2 has a red value of 210, and we move the slider upwards, they will both get the same amount of red extra. For example they would now be 45 + 22 = 67 and 210 + 22 = 232. This means if you want to correct the white balance of a photo, you also change black. If you add a lot of red and the dark background also becomes red. This is not good.

If you want the most basic and useful sliders there, then these should be white balance sliders. They would perform a multiplication only. If you want more, you may also want black balance sliders.

Regards,
Joris
robijn
Posts: 9
Joined: Sun Sep 09, 2007 9:04 pm
Location: Netherlands

Re: Color balance calculated incorrectly

Post by robijn »

Would this ever be fixed ?
It's rather annoying that XnView cannot correct white balances correctly, and it's easy to fix: instead of using an addition, use a multiplication.
User avatar
oops66
XnThusiast
Posts: 2005
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: Color balance calculated incorrectly

Post by oops66 »

robijn wrote:...It's rather annoying that XnView cannot correct white balances correctly...
+1 I support too (and thank you for the explanation ;-))
XnViewMP Linux X64 - Debian - X64
User avatar
oops66
XnThusiast
Posts: 2005
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: Color balance calculated incorrectly

Post by oops66 »

... Do you use XnView "classique" 2.xx or XnViewMP ?

FI: But, if the correction is almost always the same (ex:same white balance used to correct for incorrect light source colors for light), a workaround exist by using an ICC profile as filter (in bach convert) with XnViewMP0.64 here it is an example:

Tools\ICC Convert\Action tab\Input profile (sRGB by default)=/home/user/iccs_files/E-gray-realistic-gamma2.2.icc

Rendering intent = Perceptual
x Ignore embedded profile
x Black point compensation
(FI: * the preview "AFTER" is not possible with this "icc filter")
XnViewMP Linux X64 - Debian - X64
User avatar
xnview
Author of XnView
Posts: 43354
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Color balance calculated incorrectly

Post by xnview »

robijn wrote: It's rather annoying that XnView cannot correct white balances correctly, and it's easy to fix: instead of using an addition, use a multiplication.
right...
Pierre.
robijn
Posts: 9
Joined: Sun Sep 09, 2007 9:04 pm
Location: Netherlands

Re: Color balance calculated incorrectly

Post by robijn »

Hi Pierre,

I know "officially" you should apply the multiplication on the gamma uncorrected values, but even if you don't do that the results are a lot better than when simply shifting. The dark colors will be preserved much better.
I've done a little programming to show the difference between the current method (shifting), the direct-multiplication method, and the gamma corrected multiplication method. See attached picture. The calculations are performed on the colors in the left array, and the ones on the right are the results when performing the color correction shown on top (R: 1.2, G: 1.0, B: 0.8). With the shifting method, you can see the red shining through on the darker colors.

Regards,
Joris

EDIT: Gamma correction in the picture contained a mistake
Attachments
color corr.jpg
robijn
Posts: 9
Joined: Sun Sep 09, 2007 9:04 pm
Location: Netherlands

Re: Color balance calculated incorrectly

Post by robijn »

Bump
robijn
Posts: 9
Joined: Sun Sep 09, 2007 9:04 pm
Location: Netherlands

Re: Color balance calculated incorrectly

Post by robijn »

Any change this can get some attention some day? The color sliders are rather useless as they are now.

Joris
User avatar
xnview
Author of XnView
Posts: 43354
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Color balance calculated incorrectly

Post by xnview »

robijn wrote:Any change this can get some attention some day? The color sliders are rather useless as they are now.
This will be changed in next release...
Pierre.
robijn
Posts: 9
Joined: Sun Sep 09, 2007 9:04 pm
Location: Netherlands

Re: Color balance calculated incorrectly

Post by robijn »

Thanks, this works great now!
Post Reply