Color balance calculated incorrectly

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

Moderators: XnTriq, xnview

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

Color balance calculated incorrectly

Post by robijn » Thu Oct 18, 2012 11:14 am

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: 7
Joined: Sun Sep 09, 2007 9:04 pm
Location: Netherlands

Re: Color balance calculated incorrectly

Post by robijn » Fri Feb 07, 2014 9:13 am

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: 1999
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: Color balance calculated incorrectly

Post by oops66 » Fri Feb 07, 2014 9:23 am

robijn wrote:...It's rather annoying that XnView cannot correct white balances correctly...
+1 I support too (and thank you for the explanation ;-))
XnViewMP 0.82 Linux X64 - Ubuntu 16.04 LTS - X64

User avatar
oops66
XnThusiast
Posts: 1999
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: Color balance calculated incorrectly

Post by oops66 » Fri Feb 07, 2014 10:09 am

... 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 0.82 Linux X64 - Ubuntu 16.04 LTS - X64

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

Re: Color balance calculated incorrectly

Post by xnview » Fri Feb 07, 2014 1:07 pm

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: 7
Joined: Sun Sep 09, 2007 9:04 pm
Location: Netherlands

Re: Color balance calculated incorrectly

Post by robijn » Sun Jun 28, 2015 2:09 pm

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: 7
Joined: Sun Sep 09, 2007 9:04 pm
Location: Netherlands

Re: Color balance calculated incorrectly

Post by robijn » Thu Oct 15, 2015 8:22 pm

Bump

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

Re: Color balance calculated incorrectly

Post by robijn » Mon Jan 29, 2018 9:50 pm

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: 29922
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Color balance calculated incorrectly

Post by xnview » Tue Jan 30, 2018 9:34 am

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.

Post Reply