如何制作等亮度色块?

时间:2014-02-14 16:10:24

标签: matlab

我想制作17个等亮度灰色斑块,我从RGB(0 0 0)开始是黑色(通过加15)到RGB(255 255 255)是白色的,所以我将有17个灰色斑块。我想制作这些补丁isoluminant。我有光度计和matlab软件,但我不知道如何制作这些补丁。请指出我。

1 个答案:

答案 0 :(得分:1)

如果你想要17个高速缓存,你不能用15步。这将导致18个补丁(你可能没有计算0)或16如果你既不计算白色也不计算黑色。我只是假设你想要完整的18。

首先,构建补丁向量:

patches = repmat(0:15:255,3,1)'; %'// transpone to get the right format

接下来,将其转换为Luminance / Chrominance:

patches = rgb2ntsc(patches);

最后,为结果的亮度分量指定一些值:

patches(:,1) = mean(patches(:,1)); %// the mean luminance of all points.
patches(:,1) = patches(1,1); %// the luminance of white
patches(:,1) = 1; %// just 1

但是,你应该知道,不同的灰色阴影只有它们的亮度不同。灰色的色度(色调和饱和度)为0.这意味着所有色块都具有完全相同的颜色。考虑到这一点,有一种更简单的方法:

targetLuminance = 5; %// take any value here
patchesRGB = repmat(targetLuminance,17,3);
patchesYIQ = repmat([targetLuminance 0 0],17,1);
相关问题