필터 지우기
필터 지우기

How to convert gray image to its original colored image ?

조회 수: 3 (최근 30일)
Mohamed Elbeialy
Mohamed Elbeialy 2020년 10월 24일
답변: Walter Roberson 2020년 10월 24일
Original color (blue, and yellow )

답변 (1개)

Walter Roberson
Walter Roberson 2020년 10월 24일
You cannot do that.
Pure blue can be composed from the blue color plane with no red or green.
Pure yellow can be composed from the blue color plane together with equal amounts of red, with no green.
If we restrict ourselves to the easier case of each pixel being either pure blue or pure yellow, then we restrict ourselves to the forms
(0, 0, b) %pure blue
(c, c, 0) %pure yellow
RGB converts to gray with the formula 0.2989 * R + 0.5870 * G + 0.1140 * B so we get
gray1 = 0.1140 * b
gray2 = 0.2989 * c + 0.5870 * c + 0.1140 * 0 = 0.8859 * c
Can they equal each other?
0.1140 * b = 0.8859 * c
b = 0.8859/0.1140 * c = 7.771 * c
and if we are using uint8, then to within the rounding that is automatically done, this means that
(0, 0, 7)
has the same brightness as
(1, 1, 0)
There are grayscale intensities that could be produced by either a pure blue or a pure yellow and they cannot be distinguished. Therefore you cannot reliably map from grayscale intensity back to pure blue vs pure yellow.
The problem gets much much worse if you permit shades of color.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by