Matrix Class Function Manual (M-O)

MATCHING

| HOME | BACK |

Purpose

To automatically match point from one image to the other image. 

The two image are supposed to be of the same scene, however taken in a different view.  They must have the same number of rows.  In fact these are images that used to make an anaglyph image, where the calling matrix is the left image and the right image is in one of the arguments of the function.

This function return a matrix_flt, that contains the column number of the matched point of the particular pixel on the right image.  If matching is fail, a value set by function "set na" is put on that pixel.

Several critical parameters are needed by the functions, for example window size, search distance, interval step, etc.  They must be expressed in the pixel unit.

When searching for a corresponding point on the right photo, the function first set a center of the window at an approximate location, then it will search to the left and to the right by the amount given by the search distance,.

The window size is very much dependent on details appear on the individual scene.  In general it should be big enough to be able to include unique features, or texture, so that the correlation function can work reliably.  The bigger is more reliable but may lose the quality of localization.

The interval step is the interval on the left photo at which the center of a window is placed and the corresponding point on the right photo will be searched.

A minimum value of correlation should be given, or the function will use a default value (0.6), to discard wrong matched points.  Points that have its maximum correlation coefficient (value between -1 to 1), less than the given minimum value will be considered wrong match.  They are then assigned an value of "na", not applicable, which is set by the command "set na".

If request, a file containing correlation results of all matched point can be stored for later investigation.  It is a Matrix object of the same size as the matrix of the left photo.

Class

Matrix_uch

Usage

{Matrix_flt} ret  =  object.MATCHING({Matrix_uch} argm1,{double} argm2, {double} argm3, {double} argm4, [{double} argm5, {String} argm6])

argm1 = The right image

argm2 = interval step (in pixel unit)

argm3 = window size (in pixel unit)

argm4 = search distance (in pixel unit)

argm5 = minimum correlation coefficient value (default = window size)

argm6 = file name to store correlation results

       (If not given, there will be no file created)

 

Example:

->winsize     = 60
->step        = 5
->search      = 150
->min_corr    = 0.6

->M_match = M_left.dem(M_right, step, winsize, search, min_cor, "Corr_result")

->

See also (class function)

anaglyph, angphtif

| HOME | BACK |


MATSTR

| HOME | BACK |

Purpose

To generate a Matrix_str object from a matrix object.  For Matrix and Matrix_flt objects, the number of decimal places will be that of the current precision, set by command set precision.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Matrix_str} ret  =  object.MATSTR()

Example:

->a

ans =

no of row : 3
no of column : 5

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



->a.matstr()

ans =

no of row : 3
no of column : 5
0:1.00000 2.00000 3.00000 4.00000 5.50000
1:2.00000 3.00000 4.00000 5.00000 6.00000
2:7.00000 8.00000 9.00000 0.00000 10.00000


->set precision 8
->a.matstr()

ans =

no of row : 3
no of column : 5
0:1.00000000 2.00000000 3.00000000 4.00000000 5.50000000
1:2.00000000 3.00000000 4.00000000 5.00000000 6.00000000
2:7.00000000 8.00000000 9.00000000 0.00000000 10.00000000


->

See also (class function)

max, min, sd

| HOME | BACK |


MAX

| HOME | BACK |

Purpose

To determine the maximum value of all elements of a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{double} ret  =  object.MAX()

For class Matrix_flt

{float} ret  =  object.MAX()

For class Matrix_int

{int} ret  =  object.MAX()

For class Matrix_sht

{short} ret  =  object.MAX()

For class Matrix_uch

{uchar} ret  =  object.MAX()

For class Matrix_bln

{bool} ret  =  object.MAX()

Example:

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

->B = A.max()

->print B

        9.00000

See also (class function)

min, mean, sd

| HOME | BACK |


MEAN

| HOME | BACK |

Purpose

To determine a mean, an average, value of all elements of a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{double} ret  =  object.MEAN()

Example:

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

->B = A.mean()

->print B

        5.00000

See also (class function)

max, min, sd

| HOME | BACK |


MEDIAN

| HOME | BACK |

Purpose

To determine a median, a value at the center position when all elements are sorted, of a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{double} ret  =  object.MEDIAN()

For class Matrix_flt

{float} ret  =  object.MEDIAN()

For class Matrix_int

{int} ret  =  object.MEDIAN()

For class Matrix_sht

{short} ret  =  object.MEDIAN()

For class Matrix_uch

{uchar} ret  =  object.MEDIAN()

For class Matrix_bln

{bool} ret  =  object.MEDIAN()

Example:

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

->B = A.median()

->print B

        5.00000

See also (class function)

max, min, mean, sd

| HOME | BACK |


MIN

| HOME | BACK |

Purpose

To determine the minimum value of all elements of a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

{double} ret  =  object.MIN()

For class Matrix_flt

{float} ret  =  object.MIN()

For class Matrix_int

{int} ret  =  object.MIN()

For class Matrix_sht

{short} ret  =  object.MIN()

For class Matrix_uch

{uchar} ret  =  object.MIN()

For class Matrix_bln

{bool} ret  =  object.MIN()

Example:

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

->B = A.min()

->print B

        1.00000

See also (class function)

max, mean, sd

| HOME | BACK |


MULT121

| HOME | BACK |

Purpose

To perform a one-to-one multiplication of two same size matrices, such that each element value of the result matrix is the multiplication of elements of the two matrices at the same index.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

For class Matrix

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

For class Matrix_flt

{Matrix_flt} ret  =  object.MULT121({Matrix_flt} argm1)

For class Matrix_int

{Matrix_int} ret  =  object.MULT121({Matrix_int} argm1)

For class Matrix_sht

{Matrix_sht} ret  =  object.MULT121({Matrix_sht} argm1)

For class Matrix_uch

{Matrix_uch} ret  =  object.MULT121({Matrix_uch} argm1)

For class Matrix_bln

{Matrix_bln} ret  =  object.MULT121({Matrix_bln} argm1)

argm1 = the second matrix

Example:

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

->b = a

->c = a.mult121(b)

->print c

 no of row    : 3
 no of column : 3

 0:     1.00000     4.00000     9.00000
 1:    16.00000    25.00000    36.00000
 2:    49.00000    64.00000    81.00000

See also (class function)

matrix operators

| HOME | BACK |


MULTDIAG

| HOME | BACK |

Purpose

To multiply a matrix with a diagonal matrix.  The diagonal matrix 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.MULTDIAG({Matrix} argm1)

argm1 = the second matrix (diagonal matrix)

Example:

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

ans =

no of row    : 3
no of column : 3

0:   100.0000    400.0000    900.0000
1:   400.0000   1000.0000   1800.0000
2:   700.0000   1600.0000   2700.0000


->

See also (class function)

diagmult

| HOME | BACK |


MUPDATE

| HOME | BACK |

Purpose

To update tyhe content of many column ofs a Matrix.  This function is similar to the class function "update" and is for Matrix_str only.

Class

Matri_str

Usage

{void} object.UPDATE({Vecint} argm1, {int} argm2, {Matrix_str} argm3, {Vecint} argm4, {int} argm5)

argm1 = the column numbers of the calling Matrix to be updated stored in a Vecint object

argm2 = the column number of the calling Matrix to be used as key data

argm3 = the lookup table matrix

argm4 = the column number of the lookup table matrix containing updating data updated stored in a Vecint object

argm5 = the column number of the lookup table matrix containing key data

 

Example:

->Table1 = Matrix_str()
->Table1.loadcsv("t1.txt")
->Table1

ans =

no of row : 5
no of column : 5
0:A 1 7 0 0
1:B 2 90 0 0
2:C 1 82 0 0
3:D 3 50 0 0
4:E 2 41 0 0


->Table2 = Matrix_str()
->Table2.loadcsv("t2.txt")
->Table2

ans =

no of row : 3
no of column : 3
0:1 4000 100000
1:2 5000 200000
2:3 6000 300000


->v1 = Vecint(2)
->v1.pushback(3)
->v1.pushback(4)
->v2 = Vecint(2)
->v2.pushback(1)
->v2.pushback(2)
->Table1.mupdate(v1,1,Table2,v2,0)

Now doing updating...

Percent done : 0
: 20
: 40
: 70
: 100
->Table1

ans =

no of row : 5
no of column : 5
0:A 1 7 4000 100000
1:B 2 90 5000 200000
2:C 1 82 4000 100000
3:D 3 50 6000 300000
4:E 2 41 5000 200000


->

See also (class function)

update

| HOME | BACK |


 

NCOL

| HOME | BACK |

Purpose

To report the number of columns of a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{int} ret  =  object.NCOL()

Example:

->n = A.ncol()

->

See also (class function)

nrow

| HOME | BACK |


NO2RC

| HOME | BACK |

Purpose

To convert a number to a row and column number.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{Indx} ret  =  object.NO2RC({int} argm1)

argm1 = a number

Example:

->A = Matrix(2,3)

->A.no2rc(1)

ans = (0 , 1)

->A.no2rc(3)

ans = (1 , 0)

See also (class function)

rc2no

| HOME | BACK |


NOCONNECT

| HOME | BACK |

Purpose

To find the number of pixels whose values are greater than 0 and connected to the specified pixel, within a window of size 3 x 3.  The center of window is placed at the specified pixel.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

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

argm1 = row number of the interesting pixel

argm2 = column number of the interesting pixel

Example:

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

->a.noconnect(1,1)

ans =    8

See also (class function)

noconnect_exact

| HOME | BACK |


NOCONNECT_EXACT

| HOME | BACK |

Purpose

To find the number of pixels whose values are exactly the same as the specified pixel and connected to the specified pixel, within a window of size 3 x 3.  The center of window is placed at the specified pixel.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

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

argm1 = row number of the interesting pixel

argm2 = column number of the interesting pixel

Example:

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

->a.noconnect_exact(1,1)

ans =    0

See also (class function)

noconnect

| HOME | BACK |


NORM

| HOME | BACK |

Purpose

To compute a norm of a matrix.  A norm is defined by the square root of sum of square of all elements in the matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{double} ret  =  object.NORM()

Example:

->A = [ 1 2 3]
->A.norm()

ans = 3.74166

->

See also (class function)

angle, cross, dot

| HOME | BACK |


NROW

| HOME | BACK |

Purpose

To report the number of rows of a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{int} ret  =  object.NROW()

Example:

->n = A.nrow()

->

See also (class function)

ncol

| HOME | BACK |


NULLDATA

| HOME | BACK |

Purpose

To report the current value of null data of a matrix.

Class

Matrix, Matrix_flt, Matrix_int, Matrix_sht, Matrix_uch, Matrix_bln

Usage

{double} ret  =  object.NULLDATA()

Example:

->n = A.nulldata()

->

See also (class function)

flag_null

| HOME | BACK |