资源简介
被评为最好的颜色转换器, 可以转换这么多颜色: 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).

代码片段和文件信息
function varargout = colorspace(Conversionvarargin)
%COLORSPACE Convert a color image between color representations.
% B = COLORSPACE(SA) 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‘ R‘G‘B‘ Red Green Blue (ITU-R BT.709 gamma-corrected)
% ‘YPbPr‘ Luma (ITU-R BT.601) + Chroma
% ‘YCbCr‘/‘YCC‘ Luma + Chroma (“digitized“ version of Y‘PbPr)
% ‘YUV‘ NTSC PAL Y‘UV Luma + Chroma
% ‘YIQ‘ NTSC Y‘IQ Luma + Chroma
% ‘YDbDr‘ SECAM Y‘DbDr Luma + Chroma
% ‘JPEGYCbCr‘ JPEG-Y‘CbCr Luma + Chroma
% ‘HSV‘/‘HSB‘ Hue Saturation Value/Brightness
% ‘HSL‘/‘HLS‘/‘HSI‘ Hue Saturation Luminance/Intensity
% ‘XYZ‘ CIE XYZ
% ‘Lab‘ CIE L*a*b* (CIELAB)
% ‘Luv‘ CIE L*u*v* (CIELUV)
% ‘Lch‘ CIE L*ch (CIELCH)
%
% All conversions assume 2 degree observer and D65 illuminant. Color
% space names are case insensitive. When R‘G‘B‘ is the source or
% destination it can be omitted. For example ‘yuv<-‘ is short for
% ‘yuv<-rgb‘.
%
% MATLAB uses two standard data formats for R‘G‘B‘: double data with
% intensities in the range 0 to 1 and uint8 data with integer-valued
% intensities from 0 to 255. As MATLAB‘s native datatype double data is
% the natural choice and the R‘G‘B‘ format used by colorspace. However
% for memory and computational performance some functions also operate
% with uint8 R‘G‘B‘. Given uint8 R‘G‘B‘ color data colorspace will
% first cast it to double R‘G‘B‘ before processing.
%
% If A is an Mx3 array like a colormap B will also have size Mx3.
%
% [B1B2B3] = COLORSPACE(SA) specifies separate output channels.
% COLORSPACE(SA1A2A3) specifies separate input channels.
% Pascal Getreuer 2005-2006
%%% Input parsing %%%
if nargin < 2 error(‘Not enough input arguments.‘); end
[SrcSpaceDestSpace] = parse(Conversion);
if nargin == 2
Image = varargin{1};
elseif nargin >= 3
Image = cat(3varargin{:});
else
error(‘Invalid number of input arguments.‘);
end
FlipDims = (size(Image3) == 1);
if FlipDims Image = permute(Image[132]); end
if ~isa(Image‘double‘) Image = double(Image)/255; end
if size(Image3) ~= 3 error(‘Invalid input size.‘); end
SrcT = gettransform(SrcSpace);
DestT = gettransform(DestSpace);
if ~ischar(SrcT) & ~ischar(DestT)
% Both source and destination transforms are affine so they
% can be composed into one affine operation
T = [DestT(:1:3)*SrcT(:1:3)DestT(:1:3)*SrcT(:4)+DestT(:4)];
Temp = zeros(size(Image));
Temp(::1) = T(1)*Image(::1) + T(4)*Image(::2) + T(7)*Image(::3) + T(10);
Temp(::2) = T(2)*Image(::1) + T(5)*Image(::
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2006-08-13 18:48 colorspace\
文件 14019 2006-08-13 18:29 colorspace\colorspace.m
目录 0 2006-08-13 18:48 colorspace\demo\
文件 1809 2006-08-13 18:43 colorspace\demo\colorspace_ciedemo.m
文件 6141 2006-08-13 18:35 colorspace\demo\colorspace_demo.m
目录 0 2006-08-13 18:48 colorspace\doc\
文件 22948 2006-08-13 18:47 colorspace\doc\colorspace.html
文件 13510 2006-08-13 15:19 colorspace\doc\colorspace_01.jpg
文件 8126 2006-08-04 23:21 colorspace\doc\colorspace_02.jpg
文件 12724 2006-08-13 15:25 colorspace\doc\colorspace_03.jpg
目录 0 2006-08-13 18:48 colorspace\test\
文件 879 2006-08-13 18:04 colorspace\test\test_main.m
- 上一篇:Tamir.SharpSSH类库及使用
- 下一篇:ARM嵌入式VXWORKS实践教程
相关资源
- 编程实现二维DCT变换
- 图像二值化
- 用FFT对信号进行频谱分析
- Tone-Reservation
- QGA 量子遗传算法
- 差分形式的阻滞增长模型
- 遗传算法的M文件
- 简单二阶互联系统的非线性动力学分
- 手写数字识别-模板匹配法
- Stock_Watson_动态因子分析模型
- 果蝇优化算法优化支持向量回归程序
- 自己做的一个简单GUI扑克纸牌识别-
- multi output SVR
- AR过程的线性建模过程与各种功率谱估
- PCNN TOOLBOX
- plstoolbox.zip
- 中国国家基础地理信息系统GIS数据
- 粒子群微电网优化调度
- 矩阵分析-经典教材-中文版-Roger.A.Ho
- 压缩感知TwIST
- 基于最小错误率的贝叶斯手写数字分
- 最全系统辨识源代码,包括多种最小
- 导弹制导实验
- 画跟踪精确度图的程序.zip
- 重力场大地水准面及重力异常阶次误
- prtools5.2.3工具包
- 脉冲耦合神经网络工具箱PCNN-toolbox
- SVM算法-回归拟合程序.zip
- Kriging代理模型EGO算法.zip
- Matalb实现停车场完整系统
评论
共有 条评论