Thursday, June 5, 2008

Assign #5, Q3a




Skewing with a factor of s pixels horizontally can done using at least 2 different octave commands; namely, "rem" (return remainder) or "mod" (modulo). The difference between these two functions as outined in octave-help is the manner in which they evaluate negative numbers. In the case of this assignment question either will do.

I will show both.

First take s=1 and use rem(x,y) command.

Octave commands:

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

# as given from assignment question...

for x=1:256
for y=1:256
xnew=x;
ynew=rem(y+x,256)+1;

# rem function returns remainder of (y+x)/256...

newbigT(xnew,ynew)=bigT(x,y);
endfor
endfor

imshow(newbigT)



Next take s=2 and mod(x,y) command.

Octave commands:

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

# as given from assignment question...

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

imshow(newbigT)

Wednesday, June 4, 2008

Assign 5, Q2



In the text notes (#) of my octave entry, I should have said that we are making a function a=c(x,y) which makes a circle for a given x and y.

My understanding of how the coordinates of the RGB circles are found was done with the help of NV's blog.

octave is finally working properly!! Assign 5, Q1