LastWave Package Image 2.0 Authors Description Examples

## Authors:

• ### Jérome Fraleu Formerly at Centre de Mathematiques Appliquées Ecole Polytechnique 91128 Palaiseau Cedex - France

Description

The image package defines the image structure (of type &image) and includes all the commands that deal with images and/or matrices (in LastWave matrices use the same representation as images). It also includes the definition of the graphic class GraphImage that allows to display signals.

Examples

Very simple manipulation
a> j = <;>
= <nrow=0;ncol=0>
a> type(j)
= '&image'
a> j=<7,8;9,10>
= <nrow=2;ncol=2>
7 8
9 10
a> type(j)
= '\imagei'
a> i = <1,2;3,4;5:6;j>
= <nrow=5;ncol=2>
1 2
3 4
5 6
7 8
9 10
a> i+One
= <nrow=5;ncol=2>
2 3
4 5
6 7
8 9
10 11
Another example:
a> i=J(3,3)
= <nrow=3;ncol=3>
0 0 0
1 1 1
2 2 2
a> i+Id
= <nrow=3;ncol=3>
1 0 0
1 2 1
2 2 3
a> i.nrow
= 3
a> i.ncol
= 3
a> <i,i;i,i>
= <nrow=6;ncol=6>
0 0 0 0 0 0
1 1 1 1 1 1
2 2 2 2 2 2
0 0 0 0 0 0
1 1 1 1 1 1
2 2 2 2 2 2

Matrix manipulation (^^ is for power, ** for multiplication, ~ for transposition)
a> i=J(2,2)
= <nrow=2;ncol=2>
0 0
1 1
a> j=(i+Id)^^-1
= <nrow=2;ncol=2>
1 0
-0.5 0.5
a> j**(i+Id)
= <nrow=2;ncol=2>
1 0
0 1
a> i^^(-1)
** Error : ludcmp(): Singular matrix
---> i^^(-1)
a> s = <2,3>
= <2,3>
a> ~s
= <nrow=2;ncol=1>
2
3
a> i**~s
= <nrow=2;ncol=1>
0
5

More manipulation: extracting isolated values

a> j = J(4,4)+I
= <nrow=4;ncol=4>
0 1 2 3
1 2 3 4
2 3 4 5
3 4 5 6
a> j[<0,1,2,3;0,1,2,3>]
= <0,2,4,6>
a> u = <0,1,2,3;0,1,2,3>
= <nrow=2;ncol=4>
0 1 2 3
0 1 2 3
a> j[u]
= <0,2,4,6>
a> j[u]+=1
= <nrow=4;ncol=4>
1 1 2 3
1 3 3 4
2 3 5 5
3 4 5 7
a> j[u]=10:10:40
= <nrow=4;ncol=4>
10 1 2 3
1 20 3 4
2 3 30 5
3 4 5 40

The find operator lets you access some values that are the result of a test, e.g.
a> find(j==3)
= <nrow=2;ncol=4>
0 1 2 3
3 2 1 0
a> j[find(j==3)] := 0
= <nrow=4;ncol=4>
10 1 2 0
1 20 0 4
2 0 30 5
0 4 5 40

More manipulation: extracting sub-images (or sub-matrices)

a> j = J(4,3)+I
= <nrow=4;ncol=3>
0 1 2
1 2 3
2 3 4
3 4 5
a> j[2;:]
= <2,3,4>
Here are some more manipulations
a> j[2:;1:]
= <nrow=2;ncol=2>
3 4
4 5
a> j[*bper,2:7;1:]
= <nrow=6;ncol=2>
3 4
4 5
1 2
2 3
3 4
4 5

As for the other type of extraction, you can use the *options: *nolimit,*bperiodic,*bmirror1,*bmirror, *b0, *bconst.