Matrix Class Function Manual (A-C) |
Purpose
To get a value of an element at a particular index in a Matrix.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln, Matrix_str
Usage
For class Matrix
{double} ret = object({int} argm1, {int} argm2)
For class Matrix_flt
{float} ret = object({int} argm1, {int} argm2)
For class Matrix_int
{int} ret = object({int} argm1, {int} argm2)
For class Matrix_sht
{short} ret = object({int} argm1, {int} argm2)
For class Matrix_uch
{uchar} ret = object({int} argm1, {int} argm2)
For class Matrix_bln
{bool} ret = object({int} argm1, {int} argm2)
For class Matrix_str
{String} ret = object({int} argm1, {int} argm2
argm1 = row number
argm2 = column number
Example:
->A = [ 1 2 3; 4 5 6; 7 8 9]
->a = A(0,1) ->print a 2 |
See also (class function)
set
Purpose
To calculate an absolute value of a Matrix.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
For class Matrix
{Matrix} ret = object.ABS()
For class Matrix_flt
{Matrix_flt} ret = object.ABS()
For class Matrix_int
{Matrix_int} ret = object.ABS()
For class Matrix_sht
{Matrix_sht} ret = object.ABS()
For class Matrix_uch
{Matrix_uch} ret = object.ABS()
For class Matrix_bln
{Matrix_bln} ret = object.ABS()
Example:
->A = [ -1 -2 -3; 4 5 6; 7 8 9] ->B = A.abs() ->print B no of row : 3 -> |
See also (class function)
sin, cos, tan
Purpose
To calculate an inverse cosine function of a Matrix. The return matrix are angles, in a unit set by command "set angle", ranging from -90 degrees to +90 degrees.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{Matrix} ret = object.ACOS()
Example:
->A = [ .1 .2 .3; .4 .5 .6; .7 .8 .9] ->B = A.acos() ->print B
|
See also (class function)
sin, cos, tan
Purpose
To make a new matrix by padding border lines, 4 sides, with a specified thickness. The padding region has an initial value of zero.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
For class Matrix
{Matrix} ret = object.ADDRIM({int} argm1)
For class Matrix_flt
{Matrix_flt ret = object.ADDRIM({int} argm1)
For class Matrix_int
{Matrix_int} ret = object.ADDRIM({int} argm1)
For class Matrix_sht
{Matrix_sht} ret = object.ADDRIM({int} argm1)
For class Matrix_uch
{Matrix_uch} ret = object.ADDRIM({int} argm1)
For class Matrix_bln
{Matrix_bln} ret = object.ADDRIM({int} argm1)
argm1 = padding border line thickness
Example:
->A = [ 1 2 3; 4 5 6; 7 8 9] ->B = A.addrim(1) ->print B
|
See also (class function)
concat, concatdown
Purpose
To make an anaglyph image. The calling matrix is to be the left image and the matrix in the first argument is to be the right image. They are to be overlaid on top of each other, assigning gray scale of the left image as a shade of red color and that of the right image as a shade of cyan color. Anaglyph glasses, red and cyan or red and green, are needed to view the image.
First of all, the height, no of rows, of the two matrices must be equal.
Then, imagine that the right image is place on top of the left image, such that the left edges of the two images touch each other. This is called the initial position. Then the right image is to be moved to the left or to the right direction from the initial position. This amount of shift is specified by the user as the second argument of the function. By adjusting the amount of shift, the user can control the strength of the 3D perception.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{Image_rgb} ret = object.ANAGLYPH({Matrix_uch} argm1, {int} argm2)
argm1 = the right image
argm2 = amount of shift, in pixels, of the right image
(positive = shift to the right, negative = shift to the left)
Example:
->Img_color = A.anaglyph(B, 50) -> |
The above example will make an anaglyph image from matrix A, the left image, and matrix B, the right image, with a separation distance of 50 pixels.
See also (class function)
angphtif
Purpose
To calculate an angle between two 3D vectors. The first vector is the calling matrix and the second vector is the matrix in the function argument. The two vector can be a row or column matrix, but need to have exactly 3 elements. The unit of the return angle is controlled by command "set angle".
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
For class Matrix
{double} ret = object.ANGLE({Matrix} argm1)
For class Matrix_flt
{double} ret = object.ANGLE({Matrix_flt} argm1)
For class Matrix_int
{double} ret = object.ANGLE({Matrix_int} argm1)
For class Matrix_sht
{double} ret = object.ANGLE({Matrix_sht} argm1)
For class Matrix_uch
{double} ret = object.ANGLE({Matrix_uch} argm1)
For class Matrix_bln
{double} ret = object.ANGLE({Matrix_bln} argm1)
argm1 = the second 3D-vector
Example:
->set angle "deg" |
See also (class function)
cross, dot
Purpose
This function works almost exactly the same as the function "anaglyph", except that rather than creating an Image_rgb object, it stores the result anaglyph image as a TIF format in a file specified by the user.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{void} object.ANGPHTIF({Matrix_uch} argm1, {int} argm2, {String} argm3)
argm1 = the right image
argm2 = amount of shift, in pixels, of the right image
(positive = shift to the right, negative = shift to the left)
argm3 = TIF image file name
Example:
->A.anaglyph(B, 50, "my_3D_image") -> |
The above example will make an anaglyph image and save as a TIF file, "my_3D_image.tif" in the current working directory, from matrix A, the left image, and matrix B, the right image, with a separation distance of 50 pixels.
See also (class function)
anaglyph
Purpose
To calculate an inverse sine function of a Matrix. The return matrix are angles, in a unit set by command "set angle", ranging from -90 degrees to +90 degrees.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{Matrix} ret = object.ASIN()
Example:
->A = [ .1 .2 .3; .4 .5 .6; .7 .8 .9] ->B = A.asin() ->print B
|
See also (class function)
sin, cos, tan
Purpose
To calculate an inverse tangent function of a Matrix. The return matrix are angles, in a unit set by command "set angle", ranging from -90 degrees to +90 degrees.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{Matrix} ret = object.ATAN()
Example:
->A = [ .1 .2 .3; .4 .5 .6; .7 .8 .9] ->B = A.atan() ->print B
|
See also (class function)
sin, cos, tan
Purpose
To make a binary matrix, whose values are either 0 or 255.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{Matrix_uch} ret = object.BINARY([{double} argm1])
argm1 = The threshold value (if x > threshold; value = 255, otherwise value = 0)
(default threshold value = 0)
Example:
->A = [ 1 2 3; 4 5 6; 7 8 9] ->B = A.binary(4) ->print B
|
See also (class function)
reclass, reassign, set
Purpose
To convert to a Matrix_uch object that contains 8-bit binary number of the content of the calling matrix. Each element of the calling matrix will expand to 8 elements, representing 8 bits of the binary numbers of the original data.
Class
Matrix_uch
Usage
{Matrix_uch} ret = object.BIT()
Example:
->a = [ 1 2 3 254
255].uchar()
|
See also (class function)
-
BOOL
Purpose
To convert to a boolean matrix, a Matrix_bln object.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{Matrix_bln} ret = object.BOOL()
Example:
->A = [1 2 3; 4 5
6] |
See also (class function)
float, int, short, uchar
Purpose
To find indices of all boundary pixels of a uniform region, having a specific pixel value given by the user. It is important to make sure that there is only one uniform region of the specified value in the matrix.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
For class Matrix
{VecIndx} ret = object.BOUNDARY({double} argm1)
For class Matrix_flt
{VecIndx} ret = object.BOUNDARY({float} argm1)
For class Matrix_int
{VecIndx} ret = object.BOUNDARY({int} argm1)
For class Matrix_sht
{VecIndx} ret = object.BOUNDARY({short} argm1)
For class Matrix_uch
{VecIndx} ret = object.BOUNDARY({uchar} argm1)
For class Matrix_bln
{VecIndx} ret = object.BOUNDARY({bool} argm1)
argm1 = value of the region of which the boundary is wanted
Example:
->set precision 0 |
See also (class function)
polyline, linefollow
Purpose
To make an Image_rgb object from a matrix. All three colors of the Image_rgb are equal, hence it will basically look exactly the same as a gray scale image. This conversion is useful when the user wants to add color element to the object, e.g. draw lines, poly-lines in colors.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{Image_rgb} ret = object.BWRGB()
Example:
->A_rgb = A.bwrgb() -> |
The above example will make an Image_rgb object from matrix A.
See also (class function)
rgbauto, rgb
Purpose
To clear all pixel values and set them to a specific value given by the user.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{void} object.CLEAR({double} argm1)
argm1 = a value to which all pixels will be set
Example:
->a = [ 1 2 3; 4
5 6; 7 8 9] |
See also (class function)
set, init
Purpose
To close a virtually loaded matrix. This function is irrelevant to a normal matrix.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{void} object.CLOSE()
Example:
->A = Matrix() ->A.vload("mat_1") ->A.close() |
See also (class function)
vload, load, save
Purpose
To convert to a Matrix_cmp object. Each element in the result matrix is a complex number, whose real parts are taken from the calling matrix, and the imaginary parts are zero.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{Matrix_cmp} ret = object.COMPLEX()
Example:
->A = [1 2 3; 4 5
6] |
See also (class function)
float, int, short, uchar, bool
Purpose
To compare elements of two matrices, and store the maximum value in a new matrix.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
For class Matrix
{Matrix} ret = object.COMPMAX({Matrix} argm1)
For class Matrix_flt
{Matrix_flt} ret = object.COMPMAX({Matrix_flt} argm1)
For class Matrix_int
{Matrix_int} ret = object.COMPMAX({Matrix_int} argm1)
For class Matrix_sht
{Matrix_sht} ret = object.COMPMAX({Matrix_sht} argm1)
For class Matrix_uch
{Matrix_uch} ret = object.COMPMAX({Matrix_uch} argm1)
For class Matrix_bln
{Matrix_bln} ret = object.COMPMAX({Matrix_bln} argm1)
argm1 = a matrix whose elements values are to be compared to those of the calling matrix
Example:
->a = [ 1 2 3; 4 5 6; 7 8 9] ->b = [ 7 8 9; 4 5 6; 1 2 3] ->c = a.compmax(b) ->print c |
See also (class function)
compmin
Purpose
To compare elements of two matrices, and store the minimum value in a new matrix.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
For class Matrix
{Matrix} ret = object.COMPMIN({Matrix} argm1)
For class Matrix_flt
{Matrix_flt} ret = object.COMPMIN({Matrix_flt} argm1)
For class Matrix_int
{Matrix_int} ret = object.COMPMIN({Matrix_int} argm1)
For class Matrix_sht
{Matrix_sht} ret = object.COMPMIN({Matrix_sht} argm1)
For class Matrix_uch
{Matrix_uch} ret = object.COMPMIN({Matrix_uch} argm1)
For class Matrix_bln
{Matrix_bln} ret = object.COMPMIN({Matrix_bln} argm1)
argm1 = a matrix whose elements values are to be compared to those of the calling matrix
Example:
->a = [ 1 2 3; 4 5 6; 7 8 9] ->b = [ 7 8 9; 4 5 6; 1 2 3] ->c = a.compmin(b) ->print c |
See also (class function)
compmax
Purpose
To concatenate a matrix to the right hand side of a calling matrix, and store the result in a new matrix.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln, Matrix_str
Usage
For class Matrix
{Matrix} ret = object.CONCAT({Matrix} argm1)
For class Matrix_flt
{Matrix_flt} ret = object.CONCAT({Matrix_flt} argm1)
For class Matrix_int
{Matrix_int} ret = object.CONCAT({Matrix_int} argm1)
For class Matrix_sht
{Matrix_sht} ret = object.CONCAT({Matrix_sht} argm1)
For class Matrix_uch
{Matrix_uch} ret = object.CONCAT({Matrix_uch} argm1)
For class Matrix_bln
{Matrix_bln} ret = object.CONCAT({Matrix_bln} argm1)
For class Matrix_str
{Matrix_str} ret = object.CONCAT({Matrix_str} argm1)
argm1 = a matrix to be concatenated to the right side of the calling matrix
Example:
->a = [ 1 2 3; 4 5 6; 7 8 9] ->b = [ 7 8 9; 4 5 6; 1 2 3] ->c = a.concat(b) ->print c |
See also (class function)
concatdown
Purpose
To concatenate a matrix to the bottom of a calling matrix, and store the result in a new matrix.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln, Matrix_str
Usage
For class Matrix
{Matrix} ret = object.CONCATDOWN({Matrix} argm1)
For class Matrix_flt
{Matrix_flt} ret = object.CONCATDOWN({Matrix_flt} argm1)
For class Matrix_int
{Matrix_int} ret = object.CONCATDOWN({Matrix_int} argm1)
For class Matrix_sht
{Matrix_sht} ret = object.CONCATDOWN({Matrix_sht} argm1)
For class Matrix_uch
{Matrix_uch} ret = object.CONCATDOWN({Matrix_uch} argm1)
For class Matrix_bln
{Matrix_bln} ret = object.CONCATDOWN({Matrix_bln} argm1)
For class Matrix_str
{Matrix_str} ret = object.CONCATDOWN({Matrix_str} argm1)
argm1 = a matrix to be concatenated to the bottom of the calling matrix
Example:
->a = [ 1 2 3; 4 5 6; 7 8 9] ->b = [ 7 8 9; 4 5 6; 1 2 3] ->c = a.concatdown(b) ->print c |
See also (class function)
concat
Purpose
To calculate a convolution of two matrices. The calling matrix is the base matrix, which is to be convolved by the argument matrix.
By definition of the convolution, the convolved matrix is to be flipped in both horizontal and vertical, and is to be moved all over the base matrix. The size of the result matrix is the same as the calling matrix. Each element of the result matrix is a summation of the multiplication, element by element, of elements of the two matrices.
There is no calculation at the border of the calling image. The convolution values in this region are simply copied from the nearest lines.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{Matrix} ret = object.CONVOL({Matrix} argm1)
argm1 = a matrix to convolve to the calling matrix
Example:
->a = [ 1 2 3; 4 5 6; 7 8 9] ->b = [ 7 8 9; 4 5 6; 1 2 3] ->c = a.convol(b) ->print c |
See also (class function)
fmean, fgauss
Purpose
To compute a correlation coefficient of all elements of two matrices. The result is in a range of -1 to 1.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
For class Matrix
{double} ret = object.CORR({Matrix} argm1)
For class Matrix_flt
{double} ret = object.CORR({Matrix_flt} argm1)
For class Matrix_int
{double} ret = object.CORR({Matrix_int} argm1)
For class Matrix_sht
{double} ret = object.CORR({Matrix_sht} argm1)
For class Matrix_uch
{double} ret = object.CORR({Matrix_uch} argm1)
For class Matrix_bln
{double} ret = object.CORR({Matrix_bln} argm1)
argm1 = another matrix
Example:
->a = [ 1 2 3; 4 5 6; 7 8 9] ->b = [ 7 8 9; 4 5 6; 1 2 3] ->c = a.corr(b) ->print c |
See also (class function)
cov, compmin, compmax
Purpose
To calculate a cosine function of a Matrix. The angle unit is that set by command "set angle".
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
{Matrix} ret = object.COS()
Example:
->set angle "deg" |
See also (class function)
sin, tan
Purpose
To compute a covariant value of all elements of two matrices.
Class
Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln
Usage
For class Matrix
{double} ret = object.COV({Matrix} argm1)
For class Matrix_flt
{double} ret = object.COV({Matrix_flt} argm1)
For class Matrix_int
{double} ret = object.COV({Matrix_int} argm1)
For class Matrix_sht
{double} ret = object.COV({Matrix_sht} argm1)
For class Matrix_uch
{double} ret = object.COV({Matrix_uch} argm1)
For class Matrix_bln
{double} ret = object.COV({Matrix_bln} argm1)
argm1 = another matrix
Example:
->a = [ 1 2 3; 4 5 6; 7 8 9] ->b = [ 7 8 9; 4 5 6; 1 2 3] ->c = a.cov(b) ->print c |
See also (class function)
corr, compmin, compmax
Purpose
To calculate a cross product between two 3D vectors. The first vector is the calling matrix and the second vector is the matrix in the function argument. 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
{Matrix} ret = object.CROSS({Matrix} argm1)
For class Matrix_flt
{Matrix_flt} ret = object.CROSS({Matrix_flt} argm1)
For class Matrix_int
{Matrix_int} ret = object.CROSS({Matrix_int} argm1)
For class Matrix_sht
{Matrix_sht} ret = object.CROSS({Matrix_sht} argm1)
For class Matrix_uch
{Matrix_uch} ret = object.CROSS({Matrix_uch} argm1)
For class Matrix_bln
{Matrix_bln} ret = object.CROSS({Matrix_bln} argm1)
argm1 = the second 3D-vector
Example:
->a = [ 1 2 3 ] ->b = [ 4 5 6 ] ->c = a.cross(b) ->print c |
See also (class function)
dot, angle