title: Saturation, Value remapping to compensate for lighting
body: <p>I have the same object that is shot in two different lighting conditions by the same camera.</p>
  
  <p>Suppose I take the saturation of a red colored component A, which becomes A' in the second picture.</p>
  
  <p>If I know that the saturation of the white letters is B, how can I get a good estimate for B'? They seem to have dependence and it is intuitive that they may actually have a simple mathematical dependence, but I may be wrong.</p>
  
  <p>Simply said:
  Find an expected saturation for the grey letters in the second picture when having the original image saturation of the red and grey letters, and the second image's red saturation.
  A, A', B go from 0 to 1.</p>
  
  <p>Can I separate this equation for the three HSV channels? Or what type of transformation should I do?</p>
  
  <p>My current code is normalizing around a pivot point (by default 1) and I've found that it fails when B approaches zero:</p>
  
  <pre><code>float delta1 = (A - pivotpoint);
  float delta1new = Aprime - pivotpoint;
  float ratio = delta1new / delta1;
  float delta2 = B - pivotpoint;
  float delta2new = abs(ratio * delta2);
  float Bprime = pivotpoint - delta2new;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/4rrrK.jpg" alt="enter image description here"></p>