• Stars
    star
    334
  • Rank 126,264 (Top 3 %)
  • Language
    MATLAB
  • License
    Other
  • Created about 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

White balance camera-rendered sRGB images (CVPR 2019) [Matlab & Python]

When Color Constancy Goes Wrong: Correcting Improperly White-Balanced Images

Mahmoud Afifi1, Brian Price2, Scott Cohen2, and Michael S. Brown1

1York University    2Adobe Research

WB_sRGB_fig1

Reference code for the paper When Color Constancy Goes Wrong: Correcting Improperly White-Balanced Images. Mahmoud Afifi, Brian Price, Scott Cohen, and Michael S. Brown, CVPR 2019. If you use this code or our dataset, please cite our paper:

@inproceedings{afifi2019color,
  title={When Color Constancy Goes Wrong: Correcting Improperly White-Balanced Images},
  author={Afifi, Mahmoud and Price, Brian and Cohen, Scott and Brown, Michael S},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  pages={1535--1544},
  year={2019}
}

The original source code of our paper was written in Matlab. We also provide a Python version of our code. We tried to make both versions identical. However, there is no guarantee that the Python version will give exactly the same results. The differences should be due to rounding errors when we converted our model to Python or differences between Matlab and OpenCV in reading compressed images.

Quick start

1. Matlab:

View Image white balancing on File Exchange

  1. Run install_.m
  2. Run demo.m to process a single image or demo_images.m to process all images in a directory.
  3. Check evaluation_examples.m for examples of reporting errors using different evaluation metrics. Also, this code includes an example of how to hide the color chart for Set1 images.
2. Python:
  1. Requirements: numpy, opencv-python, and skimage (skimage is required for evaluation code only).
  2. Run demo.py to process a single image or demo_images.py to process all images in a directory.
  3. Check evaluation_examples.py for examples of reporting errors using different evaluation metrics. Also, this code includes an example of how to hide the color chart for Set1 images.

Graphical user interface

We provide a Matlab GUI to help tuning our parameters in an interactive way. Please, check demo_GPU.m.

Code/GUI parameters and options

  1. K: Number of nearest neighbors in the KNN search (Sec. 3.4 in the paper) -- change its value to enhance the results.
  2. sigma: The fall-off factor for KNN blending (Eq. 8 in the paper) -- change its value to enhance the results.
  3. device: GPU or CPU (provided for Matlab version only).
  4. gamut_mapping: Mapping pixels in-gamut either using scaling (gamut_mapping= 1) or clipping (gamut_mapping= 2). In the paper, we used the clipping options to report our results, but the scaling option gives compelling results in some cases (esp., with high-saturated/vivid images).
  5. upgraded_model and upgraded: To load our upgraded model, use upgraded_model=1 in Matlab or upgraded=1 in Python. The upgraded model has new training examples. In our paper results, we did not use this model.

Dataset

dataset

In the paper, we mentioned that our dataset contains over 65,000 images. We further added two additional sets of rendered images, for a total of 105,638 rendered images. You can download our dataset from here. You can also download the dataset from the following links:

Input images: Part1 | Part2 | Part3 | Part4 | Part5 | Part6 | Part7 | Part8 | Part9 | Part10

Input images [a single ZIP file]: Download (PNG lossless compression) | Download (JPEG) | Google Drive Mirror (JPEG)

Input images (without color chart pixels): Part1 | Part2 | Part3 | Part4 | Part5 | Part6 | Part7 | Part8 | Part9 | Part10

Input images (without color chart pixels) [a single ZIP file]: Download (PNG lossless compression) | Download (JPEG) | Google Drive Mirror (JPEG)

Augmented images (without color chart pixels): Download (rendered with additional/rare color temperatures)

Ground-truth images: Download

Ground-truth images (without color chart pixels): Download

Metadata files: Input images | Ground-truth images

Folds: Download

Online demo

Try the interactive demo by uploading your photo or paste a URL for a photo from the web.

Working with videos

You can use the provided code to process video frames separately (some flickering may occur as it does not consider temporal coherence in processing).

wb_video.mp4

Project page

For more information, please visit our project page

Commercial Use

This software and the dataset are provided for research purposes only. A license must be obtained for any commercial application.

Related Research Projects

  • White-Balance Augmenter: An augmentation technique based on camera WB errors (ICCV 2019).
  • Deep White-Balance Editing: A multi-task deep learning model for post-capture white-balance correction and editing (CVPR 2020).
  • Interactive White Balancing:A simple method to link the nonlinear white-balance correction to the user's selected colors to allow interactive white-balance manipulation (CIC 2020).

More Repositories

1

Deep_White_Balance

Reference code for the paper: Deep White-Balance Editing (CVPR 2020). Our method is a deep learning multi-task framework for white-balance editing.
Python
530
star
2

Exposure_Correction

Project page of the paper "Learning Multi-Scale Photo Exposure Correction" (CVPR 2021).
MATLAB
523
star
3

HistoGAN

Reference code for the paper HistoGAN: Controlling Colors of GAN-Generated and Real Images via Color Histograms (CVPR 2021).
Jupyter Notebook
271
star
4

WB_color_augmenter

WB color augmenter improves the accuracy of image classification and image semantic segmentation methods by emulating different WB effects (ICCV 2019) [Python & Matlab].
MATLAB
166
star
5

C5

Reference code for the paper "Cross-Camera Convolutional Color Constancy" (ICCV 2021)
Python
104
star
6

mixedillWB

Reference code for the paper Auto White-Balance Correction for Mixed-Illuminant Scenes.
Python
83
star
7

CIE_XYZ_NET

PyTorch & Matlab code for the paper: CIE XYZ Net: Unprocessing Images for Low-Level Computer Vision Tasks (TPAMI 2021).
MATLAB
78
star
8

11K-Hands

Two-stream CNN for gender classification and biometric identification using a dataset of 11K hand images.
MATLAB
77
star
9

Image_recoloring

Image Recoloring Based on Object Color Distributions (Eurographics 2019)
MATLAB
47
star
10

color-aware-style-transfer

Reference code for the paper CAMS: Color-Aware Multi-Style Transfer.
Jupyter Notebook
45
star
11

Semantic-Color-Constancy-Using-CNN

Semantic information can help CNNs to get better illuminant estimation -- a proof of concept
MATLAB
37
star
12

SIIE

Sensor-Independent Illumination Estimation for DNN Models (BMVC 2019)
MATLAB
33
star
13

ColorTempTuning

A camera pipeline that allows accurate post-capture white balance editing (CIC best paper award, 2019)
MATLAB
31
star
14

raw2raw

Project page for the paper Semi-Supervised Raw-to-Raw Mapping 2021.
Python
30
star
15

modified-Poisson-image-editing

Realistic image blending -- a Matlab implementation of MPB: A modified Poisson blending technique, Computational Visual Media 2015.
MATLAB
28
star
16

Interactive_WB_correction

Reference code for the paper Interactive White Balancing for Camera-Rendered Images Mahmoud Afifi and Michael S. Brown. In Color and Imaging Conference (CIC), 2020.
MATLAB
26
star
17

image_relighting

Python
25
star
18

colour_transfer_MKL

Python implementation of colour transfer algorithm based on linear Monge-Kantorovitch solution
Python
15
star
19

Poisson-image-editing

Matlab implementation of Poisson image editing
MATLAB
14
star
20

APAP-bias-correction-for-illumination-estimation-methods

Bias correction method for illuminant estimation -- JOSA 2019
MATLAB
9
star
21

seam-carving

MATLAB
9
star
22

Multi-stream-CNN

Matlab example of Multi-stream-CNN
MATLAB
5
star
23

WB_color_augmenter_python

Python version of the WB augmenter (ICCV'19)
Python
3
star
24

dynamic-length-color-palettes

Dynamic length colour palettes
MATLAB
2
star
25

FlickrImageDownloader

Download up to 4K images with specific keyword(s) from Flickr
Python
1
star
26

plot_rg_chromaticity

MATLAB
1
star