Matrix Class Function Manual (D-F) |
Purpose
To compute the determinant of a matrix.
Class
Matrix
Usage
{double} ret = object.DET()
Example:
->a = [ 1 2 ; 5
8] |
See also (class function)
inv
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] |
See also (class function)
diagmult
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 |
See also (class function)
cross, angle
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
Purpose
To draw a break-line on a Matrix. A break-line has elevations along all points in the line and is defined by 2 points. The user inputs a break line by specifying 2 end points and their elevations, then this function determines elevations of all other points on the line and assignes them to those points of the line.
Class
Matrix, Matrix_flt
Usage
{void} object.DRWBREAKLINE({int} argm1, {int} argm2, {double} argm3, {int}argm4, {int} argm5, {double} argm6)
argm1 = row number of the first point
argm2 = column number of the first point
argm3 = elevation, of the first point
argm4 = row number of the second point
argm5 = column number of the second point
argm6 = elevation, of the second point
Example:
->A.drwbreakline(10, 10, 20.25, 3, 2, 50.88) -> |
The above example draws a break-line from a point (row = 10, column = 10, z = 20.25 ) to another point (row = 3, column = 2, z = 50.88).
See also (class function)
drwcircle, drwellipse, drwpline, drwrectang, drwsquare, drwvecpline
DRWCIRCLE
Purpose
To draw a circle on 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
Purpose
To draw an ellipse on 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
Purpose
To draw an line on 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
Purpose
To draw a poly-line on 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
Purpose
To draw a rectangle on 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
Purpose
To draw a square on 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
Purpose
To draw a list of circles on 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
Purpose
To draw a list of poly-lines on 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
Purpose
To draw a text on a Matrix. Characters unknown to Noobeed will be drawn as "?".
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
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
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
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
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] |
See also (class function)
rref, rank, inv
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 |
See also (class function)
log, sin, cos, tan
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 |
See also (class function)
ift
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
Purpose
To fill a closed polygon, defined by a polyline, in matrix. The polygon is in fact a polyline and it needs not to be colosed because Noobeed will create one last edge to connect the first point to the last point . The fill value is taken from the current value of the red color, set by command "set pencolor".
This function only fills one polygon. Taking row = X and column = Y, Noobeed is going to fill one scan line at a time, in Y direction, or fill column by column. For each scan line, all edges that fall within it will be taken into consideration and their intersection points, (in fact these are row numbers), will be computed. The intersection points are to be checked if they are end points. If so, the end point will have to go further in one more step, that is to find the two neighbor points that commect to it. Then the neighbor points are to be checked if they are on the same side or at oppsosite sideof the scan line. If they are at the same side, one more additional dummy point will be added to the intersection list, otherwise, do nothing.
Intersection points, including the start and end points,
are grouped into pair of two, and the filling will be given for all pairs.
When encounter with vertical line, a special routine need to be used to
correctly fill out the intersection pair. Noobeed use a tempolary edge
table to monitor all these activities.
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
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, Matrix_str
Usage
For class Matrix
{int} ret = object.FIND({double} argm1,{int} argm2)
For class Matrix_flt
{int} ret = object.FIND({float} argm1,{int} argm2)
For class Matrix_int
{int} ret = object.FIND({int} argm1,{int} argm2)
For class Matrix_sht
{int} ret = object.FIND({short} argm1,{int} argm2)
For class Matrix_uch
{int} ret = object.FIND({uchar} argm1,{int} argm2)
For class Matrix_bln
{int} ret = object.FIND({bool} argm1,{int} argm2)
For class Matrix_str
{int} ret = object.FIND({String} 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] |
See also (class function)
qfind, findall, findfrom
Purpose
To find a particular element within a certain column of a matrix. All the found positions will be reported as a VecInt object, in which row numbers are stored. If not found, the return vector will be empty.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln, Matrix_str
Usage
For class Matrix
{Vecint} ret = object.FINDALL({double} argm1,{int} argm2)
For class Matrix_flt
Vecint} ret = object.FINDALL({float} argm1,{int} argm2)
For class Matrix_int
{Vecint} ret = object.FINDALL({int} argm1,{int} argm2)
For class Matrix_sht
Vecint} ret = object.FINDALL({short} argm1,{int} argm2)
For class Matrix_uch
Vecint} ret = object.FINDALL({uchar} argm1,{int} argm2)
For class Matrix_bln
Vecint} ret = object.FINDALL({bool} argm1,{int} argm2)
For class Matrix_str
Vecint} ret = object.FINDALL({String} 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] 1
|
See also (class function)
qfind
Purpose
To find a particular element within a certain column of a matrix, starting from a certain position, the row number, given by the user as the last argument. 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, Matrix_str
Usage
For class Matrix
{int} ret = object.FINDFROM({double} argm1,{int} argm2,{int} argm3)
For class Matrix_flt
{int} ret = object.FINDFROM({float} argm1,{int} argm2,{int} argm3)
For class Matrix_int
{int} ret = object.FINDFROM({int} argm1,{int} argm2,{int} argm3)
For class Matrix_sht
{int} ret = object.FINDFROM({short} argm1,{int} argm2,{int} argm3)
For class Matrix_uch
{int} ret = object.FINDFROM({uchar} argm1,{int} argm2,{int} argm3)
For class Matrix_bln
{int} ret = object.FINDFROM({bool} argm1,{int} argm2,{int} argm3)
For class Matrix_str
{int} ret = object.FINDFROM({String} argm1,{int} argm2,{int} argm3)
argm1 = data wanted to find in a matrix
argm2 = column number within which the data are searched
argm3 = row number from which the searching begins
Example:
->a = [ 1 2 3; 4 5 6 ; 1
2 3] |
See also (class function)
qfind
FIX
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 |
See also (class function)
exp, log, ln
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
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 |
See also (class function)
flipud
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 |
See also (class function)
fliplr
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
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 |
See also (class function)
fillpoly
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
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 median filter in the direction of row (in pixel unit)
argm2 = size of the median filter in the direction of column (in pixel unit)
Example:
->B = A.fmedian(3,3) -> |
See also (class function)
fgauss, fmean
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 the direction of row (in pixel unit)
argm2 = size of the mode filter in the direction of column (in pixel unit)
Example:
->a = [ 1 2 3; 4
4 4 ; 5 6 7] |
See also (class function)
fgauss, fmean, fmedian