# When Color Constancy Goes Wrong: Correcting Improperly White-Balanced Images
*[Mahmoud Afifi](https://sites.google.com/view/mafifi)*<sup>1</sup>, *[Brian Price](https://www.brianpricephd.com/)*<sup>2</sup>, *[Scott Cohen](https://research.adobe.com/person/scott-cohen/)*<sup>2</sup>, and *[Michael S. Brown](http://www.cse.yorku.ca/~mbrown/)*<sup>1</sup>
<br></br><sup>1</sup>York University <sup>2</sup>Adobe Research
![WB_sRGB_fig1](https://user-images.githubusercontent.com/37669469/76103171-3d3bf600-5f9f-11ea-9267-db077e7ddb51.jpg)
Reference code for the paper [When Color Constancy Goes Wrong:
Correcting Improperly White-Balanced Images.](http://openaccess.thecvf.com/content_CVPR_2019/papers/Afifi_When_Color_Constancy_Goes_Wrong_Correcting_Improperly_White-Balanced_Images_CVPR_2019_paper.pdf) 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](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/73428-image-white-balancing)
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`.
<p align="center">
<img src="https://user-images.githubusercontent.com/37669469/76103283-6c526780-5f9f-11ea-9f2c-ad9d87d95fb7.gif">
</p>
#### 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](https://user-images.githubusercontent.com/37669469/80766673-f3413d80-8b13-11ea-98f2-9dcebaa481d2.png)
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](http://cvil.eecs.yorku.ca/projects/public_html/sRGB_WB_correction/dataset.html). You can also download the dataset from the following links:
Input images: [Part1](https://ln2.sync.com/dl/df390d230/bcxms94b-fh7wiwb2-cjv22e95-ijqq8pry) | [Part2](https://ln2.sync.com/dl/a91b94bf0/frnsyykq-z3hhmjkj-adrxqj3h-v6v8637z/view/default/9967673500008) | [Part3](https://ln2.sync.com/dl/98719b4f0/i9zh42sd-7isdxqvh-rbrhgxbc-z7adicv4) | [Part4](https://ln2.sync.com/dl/07b36ff40/xrfe55mc-zjda4wp7-67jxgug4-7cjw5qda) | [Part5](https://ln2.sync.com/dl/7f8be8910/bwnahjub-ttystr9d-dnvu2wuj-gez7enha) | [Part6](https://ln2.sync.com/dl/a80481330/27zamddw-e6zezbpt-erqt5e3a-5x7we5uj) | [Part7](https://ln2.sync.com/dl/c647defb0/k824nusp-nb964z7f-xd6q79i7-v7j8w3z9) | [Part8](https://ln2.sync.com/dl/b0433ce80/4gbk7q9q-b96s62vi-qektmg5t-akqhueen) | [Part9](https://ln2.sync.com/dl/271048960/f2c4gr6m-9frsuuc7-g5r47tzh-4s8m55tk) | [Part10](https://ln2.sync.com/dl/21ce83f60/v36jwspj-e4mw2vtb-s6ifkgmv-jzc8mvya)
Input images [a single ZIP file]: [Download (PNG lossless compression)](https://ln2.sync.com/dl/21ce83f60/v36jwspj-e4mw2vtb-s6ifkgmv-jzc8mvya) | [Download (JPEG)](https://ln2.sync.com/dl/823095230/w94kcz2k-778ezdij-7xanis7k-67wtt6b7) | [Google Drive Mirror (JPEG)](https://drive.google.com/file/d/12UhutFIMgnm27Eo6zrieat_kwbneh8Lw/view?usp=sharing)
Input images (without color chart pixels): [Part1](https://ln2.sync.com/dl/bd8d95590/jnd4k56e-firy4vq7-8rdjucac-zfr8a47f/view/default/9967673050008) | [Part2](https://ln2.sync.com/dl/e99ba85e0/3t3wyk8n-u5c5cc7v-xr5yzh9x-wz69u97d) | [Part3](https://ln2.sync.com/dl/76cf59c80/hk7vazpq-g3tqrnt2-3ptcqw8y-fmwtdzzx) | [Part4](https://ln2.sync.com/dl/428149ef0/r5e6ahwr-ubhqugd6-bendw5ac-cdyvif99) | [Part5](https://ln2.sync.com/dl/5bc462790/y2nkwaue-z6jvs798-7gps6k8m-nhq7z89b) | [Part6](https://ln2.sync.com/dl/c659fee90/unka53m7-gxf2hmpw-ts3fqewc-9a7ekhf6) | [Part7](https://ln2.sync.com/dl/945b316e0/xzsq94w2-k4t4bfut-a7r2qh2d-y683fgk8) | [Part8](https://ln2.sync.com/dl/997b2b460/ig8rnuhc-e488k3y2-9j7iwva5-vv4siwp4) | [Part9](https://ln2.sync.com/dl/d69b8cb70/455f389w-jpzt2pm8-2f7pgdz8-g4dwqexm) | [Part10](https://ln2.sync.com/dl/c35a43450/gdrfdgz2-a34fjigz-5pwmgcth-2hw3ztvb)
Input images (without color chart pixels) [a single ZIP file]: [Download (PNG lossless compression)](https://ln2.sync.com/dl/c35a43450/gdrfdgz2-a34fjigz-5pwmgcth-2hw3ztvb) | [Download (JPEG)](https://ln2.sync.com/dl/69186ed90/vhk63ik9-mfun6pmz-y4nd4hqu-bnfrxv53) | [Google Drive Mirror (JPEG)](https://drive.google.com/file/d/1p8X-328dHw0KxkEgKfUHiDd-sV1e0kKV/view?usp=sharing)
Augmented images (without color chart pixels): [Download](https://ln2.sync.com/dl/fd890f450/qptvg83f-h5evnawu-62ksiv99-jjmtiwyv) (rendered with additional/rare color temperatures)
Ground-truth images: [Download](https://ln2.sync.com/dl/1f607c380/ypyw5z4p-q765pviu-rc8tzi2n-4pyyep8h)
Ground-truth images (without color chart pixels): [Download](https://ln2.sync.com/dl/afb9c68a0/kzbvche9-wfqfddjx-462f8xdv-pncntp8g/view/default/9967672880008)
Metadata files: [Input images](https://ln2.sync.com/dl/1ecab3360/e452ufey-6q23a2mn-bgnxu5x8-cu2hmj8f/view/default/9967672840008) | [Ground-truth images](https://ln2.sync.com/dl/e386982f0/9t49ej9n-db6bmkr9-gaactnii-kbyua7gn)
Folds: [Download](https://ln2.sync.com/dl/16e553bc0/s7eyufdq-h4i82udv-m4t3jp73-cc98jeze)
### Online demo
Try the interactive [demo](http://130.63.97.192/WB_for_srgb_rendered_images/demo.php) 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).
https://user-images.githubusercontent.com/37669469/125736626-dbcebab6-5c1d-4873-b081-640172c094ab.mp4
### Project page
For more information, please visit our [project page](http:/
没有合适的资源?快使用搜索试试~ 我知道了~
白平衡相机渲染的sRGB图像( CVPR 2019 ) [Matlab和Python].zip
共81个文件
jpg:26个
m:18个
py:10个
需积分: 2 1 下载量 28 浏览量
2024-03-11
21:29:42
上传
评论
收藏 217.73MB ZIP 举报
温馨提示
matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。 Matlab(Matrix Laboratory)是一种专为数值计算和科学与工程应用而设计的高级编程语言和环境。在算法开发和实现方面,Matlab具有以下一些好处: 1. 丰富的数学和科学函数库:Matlab提供了广泛的数学、信号处理、图像处理、优化、统计等领域的函数库,这些函数库可以帮助开发者快速实现各种复杂的数值计算算法。这些函数库提供了许多常用的算法和工具,可以大大简化算法开发的过程。 2. 易于学习和使用:Matlab具有简单易用的语法和直观的编程环境,使得算法开发者可以更快速地实现和测试他们的算法。Matlab的语法与数学表达式和矩阵操作非常相似,这使得算法的表达更加简洁、清晰。 3. 快速原型开发:Matlab提供了一个交互式的开发环境,可以快速进行算法的原型开发和测试。开发者可以实时查看和修改变量、绘制图形、调试代码等,从而加快了算法的迭代和优化过程。这种快速原型开发的特性使得算法开发者可以更快地验证和修改他们的想法。 4. 可视化和绘图功能:Matlab具有强大的可视化和绘图功能,可以帮助开发者直观地展示和分析算法的结果。开发者可以使用Matlab绘制各种图形、曲线、图像,以及创建动画和交互式界面,从而更好地理解和传达算法的工作原理和效果。 5. 并行计算和加速:Matlab提供了并行计算和加速工具,如并行计算工具箱和GPU计算功能。这些工具可以帮助开发者利用多核处理器和图形处理器(GPU)来加速算法的计算过程,提高算法的性能和效率
资源推荐
资源详情
资源评论
收起资源包目录
白平衡相机渲染的sRGB图像( CVPR 2019 ) [Matlab和Python].zip (81个子文件)
WB_sRGB-master
LICENSE.md 20KB
.github
FUNDING.yml 748B
example_images
Flickr_Rhett_Sutphin_CC_BY_2.0_.jpg 426KB
Pexels.com_prasanthdas_ds.jpg 345KB
Flikr_Thomas_Hawk_CC BY-NC_2.0.jpg 1.71MB
Set2_Rendered_WB.png 1.95MB
Flickr_Rhett_Sutphin_CC_BY_2.0__.jpg 472KB
Pexels_dot_com_Isadora_Menezes.jpg 266KB
Rendered_MIT_Adobe5K.JPG 59KB
Flickr_Edward_Simpson_CC_BY-SA_2.0_WB.jpg 141KB
Flickr_Dave--Out_and_about_CC_BY-NC_2.0.jpg 386KB
Pexels_dot_com_Thirteen_Of_Clubs.jpg 907KB
Flickr_Rhett_Sutphin_CC_BY_2.0.jpg 433KB
figure3.jpg 588KB
Set1_Rendered_WB.png 1.61MB
Rendered_Cube+.JPG 145KB
Flickr_quiddle_CC BY-SA_2.0.jpg 505KB
Pexels_dot_com_Buenosia_Carol.jpg 287KB
Flickr_chispita_666_CC_BY_2.0.jpg 276KB
Flickr_Christopher_Schmidt_CC_BY_2.0.jpg 442KB
Flickr_Michael_Figiel_CC_BY_2.0.jpg 329KB
Flickr_Racoon_Cai_CC_BY-NC_2.0.jpg 1.84MB
Flickr_Edward_Simpson_CC_BY-SA_2.0.jpg 499KB
Flickr_Alpha_CC BY-SA_2.0.jpg 88KB
Flickr_Davis_Doherty_CC_BY_2.0.jpg 413KB
Flickr_David_Pearson_CC_BY-NC_SA_2.0.jpg 825KB
Flickr_Alpha_CC_BY-NC-SA_2.0.jpg 219KB
Flcikr_Rhett_Sutphin_CC_BY_2.0.jpg 775KB
WB_sRGB_Python
classes
WBsRGB.py 7KB
LICENSE.md 20KB
demo_images.py 2KB
evaluation_examples.py 5KB
requirements.txt 29B
models
encoderBias+.npy 42KB
features.npy 13.12MB
mappingFuncs+.npy 18.17MB
features+.npy 30.28MB
mappingFuncs.npy 7.87MB
encoderWeights+.npy 2.27MB
encoderWeights.npy 2.27MB
encoderBias.npy 42KB
demo.py 2KB
evaluation
calc_mse.py 918B
calc_mae.py 1KB
evaluate_cc.py 2KB
get_metadata.py 3KB
calc_deltaE.py 1KB
calc_deltaE2000.py 4KB
WB_sRGB_Matlab
classes
WBmodel.m 7KB
autoEnc.m 1011B
PCAFeature.m 803B
WBmodel_GPU.m 7KB
uninstall_.m 696B
LICENSE.md 20KB
demo.m 2KB
evaluation_examples.m 5KB
models
WB_model_gpu.mat 21.82MB
WB_model+.mat 43.79MB
WB_model+_gpu.mat 43.79MB
WB_model.mat 21.81MB
demo_images.m 2KB
install_.m 693B
demo_GUI.m 8KB
demo_GUI.fig 44KB
evaluation
deltaE2000.m 2KB
calc_mae.m 1KB
get_metadata.m 3KB
evaluate_cc.m 2KB
calc_deltaE.m 1KB
calc_mse.m 1KB
startpooling.m 1KB
calc_deltaE2000.m 2KB
examples_from_datasets
RenderedWB_Set1
input
Canon1DsMkIII_0087_F_P.png 1.18MB
metadata
Canon1DsMkIII_0087_F_P_mask.txt 1022B
Canon1DsMkIII_0087_F_P_color.txt 569B
groundtruth
Canon1DsMkIII_0087_G_AS.png 1.21MB
RenderedWB_Set2
input
Mobile_00202.png 2.23MB
groundtruth
Mobile_00202.png 2.24MB
Rendered_Cube+
input
19_F.JPG 145KB
groundtruth
19.JPG 146KB
README.md 9KB
共 81 条
- 1
资源评论
若明天不见
- 粉丝: 1w+
- 资源: 273
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功