91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 14KB
    文件類型: .m
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-18
  • 語言: Matlab
  • 標簽: matlab??RGB??HSV????

資源簡介

該matlab程序實現各個顏色空間模型的相互轉化,說明及使用示例程序中都有說明。與君共享。

資源截圖

代碼片段和文件信息

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?[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(::

評論

共有 條評論