Untitled
unknown
plain_text
11 days ago
987 B
4
Indexable
Never
1 I=imread("cameraman.tif"); [m,n]=size(I); J_128=zeros(m/2,n/2); for i=1:m/2 for j=1:n/2 J_128(i,j)=I(2*i,2*j); end end J_64=zeros(m/4,n/4); for i=1:m/4 for j=1:n/4 J_64(i,j)=I(4*i,4*j); end end J_32=zeros(m/8,n/8); for i=1:m/8 for j=1:n/8 J_32(i,j)=I(8*i,8*j); end end figure; subplot(2,2,1); imshow(I); title('original img'); subplot(2,2,2); imshow(J_128,[]); title('img 128 bit'); subplot(2,2,3); imshow(J_64,[]); title('img 64 bit'); subplot(2,2,4); imshow(J_32,[]); title('img 32 bit'); 2 I = imread("peppers.png") [m,n,c]=size(I); J=zeros(m,n ); J1=zeros(m,n ); for i = 1:m for j = 1:n J(i,j)=(I(i,j,1)+I(i,j,2)+I(i,j,3))/3; J1(i,j)=(0.299*I(i,j,1)+0.587*I(i,j,2)+0.114*I(i,j,3))/3; end; end; figure; subplot(2,2,1); imshow(I); title("Original"); subplot(2,2,2); imshow(J,[]); title("grey"); subplot(2,2,3); imshow(J1,[]); title("grey");
Leave a Comment