Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
250 B
2
Indexable
I=imread("peppers.png")
(m,n,c)=size(I);
J=zeroes(m,n);
J1=zeroes(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,imshow(J) 
Leave a Comment