Photo Class Function Manual (I-L)


ID

| HOME | BACK |

Purpose

To report an ID of a Photo.

Class

Photo

Usage

{int} ret  =  object.ID()

Example:

->id = ph1.id()

->

See also (class function)

 

| HOME | BACK |


IMAGE

| HOME | BACK |

Purpose

To return an Image object of a Photo.

Class

Photo

Usage

{Image_uch} ret  =  object.IMAGE()

Example:

->Img = ph1.image()

->

See also (class function)

 

| HOME | BACK |


INIT

| HOME | BACK |

Purpose

To initialize a Photo object.

Class

Photo

Usage

{void} object.INIT({int} argm1, {int} argm2)

argm1 = no of rows

argm2 = no of columns

Example:

->ph1.init(1000,2000)

->

See also (class function)

 

| HOME | BACK |


IO

| HOME | BACK |

Purpose

To perform Interior Orientation (IO) of  a digital camera or an analog camera.

In case of a digital camera, once a digital camera is assigned to the photo object, the user does not need to input anything for the argument of the IO function.  This is how the program distinguish a digital camera from an analog camera. 

When shooting an image, you can rotate the camera, landscape or portrait or any angle, and the X axis of the camera and the image will always stay together when loaded into computer. HOWEVER, sometines the loading image may not appear in the same way as it sat in the camera beacause people, for some reasons, do want to physically rotate the original image. TO LET Noobeed know that the image is not original but a rotated version of the original image, the user need to specify the rotation angle between the X-axis of the camera and the X-axis of the loading image correctly.  Please use the L-function "FLAG_ROTATE" of the photo object to set this angle Prior to performing Interior Orientation (IO).

For a newly initialized photo object, the default value of the rotation flag is 0, meaning no rotation. If the rotation flag is set to 1, 2 or 3, then Noobeed will know that the image of the photo object is not original. Please note that all images in the figure below belong to ONE SAME original image.

 

 

To perform Interior Orientation for a digital camera, the program does nothing, but read camera information (c, xp, yp) and distortion parameters (k1, k2, A1, A2, p1, p2) and store them as interior orientation parameters.

The full extended collinearity is used in a digital camera as follows.

Full model with all possible parameters (c, xp, yp, k1, A1, p1, k2, A2, p2, k3)

            x = xp - c Nx/D + dx
            y = yp - c Ny/D + dy

           dx = dx(radial) + dx(affine) + dx(decentric)
           dy = dy(radial) + dy(affine) + dy(decentric)

dx(radial)    = (k1)(r^2)xb + (k2)(r^4)xb + (k3)(r^6)xb
dy(radial)    = (k1)(r^2)yb + (k2)(r^4)yb + (k3)(r^6)yb

dx(affine)    = -(A1)xb + (A2)yb
dy(affine)    = (A2)xb

dx(decentric) = (p1)(r^2+2xb^2) + 2(p2)xbyb
dy(decentric) = 2(p1)xbyb + (p2)(r^2 + 2yb^2)

    where r^2 = xb^2 + yb^2

    and    xb = x-xp
           yb = y-yp

For a digital camera, the fiducial coordinates are interpreted as distortion parameters, using the following rule:

·         x y coordinate of the 1st given fiducial mark is pixel size in x and pixel size in y direction

·         x y coordinate of the 2ndgiven fiducial mark is k1 and k2

·         x y coordinate of the 3rd given fiducial mark is A1 and A2

·         x y coordinate of the 4th given fiducial mark is p1 and p2

·         x  coordinate of the 5th given fiducial mark is k3

If more than 5 fiducial marks is given, only the first five points are relevant.

The following is an example of a digital camera documentation file.

 

 Camera

/ Documant file of a Camera object

/ camera id
  0

/ camera name
  SONY digital camera no row = 1920 no col = 2560

/ calibrated focal length (mm)
  10.000

/ calibrated principal point coordinate (X Y)
  0.000 0.000

/ list of fiducial marks

/ ( -9 pixel size_x pixel size_y) (-9 k1 k2) (-9 A1 A2) (-9 p1 p2) (-9 k3 0)

  (-9   0.004   0.004)   (-9   0   0)   (-9   0   0)   (-9   0   0) (-9 0 0)

/ GPS offset (X Y Z)
  0 0 0

It is seen that this is exactly the same as an ordinary camera documentation file, with an exception that its fiducial mark coordinates are actually geometric distortion parameters.  The above example, we have pixel size in x direction = 0.004 and pixel size in y direction = 0.004.  The rest of parameters, namely k1, k2, A1, A2, p1, p2 and k3, are all zeros.

This function will reset the two corners of the Photo x and y image rectangular coordinate, lower left and upper right, as follows.

Suppose the original photo has 100 rows and 200 columns, its initial coordinate of the two corners will be:

lower left x = 0  y = 0 and upper right x = 200 y = 100.

Once this photo calls this function,

the lower left coordinate will be x  = -(200*0.004)/2 ; y = -(100*0.004)/2

the upper right coordinate will be x =  (200*0.004)/2 ; y =  (100*0.004)/2

Then the function will read distortion parameters, and store them in the vector of IOP in the following order k1, A1, p1, k2, A2, p2, and followed by an additional value of zero.  Thus there must be exactly 7 values in the vector of IOP, io_para12, in order that the photo is regarded as digital camera image.  The number of elements, 7, is the only way that Noobeed can recognize a digital camera image (with no real physical fiducial mark). 

Please compare this strategy to the traditional aerail photo, where the number of parameters in vector of IOP, io_para12, is used to indicate the type of transformation, i.e. 4 = conformal, 6 = affine, and 12 = polynomial 2nd degree.

Once this function is done, relationship between x y image rectangular coordinate and xp yp photo coordinate is established.

In case of a classical analog camera, the IO process involves 2D transformation.  Three type of transformations available are conformal (4 parameters), affine (6 parameters), and 2nd polynomial (12 parameters).  The user has to provide a set of fiducial mark measurement data in order to perform IO.  This function uses coordinates of fiducial marks of the camera as a sort of control points.  The input measure coordinates of fiducial marks on the photograph can be either row and column numbers or x y image rectangular coordinates.  See details in Understanding Coordinate System.  The results Interior Orientation Parameters (IOP) are used to updated io-para12 and io_para21, which are parameters used to transform between x y image rectangular coordinate and x y photo coordinates back and forth.

Only in IO of an analog camera, an ASCII text file is automatically generated after the IO is done.  Also a matrix containing IOP and all related information is return to the user.  This matrix is actually where the information in the report is from.  By comparing the returning matrix to the report, the user can easily figure out what output information is represented by which part of the matrix.

The computation of this function does not involve image data, therefore, it is possible to load the photo in virtual mode, using function "vload".  This can reduce computer time tremendously, especially when the size of the photo is very large.

Be Carefule when doing measurement of fiducial marks, since the orientation/pattern of the scanned image might be different from the reference image (the image that used in camera calibration report).  For example, fiducial mark no 1 might appear, say, at the lower left corner of the reference image, while its location on the scanned image can be at upper right.

 

Class

Photo

Usage

**for digital camera**  {Matrix} ret  =  object.IO()

**for analog camera**  {Matrix} ret  =  object.IO([{VecIdPt2D} argm1, {String} argm2, {String} argm3, {int} argm4])

argm1 = list of measuring fiducial coordinates on photo

        (default will be 4 corner point coordinate in x y image system)

argm2 = type of transformation, must be either "conformal", or "affine", or "poly2nd"

        (default = "conformal")

argm3 = output file name for the report    (default = "RPT_IO.txt")

argm4 = type of measuring coordinates on the photo,

        must be 0(row and column) or 1(image rectangular coordinate).

       (default = 0 (row and column number))

Example:

->M_tmp = ph1.IO(vec_meas_fid, "affine", "ph_193_io.txt", 0)

->

See also (class function)

EO

| HOME | BACK |


IO_PARA12

| HOME | BACK |

Purpose

To report the current Interior Orientation Parameters of the photo.  Loosely speaking, this is a parameter set that used to transform from x y image rectangular coordinate to x y photo coordinate.  The number of parameters indicates the type of transformation, as follows.

Conformal

(4 parameters)

xp =  ax + by + Cx

yp = -bx + ay + Cy

io_para12(0) = a

io_para12(1) = b

io_para12(2) = Cx

io_para12(3) = Cy

Affine

(6 parameters)

xp = ax + by + Cx

yp = cx + dy + Cy

io_para12(0) = a

io_para12(1) = b

io_para12(2) = c

io_para12(3) = d

io_para12(4) = Cx

io_para12(5) = Cy

2nd polynomial

(10 parameters)

xp =  ax + by  +  cx2 +  dy2 +  exy + Cx

yp = aax + bby + ccx2 + ddy2 + eexy + Cy

io_para12(0) = a

io_para12(1) = b

io_para12(2) = c

io_para12(3) = d

io_para12(4) = e

io_para12(5) = aa

io_para12(6) = bb

io_para12(7) = cc

io_para12(8) = dd

io_para12(9) = ee

io_para12(10) = Cx

io_para12(11) = Cy

Class

Photo

Usage

{Vector} ret  =  object.IO_PARA12()

Example:

->vec_para = ph1.io_para12()

->

See also (class function)

io_para21

| HOME | BACK |


IO_PARA21

| HOME | BACK |

Purpose

To report the current Interior Orientation Parameters of the photo.  Loosely speaking, this is a parameter set that used to transform from xp yp photo coordinate to x y image rectangular coordinate.  The number of parameters indicates the type of transformation, as follows.

Conformal

(4 parameters)

x =  axp + byp + Cx

y = -bxp + ayp + Cy

io_para12(0) = a

io_para12(1) = b

io_para12(2) = Cx

io_para12(3) = Cy

Affine

(6 parameters)

x = axp + byp + Cx

y = cxp + dyp + Cy

io_para12(0) = a

io_para12(1) = b

io_para12(2) = c

io_para12(3) = d

io_para12(4) = Cx

io_para12(5) = Cy

2nd polynomial

(10 parameters)

x =  axp + byp  +  cxp2 +  dyp2 +  exyp + Cx

y = aaxp + bbyp + ccxp2 + ddyp2 + eexyp + Cy

io_para12(0) = a

io_para12(1) = b

io_para12(2) = c

io_para12(3) = d

io_para12(4) = e

io_para12(5) = aa

io_para12(6) = bb

io_para12(7) = cc

io_para12(8) = dd

io_para12(9) = ee

io_para12(10) = Cx

io_para12(11) = Cy

Class

Photo

Usage

{Vector} ret  =  object.IO_PARA21()

Example:

->vec_para = ph1.io_para21()

->

See also (class function)

io_para12

| HOME | BACK |


IS_COVER

| HOME | BACK |

Purpose

To determine whether a point is covered by a Photo.

Class

Photo

Usage

{bool} ret  =  object.IS_COVER({double} argm1, {double} argm2)

argm1 = x photo coordinate of a point being determined

argm2 = y photo coordinate of a point being determined

Example:

->b1 = ph1.is_cover(15.012, 100.235)

->

See also (class function)

 

| HOME | BACK |


LOAD

| HOME | BACK |

Purpose

To load a Photo object saved as Noobeed format.  There are 2 files needed.  One is for the documentation, and it is an ASCII file.  The other is a binary file containing data of the image. 

If file name extension is omitted, the function will add default extension to the file.   The default extension of the documentation file is ".txt" and that of the data file is ".raw".

If file “.raw” does not exist, and there exists a TIF “.tif” file, the program will go ahead read the tif file and store the tif data as the image.

If file “.raw” and file “.tif” do not exist, and there exists a BMP “.bmp” file, the program will go ahead read the bmp file and store the bmp data as the image.

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

The detail structure of the documentation file is described in function "save".

Class

Photo

Usage

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

argm1 = file name for the documentation file (default extension is ".txt")

argm2 = file name for the data file  

        (default file name is same file name as argm1 with an extension ".raw")

Example:

->A = Photo()

->A.load("my_photo")

->

See also (class function)

loadtif, loadbmp

| HOME | BACK |


LOADBMP

| HOME | BACK |

Purpose

To load data from a bitmap (BMP) file  and stored in a Photo object.

If file name extension is omitted, the function will add default extensions to the files.  The default extension of a bitmap file is ".bmp".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

This function requires that the data is of 8-bit and with no compression.

Class

Photo

Usage

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

argm1 = file name for the bitmap file (default extension is ".bmp")

Example:

->A = Photo()

->A.loadbmp("my_bmp")

->

See also (class function)

loadtif, load

| HOME | BACK |


LOADTIF

| HOME | BACK |

Purpose

To load data from a Tag Image File (TIF) file  and stored in an Image object.

If file name extension is omitted, the function will add default extensions to the files.  The default extension of a bitmap file is ".tif".

Unless the path name is given in the file names, the function will search for the files in the current working directory, defined by command "set path".

This function requires that the data is of 8-bit gray scale image and with no compression.

Class

Photo

Usage

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

argm1 = file name for the TIF file (default extension is ".tif")

Example:

->A = Photo()

->A.loadtif("my_tif")

->

See also (class function)

load, loadbmp

| HOME | BACK |


LOWER_LEFT

| HOME | BACK |

Purpose

To report x y photo coordinate of the lower left corner of the photo.

Class

Photo

Usage

{Pt2D} ret  =  object.LOWER_LEFT()

Example:

->pt1 = ph1.lower_left()

->

See also (class function)

upper_right, res_x, res_y

| HOME | BACK |


LOWER_RIGHT

| HOME | BACK |

Purpose

To report x y photo coordinate of the lower right corner of the photo.

Class

Photo

Usage

{Pt2D} ret  =  object.LOWER_RIGHT()

Example:

->pt1 = ph1.lower_right()

->

See also (class function)

upper_right, res_x, res_y

| HOME | BACK |