function J=imgchange(I,e)
[m,n]=size(I); % I为图片
J= zeros((m/e),(n/e));
for i=1:(m/e)
for j=1:(n/e)
J(i,j)=I(round(e*i),round(e*j));
end
end
把像素分为(m/e)*(n/e)个e*e的组,取每组的右下角的元素,组成一幅新图,有点马赛克的感觉吧。
clear
load mandrill
for k = 1:2:10
figure('color','k')
J = imgchange(X,k);
image(J)
colormap(map)
axis off
axis image
end
e=1时(原图没变)
e=10时