0

long-time reader first-time poster. I do test engineering for medical cameras and I was curious if there was a way to check if a YCbCr image was white balanced using python code. I know there are multiple options to perform white balance but I'm more interested in checking two images and determining if the white balance was done.

The results specs are "6504 Kelvin color temperature recommended by D65 standard color temperature", so I figure I can calculate the temperature of the image and use that. However, all the algorithms I found are algorithms for finding kelvin from RGB and I'm worried if I color map to RGB I'll lose some data I want to keep.

My ideal workflow is capturing an image from the medical camera, performing white balance, and capturing a new image. I'm trying to keep this in python so it integrates better with my other tests.

Not looking for explicit code, just some direction and if it's even feasible. Thank you!

  • you can't really tell what the picture was calibrated to, unless you also know the "true" color of the things in the picture. -- if you don't know what's in the picture, there is the "gray world assumption" check how closely the given picture comes to being "gray". if you know of gamma mapping, you know enough to solve this. – Christoph Rackwitz Apr 11 '22 at 22:25
  • *However, all the algorithms I found are algorithms for finding kelvin from RGB and I'm worried if I color map to RGB I'll lose some data I want to keep.* - the transformations are linear (https://en.wikipedia.org/wiki/YCbCr). If you keep the result as simple numbers (and don't make them byte-sized integers), you can't lose anything important for the calculation. – tevemadar Apr 12 '22 at 08:31
  • The rounding error of converting YCbCr to RGB are negligible. You may also use floating point conversion if you really want to. Something like "gray world assumption" may also work in YCbCr color space - you can check if the mean of Cb is close to the mean of Cr (image has no "blue cast" or "red cast"). It's working better if you invert the gamma first (convert to RGB, invert gamma, convert to YUV and compare the mean of U and V). It is not going to work in practice because most of the color deviations comes from the optics (not from the illumination). – Rotem Apr 12 '22 at 21:03

0 Answers0