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)









Monday, May 26, 2008

Assignment 4

Question followed by octave 3.0.0 commands

1. Matrix of 256 x 1 ones-----ones(1,256)
2. Matrix of integers 0 - 255 in a single row........[0:1:255]
3. Single column of integers 0 -255.........[0:1:255]'
4. A 256x256 matrix with rows , all same, equal to numbers 0 - 255.......ones(256)*[0:1:255]
5. A 256 x256 matrix with columns all the same equal to 1-255.............[0:1:255]'*ones(1,6)
6. A 256 x 256 matrix all zeros........zeros(256)
7. A 256x256 matrix all ones.......ones(256)
8. A 256x256 matrix of the value 128......128*ones(1,256)
9. Repeat of 6




Display of gray scale image



imshow(gray(100)')










Display of RB face
x(:,:,1) = (ones(256)*(255:-1:0)/255)';
x(:,:,2)=zeros(256);
x(:,:,3) = ones(256,1)*(0:1:255)/255;
imshow(x)



12.RG face of color cube
x(:,:,1) = (ones(256,1)*(0:1:255)/255)';
x(:,:,2)= ( ones(256,1)*(255:-1:0)/255);
x(:,:,3)=zeros(256);
imshow(x)






13. GB face of color cube
x(:,:,1) = zeros(256);
x(:,:,2) = (ones(256,1)*(0:1:255)/255);
x(:,:,3) = (ones(256,1)*(255:-1:0)/255)'
imshow(x)





14. CM face of color cube
x(:,:,1) = (ones(256,1)*(255:-1:0)/255)';
x(:,:,2) = (ones(256);
x(:,:,3) = (ones(256,1)*(0:1:255)/255)';
imshow(CM)










15. Y-M face of color cube



x(:,:,1) = ones(256);
x(:,:,2) = ones(256,1)*(0:1:255)/255;
x(:,:,3) = (ones(256,1)*(255:-1:0)/255)';
imshow(MY)






16. YC face of color cube
x(:,:,1) =ones(256);
x(:,:,2) =(ones(256,1)*(0:1:255)/(255);
x(:,:,3)=(ones(256,1)*(255:-1:0)/255)';
imshow(x)















For questions 19 - 22



Let Matrix A=













19 Shift entries of a matrix A one place left(wrapping around left-> right)

Octave> [ 1 2 3; 4 5 6; 7 8 9]*[0 0 1;1 0 0;0 1 ];

















20 Shift the entries of a matrix A one pixel down (wrapping around the bottom->up)






Octave> [0 0 1;1 0 0;0 1 0]*A;











21.Shift the entries of a matrix A one place left(dropping values on the left edge)




Octave> [0 0 0;1 0 0;0 1 0]*A;















22. Shift the entries of a matix A one place down (dropping values on the bottom edge)



Octave: [0 0 0;1 0 0;0 1 0]*A;



Tuesday, May 20, 2008

Assignment 3

1. The chromaticity diagram has the shape of a shark's fin or a triangle because it is defined by three coordinates representing the three pimary colours red, green and blue. The coordinates points are farthest apart when they form a triangle


Plots of wavelengths vs x/y, wavlengths vs y and wavelengths vs z/y shown below including table


























































The graphs represent the dominant wavelenth for a giveen ratio trichromatic coefficients



3 One approach involves treating the components as postion vectors and assigning each point a vector. Vector C1 for color 1, C2 for color 2, and vector C for color C. The color C or vector C can be represented as a linear comination of vector C1 and C2 as follows. ( Refer to diagram below)



OC = OC + aC1C2 = OC1+ a(OC2 - OC1) = OC1+ aOC2 - aOC1 = OC1(1-a) + aOC2=



(1-a)(X1, Y1) + a(X2, Y2) = ((1-a)(X, (1-a)Y1) + (aX2, aY2) =



((1-a)X1, (1-a)Y1) + (aX2, aY2) = ((1-a)X1 + aX2, (1-a)Y1 + a Y2)



where 0<= a<= sqr((x2-x1)^2 + (y2 - y1)^2)































Sketch the CMY components of the image in problem 6.6 as they would appear on a monochrome monitor.



5. The RGB components are given by the following equations

B= I(1 - s)

R = I[ 1 + ScosH/cos(60' - H) ] and G = 3I - (R + B)

The transformation that inversts the RGB componenets is R', B' and C'

where R' = 1-R, B' = 1 -B, and C' = 1 -C

Wednesday, May 14, 2008

Assignment 2

First 4 digits of my student ID - 2087

2087 mod8 = 7 2087 mod3 = 2 2087 mod 7 = 1


corresponding questions from assignment 2 are (2) -7......(3) - 2........ (6) -1

Bit Strings and logic

1. The 16 binary functions expressed using binary operations AND/OR and NOT with inputs

X = 0011 and Y =0101


Notation used to represent operators in brackets AND (^) OR (V) NOT (\)


0000 Y^ \Y
1000 \(X V Y)
0001 X^Y
1001 \((XVY) ^(X^Y))
0010 \(\X^Y)
1010 \Y
0011 \ \X
1011 \(Y^\X)
0100 Y^\X
1100 \X
0101 \\ Y
1101 \X^Y
0110 (X^Y) ^\(X^Y)
1110 \(X^y)
0111 X V Y
1111 \(Y^\Y)


2. All of the 16 possible binary functions can be represent using only compostions of { NOT, IMPLY}. This is true because IMPLY is composed of NOT and OR and using De Morgan's Laws one can obtain AND statement. Therefore aremed with NOT, OR, AND one can generate all 16 functions.


3. Indepotence describes properties of operators that yield the same result after the operation is applied a multiple of times. ex NOT (NOTX) = X. The binary operators that exhibit this property include: AND, OR and NOT and all operators that build on these fundamental operators.

4. Given trinary inputs (0,1,2) the number of possible binary operations is 3^3^2 = 19683

5. There are 3 binary operators required to represent every possible two argument function on trinary operations are NOT, OR, AND and IMPLY

6. Using GIMP to create the following




(pic1 AND pic2)













(pic1 OR pic 2)





(pic 1 IMPLY pic 2)















7. Let C = change in blood chemistry, R= residue poisin in stomach, P = death by poisin through needle, M = puncture marks


Corresponding operations to statements listed in assignment in order.

P IFF ( C OR R )


NOT ( C OR R ) AND M


M IMPLY P


NOT P IMPLY NOT M


Orders of Magnitude

1. Commodore 64 had 64 K memory = 2^6 K. A computer with 1 GB memory = 2^10 x 2^10 K= 2^20 K


Therefore a 1 GB memory has 2^20/2^6 = 2^14 = 16384 times more storage than a 64 K.

2. A 51/4 disk -> 800K, A DVD --> 4.7 GB = 4.7 x 2^20 K

Therefore 1 DVD is equivalent to 4.7 x 2^20 / 800 = 6160.384 disks


3. Promoting clock speed ( or CPU speed ) used to be a major selling feature in computer advertisements in the 1990's. One such computer; the Apple's 'Power Macintosh 8100/110" had a clock rate of 110 MHz which beat the fastest Intel processor at the time of 100 MHz.

Today's computer clock speeds are as high as. One such model available to the general public is the Dell Precision T7400 has a CPU speed of 3.4 GHz. This turns out to be just over 3oX faster than the 1990 models.

It should be noted that comparison of clock speed between different CPU families is not uselful since certain families of chips are faster in certain tasks and slower than other. One comparison of CPU speeds within the same family gives an accurate picture.

Source

http://en.wikipedia.org/wiki/Clock_rate




http://www1.ca.dell.com/content/products/productdetails.aspx/precn_t7400?c=ca&cs=calca1&l=en&s=biz





Saturday, May 10, 2008

Where are the flying cars that I was promised?

Most popular science fiction novel's from the 1980's like the Terminator or Blade Runner, centered on conflicts between humans and sideboards (halfhuman and machine) . These machines were often dispatched by some mother computer that develops human-like ambitions. These sideboards were usually equiped with high-beam lasers, GPS, scanners and flying cars which allowed them timely escapes. Destroying one of these evil sideboards could only be done by shorting out their internal CPU, and getting close one of thes chips usually came at a price.

Now, some 25 years later, the threat of computer controlled sideboards is far from a reality, yet the influence of computers on humans in North America is real; especially when it comes to our youth. As an educator, I have seen first hand how teenagers have evolved into beings that need to be plugged in inorder to 'fit' into society and funcion. They are more intune with what is being fed to their brains by miniature Ipod's than there was is present in their surroundings. Simple activities like nature walks and street hockey are on a decline. Most teenagers would rather be found inside some dark forsaken room playing video games or surfing the internet while on MSN. On a more positive note, kids in elementary school can make class presentatins using the latest in technology like power point, and photoshop that leave most teachers in awe.

I believe that computers will continue to play a larger role in shaping human behaviour. Computer chip implants will become a common practice that will allow people to keep tabs on loved ones and pets. Computer displays small enough to fit over ones prescription glasses would allow someone to play games while standing at a bus stop. Emails wil be able to be checked simply by voice recognition, and played back by a tiny computer that can fit on a wrist watch or cell phone. The future will bring exciting new trinkets and along with it a new breed of science fiction writers.

Monday, May 5, 2008

First Class Math 5300

I signed up for my first blog.....wish me luck