Matlab将图像恢复为原始颜色 [英] Matlab restoring the image to its original colors

查看:827
本文介绍了Matlab将图像恢复为原始颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我过去曾问过,有人建议我使用MACBETH,但我没有足够的资金来支持它:/

I asked it in the past, someone suggested me to use MACBETH but I don't have enough money for having it :/

所以在我拍照之前,我添加了3个圆圈将图像放置在图像中:第一个圆为红色,RGB为[255 0 0],第二个为绿色圆圈,RGB为[0 255 0],第三个为蓝色[0 0 255]。因此,我可以看到每个像素平均值的变化,并通过此更改修复整个图像。

So before I photographed, I've added 3 circles to the image to be places in the image: the first circle is red with RGB of [255 0 0], the second is green circle with RGB of [0 255 0] and the third is blue [0 0 255]. Thus I can see the change about the pixels average of each of them and fix the whole image by this change.

我有每个圆的所有像素。我得到了像素的平均值,我得到了下一个东西:

I have all the pixels of each circle. I made average of the pixels and I got the next thing:

红色圆圈的所有包含像素的平均RGB是[243 15 26]。

The red circle's average RGB of its all contained pixels is [243 15 26].

绿色圆圈所有包含像素的平均RGB为[29 235 56]。

the green circle's average RGB of its all contained pixels is [29 235 56].

以及它所在的蓝色圆圈[ 14 33 250]。

and about the blue circle it is [14 33 250].

如何根据新的red\green\blue circles'RGB结果修复图像中每个像素的颜色?

how can I fix the colors of each pixel in the image by the result of the new red\green\blue circles' RGB?

推荐答案

如果您假设线性颜色映射,您可以构建一个描述原始颜色变化的线性系统,例如(0,0,255)观察到的颜色,例如。 (14,33,250)。

If you assume a linear color mapping, you can construct a linear system that describes the change from original colors, e.g. (0, 0, 255) to observed colors, eg. (14, 33, 250).

基本上,y = A * x,其中x是原始颜色,y是观察到的颜色,A是变换矩阵。

Basically, y = A*x, where x is the original colors, y is the observed colors, A is the transformation matrix.

计算A后,可以将其反转以获得从y到x所需的变换。然后,您可以对所有像素应用A ^( - 1)进行线性颜色校正。

Once you calculated A, you can invert it to obtain the transform needed to go from y to x. You can then apply A^(-1) on all pixels for linear color correction.

这篇关于Matlab将图像恢复为原始颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆