Matrix Class Function Manual (D-F)

DET

| HOME | BACK |

Purpose

To compute the determinant of a matrix.

Class

Matrix

Usage

{double} ret  =  object.DET()

Example:

->a = [ 1 2 ; 5 8]
->print a


no of row    : 2
no of column : 2

0:    1.00000    2.00000
1:    5.00000    8.00000


->a.det()

ans = -2.00000

->

See also (class function)

inv

| HOME | BACK |


DIAGMULT

| HOME | BACK |

Purpose

To multiply a diagonal matrix with a matrix.  The diagonal matrix is the calling matrix, and it is thought of size n x n, however its actual size is actually n x 1. 

Please note that storing a diagonal matrix as a column matrix can save a lot of memory when the size of the diagonal matrix is large.

Class

Matrix

Usage

{Matrix} ret  =  object.DIAGMULT({Matrix} argm1)

argm1 = the second matrix

Example:

->A = [ 1 2 3; 4 5 6; 7 8 9]
->B = [ 100; 200; 300]
->C = B.diagmult(A)
->print C


no of row    : 3
no of column : 3

0:    100.0000    200.0000    300.0000
1:    800.0000   1000.0000   1200.0000
2:   2100.0000   2400.0000   2700.0000

->

See also (class function)

diagmult

| HOME | BACK |


DOT

| HOME | BACK |

Purpose

To calculate a dot product between two 3D vectors.  The first vector is the calling matrix and the second vector is the argument matrix.  The two vector can be a row or column matrix, but need to have exactly 3 elements. 

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{double} ret  =  object.DOT({Matrix} argm1)

For class Matrix_flt

{double} ret  =  object.DOT({Matrix_flt} argm1)

For class Matrix_int

{double} ret  =  object.DOT({Matrix_int} argm1)

For class Matrix_sht

{double} ret  =  object.DOT({Matrix_sht} argm1)

For class Matrix_uch

{double} ret  =  object.DOT({Matrix_uch} argm1)

For class Matrix_bln

{double} ret  =  object.DOT({Matrix_bln} argm1)

argm1 = the second 3D-vector

Example:

->a = [ 1 2 3]

->b = [ 4 5 6]

->c = a.dot(b)

->print c

       32.00000

See also (class function)

cross, angle

| HOME | BACK |


DOUBLE

| HOME | BACK |

Purpose

To convert to a Matrix object.  This function would make more sense when the calling matrix is of other type than double.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.DOUBLE()

Example:

->A_new = A.double()

->

See also (class function)

float, int, short, uchar, bool

| HOME | BACK |


DRWCIRCLE

| HOME | BACK |

Purpose

To draw a circle in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

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

argm1 = row number of the center of the circle being drawn

argm2 = column number of the center of the circle being drawn

argm3 = radius of the circle (in pixel unit)

Example:

->A.drwcircle(10,10,3)       

->

The above example will draw a circle center at row number = 10, column number = 10, with a radius = 3 pixels.

See also (class function)

drwellipse, drwline, drwpline, drwrectang, drwsquare, drwvecpline

| HOME | BACK |


DRWELLIPSE

| HOME | BACK |

Purpose

To draw an ellipse in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

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

argm1 = row number of the center of the ellipse being drawn

argm2 = column number of the center of the ellipse being drawn

argm3 = semi-major axis (in horizontal direction) of the ellipse (in pixel unit)

argm4 = semi-minor axis (in vertical direction) of the ellipse (in pixel unit)

Example:

->A.drwellipse(10,10,3,2)       

->

The above example will draw a circle center at row number = 10, column number = 10, with a semi-major axis = 3 pixels, and a semi-minor axis = 2 pixels.

See also (class function)

drwcircle, drwline, drwpline, drwrectang, drwsquare, drwvecpline

| HOME | BACK |


DRWLINE

| HOME | BACK |

Purpose

To draw an line in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

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

argm1 = row number of the first point

argm2 = column number of the first point

argm3 = row number of the second point

argm4 = column number of the second point

Example:

->A.drwline(10,10,3,2)       

->

The above example will draw a line from a point (row number = 10, column number = 10) to another point (row number = 3, column number = 2).

See also (class function)

drwcircle, drwellipse, drwpline, drwrectang, drwsquare, drwvecpline

| HOME | BACK |


DRWPLINE

| HOME | BACK |

Purpose

To draw a poly-line in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.DRWPLINE({VecIndx} argm1)

argm1 = list of row and column indices of a poly-line, stored in a VecIndx object

Example:

->A.drwpline(pline1)       

->

The above example will draw a poly-line using a list of end points (row and column numbers) from "pline1", a VecIndx object.

See also (class function)

drwcircle, drwellipse, drwline, drwrectang, drwsquare, drwvecpline

| HOME | BACK |


DRWRECTANG

| HOME | BACK |

Purpose

To draw a rectangle in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

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

argm1 = row number of the center point of the rectangle

argm2 = column number of the center point of the rectangle

argm3 = height of the rectangle (in pixel unit)

argm4 = width of the rectangle (in pixel unit)

Example:

->A.drwrectang(10,10,3,2)       

->

The above example will draw a rectangle center at row number = 10, column number = 10, with a height = 3 pixels, and a width = 2 pixels.

See also (class function)

drwcircle, drwellipse, drwpline, drwline, drwsquare, drwvecpline

| HOME | BACK |


DRWSQUARE

| HOME | BACK |

Purpose

To draw a square in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

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

argm1 = row number of the center point of the square

argm2 = column number of the center point of the square

argm3 = size of the square (in pixel unit)

Example:

->A.drwsquare(10,10,3)       

->

See also (class function)

drwcircle, drwellipse, drwpline, drwline, drwrectang, drwvecpline

| HOME | BACK |


DRWVECCIRCLE

| HOME | BACK |

Purpose

To draw a list of circles in a matrix.

Class

Matrix_uch

Usage

{void} object.DRWSQUARE({VecIndx} argm1, {int} argm2)

argm1 = list of indices (row and column numbers) of centers of circles

argm2 = radius of the circles (in pixel unit)

 

Example:

->A.drwveccircle(vec_center,3)       

->

See also (class function)

drwcircle, drwellipse, drwpline, drwrectang, drwsquare, drwvecpline

| HOME | BACK |


DRWVECPLINE

| HOME | BACK |

Purpose

To draw a list of poly-lines in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.DRWVECPLINE({VecRCpline} argm1)

argm1 = vector of poly-lines, stored in a VecRCpline object.

Example:

->A.drwvecpline(plines)       

->

See also (class function)

drwcircle, drwellipse, drwpline, drwline, drwrectang, drwsquare

| HOME | BACK |


DRWTEXT

| HOME | BACK |

Purpose

To draw a text in a matrix.

Class

Matrix_uch

Usage

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

argm1 = row number of upper left corner of the text block

argm2 = column number of upper left corner of the text block

argm3 = a text string (at the moment only numbers are supported)

argm4 = height of the text (in pixel unit, optimum is about 7-12 pixels)

Example:

->A.drwtext(10,20,"1256",10)       

->

See also (class function)

drwcircle, drwellipse, drwpline, drwrectang, drwsquare, drwvecpline

| HOME | BACK |


EDGECANNY

| HOME | BACK |

Purpose

To make an edge image using the Canny edge detector operator.  The result edge image is a binary image, whose pixel values are either 0, background, or 255, edge pixel.

Canny edge operator requires that, first of all, the image be smoothed with a Gaussian filter.  Hence a standard deviation should be given, otherwise the function will use a default one.

Canny edge operator also wants two cutoff value to threshold edge magnitudes.  A pixel whose slope magnitude larger than the upper cutoff value is considered edge pixel immediately.  And a pixel whose slope magnitude smaller than the lower cutoff value is discard as non-edge.  Those which have slope magnitude values between the two cutoff value will be considered edge-pixels if they are connected to strong-edge pixels. 

If the two cutoff value are not given, Noobeed calculate the upper cutoff value by using a noise estimation function.  Then the default lower cutoff value is 50% of the upper cutoff one.  The upper cutoff value can be viewed by calling global function "getmagic_number".

It is very important to know that the maximum number of edges in the output image is controlled by a system parameter, command "set max_no_pline", which is initially set at 100000.  Use the command "set max_no_pline" to change its value when needed.

If an output file containing a list of edges is requested, output edge, or poly-lines, come out from this function will have a special characteristics that 1. each edge begins with the smallest row number and ends with the largest row number, and 2. each edge has a mono-tone characteristics, that is its row numbers from the first to the last pixel can only be the same or larger.

The user can specify a value of minimum length of edge (in pixels) and only those edges having the length large than it are considered including in the output image.

A by-product of Canny edge operator is a list of poly-lines, which is saved in a file under the current working directory, if requested by the user.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_uch} ret  =  object.EDGESOBEL([{double} argm1,{double} argm2,{double} argm3,{double} argm4,{double} argm5])

argm1 = standard deviation of Gaussian filter (default = 0.25) 

argm2 = lower cutoff value

argm3 = upper cutoff value. 

argm4 = minimum length of edge in pixel unit (default = 5)

argm5 = file name for output edges

        (default = "" no output file)

Example:

->B = A.edgecanny()       

->

See also (class function)

edgesobel

| HOME | BACK |


EDGESOBEL

| HOME | BACK |

Purpose

To make an edge image using the Sobel edge detector operator.  The result edge image is a binary image, whose pixel values are either 0, background, or 255, edge pixel.

This function requires a cutoff value.  If a pixel whose gradient is larger than the cutoff value, it will be considered an edge pixel.  If the cutoff value is not given, Noobeed calculate it by using a noise estimation function.  The default cutoff value can be viewed by calling global function "getmagic_number".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_uch} ret  =  object.EDGESOBEL([{double} argm1])

argm1 = a cutoff value. 

        A pixel whose slope magnitude larger than cutoff value is considered edge pixel.  If not given, the function will determine it by using a noise estimation function.

Example:

->B = A.edgesobel()       

->

See also (class function)

polyline

| HOME | BACK |


EIGEN

| HOME | BACK |

Purpose

To calculate eigen values and eigen vectors of a matrix.  The caller matrix must be symmetric. 

On returning, the eigen values and eigen vectors are combined in one output matrix, in which the eigen values are stored in the first column of the matrix followed by the eigen vectors associated with the eigen values in the same order of that of the eigen values.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.EIGEN()

Example:

->a = [1 2; 2 1]
->b = a.eigen()
->b

ans =

no of row    : 2
no of column : 3

0:   -1.0000000000     0.7071067812     0.7071067812
1:    3.0000000000    -0.7071067812     0.7071067812



->

See also (class function)

rref, rank, inv

| HOME | BACK |


EXP

| HOME | BACK |

Purpose

To calculate a result of the natural log base, e = 2.718281828459045,  raised to the power of elements in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.EXP()

Example:

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

->b = a.exp()

->print b


 no of row    : 3
 no of column : 3

 0:       2.71828       7.38906      20.08554
 1:      54.59815     148.41316     403.42879
 2:    1096.63316    2980.95799    8103.08393
 

See also (class function)

log, sin, cos, tan

| HOME | BACK |


FFT

| HOME | BACK |

Purpose

To calculate a two-dimensional Fourier transform of a matrix.  The number of rows and number of columns of the matrix must be of 2n.  If not, the function will pad zero rows or zero columns, so that its size is of 2n.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_cmp} ret  =  object.FFT()

Example:

->a = [ 1 2 ; 3 4]
 

->b = a.fft()

->print b


 no of row    : 2
 no of column : 2

 0:    10.00 + 0.00i    -2.00 + 0.00i
 1:    -4.00 + 0.00i     0.00 + 0.00i
 

See also (class function)

ift

| HOME | BACK |


FGAUSS

| HOME | BACK |

Purpose

To filter a matrix using a 2D Gaussian filter.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix} ret  =  object.FGAUSS({double} argm1)

argm1 = standard deviation of the 2D Gaussian filter (in pixel unit)

Example:

->B = A.fgauss(1)       

->

See also (class function)

fmean, fmedian

| HOME | BACK |


FILLPOLY

| HOME | BACK |

Purpose

To fill a closed polygon, defined by a poly-line, in matrix.  The fill value is taken from the current value of the red color, set by command "set pencolor".

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{void} object.FILLPOLY({VecIndx} argm1)

argm1 = list of row and column indices of a polygon, stored in a VecIndx object.

Example:

->A.fillpoly(pline1)       

->

See also (class function)

drwcircle, drwellipse, drwline, drwrectang, drwsquare, drwvecpline

| HOME | BACK |


FIND

| HOME | BACK |

Purpose

To find a particular element within a certain column of a matrix.  If found the function returns the row number at which the data is found, otherwise returns -1.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{int} ret = object.FIND({double} argm1,{int} argm2)

argm1 = data wanted to find in a matrix

argm2 = column number within which the data are searched

Example:

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


no of row    : 3
no of column : 3

0:   1.00000   2.00000   3.00000
1:   4.00000   5.00000   6.00000
2:   7.00000   8.00000   9.00000


->A.find(4,0)

ans = 1

->

See also (class function)

qfind

| HOME | BACK |


FIX

| HOME | BACK |

Purpose

To keep the integer part, and take away the decimal part of elements in a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_int} ret  =  object.FIX()

Example:

->a = [ 1.5  2.4  -3.99]
 

->b = a.fix()

->print b


 no of row    : 1
 no of column : 3

 0:       1.00000       2.00000      -3.00000
 

See also (class function)

exp, log, ln

| HOME | BACK |


FLAG_NULL

| HOME | BACK |

Purpose

To report the current value of  flag_null.  Flag_null is a member data of a Matrix, which indicates whether the null data in the matrix are taken into account in computation such as mean, min, max etc.  When a matrix is initiated, its flag_null value is zero (off).

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{bool} ret  =  object.FLAG_NULL()

Example:

->flag = A.flag_null()

->
 

See also (class function)

nulldata

| HOME | BACK |


FLIPLR

| HOME | BACK |

Purpose

To flip a matrix in the left right, horizontal, direction.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.FLIPLR()

For class Matrix_flt

{Matrix_flt} ret  =  object.FLIPLR()

For class Matrix_int

{Matrix_int} ret  =  object.FLIPLR()

For class Matrix_sht

{Matrix_sht} ret  =  object.FLIPLR()

For class Matrix_uch

{Matrix_uch} ret  =  object.FLIPLR()

For class Matrix_bln

{Matrix_bln} ret  =  object.FLIPLR()

Example:

->a = [ 1.5  2.4  -3.99]
 

->b = a.fliplr()

->print b


 no of row    : 1
 no of column : 3

 0:      -3.99000       2.40000       1.50000
 

See also (class function)

flipud

| HOME | BACK |


FLIPUD

| HOME | BACK |

Purpose

To flip a matrix in the upside down position.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{Matrix} ret  =  object.FLIPUD()

For class Matrix_flt

{Matrix_flt} ret  =  object.FLIPUD()

For class Matrix_int

{Matrix_int} ret  =  object.FLIPUD()

For class Matrix_sht

{Matrix_sht} ret  =  object.FLIPUD()

For class Matrix_uch

{Matrix_uch} ret  =  object.FLIPUD()

For class Matrix_bln

{Matrix_bln} ret  =  object.FLIPUD()

Example:

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

->c = a.flipud()

->print c

ans =

 no of row    : 3
 no of column : 3

 0:    7.00000    8.00000    9.00000
 1:    4.00000    5.00000    6.00000
 2:    1.00000    2.00000    3.00000
 

See also (class function)

fliplr

| HOME | BACK |


FLOAT

| HOME | BACK |

Purpose

To convert to a Matrix_flt object.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_flt} ret  =  object.FLOAT()

Example:

->A_new = A.float()

->

See also (class function)

double, int, short, uchar, bool

| HOME | BACK |


FLOOD

| HOME | BACK |

Purpose

To detect a uniform region in a matrix.  An index of a seed pixel is required in this function.  Upon returning, all pixels that are contiguous to the seed pixel and have the same value as the seed pixel will have a value of 1, otherwise 0.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_uch} ret  =  object.FLOOD({int} argm1, {int} argm2)

argm1 = row number of the seed pixel

argm2 = column number of the seed pixel

Example:

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

->c = a.flood(1,1)

->print c

ans =

 no of row    : 3
 no of column : 3

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

See also (class function)

fillpoly

| HOME | BACK |


FMEAN

| HOME | BACK |

Purpose

To filter a matrix using a mean filter.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

{Matrix_flt} ret  =  object.FMEAN({int} argm1)

For class Matrix_int

{Matrix_int} ret  =  object.FMEAN({int} argm1)

For class Matrix_sht

{Matrix_sht} ret  =  object.FMEAN({int} argm1)

For class Matrix_uch

{Matrix_uch} ret  =  object.FMEAN({int} argm1)

For class Matrix_bln

{Matrix_bln} ret  =  object.FMEAN({int} argm1)

argm1 = size of the mean filter (in pixel unit)

Example:

->B = A.fmean(3)       

->

See also (class function)

fgauss, fmedian

| HOME | BACK |


FMEDIAN

| HOME | BACK |

Purpose

To filter a matrix using a median filter.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

{Matrix_flt} ret  =  object.FMEAN({int} argm1, {int} argm2)

For class Matrix_int

{Matrix_int} ret  =  object.FMEAN({int} argm1, {int} argm2)

For class Matrix_sht

{Matrix_sht} ret  =  object.FMEAN({int} argm1, {int} argm2)

For class Matrix_uch

{Matrix_uch} ret  =  object.FMEAN({int} argm1, {int} argm2)

For class Matrix_bln

{Matrix_bln} ret  =  object.FMEAN({int} argm1, {int} argm2)

argm1 = size of the mean filter in horizontal (in pixel unit)

argm2 = size of the mean filter in vertical (in pixel unit)

Example:

->B = A.fmedian(3,3)       

->

See also (class function)

fgauss, fmean

| HOME | BACK |


FMODE

| HOME | BACK |

Purpose

To filter a matrix using a mode filter, the value that have the most frequency.

Class

Matrix_int, Matrix_sht, Matrix_uch

Usage

{Matrix_uch} ret  =  object.FMODE({int} argm1, {int} argm2)

argm1 = size of the mode filter in horizontal (in pixel unit)

argm2 = size of the mode filter in vertical (in pixel unit)

Example:

->a = [ 1 2 3; 4 4 4 ; 5 6 7]
->a = a.uchar()
->b = a.fmode(3,3)
->print b


 no of row : 3
 no of column : 3

 0:    4    4    4
 1:    4    4    4
 2:    4    4    4

See also (class function)

fgauss, fmean, fmedian

| HOME | BACK |