Image Class Function Manual (P-R)

POINTRAST

| HOME | BACK |

Purpose

To rasterize 3D x y z coordinates into an Image.  The values being put in the image pixels is the z coordinates.

This function is similar to function "loadpoint", except that the calling image will not be reinitialized.  Thus points lie outside the area coverage of the image will be discard.

Duplicated points are not checked by the function.  Points read after will overwrite points previously rasterized.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{void} object.POINTRAST({VecPt3D} argm1)

argm1 = list of x y z coordinates, as a VecPt3D object

Example:

->A.pointrast(vec_spot_height)

->

See also (class function)

loadpoint

| HOME | BACK |


POLYLINE

| HOME | BACK |

Purpose

To find poly-lines in an Image.  A poly-line is defined by pixels, whose value greater than zero, connected to each other in one direction.  This function will detect all connected poly-lines in the image, and store the result in a vector of poly-lines, a VecRCpline object.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{VecRCpline} ret  =  object.POLYLINE()

Example:

->plines = A.polyline()

->

See also (class function)

set max_no_pixel_in_pline (command)

| HOME | BACK |


PROJ

| HOME | BACK |

Purpose

To report the current map projection of the image.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Projection} ret  =  object.PROJ()

Example:

->P = Img.proj()

->

See also (class function)

lower_left, upper_right, nrow, ncol

| HOME | BACK |


RC2XY

| HOME | BACK |

Purpose

To convert from a row and column number to an x y coordinate.  Please note that the arguments of the function are of type double, which allows a sub-pixel row and column number to be converted to an accurate x y coordinate.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Pt2D} ret  =  object.RC2XY({double} argm1, {double} argm2)

argm1 = row number

argm2 = column number

Example:

->pt1 = Img.rc2xy(12.544, 22.986)

->

See also (class function)

xy2rc, vecrc2xy, vecxy2rc, vidrc2xy, vidxy2rc

| HOME | BACK |


REASSIGN

| HOME | BACK |

Purpose

To re-assign a new value to elements of an Image, if the original value is within a certain range, argm1 x argm2, specified by argument 1 and argument 2 in the function.  Otherwise keeps the original value. 

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

{Image} ret  =  object.REASSIGN({double} argm1, {double} argm2, {double} argm3)

For class Image_flt

{Image_flt} ret  =  object.REASSIGN({double} argm1, {double} argm2, {double} argm3)

For class Image_int

{Image_int} ret  =  object.REASSIGN({double} argm1, {double} argm2, {double} argm3)

For class Image_sht

{Image_sht} ret  =  object.REASSIGN({double} argm1, {double} argm2, {double} argm3)

For class Image_uch

{Image_uch} ret  =  object.REASSIGN({double} argm1, {double} argm2, {double} argm3)

For class Image_bln

{Image_bln} ret  =  object.REASSIGN({double} argm1, {double} argm2, {double} argm3)

argm1 = start value of the specified range 

argm2 = end value of the specified range   

argm3 = value to be assigned, if original value is within the range.

Example:

->a = Image(3,3)

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

->a.matrix() = A

->b = a.reassign(4,6,999)

->print b.matrix()


 no of row    : 3
 no of column : 3

 0:     1.00000      2.00000      3.00000
 1:   999.00000    999.00000    999.00000
 2:     7.00000      8.00000      9.00000

See also (class function)

reclass

| HOME | BACK |


RECLASS

| HOME | BACK |

Purpose

To re-assign value of elements of an Image according to a list of boundary, given by a vector. 

The following is an example of a list of boundary values, stored in a vector object, says 5 values:  12 15 20 35 60.

Then the function will classify elements of the matrix, according to their values, into 6 classes, as follows (x is the original value).

class 0       x < 12

class 1       12 ≤ x < 15

class 2       15 ≤ x < 20

class 3       20 ≤ x < 35

class 4       35 ≤ x < 60

class 5       x 60

Thus each element of the new Image will be assigned a number from 0 to 5, according to the original values of the calling Image.

It is very important that values in the specified vector be sorted from small to large values.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

{Image} ret  =  object.RECLASS({Vector} argm1)

For class Image_flt

{Image_flt} ret  =  object.RECLASS({Vector} argm1)

For class Image_int

{Image_int} ret  =  object.RECLASS({Vector} argm1)

For class Image_sht

{Image_sht} ret  =  object.RECLASS({Vector} argm1)

For class Image_uch

{Image_uch} ret  =  object.RECLASS({Vector} argm1)

For class Image_bln

{Image_bln} ret  =  object.RECLASS({Vector} argm1)

argm1 = vector contains boundary points

Example:

->a = Image(3,3)
->A = [ 1 2 3; 4 5 6; 7 8 9]
->a.matrix() = A
->v1 = vector(2)
->v1.pushback(4)
->v1.pushback(6)
->b = a.reclass(v1)
->print b.matrix()


 no of row    : 3
 no of column : 3

 0:    0.00000    0.00000    0.00000
 1:    1.00000    1.00000    2.00000
 2:    2.00000    2.00000    2.00000

See also (class function)

reassign

| HOME | BACK |


RECTIFY

| HOME | BACK |

Purpose

To rectify an image, sometimes called geo-coding, or geo-reference. 

The transformation are determined by two given sets of control points, one is the xy-image rectangular coordinate system, the other in ground control coordinate system.  If measurement are in row and column numbers, they must be converted to xy-coordinates using function "rc2xy" or "vecrc2xy", vidrc2xy".  See details in section understanding coordinate system.

Control points in the two lists do not necessarily appear in the same order.  Also the number of points may not be the same.  The function will take only those points which have the same ID as control points.

Each x y coordinates can have a different weight, given by a standard deviation.  In general both coordinate systems are treated as observations, provided that all coordinates have standard deviations.  In case of when standard deviation is omitted, one coordinate system is kept as constant, for a sake of simplicity.

Transformation mathematic models available are conformal (4 parameters), affine (6 parameters), projective (8 parameters), and 2nd degree polynomial (10 parameters).  This results in a different minimum number of control points, i.e. 2 points for conformal, 3 points for affine, 4 points for projective, and 5 points for 2nd order polynomial transformation.

Available resample types, interpolation methods, are nearest neighbor, bilinear, and bicubic interpolation.

This function does not check the accuracy of the transformation parameters, it simply calculates the transformation and uses them right away to resample the image.  Therefore, it is recommended to check the quality of the transformation by performing a transformation using function in class "VecIdPt2D" and request a result report on a file.  Once the measurement data are verified to have a good result, then image rectification can be proceeded.

The boundary of the result rectified image is determined automatically, using the specified resolution given by the user.  If an image is to be rectified onto a pre-defined blank image, the function "rectify2img" must be used instead.  In this case the user has a full control over the area coverage of the final result image.

There is a report file, named "RPT_rect.txt", generated by this function stored in the current working directory.  This is to help user investigate the quality of transformation.  The user is supposed to be responsible of deleting it.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

{Image} ret  =  object.RECTIFY({double} argm1, {VecIdPt2D} argm2, {VecIdPt2D} argm3, {String} argm4, [{String} argm5])

For class Image_flt

{Image_flt} ret  =  object.RECTIFY({double} argm1, {VecIdPt2D} argm2, {VecIdPt2D} argm3, {String} argm4, [{String} argm5])

For class Image_int

{Image_int} ret  =  object.RECTIFY({double} argm1, {VecIdPt2D} argm2, {VecIdPt2D} argm3, {String} argm4, [{String} argm5])

For class Image_sht

{Image_sht} ret  =  object.RECTIFY({double} argm1, {VecIdPt2D} argm2, {VecIdPt2D} argm3, {String} argm4, [{String} argm5])

For class Image_uch

{Image_uch} ret  =  object.RECTIFY({double} argm1, {VecIdPt2D} argm2, {VecIdPt2D} argm3, {String} argm4, [{String} argm5])

For class Image_bln

{Image_bln} ret  =  object.RECTIFY({double} argm1, {VecIdPt2D} argm2, {VecIdPt2D} argm3, {String} argm4, [{String} argm5])

argm1 = required resolution of the result image (in ground unit)

argm2 = list of ID x y image rectangular coordinates of control point

argm3 = list of ID x y ground coordinates of control points

argm4 = transformation model, must be "conformal" or "affine" or "poly2nd" or "pjtive"

argm5 = resample method, must be "nearest" or "bilinear" or "bicubic"

        (default = "nearest")

Example:

->Img_new = Img.rectify(20, vec_xy_img, vec_xy_gcp, "affine", "bicubic")

->

See also (class function)

rectify2img

| HOME | BACK |


RECTIFY2IMG

| HOME | BACK |

Purpose

To rectify an image.  The result image will have the same size and resolution as the template image specified in one of the function arguments.

The function is similar to function "rectify", except that it will create a new image, by using information from the image in the first argument, to store the rectified image. 

This function can be used to fully control the size and resolution of the output rectified image.  Hence the target result image can be generated before hand according to a certain specification, for example resolution, coordinates of lower left and upper right corner.  Then it will be input as one of the argument in the function.  The result rectified image will have exactly the same geometry as the pre-defined image.

There is a report file, named "RPT_rect.txt", generated by this function stored in the current working directory.  This is to help user investigate the quality of transformation.  The user is supposed to be responsible of deleting it.

All other detail explanations are same as that of function "rectify" and can be seen in function "rectify". 

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

{Image} ret  =  object.RECTIFY2IMG({Image} argm1, {VecIdPt2D} argm2, {VecIdPt2D} argm3, {String} argm4, [{String} argm5])

For class Image_flt

{Image_flt} ret  =  object.RECTIFY2IMG({Image_flt} argm1, {VecIdPt2D} argm2, {VecIdPt2D} argm3, {String} argm4, [{String} argm5])

For class Image_int

{Image_int} ret  =  object.RECTIFY2IMG({Image_int} argm1, {VecIdPt2D} argm2, {VecIdPt2D} argm3, {String} argm4, [{String} argm5])

For class Image_sht

{Image_sht} ret  =  object.RECTIFY2IMG({Image_sht} argm1, {VecIdPt2D} argm2, {VecIdPt2D} argm3, {String} argm4, [{String} argm5])

For class Image_uch

{Image_uch} ret  =  object.RECTIFY2IMG({Image_uch} argm1, {VecIdPt2D} argm2, {VecIdPt2D} argm3, {String} argm4, [{String} argm5])

For class Image_bln

{Image_bln} ret  =  object.RECTIFY2IMG({Image_bln} argm1, {VecIdPt2D} argm2, {VecIdPt2D} argm3, {String} argm4, [{String} argm5])

argm1 = template image for the result rectified image

argm2 = list of ID x y image rectangular coordinates of control point

argm3 = list of ID x y ground coordinates of control points

argm4 = transformation model, must be "conformal" or "affine" or "poly2nd" or "pjtive"

argm5 = resample method, must be "nearest" or "bilinear" or "bicubic"

        (default = "nearest")

Example:

->Img_new = Img.rectify2img(Img_new, vec_xy_img, vec_xy_gcp, "affine", "bicubic")

->

See also (class function)

rectify

| HOME | BACK |


REPROJ

| HOME | BACK |

Purpose

To re-project an image into another map projection system. 

The process is done by first converting the desired map projection coordinates to geographic coordinates, latitudes and longitudes, then transform to the original map projection coordinates.  Then using one of available interpolation method, nearest neighbor, bilinear, and bicubic, determine the gray level values from the original image, the calling image, and put them in the new image.

This function can also be used to re-project an image from one ellipsoid datum to another datum, because the definition of class "Projection" also  include the definition of the ellipsoid.  Simply put a desired ellipsoid in the target map projection, the function will automatically take into account the datum difference, if the new ellipsoid is found different from the original ellipsoid.

The boundary of the result re-projected image is determined automatically, using the specified resolution given by the user.  If an image is to be re-projected onto a pre-defined blank image, the function "reproj2img" must be used instead.  In this case the user has a full control over the area coverage of the final result image.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

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

For class Image_flt

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

For class Image_int

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

For class Image_sht

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

For class Image_uch

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

For class Image_bln

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

argm1 = required resolution of the result image (in ground unit)

argm2 = target map projection

argm3 = resample method, must be "nearest" or "bilinear" or "bicubic"

        (default = "nearest")

Example:

->Proj_2 = Projection()

->Proj_2.setUTM(47)

->Img_new = Img.reproj(20, Proj_2, "bicubic")

->

See also (class function)

reproj2img

| HOME | BACK |


REPROJ2IMG

| HOME | BACK |

Purpose

To re-project an image into another map projection system.  The result image will have the same size, same resolution, and same map projection as a template image specified in one of the function arguments.

The function is similar to function "reproj", except that it will create a new image, by using information from the image in the first argument, to store the rectified image. 

This function can be used to fully control the size and resolution of the output rectified image.  Hence the target result image can be generated before hand according to a certain specification, for example resolution, coordinates of lower left and upper right corner.  Then it will be input as one of the argument in the function.  The result rectified image will have exactly the same geometry as the pre-defined image.

All other detail explanation are same as that of function "reproj" and can be seen in function "reproj". 

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

{Image} ret  =  object.REPROJ2IMG({Image} argm1, [{String} argm3])

For class Image_flt

{Image_flt} ret  =  object.REPROJ2IMG({Image_flt} argm1, [{String} argm3])

For class Image_int

{Image_int} ret  =  object.REPROJ2IMG({Image_int} argm1, [{String} argm3])

For class Image_sht

{Image_sht} ret  =  object.REPROJ2IMG({Image_sht} argm1, [{String} argm3])

For class Image_uch

{Image_uch} ret  =  object.REPROJ2IMG({Image_uch} argm1, [{String} argm3])

For class Image_bln

{Image_bln} ret  =  object.REPROJ2IMG({Image_bln} argm1, [{String} argm3])

argm1 = template image for the new re-projected image

argm3 = resample method, must be "nearest" or "bilinear" or "bicubic"

        (default = "nearest")

Example:

->Img_new = Img.reproj2img(Img_new, "bicubic")

->

See also (class function)

reproj

| HOME | BACK |


RESAMPLE

| HOME | BACK |

Purpose

To resample an Image into a new size.  Two constants, one for scale x and one for scale y, are specified by the user, and are to be multiply by the no of columns and no of rows to get a new size of an image.   A scale factor of less than 1 will reduce the size of the image.

The spatial information of the new image will remain the same, and its pixel values will be interpolated from those of the original image.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

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

For class Image_flt

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

For class Image_int

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

For class Image_sht

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

For class Image_uch

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

For class Image_bln

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

argm1 = scale factor in x direction

argm2 = scale factor in y direction

argm3 = resample method, must be "nearest" or "bilinear" or "bicubic"

        (default = "nearest")

Example:

->Img_new = Img.resample(0.5,0.5,"bilinear")

->

See also (class function)

overlay, overlap

| HOME | BACK |


RES_X

| HOME | BACK |

Purpose

To report the resolution in x axis.  This is the width of the image, in x y coordinate system unit, divided by no of columns.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{double} ret  =  object.RES_X()

Example:

->rx = Img.res_x()

->

See also (class function)

res_y

| HOME | BACK |


RES_Y

| HOME | BACK |

Purpose

To report the resolution in y axis.  This is the height of the image, in x y coordinate system unit, divided by no of rows.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{double} ret  =  object.RES_Y()

Example:

->rx = Img.res_y()

->

See also (class function)

res_x

| HOME | BACK |


RGB

| HOME | BACK |

Purpose

To make an Image_rgb object from an Image.  The colors of the output image are taken from the current color map, a 3-column matrix, by using values of elements of the calling image as an index to the color map.  The first color in the color map has an index of zero.

Any element having a value less than zero or greater than n-1, where n is the maximum number of color in the current color map, will be assigned a black color, red = 0, green = 0, blue = 0.

See details information of color map in command "set colormap".

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Image_rgb} ret  =  object.RGB()

Example:

->Img_color = Img.rgb()

->

See also (class function)

rgbauto

| HOME | BACK |


RGBAUTO

| HOME | BACK |

Purpose

To make an Image_rgb object from an Image.  The calling Image will be stretched so that its values range from 0 to n-1, where n is the number of colors in the current color map.  In contrast to function "rgb", this function will make use of the full scale of the current color map.

See details information of color map in command "set colormap".

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{Image_rgb} ret  =  object.RGBAUTO()

Example:

->Img_color = Img.rgbauto()

->

See also (class function)

rgb

| HOME | BACK |


ROTATE

| HOME | BACK |

Purpose

To rotate an image about the origin of the x y coordinate system.  The specified angle is measured counter-clockwise from the x-axis.  If other points about which the rotation is done is desired, then the image should be shift so that its origin is at that point, prior to the rotation.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

For class Image

{Image} ret  =  object.ROTATE({double} argm1, [{String} argm3])

For class Image_flt

{Image_flt} ret  =  object.ROTATE({double} argm1, [{String} argm3])

For class Image_int

{Image_int} ret  =  object.ROTATE({double} argm1, [{String} argm3])

For class Image_sht

{Image_sht} ret  =  object.ROTATE({double} argm1, [{String} argm3])

For class Image_uch

{Image_uch} ret  =  object.ROTATE({double} argm1, [{String} argm3])

For class Image_bln

{Image_bln} ret  =  object.ROTATE({double} argm1, [{String} argm3])

argm1 = rotation angle (in degree unit)

argm3 = resample method, must be "nearest" or "bilinear" or "bicubic"

        (default = "nearest")

Example:

->Img_new = Img.rotate(45, "bilinear")

->

See also (class function)

resample, overlay

| HOME | BACK |


ROW2Y

| HOME | BACK |

Purpose

To convert from a row number to a  y coordinate.  Please note that the arguments of the function are of type double, which allows a sub-pixel row number to be converted to an accurate y coordinate.

Class

Image, Image_flt, Image_int, Image_sht, Image_uch, Image_bln

Usage

{double} ret  =  object.RC2XY({double} argm1)

argm1 = row number

Example:

->A = Image(3,3)

->A.row2y(2)

ans =     0.50000

->A.row2y(0)

ans =     2.50000

See also (class function)

rc2xy, xy2rc, vecrc2xy, vecxy2rc, vidrc2xy, vidxy2rc, col2x

| HOME | BACK |