Image Class Function Manual (S-U)

SAVE

| HOME | BACK |

Purpose

To save as Noobeed format.  The function creates two files, one for documentation and another for data.

The documentation file will have an extension ".txt".  It is actually an ASCII file and must have exactly 15 lines (not including comment lines) , as follows.

 Image

/ Documant file of an Image object

/ image id

0

/ no of data type (in byte)

8

/ no of row

3

/ no of column

3

/ lower left coordinate (X Y)

0.00000 0.00000

/ upper right coordinate (X Y)

3.00000 3.00000

/ projection name

UTM

/ parameters (phe0(deg) ramda0(deg) stdlat1(deg) stdlat2(deg) sk0 Xo Yo) - not all relevant

0.000000 99.000000 0.00000 0.00000 0.9996000 500000.0000 0.0000

/ ellipsoid name

not_specified

/ ellipsoid (a, 1/f)

6378137.00000 298.2572235630

/ datum name

not_specified

/ datum shift from Earth center (Cx Cy Cz)

0.00000 0.00000 0.00000

/ flag null data (0 = off, 1 = on)

0

/ null data

0.000000000000000

The data file is in fact a generic binary file.  First it stores all element of the first row of the matrix of the image, from the first to the last column, then go to the second row, and does the same thing.  Hence the size of the data file will be exactly equal to total number of elements of the image multiplied by no of bytes per element (8 bytes in this case).

if a file name extension is not given, the function assumes an extension of ".txt" for documentation file and ".raw" for data file.

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

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

argm1 = documentation file name

argm2 = data file name   (default = same name as argm1 with extension ".raw")

Example:

->Img.save("Img_1")

->

See also (class function)

load

| HOME | BACK |


SAVEASC

| HOME | BACK |

Purpose

To save as ASCII format.  Each line in the output file represents a row in the matrix.  It is very important that the 3rd argument, if specified, is large enough to be able to separate each element within a line.  The default is that set by command "set width".

if a file name extension is not given, the function assumes an extension of ".txt".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{void} object.SAVEASC({String} argm1, [{int} argm2, {int} argm3])

argm1 = output file name

argm2 = no of decimal digits         (default = value set by command "set precision")

argm3 = no of width for each element (default = value set by command "set width")

Example:

->Img.saveasc("Img_2")

->

See also (class function)

loadasc

| HOME | BACK |


SAVEASCXYZ

| HOME | BACK |

Purpose

To save as ASCII format.  Each line in the output file represents one element of the Image, and it has three fields, namely x coordinate, y coordinate and value. 

The first line is for the 1st row and the first column element of the matrix of the image. The second line is for the first row and the second column element.  It goes all the way to the last column of the first row, then it starts doing the same thing for the second row and so on.

if a file name extension is not given, the function assumes an extension of ".txt".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{void} object.SAVEASCXYZ({String} argm1, [{int} argm2, {int} argm3])

argm1 = output file name

argm2 = no of decimal digits         (default = value set by command "set precision")

argm3 = no of width for each element (default = value set by command "set width")

Example:

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

->A.saveascxyz("list_xyz")

(The ASCII output file, "list_xyz.txt", will looks like:

0.500   2.500   1.000
1.500   2.500   2.000
2.500   2.500   3.000
0.500   1.500   4.000
1.500   1.500   5.000
2.500   1.500   6.000
0.500   0.500   7.000
1.500   0.500   8.000
2.500   0.500   9.000)

See also (class function)

saveasc

| HOME | BACK |


SAVEBIN

| HOME | BACK |

Purpose

To save as binary format.  First it stores all elements of the first row of the matrix of the image, from the first to the last column, then go to the second row, and does the same thing.  Hence the size of the data file will be exactly equal to total number of elements of the image multiplied by no of bytes per element (8 bytes in this case).

if a file name extension is not given, the function assumes an extension of ".raw".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

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

argm1 = an existing file name

Example:

->Img.savebin("Img_3")

->

See also (class function)

save, sappbin

| HOME | BACK |


SAVEBMP

| HOME | BACK |

Purpose

To save as bitmap (BMP) format.  The image will be first converted to an 8-bit data, and the output file will have an 8-bit gray scale format.  Losing of accuracy of data is unavoidable, if the original value range of data is beyond 8 bit, 0 to 255.

if a file name extension is not given, the function assumes an extension of ".bmp".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

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

argm1 = output file name

Example:

->Img.savebmp("Img_2")

->

See also (class function)

savetif

| HOME | BACK |


SAVEDOC

| HOME | BACK |

Purpose

To save only information of an Image to a documentation file.  The documentation file will have an extension ".txt".  It is actually an ASCII file and must have exactly 15 lines, see details in function "save".

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

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

argm1 = output file name (default extension = ".txt")

Example:

->Img.savedoc("Img_2")

->

See also (class function)

save

| HOME | BACK |


SAVETIF

| HOME | BACK |

Purpose

To save as Tag Image File (TIF) format.  The Image will be first converted to an 8-bit data, and the output file will have an 8-bit gray scale format.  Losing of accuracy of data is unavoidable, if the original value range of data is beyond 8 bit, 0 to 255.

if a file name extension is not given, the function assumes an extension of ".tif".

if a path name is not include in the specified file name, the function will search in the current data path, set by command "set path".

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

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

argm1 = output file name

Example:

->A.savetif("Mat_2")

->

See also (class function)

savebmp

| HOME | BACK |


SD

| HOME | BACK |

Purpose

To determine the value of the standard deviation of all elements in an Image.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{double} ret  =  object.SD()

Example:

->Img.matrix() = [1 2 3; 4 5 6; 7 8 9]

->B = Img.sd()

->print B

        2.73861

See also (class function)

max, min, mean

| HOME | BACK |


SET

| HOME | BACK |

Purpose

To set new value to elements of an Image at particular coordinates, specified by a list of coordinates, stored in a VecPt2D object. 

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{void} object.SET({VecPt2D} argm1, {double} argm2)

argm1 = a vector stored list of x y coordinates at which a new value being assigned

argm2 = a new value assigned to elements at coordinates specified by argm1

Example:

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

->v = findimg(A>5)

->A.set(v,999)

->print A

 no of row    : 3
 no of column : 3

 0:    1.00000     2.00000     3.00000
 1:    4.00000     5.00000   999.00000
 2:  999.00000   999.00000   999.00000

See also (class function)

findimg (global function)

| HOME | BACK |


SETSYMB

| HOME | BACK |

Purpose

To set a symbol at a particular coordinate in an Image.  A symbol is realized by using a matrix, which is one of arguments given by the user.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

{void} object.SETSYMB({double} argm1, {double} argm2, {Matrix} argm3)

For class Image_flt

{void} object.SETSYMB({double} argm1, {double} argm2, {Matrix_flt} argm3)

For class Image_int

{void} object.SETSYMB({double} argm1, {double} argm2, {Matrix_int} argm3)

For class Image_sht

{void} object.SETSYMB({double} argm1, {double} argm2, {Matrix_sht} argm3)

For class Image_uch

{void} object.SETSYMB({double} argm1, {double} argm2, {Matrix_uch} argm3)

For class Image_bln

{void} object.SETSYMB({double} argm1, {double} argm2, {Matrix_bln} argm3)

argm1 = x coordinate at which the center of the symbol is placed

argm2 = y coordinate at which the center of the symbol is placed

argm3 = matrix being used as a symbol to place on the calling matrix

Example:

->A = [ 0 1 0; 1 1 1; 0 1 0 ]
->B.setsybm(100.5 ,200.256, A)
->

See also (class function)

 

| HOME | BACK |


SETVECSYMB

| HOME | BACK |

Purpose

To set a symbol at particular x y image rectangular coordinates, specified by a VecPt2D object.  A symbol is realized by using a matrix, which is one of arguments given by the user.

Class

Image_uch

Usage

{void} object.SETVECSYMB({VecPt2D} argm1, {Matrix_uch} argm2)

argm1 = a vector contains x y coordinates of centers of the symbol

argm2 = matrix being used as a symbol to place on the calling image

Example:

->A = [ 0 1 0; 1 1 1; 0 1 0 ]
->Img.setvecsybm(vec_center_point, A)
->

See also (class function)

setsymb

| HOME | BACK |


SHADRELF

| HOME | BACK |

Purpose

To make a shade relief image.  This function calculate incident angles, and set the brightness values of the new image inversely proportional to the cosine function of incident angles.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Image} ret  =  object.SHADRELF([{double} argm1, {double} argm2])

argm1 = altitude of the sun or light source  (default = 45)

argm2 = azimuth of the sun or light source   (default = 45)

Example:

->Img_shade = DEM.shadrelf(40,135)

->

See also (class function)

incdang

| HOME | BACK |


SHORT

| HOME | BACK |

Purpose

To convert to a Image_sht object.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Image_sht} ret  =  object.SHORT()

Example:

->Img_new = Img.short()

->

See also (class function)

double, float, int, uchar, bool

| HOME | BACK |


SIZE

| HOME | BACK |

Purpose

To report the size of an Image, no of rows and columns.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Indx} ret  =  object.SIZE()

Example:

->Img.matrix() = [ 1 2 3; 4 5 6; 7 8 9]

->Img.size()

ans =     (3 , 3)

See also (class function)

nrow, ncol

| HOME | BACK |


SKIP

| HOME | BACK |

Purpose

To decrease the size of an Image by skipping a certain number of rows and columns.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

{Image} ret  =  object.SKIP({int} argm1)

For class Image_flt

{Image_flt} ret  =  object.SKIP({int} argm1)

For class Image_int

{Image_int} ret  =  object.SKIP({int} argm1)

For class Image_sht

{Image_sht} ret  =  object.SKIP({int} argm1)

For class Image_uch

{Image_uch} ret  =  object.SKIP({int} argm1)

For class Image_bln

{Image_bln} ret  =  object.SKIP({int} argm1)

argm1 = no of rows and columns being skipped

Example:

->a = Image(100,100)

->b = a.skip(1)

->print b.size()

(50 , 50)

See also (class function)

resample

| HOME | BACK |


SLOPE

| HOME | BACK |

Purpose

To compute a slope image.  First slope in x and y direction are computed, then the result slope image is the magnitude of the maximum slope, such that it is the square root of sum square of slope in x and y direction.

There are a number of algorithms to calculate slope in x and slope in y directions.  This function offers 2 options, one is using 4 pixels (2 for calculating slope in x direction and 2 for calculating slope in y direction), the other is using 8 pixels to do the calculation.

The computed slope is a sort of ratio number, dh / dL, where dh is change pixel value and dL is distance.  Hence it is unit-less.  To get a slope in percent, the user simply multiple with 100, and to get a slope in angle the user can use a function "atan".

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Image} ret  =  object.SLOPE([{int} argm1])

argm1 = computation method (1 = using 4 pixels, 2 = using 8 pixels)

        (default value = 1)

->Img_slope = DEM.slope(2)

->

See also (class function)

slope_x, slope_y, aspect

| HOME | BACK |


SLOPE_X

| HOME | BACK |

Purpose

To compute an Image of slope in x direction.

There are a number of algorithms to calculate slope in x directions.  This function offers 2 options, one is using 2 pixels, the other is using 6 pixels to do the calculation.

The computed slope is a sort of ratio number, dh / dL, where dh is change pixel value and dL is distance.  Hence it is unit-less.  To get a slope in percent, the user simply multiple with 100, and to get a slope in angle the user can use a function "atan".

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Image} ret  =  object.SLOPE_X([{int} argm1])

argm1 = computation method (1 = using 2 pixels, 2 = using 6 pixels)

        (default value = 1)

->Img_slope_x = DEM.slope_x(2)

->

See also (class function)

slope, slope_y, aspect

| HOME | BACK |


SLOPE_Y

| HOME | BACK |

Purpose

To compute an Image of slope in y direction.

There are a number of algorithms to calculate slope in y directions.  This function offers 2 options, one is using 2 pixels, the other is using 6 pixels to do the calculation.

The computed slope is a sort of ratio number, dh / dL, where dh is change pixel value and dL is distance.  Hence it is unit-less.  To get a slope in percent, the user simply multiple with 100, and to get a slope in angle the user can use a function "atan".

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Image} ret  =  object.SLOPE_Y([{int} argm1])

argm1 = computation method (1 = using 2 pixels, 2 = using 6 pixels)

        (default value = 1)

->Img_slope_y = DEM.slope_y(2)

->

See also (class function)

slope, slope_x, aspect

| HOME | BACK |


STRETCH

| HOME | BACK |

Purpose

To perform a general linear stretching.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

{Image} ret  =  object.STRETCH([{double} argm1, {double} argm2])

For class Image_flt

{Image_flt} ret  =  object.STRETCH([{double} argm1, {double} argm2])

For class Image_int

{Image_int} ret  =  object.STRETCH([{double} argm1, {double} argm2])

For class Image_sht

{Image_sht} ret  =  object.STRETCH([{double} argm1, {double} argm2])

For class Image_uch

{Image_uch} ret  =  object.STRETCH([{double} argm1, {double} argm2])

For class Image_bln

{Image_bln} ret  =  object.STRETCH([{double} argm1, {double} argm2])

argm1 = start value of the stretching range      (default = 0)

argm2 = end value of the stretching range        (default = 255)

Example:

->A.matrix() = [ 1 2 3; 4 5 6; 7 8 9]
->B = A.stretch()
->print B.matrix()


 no of row    : 3
 no of column : 3

 0:      0.00000    31.87500    63.75000
 1:     95.62500   127.50000   159.37500
 2:    191.25000   223.12500   255.00000

See also (class function)

stretchfix, stretchsat

| HOME | BACK |


STRETCHFIX

| HOME | BACK |

Purpose

To perform a linear stretching with fix interval.  In other words, the stretching will be done within a specific range. 

Values that are less than the specified range will be assigned the new value as the minimum value of the stretching range.  Values that are larger than the specified range will be assigned the new value as the maximum value of the stretching range.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

{Image} ret  =  object.STRETCH({double} argm1, {double} argm2, [{double} argm3, {double} argm4])

For class Image_flt

{Image_flt} ret  =  object.STRETCH({double} argm1, {double} argm2, [{double} argm3, {double} argm4])

For class Image_int

{Image_int} ret  =  object.STRETCH({double} argm1, {double} argm2, [{double} argm3, {double} argm4])

For class Image_sht

{Image_sht} ret  =  object.STRETCH({double} argm1, {double} argm2, [{double} argm3, {double} argm4])

For class Image_uch

{Image_uch} ret  =  object.STRETCH({double} argm1, {double} argm2, [{double} argm3, {double} argm4])

For class Image_bln

{Image_bln} ret  =  object.STRETCH({double} argm1, {double} argm2, [{double} argm3, {double} argm4])

argm1 = start value of the original range being stretched

argm2 = end value of the original range being stretched

argm3 = start value of the stretching range      (default = 0)

argm4 = end value of the stretching range        (default = 255)

Example:

->A.matrix() = [ 1 2 3; 4 5 6; 7 8 9]
->B = A.stretchfix(2,7,100,200)
->print B.matrix()


 no of row    : 3
 no of column : 3

 0:    100.00000    100.00000    120.00000
 1:    140.00000    160.00000    180.00000
 2:    200.00000    200.00000   200.00000

See also (class function)

stretch, stretchsat

| HOME | BACK |


STRETCHEQ

| HOME | BACK |

Purpose

To perform a stretching using histogram equalization.

Class

Matrix_uch

Usage

{Image_uch} ret  =  object.STRETCHEQ([{double} argm1, {double} argm2])

argm1 = start value of the stretching range      (default = 0)

argm2 = end value of the stretching range        (default = 255)

Example:

->Img_new = Img.stretcheq()

->

See also (class function)

stretchfix, stretchsat, stretch

| HOME | BACK |


STRETCHSAT

| HOME | BACK |

Purpose

To perform a linear stretching with saturation. 

The user gives an amount of percent, a so-called percent of saturation, say 5 percents.  Then the function calculate 2 fixed values.  One is the value that 5 percents of the data will have values less than it.  The second one is the value that 5 percents of the data will have values larger than it.  These two fixed values will be used to perform a linear stretching with fixed interval. 

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

{Image} ret  =  object.STRETCHSAT({double} argm1, [{double} argm2, {double} argm3])

For class Image_flt

{Image_flt} ret  =  object.STRETCHSAT({double} argm1, [{double} argm2, {double} argm3])

For class Image_int

{Image_int} ret  =  object.STRETCHSAT({double} argm1, [{double} argm2, {double} argm3])

For class Image_sht

{Image_sht} ret  =  object.STRETCHSAT({double} argm1, [{double} argm2, {double} argm3])

For class Image_uch

{Image_uch} ret  =  object.STRETCHSAT({double} argm1, [{double} argm2, {double} argm3])

For class Image_bln

{Image_bln} ret  =  object.STRETCHSAT({double} argm1, [{double} argm2, {double} argm3])

argm1 = percent of saturation

argm2 = start value of the stretching range      (default = 0)

argm3 = end value of the stretching range        (default = 255)

Example:

->A.matrix() = [ 1 2 3; 4 5 6; 7 8 9 ]
->B = A.stretchsat(30)
->print B.matrix()


 no of row    : 3
 no of column : 3

 0:      0.00000     0.00000    42.50000
 1:     85.00000   127.50000   170.00000
 2:    212.50000   255.00000   255.00000

See also (class function)

stretch, stretchfix

| HOME | BACK |


SUM

| HOME | BACK |

Purpose

To compute the summation value of all elements in an Image.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{double} ret  =  object.SUM()

Example:

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

->B = A.sum()

->print B

       45.00000

See also (class function)

max, min, mean

| HOME | BACK |


UCHAR

| HOME | BACK |

Purpose

To convert to a Image_uch object.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Image_uch} ret  =  object.UCHAR()

Example:

->Img_new = Img.uchar()

->

See also (class function)

double, float, int, short, bool

| HOME | BACK |


UNION

| HOME | BACK |

Purpose

To create a blank image from a union region of two images.  The two images must be in the same map projection.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Image} ret  =  object.UNION({Image} argm1)

argm1 = The second image

Example:

->new_blank_img = Img_1.union(Img_2)

->

See also (class function)

intersect

| HOME | BACK |


UPPER_LEFT

| HOME | BACK |

Purpose

To report x y coordinate of the upper left corner of the image.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Pt2D} ret  =  object.UPPER_LEFT()

Example:

->pt1 = Img.upper_left()

->

See also (class function)

upper_right, res_x, res_y

| HOME | BACK |


UPPER_RIGHT

| HOME | BACK |

Purpose

To report x y coordinate of the upper right corner of the image.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Pt2D} ret  =  object.UPPER_RIGHT()

Example:

->pt1 = Img.upper_right()

->

See also (class function)

upper_left, res_x, res_y

| HOME | BACK |