Training the learning-based white balance algorithm
Примеры с cv2.imshow требуют сборки OpenCV с GUI. В ноутбуке с headless-версией используйте вывод изображений через Matplotlib.
Training the learning-based white balance algorithm
Many traditional white balance algorithms are statistics-based, i.e. they rely on the fact that certain assumptions should hold in properly white-balanced images like the well-known grey-world assumption. However, better results can often be achieved by leveraging large datasets of images with ground-truth illuminants in a learning-based framework. This tutorial demonstrates how to train a learning-based white balance algorithm and evaluate the quality of the results.
How to train a model
- Download a dataset for training. In this tutorial we will use the Gehler-Shi dataset. Extract all 568 training images in one folder. A file containing ground-truth illuminant values (real_illum_568..mat) is downloaded separately.
- We will be using a Python script for training. Call it with the following parameters: This should start training a model on the first 378 images (2/3 of the whole dataset). We set the size of the model to be 30 regression tree pairs per feature and limit the tree depth to be no more then 6. By default the resulting model will be saved to color_balance_model.yml
python learn_color_balance.py -i <path to > - < ..> - , -- -- --