https://docs.opencv.org/master/d7/d71/classcv_1_1xphoto_1_1GrayworldWB.html#details
https://docs.opencv.org/master/d9/dcd/white__balance_8hpp.html
Gray-world white balance algorithm.
白平衡算法是灰度世界法
More sophisticated learning-based automatic white balance algorithm
A simple white balance algorithm that works by independently stretching each of the input image channels to the specified range. For increased robustness it ignores the top and bottom p% of pixel values.
//灰度世界算法
Ptr<xphoto::WhiteBalancer> grayWB = xphoto::createGrayworldWB();
grayWB->balanceWhite(inputImage, grayWBImage);
//完美反射算法
Ptr<xphoto::WhiteBalancer> simpleWB = xphoto::createSimpleWB();
simpleWB->balanceWhite(inputImage, simpleWBImage);
pcl@pclrov:~/catws/opencv_contrib$ find . -name "*.cpp" | xargs grep "balanceWhite"
./modules/xphoto/samples/color_balance.cpp: wb->balanceWhite(src, res);
./modules/xphoto/test/simple_color_balance.cpp: wb->balanceWhite(src, currentResult);
./modules/xphoto/test/simple_color_balance.cpp: wb->balanceWhite(test, test);
./modules/xphoto/test/test_grayworld.cpp: wb->balanceWhite(src, currentResult);
./modules/xphoto/test/test_grayworld.cpp: wb->balanceWhite(src_16U, currentResult_16U);
./modules/xphoto/src/learning_based_color_balance.cpp: void balanceWhite(InputArray _src, OutputArray _dst) CV_OVERRIDE
./modules/xphoto/src/simple_color_balance.cpp:void balanceWhiteSimple(std::vector<Mat_<T> > &src, Mat &dst, const float inputMin, const float inputMax,
./modules/xphoto/src/simple_color_balance.cpp: void balanceWhite(InputArray _src, OutputArray _dst) CV_OVERRIDE
./modules/xphoto/src/simple_color_balance.cpp: balanceWhiteSimple(mv, dst, inputMin, inputMax, outputMin, outputMax, p);
./modules/xphoto/src/simple_color_balance.cpp: balanceWhiteSimple(mv, dst, inputMin, inputMax, outputMin, outputMax, p);
./modules/xphoto/src/simple_color_balance.cpp: balanceWhiteSimple(mv, dst, inputMin, inputMax, outputMin, outputMax, p);
./modules/xphoto/src/simple_color_balance.cpp: balanceWhiteSimple(mv, dst, inputMin, inputMax, outputMin, outputMax, p);
./modules/xphoto/src/grayworld_white_balance.cpp: void balanceWhite(InputArray _src, OutputArray _dst) CV_OVERRIDE
./modules/xphoto/perf/perf_grayworld.cpp: TEST_CYCLE() wb->balanceWhite(src, dst);
./modules/xphoto/perf/perf_learning_based_color_balance.cpp: TEST_CYCLE() wb->balanceWhite(src, dst);
pcl@pclrov:~/catws/opencv_contrib$
pcl@pclrov:~/catws/opencv_contrib$ find . -name "*.cpp" | xargs grep "balanceWhite"
./modules/xphoto/samples/color_balance.cpp: wb->balanceWhite(src, res);
./modules/xphoto/test/simple_color_balance.cpp: wb->balanceWhite(src, currentResult);
./modules/xphoto/test/simple_color_balance.cpp: wb->balanceWhite(test, test);
./modules/xphoto/test/test_grayworld.cpp: wb->balanceWhite(src, currentResult);
./modules/xphoto/test/test_grayworld.cpp: wb->balanceWhite(src_16U, currentResult_16U);
./modules/xphoto/src/learning_based_color_balance.cpp: void balanceWhite(InputArray _src, OutputArray _dst) CV_OVERRIDE
./modules/xphoto/src/simple_color_balance.cpp:void balanceWhiteSimple(std::vector<Mat_<T> > &src, Mat &dst, const float inputMin, const float inputMax,
./modules/xphoto/src/simple_color_balance.cpp: void balanceWhite(InputArray _src, OutputArray _dst) CV_OVERRIDE
./modules/xphoto/src/simple_color_balance.cpp: balanceWhiteSimple(mv, dst, inputMin, inputMax, outputMin, outputMax, p);
./modules/xphoto/src/simple_color_balance.cpp: balanceWhiteSimple(mv, dst, inputMin, inputMax, outputMin, outputMax, p);
./modules/xphoto/src/simple_color_balance.cpp: balanceWhiteSimple(mv, dst, inputMin, inputMax, outputMin, outputMax, p);
./modules/xphoto/src/simple_color_balance.cpp: balanceWhiteSimple(mv, dst, inputMin, inputMax, outputMin, outputMax, p);
./modules/xphoto/src/grayworld_white_balance.cpp: void balanceWhite(InputArray _src, OutputArray _dst) CV_OVERRIDE
./modules/xphoto/perf/perf_grayworld.cpp: TEST_CYCLE() wb->balanceWhite(src, dst);
./modules/xphoto/perf/perf_learning_based_color_balance.cpp: TEST_CYCLE() wb->balanceWhite(src, dst);
pcl@pclrov:~/catws/opencv_contrib$