Wednesday, June 11, 2008

Q#3(ii) Picture



Q#3(b)
Average Colour of second image

Octave Commands
octave-3.0.0.exe:47> a=imread("pic2.jpg");
octave-3.0.0.exe:48> b=double(a)/255;
octave-3.0.0.exe:49> size(b)
ans =

541 500 3

octave-3.0.0.exe:50> c=sum(sum(b))/(541*500)
c =

ans(:,:,1) = 0.56223
ans(:,:,2) = 0.62916
ans(:,:,3) = 0.65633


octave-3.0.0.exe:51> d=ones(256);
octave-3.0.0.exe:52> d(:,:,1)=0.56223*ones(256);
octave-3.0.0.exe:53> d(:,:,2)=0.62916*ones(256);
octave-3.0.0.exe:54> d(:,:,3)=0.65633*ones(256);
octave-3.0.0.exe:55> imshow(d);

Assignment#6 Q3



Q#3(c)

Average colour of two assigned pictures
For this assignment Paul helped me alot in downloading assigned pictures.
pkg load image
a=imread("pic1.jpg");
b=double(a)/255;

avgb=sum(sum(b))/(650*780)

c=ones(256);
c(:,:,1)=0.95854*ones(256);
c(:,:,2)=0.95091*ones(256);
c(:,:,3)=0.94792*ones(256);
imshow(c)

Monday, June 9, 2008

Q#3a continued..


Average of colours
octave-3.0.0.exe:14> sum(sum(A))/100/100,
ans =

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


octave-3.0.0.exe:15> imshow(sum(A));

Assignment #6 Q3


Q#3 Detrmine the average color
a) R=ones(100); G=tril(ones(100));, B=zeros(100);
Ans:
octave-3.0.0.exe:5> A(:,:,1)=ones(100);
octave-3.0.0.exe:6> A(:,:,2)=tril(ones(100));
octave-3.0.0.exe:7> A(:,:,3)=zeros(100);
octave-3.0.0.exe:8> imshow(A);

Assignment #6 Q2


Q#2 create a 256 X 256 matrix with in (i,i+1) position and zeros elsewhere
Octave Commands:
A= zeros(256);
for i=1:256;
A(i,i+1)=1;
end;
imshow(A);
or
octave-3.0.0.exe:8> A=tril(ones(256),1);
octave-3.0.0.exe:9> B=tril(ones(256),0);
octave-3.0.0.exe:10> imshow(A-B);

Question#3c


Big T 7pi/4
Octave Command
bigT=255*ones(256);
bigT(30:79,64:191)=zeros(50,128);
bigT(50:199,111:146)=zeros(150, 36);
for x = 1:256
for y = 1:256
newy=rem(2*x+y,256)+1;
bigTskew(x,y)=bigT(x,newy);
end;
end;
for x=1:256;
for y=1:256;
bigTskewrotate(x,y)=bigTskew(mod(round(x*cos(7*pi/4)-y*sin(7*pi/4)),256)+1, mod(round(x*sin(7*pi/4)+y*cos(7*pi/4)),256)+1);
end;
end;
imshow(bigTskewrotate);

Question #3 b











BigT for S=1
Octave commandoctave-3.0.0.exe:5>
octave-3.0.0.exe:5> bigT=255*ones(256);
octave-3.0.0.exe:6> bigT(30:79,64:191)=zeros(50,128);
octave-3.0.0.exe:7> bigT(50:199,111:146)=zeros(150,36);
octave-3.0.0.exe:8>
octave-3.0.0.exe:8> # as given from assignment question...
octave-3.0.0.exe:8>
octave-3.0.0.exe:8> for x=1:256
> for y=1:256
> xnew=x;
> ynew=mod((2*x+y),256)+1;
> newbigT(xnew,ynew)=bigT(x,y);
> endfor
> endfor
octave-3.0.0.exe:9>
octave-3.0.0.exe:9> imshow(newbigT)
octave-3.0.0.exe:10>