MATLAB 图像处理-图像灰度化,高斯滤波,降采样

%读取图像并转成灰度图像
I =imread('tiantan.jpg');
I =rgb2gray(I);
%生成高斯滤波器核
w =fspecial('gaussian',3,0.5);
size_a = size(I);
%进行高斯滤波
g =imfilter(I,w,'conv','symmetric','same');
%降采样
t = g(1:3:size_a(1),1:3:size_a(2));
%显示处理结果
imshow(I);
figure
imshow(t)

 

 

法二:通过video.Pyramid调用

hgausspymd =video.Pyramid;
hgausspymd.PyramidLevel=2;
x =imread('1.jpg');
y =step(video.Pyramid,x);

%显示结果
figure,imshow(x);title('原始图像');
x1 =mat2gray(double(y));
figure,imshow(x1);
title('Decomposed Image')
 

你可能感兴趣的:(MATLAB图像处理基础,图像降采样)