数字图像处理-数字图像基础
- 用matlab程序实现同时对比度实验。
clear m=256; n=256; ground_gray1=180; X1=ones(m,n)*ground_gray1; ground_gray2=120; X2=ones(m,n)*ground_gray2; before_gray=150; m0=100; n0=100; step=50; X1(m0:m0+step,n0:n0+step)=before_gray; subplot(1,2,1); imshow(uint8(X1)); title('before150,ground180'); X2(m0:m0+step,n0:n0+step)=before_gray; subplot(1,2,2); imshow(uint8(X2)); title('before150,ground120');
- 用matlab程序实验空间分辨率变化效果
clear X1=imread('lena.jpg'); subplot(1,3,1); imshow(uint8(X1)); title('180*180'); [m,n]=size(X1); hold on; X2=X1(1:2:m,1:2:n); subplot(1,3,2); imshow(uint8(X2)); title('90*90'); hold on; X3=X1(1:3:m,1:3:n); subplot(1,3,3); imshow(uint8(X3)); title('60*60'); hole on;
- 用matlab程序实验幅度分辨率变化效果
clear X=imread('lena.jpg'); [m,n]=size(X); figure subplot(1,3,1); imshow(uint8(X)); title('180级'); for i=1:m for j=1:n X2(i,j)=2*(ceil(X(i,j)/2)); %仅保留2的倍数的灰度值 end end subplot(1,3,2); imshow(uint8(X2)); title('90级'); for i=1:m for j=1:n X3(i,j)=3*(ceil(X(i,j)/3)); %仅保留3的倍数的灰度值 end end subplot(1,3,3); imshow(uint8(X3)); title('60级');
hello world~