Registration using Kilauea Data

The tutorial in the Appendix contains examples of registration (Section 1.5.1: Stanford Workshop Grass Tutorial). This example uses sample data from a CD-ROM containing data of the Kilauea Volcano in Hawaii. Registration is a multi-step proccess, involving creating a Group (a collection of images) and a Target Database, followed by the selection of control points; i.e. points that are congruent on the different images, and finally the registration of the images together using the control points.

This example is a fairly detailed one that shows how to register one raster image (kildem) to a set of three (skil12n2.img, skil12n4.img, skil12n7.img). In the process, we will modify the kildem image by creating a grey scale for it. We will then create a group for the kildem data (kildem.grp), target it, and rectify it. Following this, the set of three images will also be grouped and targeted (producing image.grp), followed by the rectification to the first image.

Througout the process, note that the `i.point' procedure is used to obtain the reference points used to register the images together. Note also that one has to `group' the kildem image, even though it is a group of one. GRASS considers this neccessary so as to allow one to target the image to it (since GRASS targets a `group').

Specifiying the Location and Mapset

First, one must specify a Location and a Mapset:
  
  GRASS     4.1
  LOCATION: This is the name of an available geographic
  location.
  MAPSET:   Every GRASS session runs under the name of a
  MAPSET.  Associated with each MAPSET is a rectangular
  COORDINATE REGION and a list of any new maps created.
  DATABASE: This is the unix directory containing the
  geographic databases The REGION defaults to the entire area
  of the chosen LOCATION.
  
  You may change it later with the command: g.region
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - - - -
  LOCATION:   kil.tutor.targ_(enter list for a list of
  locations)
  MAPSET:     schwehr_____(or mapsets within a location)
  DATABASE:
  /home/schwehr/grass/data__________________________
                      AFTER COMPLETING ALL ANSWERS, HIT <ESC>
  TO CONTINUE
                                (OR <Ctrl-C> TO CANCEL)
Please input 'kil.tutor.targ' as the Location and your name as the Mapset:
  
  LOCATION <kil.tutor.targ> - doesn't exist
  Available locations:
  ----------------------
  den.utm.z12    kil.sample.xy  kill.dan.xy    spearfish.tar.Z
  denver.aea.2   kil.sample.xy.tar   mars.in.xy     text.files
  denver.in.1    kil.tutor.xy        mars.tutor.xy
  denver.ll      spearfish
  ----------------------
  Would you like to create location <kil.tutor.targ> ? (y/n)  y
  
  To create a new LOCATION, you will need the following information:
  1. The coordinate system for the database
                      x,y (for imagery and other unreferenced data)
                      UTM
                      State Plane
                      Latitude-Longitude
                      other projection
  2. The zone for the database
           (except for x,y and Latitude-Longitude databases)
  3. The coordinates of the area to become the default region
       and the grid resolution of this region
  4. A short, one-line description or title for the location
  
  Do you have all this information for location <kil.tutor.targ> ? (y/n) y
  
  Please specify the coordinate system for location <kil.tutor.targ>
            0 x,y
            1 UTM
            2 State Plane
            3 Latitude-Longitude
       99 Other
  RETURN to cancel
  >    0
  x,y coordinate system? (y/n) [y]
  
  Please enter a one line description for location <kil.tutor.targ>
  
  > Tutorial location for Kilauea - target for registering files - xy coords
  
  =====================================================
  Tutorial location for Kilauea - target for registering
  files - xy coords
  =====================================================
  ok? (y/n) [y]
  
                                  DEFINE THE DEFAULT REGION
  
                               ====== DEFAULT REGION ========
                              | NORTH EDGE:400________      |
                     WEST EDGE|                             |EAST EDGE
                   0__________|                             |400_______
                              | SOUTH EDGE:0__________      |
                                ============================
  
          PROJECTION: 0 (x,y)                        ZONE: 0
  
                           GRID RESOLUTION
                             East-West:     1_________
                           North-South:     1_________
  
  
         AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
                            (OR <Ctrl-C> TO CANCEL)
  
       projection:    0 (x,y)
       zone:          0
       north:         400
       south:         0
       east:          400
       west:          0
       e-w res:       1
       n-s res:       1
       total rows:              400
       total cols:              400
       total cells:         160,000
  Do you accept this region? (y/n) [y] >
  LOCATION <kil.tutor.targ> created!
After specifiying the Location and Mapset, be sure to save it when exiting:
  
  When ready to quit enter:             exit
  
   GRASS 4.1 > exit
  
  GRASS SESSION WRAPUP
  You have just finished working on mapset: <schwehr>
  There are no RASTER maps in this mapset
  There are no VECTOR maps in this mapset
  There are no SITES maps in this mapset
  
  Shall the mapset <schwehr> be saved? y/n [y]
Enter GRASS again and specify the Location kil.tutor.targ and your Mapset ('schwehr' in this tutorial). By using a 'g' command (i.e. general, one can list the raster files available):
  
   GRASS 4.1 > g.list rast
   
   ---------------------------------------------
  raster files available in mapset PERMANENT:
  kildem    skil12n2.img  skil12n4.img  skil12n7.img
  ----------------------------------------------
Customizing the Database Environment and Selecting the Graphic Output Device One can now customize the database environment and select the graphics output device. Use of the `g.gisenv ` command displays the specified variable as part of the prompt if desired:
  
   GRASS            4.1 > g.gisenv
   
  GISDBASE=/home/schwehr/grass/data
  LOCATION_NAME=kil.tutor.targ MAPSET=schwehr
  
   GRASS  4.1 > setenv DISPLAY console:0
   GRASS  4.1 > d.mon start=iris
   
  Graphics driver [iris] started
  
   GRASS  4.1 > d.frame -e
Obtaining a Grey Scale

Obtain a grey scale with the following commands:

  
   GRASS  4.1 > g.region rast=kildem
   GRASS  4.1 > d.rast kildem
   GRASS  4.1 > i.grey.scale

  which layer needs a grey scale?
  Enter 'list' for a list of existing raster files Enter
  'list -f' for a list with titles
  Hit RETURN to cancel request
  > list
  <list>
  
  ---------------------------------------------
  raster files available in mapset PERMANENT:
  kildem    skil12n2.img   skil12n4.img   skil12n7.img
  ----------------------------------------------
  
  which layer needs a grey scale?
  Enter 'list' for a list of existing raster files
  Enter 'list -f' for a list with titles
  Hit RETURN to cancel request
  > kildem
  <kildem>
  Reading kildem ...
  [kildem in PERMANENT] now has a grey scale color table
  which layer needs a grey scale?
  Enter 'list' for a list of existing raster files
  Enter 'list -f' for a list with titles
  Hit RETURN to cancel request
  >
Display the output:
 
   GRASS  4.1 > d.rast kildem
The grey scale file is an ascii text that is can be edited using any text editor such as vi or emacs. The format is of an altitude, followed by the grey scale range to code for that altitude level:
   
   GRASS  4.1 > cd
 ~schwehr/grass/data/kil.tutor.targ/schwehr/colr2/PERMANENT
   GRASS  4.1 > cat kildem
   
  % 1 6363
  0:0
  1:0 15:0
  16:1 28:1
  29:2 37:2
  38:3 47:3
  48:4 53:4
  54:5 62:5
  63:6 69:6
       ...
       etc ...
To get familiar with the data, one can use the d.what.rast command. This will let you use your mouse to select a point and obtain information on that point: Using this, one can select different altitudes ranges and modify the grey scale.
   
   GRASS 4.1 > d.what.rast
   
  Buttons
   Left:  what's here
   Right: quit
  221.5(E) 935.5(N)
  kildem in PERMANENT (4496)
  212.5(E) 762.5(N)
  kildem in PERMANENT (3618)
  469.5(E) 691.5(N)
  kildem in PERMANENT (3547)
  558.5(E) 629.5(N)
  kildem in PERMANENT (3250)
  724.5(E) 598.5(N)
  kildem in PERMANENT (2505)
  Buttons
   Left:  what's here
   Right: quit
  
  GRASS 4.1 > ls -l
  total 9
  -rw-r--r--   1 schwehr  vpe         4292 Aug 18 17:07
  kildem
Using this technique, the grey scale can be changed to what one desires (after using the `d.what.rast' command to obtain the values one wants). For this example the kildem grey scale was changed to the following:
   
   GRASS  4.1 > more kildem

  % 1 6363
  0:0 2505:255
  2506:255:255:255 3250:0:255:0
  3251:0:255:0 3547:255:0:0
  3548:255:0:0 3618:0:255:0
  3619:0:255:0 4045:255:0:255
  4046:255:0:255 4496:255:0:0
This is not the best color scale. Try your own, and you will probably get better results.

One can use the 'zoom' command to change the current region:

   
   GRASS  4.1 > d.rast kildem
   GRASS  4.1 > d.zoom
   
  Buttons:
  Left:   Establish a corner
  Middle: Check coordinates
  Right:  Accept region
  north: 889  south: 888  east: 512  west: 511
  north: 889  south: 654  east: 512  west: 265
  This region now saved as current region.
  Note: run 'd.erase' for the new region to affect the
  graphics.
See Figure 1: kildem.1.gif for a sample of the display output. Since the display is using an iris monitor, it needs to be cleared using the d.frame -e command.
   > GRASS4.1 > d.frame -e
   > GRASS4.1 > d.rast kildem
Grouping the first Raster Image Grass can be used on multiples of images. This is facilitated by the use of a 'group'; i.e. sets of images that are coprocessed. Creating a group is required for this registration:
   
   > GRASS4.1 > i.group
   
  This program edits imagery groups. You may add data layers
  to, or remove data layers from an imagery group. You may
  also create new groups
  Please enter the group to be created/modified
  GROUP:    kildem.grp__________   (list will show available
  groups)
                                  AFTER COMPLETING ALL
  ANSWERS, HIT <ESC> TO CONTINUE
                      (OR <Ctrl-C> TO CANCEL)
  
  kildem.grp - does not exist, do you wish to create a new
  group? (y/n) [n] y
  
  LOCATION: kil.tutor.targ      GROUP: kildem.grp   MAPSET:
  schwehr
  Please mark an 'x' by the files to be added in group
  [kildem.grp]
  MAPSET: PERMANENT
  _x kildem
  __ skil12n2.img
  __ skil12n4.img
  __ skil12n7.img
  
                 AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO
  CONTINUE
                      (OR <Ctrl-C> TO CANCEL)
  
  Group [kildem.grp] references the following raster file
  
  -----------------------
  kildem in PERMANENT
  -----------------------
  Look ok? (y/n) y
  Group [kildem.grp] created!
  LOCATION: kil.tutor.targ       GROUP: kildem.grp
  MAPSET: schwehr
            1.   Select a different group
            2.   Edit group title
            3.   Include new raster files in the group
                 or remove raster files from the group
            4.   Assign colors to the group
            5.   Create a new subgroup within the group
       RETURN    exit
Targeting the First Image After creating the group, one must target it to the database one wants to use:
   GRASS 4.1 > i.target
   
  This program targets an imagery group to a GRASS database
  Enter group that needs a target
  Enter 'list' for a list of existing imagery groups Enter
  'list -f' for a verbose listing
  Hit RETURN to cancel request
  > list
  
  <list>
  Available groups
  ---------------------------------
  kildem.grp
  ---------------------------------
  hit RETURN to continue -->
  
  Enter group that needs a target
  Enter 'list' for a list of existing imagery groups
  Enter 'list -f' for a verbose listing
  Hit RETURN to cancel request
  > kildem.grp
  
  <kildem.grp>
  Please select the target LOCATION and MAPSET for group
  <kildem.grp>
  CURRENT LOCATION: kil.tutor.targ
  CURRENT MAPSET:   schwehr
  TARGET LOCATION:  ____________________
  TARGET MAPSET:    ____________________
  (enter list for a list of locations or mapsets within a
  location)
  
   AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
                             (OR <Ctrl-C> TO CANCEL)
Fill this form with 'kil.tutor.targ' as the Location and your name as the Mapset. Using `i.points' on the First Image Finally, one can begin the registration process. 'i.points' will let you locate the points that you will use as markers. It uses a mouse menuing system to let you pick the map points that you believe you have coordinate information on. You can then do an analysis that shows the list of control points and the positioning error. Iteratively, one can do the point selection and analysis to reduce the error ( Figure 6: img.pts.3.sml.gif):
   GRASS 4.1 > i.points
  
  Enter imagery group to be registered
  Enter 'list' for a list of existing imagery groups
  Enter 'list -f' for a verbose listing
  Hit RETURN to cancel request
  > list
  
  <list>
  Available groups
  ---------------------------------
  kildem.grp
  ---------------------------------
  hit RETURN to continue -->
  Enter imagery group to be registered
  Enter 'list' for a list of existing imagery groups
  Enter 'list -f' for a verbose listing
  Hit RETURN to cancel request
  > kildem.grp

Figure 6: img.pts.3.sml.gif:

Rectifying The First Image
  
   GRASS 4.1 > i.rectify
   
  Enter the group containing files to be rectified Enter
  'list' for a list of existing imagery groups Enter 'list -
  f' for a verbose listing
  Hit RETURN to cancel request
  > list
  <list>
  
  Available groups
  ---------------------------------
  kildem.grp
  ---------------------------------
  hit RETURN to continue -->
  
  Enter the group containing files to be rectified Enter
  'list' for a list of existing imagery groups Enter 'list -
  f' for a verbose listing
  Hit RETURN to cancel request
  > kildem.grp
  
  <kildem.grp>
  
  Please select the file(s) you wish to rectify by naming an
  output file
  kildem@schwehr . . . . . . . . . . kildem_________
  
  (enter list by  name to get a list of existing raster
  files)
  AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
                         (OR <Ctrl-C> TO CANCEL)
  
  Please select one of the following options
   1. Use the current region in the target location
   2. Determine the smallest region which covers the image
  > 1
You will receive mail when i.rectify is complete. The contents of the rectification notice will look similar to the following:
   
   GRASS 4.1 > mail
   
  From schwehr  Thu Aug 18 17:42:25 1994
  Thu, 18 Aug 94 17:42:25 -0700
  From: schwehr (Kurt Schwehr)
  Subject: i.rectify
  Apparently-To: schwehr
  ***********************************************
  Rectify [kildem@PERMANENT] (LOCATION kil.tutor.targ)
  into  [kildem in schwehr] (LOCATION kil.tutor.tar)
  complete
  -----------------------------------------------
   400 rows, 400 cols (160000 cells) completed in 0:06
       1600000.0 cells per minute
  ? d
Grouping the Three Other Images After receiving notification one can continue:
  
   GRASS 4.1 > i.group
   
  LOCATION: kil.tutor.targ.group     MAPSET: schwehr
  This program edits imagery groups. You may add data layers
  to, or remove data layers from an imagery group. You may
  also create new groups
  
  Please enter the group to be created/modified
  
  GROUP:    images.grp__________   (list will show available
  groups)
  
  AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
                 (OR <Ctrl-C> TO CANCEL)
  
  images.grp - does not exist, do you wish to create a new
  group? (y/n) [n] y
  LOCATION: kil.tutor.targ GROUP: images.grp   MAPSET:
  schwehr
  Please mark an 'x' by the files to be added in group
  [images.grp]
  
  MAPSET: PERMANENT
  __ kildem
  _x  skil12n2.img
  _x  skil12n4.img
  _x  skil12n7.img
  
  AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
            (OR <Ctrl-C> TO CANCEL)
These images can be grouped together since they have already been registered to each other. Thus the same transform will be used on all three to rectify them together to match the kildem in kil.tutor.targ
  
  Group [images.grp] references the following raster files
  -----------------------
       skil12n2.img in PERMANENT
       skil12n4.img in PERMANENT
       skil12n7.img in PERMANENT
  -----------------------
  Look ok? (y/n) y
  
  Group [images.grp] created!
  LOCATION: kil.tutor.targ       GROUP: images.grp
  MAPSET: schwehr
       1.   Select a different group
       2.   Edit group title
       3.   Include new raster files in the group
            or remove raster files from the group
     4.     Assign colors to the group
       5.   Create a new subgroup within the group
       RETURN    exit
  >
Targeting The Three Images
   
   GRASS 4.1 > i.target
   
  This program targets an imagery group to a GRASS database
  Enter group that needs a target
  
  Enter 'list' for a list of existing imagery groups
  Enter 'list -f' for a verbose listing
  Hit RETURN to cancel request
  > list
  
  <list>
  Available groups
  ---------------------------------
  images.grp  kildem.grp
  ---------------------------------
  hit RETURN to continue -->
  Enter group that needs a target
  Enter 'list' for a list of existing imagery groups
  Enter 'list -f' for a verbose listing
  Hit RETURN to cancel request
  > images.grp
  
  <images.grp>
  Please select the target LOCATION and MAPSET for group
  <images.grp>
  CURRENT LOCATION: kil.tutor.targ
  CURRENT MAPSET:   schwehr
  TARGET LOCATION:  ____________________
  TARGET MAPSET:    ____________________
  
  (enter list for a list of locations or mapsets within a
  location)
  AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
            (OR <Ctrl-C> TO CANCEL)
  
  group [images.grp] targeted for location [kil.tutor.tar],
  mapset [schwehr]
  Mapset <schwehr> in Location <kil.tutor.targ>
Using Points on the Three Images group to prepare to Register with the First
   GRASS 4.1 > i.points
   
  Enter imagery group to be registered
  Enter 'list' for a list of existing imagery groups
  Enter 'list -f' for a verbose listing
  Hit RETURN to cancel request
  > list
  
  <list>
  Available groups
  ---------------------------------
  images.grp  kildem.grp
  ---------------------------------
  hit RETURN to continue -->
  
  Enter imagery group to be registered
  Enter 'list' for a list of existing imagery groups
  Enter 'list -f' for a verbose listing
  Hit RETURN to cancel request
  > images.grp

Use plot raster to bring up the image hidden on the right (Figure 7: img.pts.1.gif):

The i.point command uses the mouse to select the registration points. The following are some sample mouse point selections (yours may be very different):

  
  |Point 1 marked on image at
  |  East:732.07
  |  North:     496.06|
  |Point located at
  |  East:277.49
  |  North:     242.29
  |Point 2 marked on image at
  |     East:750.19
  |     North:     507.36
  
       ....
  
  |Point 9 marked on image at
  |     East:575.12
  |     North:     706.23
  |Point located at
  |     East:188.86
  |     North:     371.47
  |Point 10 marked on image at
  |     East:686.16
  |     North:     693.27
  |Point located at
  |     East:247.08
  |     North:     363.47
See above (Figure7: img.pts.1.gif). As well as Figure 8: img.pts.2.gif: Rectifying the First Image Group to the Three Image Group
   GRASS 4.1 > i.rectify
   
  Enter the group containing files to be rectified Enter
  'list' for a list of existing imagery groups Enter 'list -
  f' for a verbose listing
  Hit RETURN to cancel request
  > list
  
  <list>
  Available groups
   ---------------------------------
  images.grp  kildem.grp
   ---------------------------------
  hit RETURN to continue -->
  Enter the group containing files to be rectified Enter
  'list' for a list of existing imagery groups Enter 'list -
  f' for a verbose listing
  Hit RETURN to cancel request
  > images.grp
  
  <images.grp>
  Please select the file(s) you wish to rectify by naming an
  output file
  skil12n2.img@PERMANENT . . . . . . . skil12n2______
  skil12n4.img@PERMANENT . . . . . . . skil12n4______
  skil12n7.img@PERMANENT . . . . . . . skil12n7_______
  (enter list by any name to get a list of existing raster
  files)
  
  AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
                 (OR <Ctrl-C> TO CANCEL)
  
  Please select one of the following options
   1. Use the current region in the target location
   2. Determine the smallest region which covers the image
  > 1
  You will receive mail when i.rectify is complete
  
   GRASS 4.1 > mail
   
  From schwehr  Thu Aug 18 18:03:32 1994
  Date: Thu, 18 Aug 94 18:03:32 -0700
  From: schwehr (Kurt Schwehr)
  Subject: i.rectify
  Apparently-To: schwehr
  ***********************************************
  Rectify [skil12n2.img@PERMANENT] (LOCATION kil.tutor.xy)
  into  [skil12n2 in schwehr] (LOCATION kil.tutor.tar)
  complete -----------------------------------------------
  400 rows, 400 cols (160000 cells) completed in 0:06
   1600000.0 cells per minute
  ***********************************************
  Rectify [skil12n4.img@PERMANENT] (LOCATION kil.tutor.xy)
   into  [skil12n4 in schwehr] (LOCATION kil.tutor.tar)
   complete -----------------------------------------------
  400 rows, 400 cols (160000 cells) completed in 0:06
   1600000.0 cells per minute
  ***********************************************
  Rectify [skil12n7.img@PERMANENT] (LOCATION kil.tutor.xy)
   into  [skil12n7 in schwehr] (LOCATION kil.tutor.tar)
   complete -----------------------------------------------
  400 rows, 400 cols (160000 cells) completed in 0:05
   1920000.0 cells per minute
  ? d

[Prev] [Next]
Email to:
Kurt Schwehr schwehr@cs.stanford.edu -- Dan Delgado renata@eos.arc.nasa.gov

Tree Kurt's Homepage