Add new comment

There is no exposed function.

There is no exposed function.

You may steal code from internal\dcraw_common.cpp:scale_colors() function;

Starting with

  if (use_auto_wb || (use_camera_wb && cam_mul[0] == -1))
  {

And up to final calculation of pre_mul:

 pre_mul[geshifilter-c] = dsum[c + 4] / dsum[c];


This code cycle through image[] 8x8 blocks, skip blocks with data near sensor saturation and calculates pixel sum/count for other (non-saturated) blocks to get mean per-channel values. This code assumes entire image is (average) gray. If not, auto-WB will not work well.[/geshifilter-c]

-- Alex Tutubalin @LibRaw LLC