Saturday, June 21, 2008

Assign 6 Q3b


Rainbow from Assignment 4 Q4 is given by:
To find its average color write the following code:
pkg load image
cd C:\users\admin\pictures
A=imread("assign4q18rainbow.jpg");
imshow(A)

size(A)
ans =

89 129 3

sum(sum(A))
ans =

ans(:,:,1) = 2076422
ans(:,:,2) = 1669866
ans(:,:,3) = 1580322

B=sum(sum(A))/size(A,1)/size(A,2)
B =

ans(:,:,1) = 180.86
ans(:,:,2) = 145.45
ans(:,:,3) = 137.65

for i=1:3
averagecolor(:,:,i)=B(i)*ones(100);
end
imshow(averagecolor)

Average color = white screen




No comments: