Untitled

mail@pastecode.io avatar
unknown
plain_text
24 days ago
582 B
3
Indexable
Never
%read an image in matrix I

%read an image in matrix m,n,c

I=imread("peppers.png");

[m,n,c]=size(1);

3=zeros(m,n);

%creating zero matrix of size m x n

31=zeros(m, n);

%initalizing the values in the zero matrix J and J1

for i=1:m

J(i,j)=(I(i,j,1)+I(i,j,2)+I(i,j,3))/3; J1(i,j)=(0.299*1(i,j,1)+0.587*1(i,j,2)+0.114*1(i,j,3))/3;

1

2

3

4

5

6

7

8

9

10

11

for j=1:n

12

13

14

end;

15

end;

16

17

figure;

18

subplot(2,2,1);

19

imshow(I);

20

title("original");

21

subplot(2,2,2);

22

imshow(3,[]);

23

title("");

24

subplot(2,2,3);

25

imshow(31,[]);
Leave a Comment