彩色图像处理
2015-10-23 09:42
260 查看
熟悉一些彩色空间处理的基本操作:rgb图像和索引图像,彩色空间之间的转换,彩色变换和彩色空间滤波,包过彩色平滑和锐化,最后进行彩色边缘检测和rgb向量空间的图像分割。
1.从两个对称视角查看RGB彩色立方体
rgbcube(10,10,4);<span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;">%10,10,4是默认的坐标</span>
axis on;grid on;
title('视角4');
figure,rgbcube(10,10,-4);
axis on;grid on;
title('视角-4');
%运行结果:
<img src="https://img-blog.csdn.net/20151023100121175?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" /><img src="https://img-blog.csdn.net/20151023100125919?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center"
alt="" />
2.索引图像
>> imgRGB=imread('.\06\Fig0635(top_ left_flower).tif');
>> [X map]=rgb2ind(imgRGB,256);
>> imshow(X,map);
>> title('256');
运行结果如下:
<img src="https://img-blog.csdn.net/20151023100924192?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
[Y,newmap]=imapprox(X,map,64);%64种颜色来近似一幅索引图像
figure,imshow(Y,newmap);
title('64');
%其运行结果如下:
<img src="https://img-blog.csdn.net/20151023102454450?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
RGB=imread('.\06\Fig0651(a)(flower_no_compression).tif');
>> imshow(RGB)
<img src="https://img-blog.csdn.net/20151023105029777?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
>> [X1 map1]=rgb2ind(RGB,8,'nodither');
>> imshow(X1,map1);
<img src="https://img-blog.csdn.net/20151023104938973?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
<span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;">>> [X2 map2]=rgb2ind(RGB,8,'dither');</span>
>> figure,imshow(X2,map2)
<img src="https://img-blog.csdn.net/20151023105110927?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
<span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;">>> g=rgb2gray(RGB);</span>
<span style="font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;">>> g1=dither(g);
>> figure,imshow(g);figure,imshow(g1);</span>
<span style="font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;"><img src="https://img-blog.csdn.net/20151023105128270?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
</span>
<img src="https://img-blog.csdn.net/20151023105206734?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
3.彩色图像处理基础
包括颜色变换(彩色映射)、单独彩色平面的空间处理、颜色向量处理
4.彩色变换
问题:线性插值???样条插值???
<span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">%% spline函数的使用</span><br style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color:
rgb(245, 245, 245);">clc</span><br style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">clear</span><br style="font-family: 'Courier New'; line-height: 18px;"
/><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">x=</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 128);">0</span><span style="font-family: 'Courier New'; line-height:
18px; background-color: rgb(245, 245, 245);">:</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 128);">10</span><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">;</span><br
style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">y=sin(x);</span><br style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family:
'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">subplot(</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 128);">121</span><span style="font-family: 'Courier New'; line-height: 18px; background-color:
rgb(245, 245, 245);">),plot(x,y,</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">'</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">+</span><span style="line-height: 18px; font-family:
'Courier New'; color: rgb(128, 0, 0);">'</span><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">,x,y,</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">'</span><span
style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">r</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">'</span><span style="font-family: 'Courier New'; line-height: 18px; background-color:
rgb(245, 245, 245);">);%画xy图像,并标出x和y点</span><br style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">xx=</span><span style="line-height: 18px; font-family:
'Courier New'; color: rgb(128, 0, 128);">0</span><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">:.</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 128);">25</span><span
style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">:</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 128);">10</span><span style="font-family: 'Courier New'; line-height: 18px;
background-color: rgb(245, 245, 245);">;</span><br style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">yy=spline(x,y,xx);</span><br style="font-family:
'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">subplot(</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 128);">122</span><span style="font-family:
'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">),plot(x,y,</span><span style="line-height: 18px; font-f
a148
amily: 'Courier New'; color: rgb(128, 0, 0);">'</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128,
0, 0);">o</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">'</span><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">,xx,yy,</span><span style="line-height: 18px; font-family:
'Courier New'; color: rgb(128, 0, 0);">'</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">b</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">'</span><span style="font-family:
'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">);%也是画xy图像,标出x和y点,但是这中间插值了隔.25的数,只是没被标出来(转)</span><br style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color:
rgb(245, 245, 245);">%其运行结果如下:</span>
<img src="https://img-blog.csdn.net/20151023111941966?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
>> f=imread('.\06\Fig0646(a)(lenna_original_RGB).tif');
>> g=ice('image',f);%'wait'.'off/on''space'.'hsi/cmy....'默认rgb
<img src="https://img-blog.csdn.net/20151023112707099?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
1.从两个对称视角查看RGB彩色立方体
rgbcube(10,10,4);<span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;">%10,10,4是默认的坐标</span>
axis on;grid on;
title('视角4');
figure,rgbcube(10,10,-4);
axis on;grid on;
title('视角-4');
%运行结果:
<img src="https://img-blog.csdn.net/20151023100121175?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" /><img src="https://img-blog.csdn.net/20151023100125919?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center"
alt="" />
2.索引图像
>> imgRGB=imread('.\06\Fig0635(top_ left_flower).tif');
>> [X map]=rgb2ind(imgRGB,256);
>> imshow(X,map);
>> title('256');
运行结果如下:
<img src="https://img-blog.csdn.net/20151023100924192?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
[Y,newmap]=imapprox(X,map,64);%64种颜色来近似一幅索引图像
figure,imshow(Y,newmap);
title('64');
%其运行结果如下:
<img src="https://img-blog.csdn.net/20151023102454450?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
RGB=imread('.\06\Fig0651(a)(flower_no_compression).tif');
>> imshow(RGB)
<img src="https://img-blog.csdn.net/20151023105029777?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
>> [X1 map1]=rgb2ind(RGB,8,'nodither');
>> imshow(X1,map1);
<img src="https://img-blog.csdn.net/20151023104938973?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
<span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;">>> [X2 map2]=rgb2ind(RGB,8,'dither');</span>
>> figure,imshow(X2,map2)
<img src="https://img-blog.csdn.net/20151023105110927?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
<span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;">>> g=rgb2gray(RGB);</span>
<span style="font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;">>> g1=dither(g);
>> figure,imshow(g);figure,imshow(g1);</span>
<span style="font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;"><img src="https://img-blog.csdn.net/20151023105128270?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
</span>
<img src="https://img-blog.csdn.net/20151023105206734?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
3.彩色图像处理基础
包括颜色变换(彩色映射)、单独彩色平面的空间处理、颜色向量处理
4.彩色变换
问题:线性插值???样条插值???
<span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">%% spline函数的使用</span><br style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color:
rgb(245, 245, 245);">clc</span><br style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">clear</span><br style="font-family: 'Courier New'; line-height: 18px;"
/><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">x=</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 128);">0</span><span style="font-family: 'Courier New'; line-height:
18px; background-color: rgb(245, 245, 245);">:</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 128);">10</span><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">;</span><br
style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">y=sin(x);</span><br style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family:
'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">subplot(</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 128);">121</span><span style="font-family: 'Courier New'; line-height: 18px; background-color:
rgb(245, 245, 245);">),plot(x,y,</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">'</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">+</span><span style="line-height: 18px; font-family:
'Courier New'; color: rgb(128, 0, 0);">'</span><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">,x,y,</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">'</span><span
style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">r</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">'</span><span style="font-family: 'Courier New'; line-height: 18px; background-color:
rgb(245, 245, 245);">);%画xy图像,并标出x和y点</span><br style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">xx=</span><span style="line-height: 18px; font-family:
'Courier New'; color: rgb(128, 0, 128);">0</span><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">:.</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 128);">25</span><span
style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">:</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 128);">10</span><span style="font-family: 'Courier New'; line-height: 18px;
background-color: rgb(245, 245, 245);">;</span><br style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">yy=spline(x,y,xx);</span><br style="font-family:
'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">subplot(</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 128);">122</span><span style="font-family:
'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">),plot(x,y,</span><span style="line-height: 18px; font-f
a148
amily: 'Courier New'; color: rgb(128, 0, 0);">'</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128,
0, 0);">o</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">'</span><span style="font-family: 'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">,xx,yy,</span><span style="line-height: 18px; font-family:
'Courier New'; color: rgb(128, 0, 0);">'</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">b</span><span style="line-height: 18px; font-family: 'Courier New'; color: rgb(128, 0, 0);">'</span><span style="font-family:
'Courier New'; line-height: 18px; background-color: rgb(245, 245, 245);">);%也是画xy图像,标出x和y点,但是这中间插值了隔.25的数,只是没被标出来(转)</span><br style="font-family: 'Courier New'; line-height: 18px;" /><span style="font-family: 'Courier New'; line-height: 18px; background-color:
rgb(245, 245, 245);">%其运行结果如下:</span>
<img src="https://img-blog.csdn.net/20151023111941966?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
>> f=imread('.\06\Fig0646(a)(lenna_original_RGB).tif');
>> g=ice('image',f);%'wait'.'off/on''space'.'hsi/cmy....'默认rgb
<img src="https://img-blog.csdn.net/20151023112707099?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
相关文章推荐
- mysql 4种事务隔离级别
- c#与JavaScript实现对用户名、密码进行RSA非对称加密
- sql 截取字符串与 截取字符串最长的字符串
- 【PAT】1083. List Grades (25)
- 框架vs.类库
- Ubuntu linux 下查找文件或者内容常用命令
- swift可以不继承NSObject
- [转载] 为 Key-Value 数据库实现 MVCC 事务
- Python字符编码详解
- Android 三大图片缓存原理、特性对比
- 为什么农民宁可被拘留也要烧秸秆?对烧秸秆农民拘留、罚款,非解决问题之道
- JSON在ASP.NET中使用方法
- Java&Android开源库代码剖析】のandroid-async-http(如何设计一个优雅的Android网络请求框架,同...
- ASP.NET VS2013 Office 转 PDF
- Sql Server 数据分页
- BIOS设置之UEFI/Legacy BIOS切换图文详解
- 大风大浪过后,必有彩虹,大浪中要稳握着股票,
- 【笔记】C#往TextBox的方法AppendText加入的内容里插入换行符
- [OrangePi] Booting from USB drive
- 每天一个Linux命令(3): cd