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
Monday, June 9, 2008
Q#3a continued..
Assignment #6 Q3
Assignment #6 Q2
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>
Wednesday, June 4, 2008
Q#3
Assignment #5 Q#2
Q#2:Give octave commands to draw the top part of figure 6.4 in the book
Ans:
Octave commands:
octave-3.0.0.exe:34> C=zeros(256);
octave-3.0.0.exe:35> functionC=circle(x,y)
error: `circle' undefined near line 35 column 11
error: evaluating assignment expression near line 35, column 10
octave-3.0.0.exe:35> function C=circle(x,y)
> for i=1:256
> for j=1:256
> if (i-x)^2+(j-y)^2 <=2500
> C(i,j)=1;
> else
> C(i,j)=0;
> endif
> endfor
> endfor
> endfunction
octave-3.0.0.exe:36> C(:,:,1)=circle(142,103);
octave-3.0.0.exe:37> C(:,:,2)=circle(99,128);
octave-3.0.0.exe:38> C(:,:,3)=circle(142,153);
octave-3.0.0.exe:39> imshow(C)
octave-3.0.0.exe:40> imshow(C);
Ans:
Octave commands:
octave-3.0.0.exe:34> C=zeros(256);
octave-3.0.0.exe:35> functionC=circle(x,y)
error: `circle' undefined near line 35 column 11
error: evaluating assignment expression near line 35, column 10
octave-3.0.0.exe:35> function C=circle(x,y)
> for i=1:256
> for j=1:256
> if (i-x)^2+(j-y)^2 <=2500
> C(i,j)=1;
> else
> C(i,j)=0;
> endif
> endfor
> endfor
> endfunction
octave-3.0.0.exe:36> C(:,:,1)=circle(142,103);
octave-3.0.0.exe:37> C(:,:,2)=circle(99,128);
octave-3.0.0.exe:38> C(:,:,3)=circle(142,153);
octave-3.0.0.exe:39> imshow(C)
octave-3.0.0.exe:40> imshow(C);
Q#16
Question # 15,
Monday, June 2, 2008
Q#13, 14
Display the GB face of the colour cube
GB(:,:,1) = Zeros(256);
GB(:,:,2)=[ones(256,1)*[256:-1:0]/255];
GB(:,;,3)=[ones(256,1)*[255:-1:0]/255]';
imshow(GB)
Q#14 Show the CY face of colour cube
Octave Commands:
CY(:,:,1)=[ones(256,1)*[255:-1:0]/255]';
CY(:,:,2)=ones(256);
CY(:,:,3)=[ones(256,1)*[0:1:255]/255];
imshow(CY);
Q#12
Assignment#4 Q11
RB(:,:,1)=[ones(256,1)*[0:1:255]/255]';
RB(:,:,2)=zeros(256);
RB(:,:,3)=[ones(256,1)*[0:1:255]/255];
imshow(RB)
RB(:,:,2)=zeros(256);
RB(:,:,3)=[ones(256,1)*[0:1:255]/255];
imshow(RB)
Subscribe to:
Posts (Atom)