您的位置:首页 > 其它

彩色图像处理

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="" />
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: