hahnec / color-matcher

automatic color-grading

Home Page:https://hahnec.github.io/color-matcher/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

color-matcher

Description

color-matcher enables color transfer across images which comes in handy for automatic color-grading of photographs, paintings and film sequences as well as light-field and stopmotion corrections. The methods behind the mappings are based on the approach from Reinhard et al., the Monge-Kantorovich Linearization (MKL) as proposed by Pitie et al. and our analytical solution to a Multi-Variate Gaussian Distribution (MVGD) transfer in conjunction with classical histogram matching. As shown below our HM-MVGD-HM compound outperforms existing methods.

release License coverage PyPi Dl2 PyPI Downloads

binder

Results

Source Target Result
Photograph
Film sequence
Light-field correction
Paintings

Installation

  • via pip:
    1. install with pip3 install color-matcher
    2. type color-matcher -h to the command line once installation finished
  • from source:
    1. install Python from https://www.python.org/
    2. download the source using git clone https://github.com/hahnec/color-matcher.git
    3. go to the root directory cd color-matcher
    4. load dependencies $ pip3 install -r requirements.txt
    5. install with python3 setup.py install
    6. if installation ran smoothly, enter color-matcher -h to the command line

CLI Usage

From the root directory of your downloaded repo, you can run the tool on the provided test data by

color-matcher -s './tests/data/scotland_house.png' -r './tests/data/scotland_plain.png'

on a UNIX system where the result is found at ./tests/data/. A windows equivalent of the above command is

color-matcher --src=".\\tests\\data\\scotland_house.png" --ref=".\\tests\\data\\scotland_plain.png"

Alternatively, you can specify the method or select your images manually with

color-matcher --win --method='hm-mkl-hm'

Note that batch processing is possible by passing a source directory, e.g., via

color-matcher -s './tests/data/' -r './tests/data/scotland_plain.png'

More information on optional arguments, can be found using the help parameter

color-matcher -h

API Usage

Experimental results

The above diagram illustrates light-field color consistency from Wasserstein metric W1 and histogram distance D2 where low values indicate higher similarity between source r and target z. These distance metrics are computed as follows

where f(k,  ⋅ ) and F(k,  ⋅ ) represent the Probability Density Function (PDF) and Cumulative Density Function (CDF) at intensity level k, respectively. More detailed information can be found in our IEEE paper.

Citation

Author

Christopher Hahne