Coder Social home page Coder Social logo

wb_srgb's Introduction

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.

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.

wb_srgb's People

Contributors

mahmoudnafifi avatar manipopopo avatar mortenhannemose avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.