采样原理
对坐标值进行数字化称为采样。
采样结果
原图:
采样结果:
采样局部放大图:
采样结果分析
采样间隔越大,所得图像像素数越少,空间分辨率低,质量差,严重时会出现马赛克;采样间隔越小,所得图像像素数越多,空间分辨率越高,空间质量好,但与此同时,数据量也会增大。
代码
%Write by 长安 Rjex
clear, close all;
I = imread('myfirst.jpg');I = rgb2gray(I); %图像灰度化
I2=I(1:2:end,1:2:end); %每2位采集1位
I4=I(1:4:end,1:4:end); %每4位采集1位
I8=I(1:8:end,1:8:end); %每8位采集1位
I16=I(1:16:end,1:16:end); %每16位采集1位
I32=I(1:32:end,1:32:end); %每32位采集1位
%显示图片
subplot(2,3,1),imshow(I),title('原始图像(256*256)');
subplot(2,3,2),imshow(I2),title('采样图像1(128*128)');
subplot(2,3,3),imshow(I4),title('采样图像2(64*64)');
subplot(2,3,4),imshow(I8),title('采样图像3(32*32)');
subplot(2,3,5),imshow(I16),title('采样图像4(16*16)');
subplot(2,3,6),imshow(I32),title('采样图像5(8*8)');