# Class4

Documentation for Octave : online version (http://www.gnu.org/software/octave/doc/interpreter/)

An introduction to Octave (based on a similar tutorial for matlab). This does not talk about images, but it does cover other stuff: pdf file (http://www-mdp.eng.cam.ac.uk/CD/engapps/octave/octavetut.pdf)

The fourth assignment: Media:Ass4.pdf

I said the other night that you can put in text like $\sum_{i=0}^\infty i$ then you get a nice typeset equation. Well I lied (as you can see this is exactly what I typed and I didn't get that. If you replace the \$ by a tag which indicates that this is an equation then you will get $\sum_{i=0}^\infty i$.

If you want to see what that tag looks like you can 'edit' this page and look at the text that I typed. In particular the second example that I talked about last night looks like: $A = \left[ a_{ij} \right]_{1 \leq i \leq n,1 \leq j \leq m}$

Because there are two forms of Octave sitting out there (versions before 2.9 and those after) there are two ways of handling showing images. Also I have found that Octave 3.0.1 has serious flaws in the way that it handles images. I am going to stop giving instructions on how to make that version work and instead use Octave 3.0.0 because I cannot guarantee the most recent version will behave properly.

Octave 2.1.something:

Command: imshow( r, g, b )

where r, g, and b are all M x N matrices with entries between 0 and 1 or between 0 and 255.

example: the first of the following is brighter than the last two, but the last two are the same.

imshow( ones(100), eye(100), zeros(100) )

imshow( ones(100)*128, eye(100)*128, zeros(100) )

imshow( ones(100)*0.5, eye(100)*0.5, zeros(100) )

Octave 3.0.0

imshow( rgb )

where rgb is an M x N x 3 matrix with entries between 0 and D. The color will be rescaled so that the maximum value which appears in the matrix D corresponds to full color.

example: All three of the following have the same image!

x(:,:,1) = ones(100);

x(:,:,2) = eye(100);

x(:,:,3) = zeros(100);

imshow(x)

x(:,:,1) = ones(100)*128;

x(:,:,2) = eye(100)*128;

x(:,:,3) = zeros(100);

imshow(x)

x(:,:,1) = ones(100)*0.5;

x(:,:,2) = eye(100)*0.5;

x(:,:,3) = zeros(100);

imshow(x)