Monday, June 2, 2008

Assignment #6-question 3

Assignment 6 - 3 b)


pkg load image

cd 'C:\pictures'
A=imread("Rainbow.jpg");
B=double(A)/255;
size(B)

ans =
109 200 3

aveB=sum(sum(B))/109/200

ans(:,:,1)=0.56770
ans(:,:,2)=0.34527
ans(:,:,3)=0.30058


aveB(:,:,1)=0.56770
aveB(:,:,2)=0.34527
aveB(:,:,3)=0.30058

imshow(aveB)


6 -3 b)

Find the average colour of two images from the web.

C=imread("green.jpg");
D=double(C)/255;
imshow(D)
size(D)

ans =
110 160 3

aveD=sum(sum(D))/110/160

ans(:,:,1)=0.46077
ans(:,:,2)=0.66349
ans(:,:,3)=0.069944


aveD(:,:,1)=0.46077
aveD(:,:,2)=0.66349
aveD(:,:,3)=0.069944

imshow(aveD)


E=imread("blue.jpg");
F=double(E)/255
imshow(F)
size(F)
ans =

106 160 3

aveF=sum(sum(F))/106/160

ans(:,:,1)=0.24725
ans(:,:,2)=0.35670
ans(:,:,3)=0.76474


aveF(:,:,1)=0.24725
aveF(:,:,2)=0.35670
aveF(:,:,3)=0.76474
imshow(aveF)

When the original image is predominately one colour, the average colour is similar. When the original image has many colours, the average colour is less predictable.

No comments: