Matrix Class Function Manual (J-L)


KERNELDGAUSS

| HOME | BACK |

Purpose

To generate a directional edge detector (kernel), using a 1D Gaussian filter convolved with a 1D derivative of Gaussian filter, then rotate it in the specified direction. 

The returning kernel has a size of n by n, where n is specified by the user.  However, the kernel size also depends on the value of standard deviation.  If the specified n is too small, the function will ignore and make create the minimum possible size.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.KERNELDGAUSS({double} argm1, {double} argm2, [{int} argm3])

argm1 = no of standard deviation of Gaussian function

argm2 = a counter-clockwise angle, in degrees, from X-axis to the desired direction

argm3 = size of the kernel   (default = size of a kernel having an SD of 6 pixels)

Example:

->A = Matrix()

->A.kerneldgauss(1,45,5)

->print A

 no of row    : 5
 no of column : 5

 0: 0.183    0.009    0.000    0.000    0.000

 1: 0.009    0.092    0.007    0.000    0.000

 2: 0.000    0.007    0.957    0.001   -0.000

 3: 0.000    0.000    0.001   -0.092   -0.009

 4: 0.000    0.000   -0.000   -0.009   -0.183

See also (class function)

kernelgauss, kernelmean

| HOME | BACK |


KERNELGAUSS

| HOME | BACK |

Purpose

To generate a 2D Gaussian filter.  The default size of the kernel is determined automatically by the function, by using a length from -3SD to 3SD.  If the user gives a too small required kernel size, the program will ignore it and use the default size.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.KERNELGAUSS({double} argm1, [{int} argm2])

argm1 = no of standard deviation of Gaussian function

argm2 = size of the kernel   (default = size of a kernel having an SD of 6 pixels)

Example:

->A = Matrix()

->A.kernelgauss(0.5)

->print A

 no of row    : 5
 no of column : 5

 0:    0.000    0.000    0.000    0.000    0.000
 1:    0.000    0.011    0.084    0.011    0.000
 2:    0.000    0.084    0.619    0.084    0.000
 3:    0.000    0.011    0.084    0.011    0.000
 4:    0.000    0.000    0.000    0.000    0.000

See also (class function)

kerneldgauss, kernelmean

| HOME | BACK |


KERNELMEAN

| HOME | BACK |

Purpose

To generate a 2D mean kernel. 

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.KERNELGAUSS({int} argm1)

argm1 = size of the kernel

Example:

->A = Matrix()

->A.kernelmean(3)

->print A

 no of row    : 5
 no of column : 5

 0:    0.111    0.111    0.111
 1:    0.111    0.111    0.111
 2:    0.111    0.111    0.111

See also (class function)

kerneldgauss, kernelgauss

| HOME | BACK |


LINEFOLLOW

| HOME | BACK |

Purpose

To extract a line feature in a matrix.  The function takes a seed pixel input by the user as a starting point.  It follows the line as far as it can go.  The result is a poly-line stored in a VecIndx object.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.LINEFOLLOW({int} argm1, {int} argm2)

argm1 = row number of the seed pixel

argm2 = column number of the seed pixel

Example:

->A = [1 0 0; 1 0 0; 1 0 0]

->pline_1 = A.linefollow(0,0)

->pline_1

ans =
Vector of Index (row, column)...

list id : 0

Vector size : 3

(0 , 0)
(1 , 0)
(2 , 0)

See also (class function)

polyline, boundary

| HOME | BACK |


LINGEN

| HOME | BACK |

Purpose

To generate a matrix whose first and last element values are specified by the user.  The values of elements in between will linearly increase by a specified interval.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.LINGEN({double} argm1, {double} argm2, [{double} argm3])

argm1 = start value for the first element

argm2 = end value for the last element

argm3 = linear spacing interval         (default = 1)

Example:

->A = Matrix()

->A.lingen(1,3,0.5)

->print A

 no of row    : 1
 no of column : 5

 0:    1.00000    1.50000    2.00000    2.50000    3.00000

See also (class function)

init, clear

| HOME | BACK |


LN

| HOME | BACK |

Purpose

To calculate a natural log function of elements of a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.LN()

Example:

->A = [1 2 3; 4 5 6; 7 8 9]

->B = A.ln()

->print B

 no of row    : 3
 no of column : 3

 0:    0.00000    0.69315    1.09861
 1:    1.38629    1.60944    1.79176
 2:    1.94591    2.07944    2.19722

See also (class function)

exp, log

| HOME | BACK |


LOAD

| HOME | BACK |

Purpose

To load a matrix object saved as Noobeed format.  There are 2 files needed.  One is for the documentation, and it is an ASCII file.  The other is a binary file containing data of the matrix. 

If file name extension is omitted, the function will add default extension to the file.   The default extension of the documentation file is ".txt" and that of the data file is ".raw".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

The detail structure of the documentation file is described in function "save".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.LOAD({String} argm1, [{String} argm2])

argm1 = file name for the documentation file (default extension is ".txt")

argm2 = file name for the data file  

        (default file name is same file name as argm1 with an extension ".raw")

Example:

->A = Matrix()

->A.load("my_matrix")

->

See also (class function)

loadtif, loadbmp, loadasc, loadbin, save, savetif, savebmp, saveasc, savebin, vload

| HOME | BACK |


LOADASC

| HOME | BACK |

Purpose

To read data from an ASCII file and stored in a matrix object.

If file name extension is omitted, the function will add default extensions to the files.  The default extension of an ASCII data file is ".txt".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

An example of an ASCII data file is as follows.

1    2   3

4    5   6

7    8   9

Here the data file has 3 lines.  This will generate a matrix with 3 rows.  Each line has 3 values, separated by at least one white space, a blank character.  Therefore, the matrix will have 3 columns. 

It is possible to have a comment line in the data file, by inserting a slash sign, "/", in front of a line.  Comment lines will not be read by the function.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.LOADASC({String} argm1)

argm1 = file name for the documentation file (default extension is ".txt")

Example:

->A = Matrix()

->A.loadasc("my_matrix_asc")

->

See also (class function)

loadtif, loadbmp, loadbin, save, savetif, savebmp, saveasc, savebin

| HOME | BACK |


 LOADBIN1

| HOME | BACK |

Purpose

To load data from a binary file and stored in a matrix object.  Each element will take one byte.  Only Matrix_uch object can use this function.  The file size is determined by the function automatically and is the number of rows of the calling matrix.

If file name extension is omitted, the function will add default extensions to the files.  The default extension of a binary data file is ".raw".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

Class

Matrix_bln

Usage

{void} object.LOADBIN1({String} argm1)

argm1 = file name for the binary file (default extension is ".raw")

Example:

->A = Matrix()

->A.loadbin("my_matrix_bin")

->

See also (class function)

loadtif, loadbmp, loadasc, save, savetif, savebmp, saveasc, savebin

| HOME | BACK |


LOADBIN

| HOME | BACK |

Purpose

To load data from a binary file and stored in a matrix object.

If file name extension is omitted, the function will add default extensions to the files.  The default extension of a binary data file is ".raw".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

It should be noted that the number of bytes occupied by one single pixel, an element of a matrix, is governed by the data type of the calling matrix.  In this case a double precision number, thus 8 bytes per element.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.LOADBIN({String} argm1, {int} argm2, {int} argm3)

argm1 = file name for the binary file (default extension is ".raw")

argm2 = no of rows

argm3 = no of columns

Example:

->A = Matrix()

->A.loadbin("my_matrix_bin", 100, 200)

->

See also (class function)

loadtif, loadbmp, loadasc, save, savetif, savebmp, saveasc, savebin

| HOME | BACK |


LOADBIN_OFFSET

| HOME | BACK |

Purpose

To load data from a binary file and stored in a matrix object.  This function requires an offset number of bytes, where the data reading starts to take place.

If file name extension is omitted, the function will add default extensions to the files.  The default extension of a binary data file is ".raw".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

It should be noted that the number of bytes occupied by one single pixel, an element of a matrix, is governed by the data type of the calling matrix.  In this case a double precision number, thus 8 bytes per element.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.LOADBIN_OFFSET({String} argm1, {int} argm2, {int} argm3, {int} argm4)

argm1 = file name for the binary file (default extension is ".raw")

argm2 = no of rows

argm3 = no of columns

argm4 = offset number of bytes (first byte = 0), position where the reading starts.

Example:

->A = Matrix()

->A.loadbin_offset("my_matrix_bin", 100, 200, 50)

->

See also (class function)

loadtif, loadbmp, loadasc, save, savetif, savebmp, saveasc, savebin, loadbin

| HOME | BACK |


LOADBMP

| HOME | BACK |

Purpose

To load data from a bitmap (BMP) file  and stored in a matrix object.

If file name extension is omitted, the function will add default extension to the file.   The default extension of a bitmap file is ".bmp".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

This function requires that the data is of 8-bit or 24-bit and with no compression.  The 24-bit RGB pixel values will be averaged to grey scale values before storing into a Matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.LOADBMP({String} argm1)

argm1 = file name of the bitmap file (default extension is ".bmp")

Example:

->A = Matrix()

->A.loadbmp("my_matrix_bmp")

->

See also (class function)

loadtif, loadasc, loadbin, save, savetif, savebmp, saveasc, savebin

| HOME | BACK |


LOADCSV

| HOME | BACK |

Purpose

To read data from a CSV (Comma Separated Values) file and stored in a matrix object.

If file name extension is omitted, the function will add default extensions to the files.  The default extension of an ASCII data file is ".txt".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

An example of a CSVI data file is as follows.

1,2,3

4,5,6

7,8,9

Here the data file has 3 lines.  This will generate a matrix with 3 rows.  Each line has 3 values, separated by a comma sign.  Therefore, the matrix will have 3 columns. 

It is possible to have a comment line in the data file, by inserting a slash sign, "/", in front of a line.  Comment lines and blank lines will not be read by the function.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln, Matrix_str

Usage

{void} object.LOADCSV({String} argm1)

argm1 = file name of the CSV file (default extension is ".txt")

Example:

->A = Matrix()

->A.loadcsv("my_matrix_asc")

->

See also (class function)

loadtif, loadbmp, loadbin, save, savetif, savebmp, saveasc, savebin, savecsv

| HOME | BACK |


 LOADTIF

| HOME | BACK |

Purpose

To load data from a Tag Image File (TIF) file  and stored in a matrix object.

If file name extension is omitted, the function will add default extension to the file.   The default extension of a bitmap file is ".tif".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

This function requires that the data is of 8-bit or 24-bit and with no compression.  The 24-bit RGB pixel values will be averaged to grey scale values before storing into a Matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.LOADTIF({String} argm1)

argm1 = file name for the TIF file (default extension is ".tif")

Example:

->A = Matrix()

->A.loadtif("my_matrix_tif")

->

See also (class function)

loadbmp, loadasc, loadbin, save, savetif, savebmp, saveasc, savebin

| HOME | BACK |


LOADTIF16

| HOME | BACK |

Purpose

To load data from a Tag Image File (TIF) file  and stored in a matrix object.  The TIF file has to be a 16 bit gray scale image.

If file name extension is omitted, the function will add default extension to the file.   The default extension of a bitmap file is ".tif".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

This function requires that the data is of 8-bit gray scale image and with no compression.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht

Usage

{void} object.LOADTIF16({String} argm1)

argm1 = file name for the TIF file (default extension is ".tif")

Example:

->A = Matrix()

->A.loadtif16("my_matrix_tif")

->

See also (class function)

loadbmp, loadasc, loadbin, save, savetif, savebmp, saveasc, savebin

| HOME | BACK |


LOADTIF32

| HOME | BACK |

Purpose

To load data from a Tag Image File (TIF) file  and stored in a matrix object.  The TIF file has to be a 64 bit gray scale image.  The 32 bit data are read as single precision floating point values.

If file name extension is omitted, the function will add default extension to the file.   The default extension of a bitmap file is ".tif".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

Class

Matrix, Matrix_flt

Usage

{void} object.LOADTIF32({String} argm1)

argm1 = file name for the TIF file (default extension is ".tif")

Example:

->A = Matrix_flt()

->A.loadtif32("my_matrix_tif")

->

See also (class function)

loadbmp, loadasc, loadbin, save, savetif, savebmp, saveasc, savebin

| HOME | BACK |


LOADTIF64

| HOME | BACK |

Purpose

To load data from a Tag Image File (TIF) file  and stored in a matrix object.  The TIF file has to be a 64 bit gray scale image.  The 64 bit data are read as double precision floating point values.

If file name extension is omitted, the function will add default extension to the file.   The default extension of a bitmap file is ".tif".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

Class

Matrix

Usage

{void} object.LOADTIF64({String} argm1)

argm1 = file name for the TIF file (default extension is ".tif")

Example:

->A = Matrix()

->A.loadtif64("my_matrix_tif")

->

See also (class function)

loadbmp, loadasc, loadbin, save, savetif, savebmp, saveasc, savebin

| HOME | BACK |


 

LOG

| HOME | BACK |

Purpose

To calculate a base 10 logarithm function of elements of a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.LOG()

Example:

->A = [1 2 3; 4 5 6; 7 8 9]

->B = A.log()

->print B

 no of row    : 3
 no of column : 3

 0:    0.00000    0.30103    0.47712
 1:    0.60206    0.69897    0.77815
 2:    0.84510    0.90309    0.95424

See also (class function)

exp, ln

| HOME | BACK |


LOOKUP

| HOME | BACK |

Purpose

To create a new matrix whose values are from a lookup table value of the original matrix, the calling matrix.

Class

Matrix_int, Matrix_sht, Matrix_uch

Usage

{Matrix_uch} ret  =  object.LOOKUP({VecIndx} argm1)

argm1 = lookup table (first number is original value and second number is new values)

Example:

->B = A.lookup(vec_ind1)

->

See also (class function)

reassign, histmatch, reclass

| HOME | BACK |


LU

| HOME | BACK |

Purpose

To decompose a matrix (A) to a lower triangular matrix (L) and an upper triangular matrix (U), such that

        A = L*U

Due to rounding error, a partial pivoting is preferable when performing the LU decomposition.  This is achieved by setting the value of the flag in the argument to 1.   As a consequence, the resulting matrix A does not look exactly as the original matrix A, however, it is a row-wise permutation of the original one.  The order of the permutation is recorded during pivoting and is reported in the output matrix.

When the value of the flag is set to 2, the permutation matrix (P) is outputted as a part of the resulting matrix, so that

        A = P*L*U

and this time the original matrix is exactly recovered.

The output matrix consists of the lower triangular matrix (L) concatenated to the right by the upper triangular matrix (U), followed by the indexing matrix or the permutation matrix (P), if any.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.LU({int} argm1)

argm1 = flag (must be 0, 1 or 2; default = 0)

Example:

->A = [ 1 2; 3 4]
->B = A.lu()
->print B


no of row    : 2
no of column : 4

0:    1.00000    0.00000    1.00000    2.00000
1:    3.00000    1.00000    0.00000   -2.00000


->L = B.window(0,1,0,1)
->U = B.window(0,1,2,3)
->L*U

ans =

no of row    : 2
no of column : 2

0:    1.00000    2.00000
1:    3.00000    4.00000



->C  = A.lu(1)
->print C


no of row    : 2
no of column : 5

0:    1.00000    0.00000    3.00000    4.00000    1.0000

1:    0.33333    1.00000    0.00000    0.66667    0.0000

->L1 = C.window(0,1,0,1)
->U1 = C.window(0,1,2,3)
->L1*U1

ans =

no of row    : 2
no of column : 2

0:    3.00000    4.00000
1:    1.00000    2.00000

->D  = A.lu(2)
->L2 = D.window(0,1,0,1)
->U2 = D.window(0,1,2,3)
->P  = D.window(0,1,4,5)
->P*L2*U2

ans =

no of row    : 2
no of column : 2

0:    1.00000    2.00000
1:    3.00000    4.00000



->

 

See also (class function)

rref, eigen

| HOME | BACK |