Matlab restoring the image to its original colors

梦想与她 提交于 2019-12-11 01:24:21

问题


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

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:

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

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

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

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


回答1:


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).

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

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.



来源:https://stackoverflow.com/questions/12843188/matlab-restoring-the-image-to-its-original-colors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!