20060509-A Lab-based uniform color scale

本文介绍了如何在MATLAB中创建一个均匀的色彩尺度,并详细解释了选择有效色彩尺度的四个设计原则。通过在L*a*b*颜色空间中定义路径并将其转换为sRGB色彩空间,实现了色彩映射。此外,还提供了使用该色彩尺度查看Radon变换图像的应用实例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文:http://blogs.mathworks.com/steve/2006/05/09/a-lab-based-uniform-color-scale/

DSP Tips & Tricks

McNames gives four design principles for selecting an effective color scale (orcolormap, in MATLAB terminology):

  • "[The] color scale should cover as much of the range of available colors as possible, subject to the constraint that the luminance increases monotonically (for gray scale publications).
  • "Neighboring colors throughout the scale should be as distinct as possible."
  • "The perceptual difference between two colors should be approximately proportional to the difference between their positions along the color scale."
  • "The color scale should be intuitive."
A path through L*a*b* color space

Let's make a color scale that is a uniform ramp in L*. In the a*-b* plane, trace a semicircular path of radius 50, with angle varying between 0 and pi/2.

radius = 50;
theta = linspace(0, pi/2, 256).';
a = radius * cos(theta);
b = radius * sin(theta);
L = linspace(0, 100, 256).';
Lab = [L, a, b];
Now convert the L*a*b* values to sRGB so we can use it as a MATLAB colormap. Use the Image Processing Toolbox functions  makecform and applycform.
map = applycform(Lab, makecform('lab2srgb'));

Radon example

Let's use this colormap for looking at a Radon transform image.

I = zeros(100,100);
I(25:75, 25:75) = 1;
theta = 0:180;
[R,xp] = radon(I,theta);
imshow(R,[],'InitialMagnification','fit')
colormap(map)

Color scale function on MATLAB Central

The function color_scale on MATLAB Central lets you easily create color scales like this. You can choose different values for the radius and the starting angle, and you specify a clockwise or counterclockwise path through a*-b* space.

colormap(color_scale)

Color scale GUI

The same MATLAB Central submission contains the color_scale_tool function, which is a GUI that lets you control the color scale parameters with sliders. It also shows you both the color scale and the approximate grayscale equivalent.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值