第一范文网 - 专业文章范例文档资料分享平台

matlab图像处理基础实例

来源:用户分享 时间:2025/7/31 20:34:46 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

mat2gray函数将一个数据矩阵转化为一个灰度图像 >> i=imread('rice.png');

>> j=filter2(fspecial('sobel'),i); >> k=mat2gray(j); >> imshow(i)

>> figure,imshow(k)

rgb2gary函数将真彩色图像转化为灰度图像 >> [x,map]=imread('rice.png');

>> np=rgb2gray(map);

??? Error using ==> rgb2gray>parse_inputs MAP must be a m x 3 array.

Error in ==> rgb2gray at 35 X = parse_inputs(varargin{:}); ???????????? >> rgb=imread('peppers.png');

>> [X_nodither,map]=rgb2ind(rgb,8,'nodither'); >> [X_dither,map]=rgb2ind(8,'dither'); >> subplot(131),imshow(rgb);

>> subplot(132),imshow(X_nodither,map); %无抖动 >> subplot(133),imshow(X_dither,map) %有抖动

im2bw函数通过设定阈值将真彩、索引和灰度图像转化为二值图像 >> load trees

>> b=im2bw(X,map,.4); >> imshow(X,map) >> figure,imshow(b)

>> rgb=reshape(ones(64,1)*reshape(jet(64),1,192),[64,64,3]);

>> hsv=rgb2hsv(rgb); >> h=hsv(:,:,1); >> s=hsv(:,:,2); >> v=hsv(:,:,3); >> subplot(221)

>> imshow(h),title('色调')

>> subplot(222),imshow(s),title('饱和度') >> subplot(223),imshow(v),title('亮度')

>> subplot(224),imshow(h),title('原真彩色调色板')

>> rgb=imread('peppers.png'); >> yiq=rgb2ntsc(rgb);

>> subplot(121),imshow(rgb),title('原始rgb图像')

>> subplot(122),imshow(yiq(:,:,1)),title('变换后的ntsc图像')

>> rgb=imread('peppers.png'); >> hsv=rgb2hsv(rgb);

>> subplot(121),imshow(rgb),title('原始rgb图像')

>> subplot(122),imshow(hsv),title('变换后的hsv图像')

>> rgb=imread('peppers.png'); >> ycbcr=rgb2ycbcr(rgb);

>> subplot(121),imshow(rgb),title('原始rgb图像')

>> subplot(122),imshow(ycbcr),title('变换后的ycbcr图像')

色彩重排

>> [x,map]=imread('canoe.tif'); >> [y,newmap]=cmpermute(x,map);

>>map

。。。。。。。。 >>newmap

。。。。。。。。

褪色前后

>> [x,map]=imread('canoe.tif'); >> [y,newmap]=imapprox(x,map,20); >> imshow(x,map)

>> figure,imshow(y,newmap)

搜索更多关于: matlab图像处理基础实例 的文档
matlab图像处理基础实例.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c33su009ccj0h1ll029w4_8.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top