Sunday, July 6, 2008

Mosaic

Starting image ........Picture taken from mural in hallway of my school




































































Below is the attempt of making a mosaic of the initial image above using photo images of flowes, grass and concrete taken from the school premises. Images taken such that they covered the entire color spectrum and ideal for taking color averages



pp
Sample of tiles used for mosaic. Images taken from camera

Sunday, June 15, 2008

Friday, June 13, 2008

Assignment 6 cont'd

3(c) Picture 2nd row 2nd column Picture from row 7 and column 2































pic1.jpg average color




Octave commands

pkg load image
cd t:\
a=imread("pic1.jpg")

sum(sum(a)) # yields


imshow(a)

size (a) #yields

160 107 3

sum(sum(a)) # yields

ans(:,:,1) = 1529983
ans(:,:,2) = 1729019
ans(:,:,3)= 1257798

b=sum(sum(a)/size(a)/size(a,1)/size(a,2);

ans(:,:,1)=89.368
ans(:,:,2)=100.99
ans(:,:,3) =73.470



for 1=1:3;average(:,:,i)=b(i)*ones(100);end;imshow(average)
6(c) Rainbow Picture


Sunday, June 8, 2008

Assignment 6

Q(1)

bigT=255*ones(256);
bigT(30:79,64:191)=zeros(50,128);
bigT(50:199,111:146)=zeros(150,36);
newmatrix=128*ones(256)
phi=(pi)/6;
for x=1:256;
for y=1:256;
u=x*cos(phi) - y*sin(phi);
v=x*sin(phi) + y*cos(phi);
up=mod(u,256) + 1;
vp=mod(v,256) + 1;
a=up;
b=mod(vp-1*up,256)+1;
r=floor(a);
s=floor(b);
if (r>0) and (r<256)>0) and (s<256);
mata=[1-a+r, a-r];
matb=[bigT(r,s), bigT(r,s+1); bigT((r+1),s),
bigT((r+1),(s+1))]; matc=[1-b+s;b-s]; newmatrix(x,y)=mata*matb*matc;
end;
end;
end;
imshow(newmatrix)





















2 (a). Create a 256 x 256 matrix with 1s in the (i,i+1) position and zeros elsewhere: (Octave commands) >x=tril(ones(256),1);
>y=tril(ones(256),0);
>x-y #yields matrix with 1s in diagonal



for picture type imshow(ans) to get











>
An alternative method using the command "tril" for "lower triangle" of matrix is


x=[tril(ones(256,1))-tril(ones(256),0);
imshow(x)

ex for a 5 X 5 matrix----> x= [tril(ones(5,1)-tril(ones(5),0); yields

01000
00100
00010
00001



3a) R=ones(100);G=tril(ones(100));B=zeros(100);

x(:,:,1)=(ones(100));x(:,:,2)=tril(ones(100));x(:,:,3)=zeros(100);
imshow(x);











sum(sum(x))/100/100


Octave output


ans(:,:,1) = 1
ans(:,:,2) = 0.50500
ans(:,:,3) = 0





3(b) Images processing from www.pbase.com

My assigned images are pic1= 2nd row 2nd column, and pic2= 7th row, 2nd column

Both images saved in folder called "images" in my C drive

pkg load image;

cd'C:\images'

a=imread("pic1.jpg");

b= double(a)/255;

size(b)

Octave gives:

106 107 3

Tuesday, May 27, 2008

Assignment 5

1) A= zeros(256);
for x=1:256;
for y=1:256;
if((x-128)^2+(y-128)^2<=50^2) A(x,y)=1; endif; endfor; endfor; imshow(A)














2. Use Octave to compose the picture of fig 6.4 in the text

A=zeros(256);B=zeros(256);C=zeros(256);
for x=1:256;
for y=1:256;
if (x-93)^2+(y-128)^2<=50^2; A(x,y)=1;
endif;
if (x-153)^2+(y-93)^2<= 50^2; B(x,y)=1; endif; if (x-153)^2+(y-153)^2<= 50^2; C(x,y)=1; endif; endfor;
endfor;
X(:,:,1)=A*255; X(:,:,2)=B*255; X(:,:,3)=C*255;
imshow (X)



3. big T ( octave commands from class notes)

bigT = 255*ones(256);
bigT(30:79,64:191) = zeros(50,128);
bigT(50:199,111:146)= zeros(160,36);
imshow(bigT)











Shewed bigT


bigT=255*ones(256);
bigT(30:79,64:191)=zeros(50,128);
bigT(50:199,111:146)=zeros(150,36);
function retval=newy(x,y,s);
retval=y+mod(x*s,256)+1;
endfunctionfor x=1:256;
for y=1:256;y1=int32(newy(x,y,1));
if(y1>256)y1=y1-256;endif;bigT1(x,y1)=bigT(x,y);
endfor;
endfor;
imshow(bigT1)












Shewed bigT rotated by 5pi/6

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;xa=int32(mod(x*cos(5*pi/6)-y*sin(5*pi/6),256)+1);ya=int32(mod(x*cos(5*pi/6)+y*sin(5*pi/6),256)+1);bigT1(xa,ya)=bigT(x,y);
endfor;
endfor;
imshow(bigT2)