https://github.com/sony/dolp-colorconstancy
https://github.com/sony/dolp-colorconstancy
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sony/dolp-colorconstancy
- Owner: sony
- License: mit
- Created: 2022-03-22T06:10:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-04T07:45:47.000Z (over 3 years ago)
- Last Synced: 2025-04-16T05:45:46.606Z (6 months ago)
- Language: Python
- Size: 20.6 MB
- Stars: 13
- Watchers: 19
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Degree-of-linear-polarization-based Color Constancy (CVPR 2022)
Taishi Ono, Yuhi Kondo, Legong Sun, Teppei Kurita, and Yusuke MoriuchiSony Group Corporation, Tokyo, Japan
[paper](https://openaccess.thecvf.com/content/CVPR2022/html/Ono_Degree-of-Linear-Polarization-Based_Color_Constancy_CVPR_2022_paper.html) |
[data\*](https://sonyjpn.sharepoint.com/sites/S168-DOLPCC)
\*Access to [data](https://sonyjpn.sharepoint.com/sites/S168-DOLPCC) requires a **Microsoft account**.
After creating your Microsoft account, please contact [us]() with your **Microsoft E-mail address** to grant access.
The access right is revoked after a certain period of time , and your account information is not retained.## Introduction
This repository is the implementation of "Degree-of-linear-polarization-based Color Constancy," presented in CVPR 2022.This paper proves that the degree of linear polarization (DoLP) dramatically solves the color constancy problem.
The main idea is quite simple: **the DoLP values of achromatic pixels are also achromatic regardless of the illumination colors.**
Additionally, we widely analyzed how to estimate illuminations from chromatic pixels and examined a solution for multi-illumination scenes.
Raw-RGB images (top) and their DoLP values of RGB (bottom).
DoLP of achromatic pixels are always achromatic regardless of the illumination colors.
Achromatic patches located in the bottom rows have always achromatic
DoLP values.## Dependency
We use the following version of libraries. Subtle version differences are acceptable.
- Python 3.7.3
- opencv-python 4.1.2.30
- numpy 1.17.4## Usage
1. Set the parameters in `parameters.json`.
2. Run `python polarAWB.py` or `python polarAWB_noGT.py` according to your folder includes gt illuminations or not.## Reproduce the results of our paper
1. Copy our evaluation data from [data](https://sonyjpn.sharepoint.com/sites/S168-DOLPCC) to `images/`.
2. Set the parameters in `parameters.json` according to our paper. The preset values are the same as the parameters used in our paper.
3. Run `python polarAWB.py`.
4. Set the file path in `print_error_forPaper.py` and run `python print_error_forPaper.py`.## Folder structure
Please see also `images/sample_images/`.
```
./Sony_PolarizationAWB_CVPR2022/
|- polarAWB.py
|- polarAWB_noGT.py
|- parameters.json
|- myutils/
|- images/
|- folder_1/ # w/ ground-truth illuminations
|- macbeth_position.txt
|- scene000_i000.png
|- scene000_i045.png
|- scene000_i090.png
|- scene000_i135.png
|- scene000_imean.png
|- scene000_mecbeth.png
|- ...
|- folder_2/ # w/o ground-truth illuminations
|- scene000_i000.png
|- scene000_i045.png
|- scene000_i090.png
|- scene000_i135.png
|- scene000_imean.png
|- ...
|- results/
```
`macbeth_position.txt` must include scene names and their corresponding positions of color charts as follows:
```
scene000 x:123, y:456, w:123, h:456
scene001 x:111, y:222, w:333, h:444
...
````parameters.json` includes the following parameters:
```
"input_folder" : the name of your folder.
"valid_th" : percentile for excluding the high and low intensity.
"w_dolp_a" : "a" in Equation 12.
"w_dolp_b" : "b" in Equation 12.
"w_dolp_ach_a" : "a" in Equation 9.
"w_dolp_ach_b" : "b" in Equation 9.
"w_aolp_ach_a" : "a" in differences between RGB values of AoLP.
"w_aolp_ach_b" : "b" in differences between RGB values of AoLP.
"w_dolp_ch_a" : "a" in Equation 10.
"w_dolp_ch_b" : "b" in Equation 10.
"w_aolp_ch_a" : "a" in AoLP differences for exlcluding edges.
"w_aolp_ch_b" : "b" in AoLP differences for exlcluding edges.
"alpha" : "alpha" to blend the results of chromatic and achromatic pixels, described in Fig. 3 in supplementary material.
```## License
This software is released under the MIT License. See [LICENSE](/LICENSE) for details.## Citation
```
@InProceedings{Ono_2022_CVPR,
author = {Ono, Taishi and Kondo, Yuhi and Sun, Legong and Kurita, Teppei and Moriuchi, Yusuke},
title = {Degree-of-linear-polarization-based Color Constancy},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2022},
pages = {19740-19749}
}
```