This is not a command in itself, but an option to the command i.ortho.photo .

## NAME

photo.2target - An imagery function that enables you to mark control points on an image to be ortho-rectified, and then input the ground coordinates of each control point for determination of ortho-rectification parameters. This establishes the absolute orientation between image pixels and ground coordinates. The ortho-rectification parameters are required as input for the GRASS program photo.rectify .
(GRASS Imagery Processing Tool)

## SYNOPSIS

Selected from i.ortho.photo

## DESCRIPTION

photo.2target is an imagery function that enables you to mark control points on an image to be ortho-rectified and then input the coordinates of each point for calculation of rectification parameters. Rectification is the mapping of an image from one coordinate system to another. The geometry of an image extracted into a GRASS LOCATION having an x,y coordinate system is not planimetric. To create a planimetric image, that is, to convert the x,y coordinate system into a standard coordinate system (for example, the UTM coordinate system or the State Plane coordinate system), points from a map having the standard coordinates must be associated with the same points on the image to be rectified. The ortho-rectification parameters are computed in two phases. The first phase computes a transformation matrix between image (row,col) coordinates and photo (x,y) coordinates relative to the perspective center. The transformation matrix is computed explicitly in the option photo.2image . The second phase, photo.2target, enables you to mark control points on the image and then input the standard coordinates (Easting,Northing, and elevation) to determine the parameters for a three dimensional projective transformation. photo.init may be run before running photo.2target to modify the initial camera exposure station parameters, and/or modify the standard deviation of these parameters. photo.init is not required but generally is helpful.

During the process of marking control points and entering standard coordinates, you may compute the RMS (root mean square) error for each control point entered. photo.2target does this by calculating the transformation equation, and then plugging these results into an equation for RMS error.

photo.2target offers a zoom option to locate precisely the point to be marked on an image. This program also offers you the option of acquiring standard coordinates for a marked point from a map layer in the target database, or from a digitizer.

To run photo.2target, a graphics monitor is required.

The procedure for marking points, entering coordinates, and calculating RMS error is described below.

The terminal screen displays the following message:

use mouse now...

The graphics monitor displays the following screen:

    +-----------------------------+--------------------------------+
    |imagery  filename  (mag)     | target  filename  (mag)        |
    +-----------------------------+--------------------------------+
    |                             |                                |
    |                             |                                |
    |                             |                                |
    |                             |                                |
    |                             |                                |
    |                             |                                |
    |                             |                                |
    +-----------------------------+--------------------------------+
    |                             |                                |
    |                             |                                |
    |                             |                                |
    |                             |                                |
    |                             |                                |
    |                             |                                |
    +-----------------------------+--------------------------------+
    |QUIT ZOOM PLOTCELL ANALYZE   |                                |
    +-----------------------------+--------------------------------+

A pop-down menu like that shown below will be superimposed on the left half of the screen:

               +----------------------------------------+
               |Double click on cell file to be plotted |
               | Double click here to cancel            |
               +----------------------------------------+
                           +--------------------+
                           |  Mapset PERMANENT  |
                           +---------+----------+
                           |gs13.1   | gs14.1   |
                           +---------+----------+
                           |gs21.1   | gs22.2   |
                           +---------+----------+

Any single file in the imagery group may be used to mark points, and you can mark points on more than one file in the imagery group to accumulate the 12 points suggested minimum. Any file in the imagery group can be rectified (using photo.rectify ) based on the rectification parameters computed from these control points.

The imagery file you select is displayed in the upper left quadrant of the screen.

## ZOOM

To magnify the displayed file, you must place the mouse cross hairs on the word ZOOM. The following menu will then be displayed at the bottom of the screen:

              +-------+-----+-------++--------------------+
              |Cancel | Box | Point ||Select type of ZOOM |
              +-------+-----+-------++--------------------+

You may identifying the zoom window either by using the mouse to make a box, or by using the mouse to mark the center of the window and entering a magnification factor. The terminal screen will display a mouse button menu to guide you in identifying the window.

## MARKING POINTS

To mark the points on the image that correspond to the points on a standard coordinate system map, you must place the mouse cross hairs on the corresponding location on the image to be marked and press the left hand button on the mouse. A diamond shaped symbol will be marked on the image. The terminal will display the following menu:

       +------------------------------------+--------------------------+
       |Point 1 marked at IMAGE COORDINATES |                          |
       |IMAGE X:   1023.77                  |                          |
       |IMAGE Y:  -164.41                   |                          |
       |                                    |                          |
       +------------------------------------+--------------------------+
       |Enter CONTROL COORDINATES as east,north,elevation:             |
       +---------------------------------------------------------------+

You then enter the easting, northing, and elevation for the point marked on the image. If you wish not to enter a coordinate, simply hit RETURN to return control to the mouse; the marked point then disappears.

## PLOT CELL

In addition to acquiring control points from a standard map, you have the option of acquiring the points from a cell-map in the target database. The database map is displayed by placing the mouse cross hairs on the words PLOT CELL. The following line is then displayed at the bottom of the monitor:

        +-------+---------------------------------------+
        |Cancel | Indicate which side should be plotted |
        +-------+---------------------------------------+

Which side of the monitor is to be plotted is indicated by placing the mouse cross hairs on the half of the monitor screen that you would like to use, and pressing the left mouse button. The following pop-down menu will be superimposed on the half of the screen that was chosen:

        +----------------------------------------+
        |Double click on cell file to be plotted |
        | Double click here to cancel            |
        +----------------------------------------+

        +-----------------------------+
        |   Mapset user1              |
        +--------------+--------------+
        |tm.rectified  |              |
        +--------------+--------------+
        |tm.classified |              |
        +--------------+--------------+
        |   Mapset PERMANENT          |
        +--------------+--------------+
        |elevation     | geology      |
        +--------------+--------------+
        |slope         | soils        |
        +--------------+--------------+
        |aspect        |              |
        +--------------+--------------+
        |roads         |              |
        +--------------+--------------+
        |streams       |              |
        +--------------+--------------+
        |airfields     |              |
        +--------------+--------------+

After the map is displayed the following message appears at the bottom of the monitor:

         +-----------------+----------+--------+
         |input method ->  | keyboard | screen |
         +-----------------+----------+--------+

If you wish to use the plotted map only as a comparative reference, the keyboard can be chosen as the means to input coordinates corresponding to the marked control points. This is done by placing the mouse cross hairs on the word KEYBOARD and pressing the left button on the mouse.

If you select the SCREEN option, points marked on the image will automatically be associated with the coordinates from the corresponding points on the target database map, and a corresponding elevation from the cell-file selected for elevation data. In this option, when you mark a point on the image, the following menu is displayed on the terminal:

       +------------------------------------+--------------------------+
       |Point 5 marked at IMAGE COORDINATES |                          |
       |IMAGE X: 1023.77                    |                          |
       |IMAGE Y: -164.41                    |                          |
       |                                    |                          |
       |                                    |                          |
       |Control Point location              |                          |
       |East:      679132.57                |                          |
       |North:    4351080.67                |                          |
       |Elevation:  1010.00                 |                          |
       |                                    |                          |
       |                                    |                          |
       |                                    |                          |
       +------------------------------------+--------------------------+
       |use mouse now...                                               |
       +---------------------------------------------------------------+

The coordinates for the target database map are automatically saved as the coordinates corresponding to the marked control point on the image.

## ANALYZE

After a number of points have been marked (4 to 7), you can check the RMS error of the points marked on the image. This is done by placing the mouse cross hairs on the word ANALYZE at the bottom of the monitor. An error report resembling that shown below is superimposed on the monitor:

    +--------------------------------------------------------------------------+
    |                                 error                                    |
    |#  east    north    target    east    north    east    north     elev.    |
    +--------------------------------------------------------------------------+
    |1  0.0     -0.9       1.0     48.5     4.8   79132.5 351080.6    10.0     |
    |2  0.4      1.0       1.3     53.1     7.2   84314.7 399001.4   239.3     |
    |3 -1.2     -0.5       0.6     52.8     6.5   67841.4 457682.8   209.5     |
    |4  1.1      0.5       1.3     34.0     9.2   77573.8 352626.4   432.5     |
    |5 -2.7     14.0      14.2     48.6  -144.9   79132.6 351080.7   985.0     |
    |                                                                          |
    +--------------------------------------------------------------------------+
    |         overall   rms      error:   4.46                                 |
    +--------------------------------------------------------------------------+

The following menu then appears at the bottom of the monitor:

     +-----+------------+------------------------------------------------+
     |DONE | PRINT FILE |  Double click on point to be included/excluded |
     +-----+------------+------------------------------------------------+

The RMS error for the image is given under the column TITLEd "error" and subTITLEd "east" and "north". In the above report, point number 1 is 0.0 and -0.9 meters (east and north) from the predicted location calculated from the transformation equation. The RMS error for the target map is listed under the heading "target". This is the RMS error for the east and north coordinates of the target map but it is presented in the table using one general value. The overall RMS error is displayed at the bottom of the screen in meters. Points that create high RMS error are displayed in red on the monitor (represented here in italics).

The image coordinates of the point marked on the imagery group file is given under the heading "image" and the subheadings "east" and "north". The location of the control point in the target database is given under the heading "control" and the subheadings "east","north", and "elev". If you would like to exclude or include a control point, this can be accomplished by placing the mouse cross hairs on the control point number to be included (if the point is absent) or excluded (if the point is displayed) and pressing the left button on the mouse twice. When a point is excluded, it is not afterwards included in the calculation of the RMS error, or included in the final rectification parameters. However, it can be retrieved within photo.2target at any time by double clicking with the mouse as described above.

## QUIT

To end the photo.2target program place the mouse cross hairs on the word QUIT; the marked control points (including coordinates) will be saved.

## NOTES

During the course of marking control points and computing the ortho-rectification parameters, a matrix inversion error may occur. This is caused by trying to invert a non-singular normal equation matrix. When this situation arises, the status of all previously selected control points are modified, the control points are excluded. Running photo.init for the selected imagery group with accurate camera exposure station parameters should remedy the situation. The excluded control points may again be included as described in the section ANALYZE.

A good rule of thumb is to mark at least 12 to 15 points which are evenly distributed over the entire imagery group file in order to obtain an accurate transformation parameters for the rectification process. The RMS error may increase with more points added, but the transformation parameters will be more accurate over the entire image.

An RMS error of less than or equal to approximately one resolution unit (pixel) for the image being rectified is generally considered acceptable.

## SEE ALSO

i.ortho.photo
photo.camera
photo.2image
photo.init
photo.rectify

## AUTHOR

Mike Baba, DBA Systems, Inc.

Last changed: $Date: 2002/11/27 09:14:11 $