Sunday, June 1, 2008

ASSIGNMENT # 6

#1

bigT=255*ones(256);
bigT(30:79,64:191)=zeros(50,128);
bigT(50:199,111:146)=zeros(150,36);
bigT1=ones(256);
for x=1:256
for y =1:256
u=x*cos(3*pi/4)+y*sin(3*pi/4);
v=-x*sin(3*pi/4)+y*cos(3*pi/4);
a=u; b=mod(v-u,256)+1;
r=floor(a);s=floor(b);
if((r>0)&(r,256)&(s>0)&(s<256))>
endif
endfor
endfor
imshow(bigT1/255);
imshow(double(bigT1)/255)





















#3

a)

compute the average colour for R = ones(100), G= tril(ones (100)0, B=zeros(100);

A(:,:,1)=ones(100);
A(:,:,2)=tril(ones(100));
A(:,:,3)=zeros(100);
B=255*A;
imshow(B)

To get the average colour:

A(:,:,1)=ones(100);
A(:,:,2)=tril(ones(100));
A(:,:,3)=zeros(100);
B=255*A;

size(A)


sum(sum(A))/100/100


C(:,:,1)=1*ones(100);
C(:,:,2)=0.50500*ones(100);
C(:,:,3)=zeros(100);
imshow(C)

images:



































b) the rainbow picture we made in assignment #4



pkg load image;
cd C:\;
A=imread(“rainbow.jpg”);
imshow(double(A)/255)






















size (A)

sum(sum(A))/(303*376)


B(:,:,1)=221.79*(ones(256));
B(:,:,2)=220.09*(ones(256));
B(:,:,3)=213.46*(ones(256));
imshow(B)








c)




pkg load image;
cd C:\;
A=imread(“biter.jpg”);
imshow(double(A)/255)

'





size (A)
ans =

107 160 3
sum(sum(A))/(107*160)
ans(:,:,1) = 82.482
ans(:,:,2) = 98.460
ans(:,:,3) = 14.894

ans/256

B=ones(256);
B(:,:,1) = 0.32346*ones(256);
B(:,:,2) = 0.38612*ones(256);
B(:,:,3) = 0.058407*ones(256);
imshow(B)








The average colour is the "mixed" green of all greens of this picture.

d)

pkg load image;
cd C:\;
A=imread("toyboy.jpg");
size(A)
ans =

160 128 3

sum(sum(A))/(160*128)
ans =

ans(:,:,1) = 30.857
ans(:,:,2) = 46.076
ans(:,:,3) = 62.843


ans/256
ans =

ans(:,:,1) = 0.12054
ans(:,:,2) = 0.17998
ans(:,:,3) = 0.24548


C=ones(256);
C(:,:,1)=0.12054*ones(256);
C(:,:,2)=0.17998*ones(256);
C(:,:,3)=0.24548*ones(256);
imshow(C)











The average colour is the mixture of "blues" in this picture.


#2













































No comments: