        DEM Reassemly / Image Registration Notes

     Orion Sky Lawlor, olawlor@acm.org, 10/20/2001

This 3x6 arc-second (approx 90m) DEM comes from the USGS base maps, 
which I assembled at ASF.  Unfortunately, concat got rid of the topleft
projection coordinate, so I'll have to synthesize the geographic
box.

According to the USGS map, the topleft corner of our image is at
153 degrees west longitude, 64 degrees north latitude.  The bottom-right
is near 148.5, 62 degrees.  Thus the topleft should have its topleft at
projection coordinates (in arcseconds) -550,800 x, 230,400 y.
The image is 2702 by 2402 (four quads), so bottomright 
is -534,588 x, 223,194 y.

The ddr synthesis command is
  > makeddr 90m2.ddr 2402 2702 2 GEO 230400 -550800 223194 -534588 6 3

And then geocoding
  > geocode -r bilinear -p 40 90m_trim.ddr 90m_trim.img utm.proj utm.key utm_huge.img

UTM_huge is a 5895 x 5772 UTM zone 5 image at 40m pixel spacing.
The orientation is different from that of our image; but other than
that the matchup looks excellent-- in particular, the landsat image
must be either very orthogonal or else orthorectified.

COREGISTRATION:
I'll align the landsat to the DEM-- the DEM has exact projection coordinates.
Manually, I note:

A small stream intersects a larger drainage in the extreme lower left:
DEM: 670, 5692   LANDSAT: 852, 5650

Ditto, near upper right
DEM: 5064, 457   LANDSAT: 5082, 826

Mountain peak, upper left (least accurate)
DEM: 455, 827    LANDSAT: 758, 1079

These correspondences should let me do a rigid-body rotate/scale
of the landsat onto the DEM.  I just need the software-- 3pt.
The command is:

~/dev/osl/bin/3pt landsat/composite_huge.jpg 5895 5772 utm_huge.jpg \
    852 5650   670 5692 \
    5082 826   5064 457 \
    758 1079   455 827

Checked a lower-right corner feature for registration-- bang-on!
This means the reassembly, map projection, and resampling are all good.


EXTRACTION:
I want a rectangular block of all good data-- this means trimming off the
edges (which also contain superfluous registration marks, etc.).
The topleft of the clip region should be 32, 232; the bottom right 
5512, 5584 (for a size of 5480, 5352).

The commands are:
	~/dev/osl/bin/trim utm_huge.jpg final.jpg 32 232 5480 5352
	/work/asf/bin/linux/trim utm_huge.img final.dem 232 32 5352 5480

SHRINK:
Shrinking by a factor of four gives 160m pixels; and a more manageable
1370, 1338.  The commands are
	~/dev/osl/bin/minify final.jpg 2 final_2.ppm
	/work/asf/bin/linux/remap final.dem final_2.dem -scale 0.5 0.5 -kernel 2 2
	~/dev/osl/bin/minify final.jpg 4 final_4.ppm
	/work/asf/bin/linux/remap final.dem final_4.dem -scale 0.25 0.25 -kernel 4 4
	~/dev/osl/bin/minify final.jpg 8 final_8.ppm
	/work/asf/bin/linux/remap final.dem final_8.dem -scale 0.125 0.125 -kernel 8 8



