彩色图像处理MATLAB函数简介课件_第1页
彩色图像处理MATLAB函数简介课件_第2页
彩色图像处理MATLAB函数简介课件_第3页
彩色图像处理MATLAB函数简介课件_第4页
彩色图像处理MATLAB函数简介课件_第5页
已阅读5页,还剩24页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

彩色图像处理函数简介1函数简介applycform-Applydevice-independentcolorspacetransformation.hsv2rgb-ConvertHSVvaluestoRGBcolorspace(MATLABToolbox).iccread-ReadICCcolorprofile.lab2double-ConvertLabcolorvaluestodouble.lab2uint16-ConvertLabcolorvaluestouint16.lab2uint8-ConvertLabcolorvaluestouint8.makecform-Createdevice-independentcolorspacetransformstructure.ntsc2rgb-ConvertNTSCvaluestoRGBcolorspace.1函数简介rgb2hsv-ConvertRGBvaluestoHSVcolorspace(MATLABToolbox).rgb2ntsc-ConvertRGBvaluestoNTSCcolorspace.rgb2ycbcr-ConvertRGBvaluestoYCBCRcolorspace.whitepoint-ReturnsXYZvaluesofstandardilluminants.xyz2double-ConvertXYZcolorvaluestodouble.xyz2uint16-ConvertXYZcolorvaluestouint16.ycbcr2rgb-ConvertYCBCRvaluestoRGBcolorspace.1函数简介dither-Convertimageusingdithering.gray2ind-Convertintensityimagetoindexedimage.grayslice-Createindexedimagefromintensityimagebythresholding.graythresh-ComputeglobalimagethresholdusingOtsu'smethod.im2bw-Convertimagetobinaryimagebythresholding.im2double-Convertimagearraytodoubleprecision.

1函数简介ind2gray-Convertindexedimagetointensityimage.ind2rgb-ConvertindexedimagetoRGBimage(MATLABToolbox).mat2gray-Convertmatrixtointensityimage.rgb2gray-ConvertRGBimageorcolormaptograyscale.rgb2ind-ConvertRGBimagetoindexedimage.‘type’参数‘type’参数应用rgb=imread('peppers.png');cform=makecform('srgb2lab');lab=applycform(rgb,cform);3颜色空间转换函数举例rgb2hsvConvertRGBcolormaptoHSVcolormapcmap=rgb2hsv(M)DescriptionconvertsanRGBcolormapMtoanHSVcolormapcmap.Bothcolormapsarem-by-3matrices.Theelementsofbothcolormapsareintherange0to1.ThecolumnsoftheinputmatrixMrepresentintensitiesofred,green,andblue,respectively.Thecolumnsoftheoutputmatrixcmaprepresenthue,saturation,andvalue,respectively.3颜色空间转换函数举例hsv2rgbConvertHSVcolormaptoRGBcolormapM=hsv2rgb(H)Descriptionconvertsahue-saturation-value(HSV)colormaptoared-green-blue(RGB)colormap.Hisanm-by-3matrix,wheremisthenumberofcolorsinthecolormap.ThecolumnsofHrepresenthue,saturation,andvalue,respectively.Misanm-by-3matrix.Itscolumnsareintensitiesofred,green,andblue,respectively.编程应用figure(2)imshow(fr)title('redcomponent')figure(3)imshow(fg)title('greencomponent')figure(4)imshow(fb)title('bluecomponent')编程应用%将RGB转换成HSVhc=rgb2hsv(fc);%提取HSV分量h=hc(:,:,1);s=hc(:,:,2);v=hc(:,:,3);figure(5)imshow(hsv2rgb(hc))title('hsvimage')编程应用%产生均值滤波器w=fspecial('average',5);%对RGB图像滤波rgb_filtered=imfilter(fc,w,'replicate');figure(9)imshow(rgb_filtered)title('filteredRGBimage')编程应用%仅对HSV图像的v分量滤波v_filtered=imfilter(v,w,'replicate');h=cat(3,h,s,v_filtered);f_filtered=hsv2rgb(h);f_filtered=min(f_filtered,1);figure(10)imshow(f_filtered)title('filteredhsvimage')编程应用%对h,s,v同时滤波h_filtered=imfilter(h,w,'replicate');s_filtered=imfilter(s,w,'replicate');v_filtered=imfilter(v,w,'replicate');h=cat(3,h_filtered,s_filtered,v_filtered);f_filtered=hsv2rgb(h);f_filtered=min(f_filtered,1);figure(11)imshow(f_filtered)4颜色空间转换函数的编写functionhsi=rgb2hsi(rgb)%将RGB图像转换成HSI图像rgb=im2double(rgb);r=rgb(:,:,1);g=rgb(:,:,2);b=rgb(:,:,3);4颜色空间转换函数的编写%将RGB转换HSInum=0.5*((r-g)+(r-b));den=sqrt((r-g).^2+(r-b).*(g-b));theta=acos(num./(den+eps));H=theta;h(b>g)=2*pi-H(b>g);H=H/(2*pi);num=min(min(r,g),b);den=r+g+b;den(den==0)=eps;S=1-3.*num./den;I=(r+g+b)/3;hsi=cat(3,H,S,I);4颜色空间转换函数的编写functionrgb=hsi2rgb(hsi)%将HSI图像转换成RGB图像H=hsi(:,:,1)*2*pi;S=hsi(:,:,2);I=hsi(:,:,3);%初始化R=zeros(size(hsi,1),size(hsi,2));G=zeros(size(hsi,1),size(hsi,2));B=zeros(size(hsi,1),size(hsi,2));4颜色空间转换函数的编写%GB区间(120-240)idx=find((2*pi/3<=H)&(H<4*pi/3));R(idx)=I(idx).*(1-S(idx));G(idx)=I(idx).*(1+S(idx).*cos(H(idx)-2*pi/3)./cos(pi-H(idx)));B(idx)=3*I(idx)-(R(idx)+G(idx));4颜色空间转换函数的编写%BR区间(240-360)idx=find((4*pi/3<=H)&(H<=2*pi));G(idx)=I(idx).*(1-S(idx));R(idx)=I(idx).*(1+S(idx).*cos(H(idx)-4*pi/3)./cos(5*pi/3-H(idx)));G(idx)=3*I(idx)-(G(idx)+B(idx));%组合成RGB图像rgb=cat(3,R,G,B);rgb=max(min(rgb,1),0);5灰度条与彩条产生函数X=ones(h,w);l=256/l;fork=0:l:256Y=k*X;c=cat(2,c,Y);endifisempty(map)map=[0:1/256:1]'*ones(1,3);endfigureimshow(c,map)6彩色,索引,灰度图像的转换[x,map]=gray2ind(gray_image,n);gray_image=ind2gray(x,map);[x,map]=rgb2ind(rgb_image,n,dither_option);rgb_image=ind2rgb(x,map);gray_image=rgb2gray(r

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论