Untitled
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(""); subplot(2,2,3); imshow(J1,[]);
Leave a Comment