Colorspace Transformations

版本 1.4.0.0 (66.2 KB) 作者: Pascal Getreuer
Transform colors between sRGB, YCbCr, YPbPr, YUV, YIQ, HSV, HSL, HSI, XYZ, Lab, Luv, LCH, CAT02 LMS
18.7K 次下载
更新时间 2011/1/14

查看许可证

编者注: This file was selected as MATLAB Central Pick of the Week

This package converts colors between sRGB, Y'PbPr, Y'CbCr, JPEG-Y'CbCr, Y'UV, Y'IQ, Y'DbDr, HSV, HSL, HSI, CIE XYZ, CIE L*a*b* (CIELAB), CIE L*u*v* (CIELUV), and CIE L*ch (CIELCH), and CIE CAT02 LMS. It can be used either as part of a C/C++ program or compiled as a MATLAB MEX function.

For use in Matlab, colorspace is compiled as a MEX function by entering

mex colorspace.c

on the Matlab command console. As an alternative to MEX, a pure M-code version colorspace.m is also included.

For use in C programs, an example command line program colorcalc is included.

B = colorspace(S,A) converts the color representation of image A where S is a string specifying the conversion. S tells the source and destination color spaces, S = 'dest<-src', or alternatively, S = 'src->dest'. Supported color spaces are
'RGB' = sRGB IEC 61966-2-1
'YPbPr' = Luma (ITU-R BT.601) + Chroma
'YCbCr' = Luma + Chroma
'JPEG-YCbCr' = space used in JPEG
'YUV' = NTSC PAL Y'UV Luma + Chroma
'YIQ' = NTSC Y'IQ Luma + Chroma
'YDbDr' = SECAM Luma + Chroma
'HSV' or 'HSB' = Hue Saturation Value/Brightness
'HSL' or 'HLS' = Hue Saturation Luminance
'HSI' = Hue Saturation Intensity
'XYZ' = CIE XYZ
'Lab' = CIE L*a*b* (CIELAB)
'Luv' = CIE L*u*v* (CIELUV)
'LCH' = CIE L*C*H* (CIELCH)
'CAT02 LMS' = CIE CAT02 LMS

All transforms assume 2 degree observer and D65 illuminant. Color space names are case insensitive. When sRGB is the source or destination, it can be omitted. For example 'yuv<-' is short for 'yuv<-rgb'.

引用格式

Pascal Getreuer (2024). Colorspace Transformations (https://www.mathworks.com/matlabcentral/fileexchange/28790-colorspace-transformations), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2007b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.4.0.0

added tags, minor update in documentation

1.3.0.0

* Added missing colorspace.h file---thanks to William Cook
* Added M-code version colorspace.m
* Added JPEG-Y'CbCr
* ITU-R BT.709 gamma correction replaced with more standard sRGB definition
* Fix in Xyz2Luv
* Fix in CIE tongue demo