Matlab数字图像处理基础【6】

实例:彩色图像的锐化
clc;
clear;

%读取经典图像lena.jpg
A = imread('lena.jpg');
figure,imshow(A),title('原图像');

%提取三个通道的像素值
R_A = A(:,:,1);
G_A = A(:,:,2);
B_A = A(:,:,3);
figure
subplot(1,3,1),imshow(R_A),title('R通道');
subplot(1,3,2),imshow(G_A),title('G通道');
subplot(1,3,3),imshow(B_A),title('B通道');

%定义锐化算子
h1 = fspecial('sobel');
h2 = fspecial('prewitt');

%R通道锐化
R_h1 = imfilter(R_A, h1);
R_h2 = imfilter(R_A, h2);
figure,
subplot(1,2,1),imshow(R_h1),title('Sobel R通道锐化');
subplot(1,2,2),imshow(R_h2),title('Prewitt R通道锐化');

%G通道锐化
G_h1 = imfilter(G_A, h1);
G_h2 = imfilter(G_A, h2);
figure,
subplot(1,2,1),imshow(G_h1),title('Sobel G通道锐化');
subplot(1,2,2),imshow(G_h2),title('Prewitt G通道锐化');

%B通道锐化
B_h1 = imfilter(B_A, h1);
B_h2 = imfilter(B_A, h2);
figure,
subplot(1,2,1),imshow(B_h1),title('Sobel B通道锐化');
subplot(1,2,2),imshow(B_h2),title('Prewitt B通道锐化');

%合成三个通道的锐化结果
A_h1 = cat(3, R_h1, G_h1, B_h1);
A_h2 = cat(3, R_h2, G_h2, B_h2);
figure,
subplot(1,2,1),imshow(A_h1),title('Sobel 三通道合成');
subplot(1,2,2),imshow(A_h2),title('Prewitt 三通道合成');

实验结果:
原图像:
三通道分离:
R通道滤波结果:
G通道滤波结果:
B通道滤波结果:
滤波结果合成:

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值