Code covered by the BSD License  

Highlights from
Lab color scale

4.75

4.8 | 4 ratings Rate this file 25 Downloads (last 30 days) File Size: 12.1 KB File ID: #11037
image thumbnail

Lab color scale

by

 

09 May 2006 (Updated )

Create color scale that prints well on grayscale printers

| Watch this File

File Information
Description

The function color_scale creates a color scale, or colormap, that is approximately uniform perceptually on both a color display and on a grayscale printer. The color scale is computed using the L*a*b* color space. It follows a uniform ramp along the L* direction, and it follows a semicircular path in the a*-b* plane.

The function color_scale_tool launches a GUI that allows you to experiment easily with different input parameters for color_scale.

For more information about these functions, see my image processing blog posting, http://blogs.mathworks.com/steve/?p=57

Acknowledgements

This file inspired Bipolar Colormap and Perceptually Improved Colormaps.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.2 (R2006a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
09 Apr 2013 Steve Eddins

applycform clips colors to the gamut.

09 Apr 2013 Jonathan

How does applycform deal with colors outside the RGB cube? Certainly when you have lightness at 0 or 100, and non-zero chroma, these values cannot be reproduced by RGB. I've tried to implement a variation of this in Python (https://gist.github.com/endolith/5342521/) and it works pretty well, but you don't seem to do anything to limit the range of the colors.

22 Oct 2010 Matteo Niccoli

Steve,

I do not have image processing toolbox, so I cannot really run this code. But I give the submission a 5 based on your excellent post. It was really useful for me to learn more on how to work in Lab space. I modified the code snippet in your post and combined with cline and colorspace to display L plot using the resulting RGB color:

% 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];
% RGBhlx=colorspace('RGB<-Lab',(Lab));
% figure; cline(a, b, L, L,RGBhlx); view(3);
% VIEW(-165,-15);

25 Jun 2008 Alexandre Tumlinson

Take a look at 'colorGray' which has similar functionality but with "rainbow" like color spectrum.

04 Jul 2007 michal sh  
08 Feb 2007 hassan quzmar  

Contact us