数字图像处理第五章代码

这篇博客介绍了使用MATLAB进行数字图像处理,包括RGB到索引颜色的转换、HSI颜色空间操作、彩色标尺图像创建、图像白边处理、色彩校正以及图像平滑和锐化等技术。通过示例代码展示了不同步骤的应用。
摘要由CSDN通过智能技术生成

图像处理第五章代码

5.1

f=imread(‘D:\1\1.tif’);

[x1,map1]=rgb2ind(f,8,‘nodither’);

[x2,map2]=rgb2ind(f,8,‘dither’);

g=rgb2gray(f);

g1=dither(g);

subplot(3,3,1),imshow(‘D:\作业\tp\DIP3E_CH06_Original_Images\DIP3E_Original_Images_CH06\1.tif’)

subplot(3,3,2),imshow(x2,map1)

subplot(3,3,3),imshow(x2,map2)

subplot(3,3,4),imshow(g)

subplot(3,3,5),imshow(g1)

5ea044df83e448d484f1504a40321f3d.jpeg

 

5.2

path=(‘D:\1\2.tif’);

%% RGB

I=imread(path);

figure();

subplot(111);

imshow(I);%显示原始彩色图像title(‘原始图像’);

 

%% HSI颜色空间

iHsi=rgb2hsi(I);

figure();

hsi_H=iHsi(:,:,1); %色调

hsi_S=iHsi(:,:,2); %饱和度

hsi_I=iHsi(:,:,3); %亮度

subplot(131);imshow(hsi_H);title(‘H(色调)’);

subplot(132);imshow(hsi_S);title(‘S(饱和度)’);

subplot(133);imshow(hsi_I);title(‘I(亮度)’);

0bde24f148e446b999720a153d7e9f7b.png

 

5.3

L = linspace(40,80,1024); %构建线性斜坡

radius = 70;

theta = linspace(0,pi,1024);

a = radiuscos(theta);

b = radiussin(theta); %设置平面中的彩色极角

L=repmat(L,100,1);

a=repmat(a,100,1);

b=repmat(b,100,1);

lab_scale = cat(3,L,a,b); %制作一幅彩色标尺图像

cform = makecform(‘lab2srgb’);

rgb_scale = applycform(lab_scale,cform);

imshow(rgb_scale) %显示彩色标尺

0010e0847cdf44009d073d906915e8bc.png

 

5.4

f=imread(‘D:\作业\tp\DIP3E_CH06_Original_Images\DI

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值