4.67857

4.7 | 29 ratings Rate this file 320 downloads (last 30 days) File Size: 48.13 KB File ID: #7744

Color Space Converter

by Pascal Getreuer

 

28 May 2005 (Updated 16 Aug 2006)

Code covered by BSD License  

Convert color images between RGB, YCbCr, HSV, HSL, CIE Lab, CIE Luv, CIE Lch, and more.

Editor's Notes:


This is a File Exchange Select file.



Select files are submissions that have been peer-reviewed and approved as meeting a high standard of utility and quality.

Download Now | Watch this File

File Information
Description

The M-file colorspace included in this package is a self-contained MATLAB function that converts color images between R'G'B', Y'PbPr, Y'CbCr, Y'UV, Y'IQ, Y'DbDr, JPEG-Y'CbCr, HSV, HSL, XYZ, CIE L*a*b* (CIELAB), CIE L*u*v* (CIELUV), and CIE L*ch (CIELCH).

B = colorspace('dest<-src', A) converts image A from color space 'src' to color space 'dest'.

Example:
B = colorspace('HSV<-RGB',A); % Convert image A from R'G'B' to HSV
C = colorspace('YCbCr<-HSV',B); % Convert HSV to Y'CbCr
D = colorspace('RGB<-YCbCr',C); % Convert Y'CbCr back to R'G'B'

See the HTML file for more information.

Acknowledgements
This submission has inspired the following:
Bilateral Filtering
MATLAB release MATLAB 5.3 (R11)
Zip File Content  
HTML Files colorspace/doc/colorspace.html
Other Files colorspace/colorspace.m,
colorspace/demo/colorspace_ciedemo.m,
colorspace/demo/colorspace_demo.m,
colorspace/doc/colorspace_01.jpg,
colorspace/doc/colorspace_02.jpg,
colorspace/doc/colorspace_03.jpg,
colorspace/test/test_main.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (33)
07 Jun 2005 Pushkar Pradhan

Very user friendly, however I wish it had the HLS model based on the triangle model:
L=(R+G+B)/3

08 Oct 2005 Nolan McGee  
09 Nov 2005 er rtq  
07 Mar 2006 monly w.  
15 Mar 2006 tahir lord  
15 Mar 2006 tahir lord

no

31 Aug 2006 Steven De Lamas

Great effort.. Thanks!

03 Oct 2006 jason tu

Good

14 Nov 2006 shiquan yang

very useful in matlab v6.5 which have only 4 kinds of color spaces conversion

28 Dec 2006 sai githa

great!

05 Feb 2007 Jubi Jubi

Very good!

04 Mar 2007 raja rao chatla

This is a good attempt to study color conversion algorithms

09 May 2007 Rayner Tiam  
04 Sep 2007 badtiger badtiger

can not download the .zip file

06 Sep 2007 ali fotouhi  
08 Sep 2007 alireza kashanipour

the range of H in HSL space is [0,255] but your rgb2hsl function ('hsl<-rgb') get value in [0,360]!!!!

09 Sep 2007 alireza kashanipour

oh sorry,right with you,so sorry again and tanx alot for sharing,

21 Nov 2007 anh nguyen  
30 Dec 2007 Paul Koppen  
12 Feb 2008 prem kumar  
10 Mar 2008 liliana espaƱa  
01 Apr 2008 David IMM  
02 Apr 2008 Jakrawut Janta  
24 Jun 2008 manish meshram

good

15 Jul 2008 zhang lily

help for me, very useful

18 Sep 2008 Richie Cotton

Easy to use; well documented; very useful tool. Thanks.

02 Oct 2008 Dinesh Thakur  
13 Nov 2008 Royi Avital

Hello.
I used this M file to convert from sRGB to LAB.
I compared the Values from your method to those from using "makecform" and found them to be different, is there a reason?
Furthermore, both of them are different than L Channel in Photoshop.

Could anyone help me get the exact values of L channel in Photoshop?

Thanks.

27 Apr 2009 Florian

very usefull and nice docs

03 May 2009 Daniel N

Thank you!!
I find it for long time,almost,it is need money,
but,this is free, thank you for sharing~~

12 Aug 2009 shoo chen

Thank you!!
^_^

07 Sep 2009 Masoud

Perfect. Thank you!

06 Nov 2009 James

thanks

Please login to add a comment or rating.
Updates
16 Aug 2006

Created Select structure, added support for CIE color spaces

Tag Activity for this File
Tag Applied By Date/Time
color Pascal Getreuer 22 Oct 2008 07:49:32
rgb Pascal Getreuer 22 Oct 2008 07:49:32
ycbcr Pascal Getreuer 22 Oct 2008 07:49:32
hsv Pascal Getreuer 22 Oct 2008 07:49:32
hsl Pascal Getreuer 22 Oct 2008 07:49:32
cie Pascal Getreuer 22 Oct 2008 07:49:32
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com