home *** CD-ROM | disk | FTP | other *** search
/ vis-ftp.cs.umass.edu / vis-ftp.cs.umass.edu.tar / vis-ftp.cs.umass.edu / pub / Software / ASCENDER / ascendMar8.tar / UMass / Terrain / denver-terrain.lisp < prev    next >
Lisp/Scheme  |  1995-09-11  |  5KB  |  129 lines

  1. (in-package 'cme)
  2. ;;; for reading in Howard's terrain map for the MMC building
  3. ;;; in Denver, Co. (made from images 74sxx and 75nxx).  These
  4. ;;; images are in the ALV-UGV1 site model in the RCDE.  This file
  5. ;;; assumes that site model has already been loaded.
  6. ;;;
  7. ;;; Bob Collins, Univ of Mass, Aug 12 1995.
  8. ;;;
  9. ;;; Note: The terrain image to world transformation matrix was determined
  10. ;;; empirically by choosing match points in Howard's ortho/z images then
  11. ;;; selecting corresponding points in the RCDE 74sxx image and noting the 
  12. ;;; reported 3d world x,y,z points.  The points were
  13. ;;;      ORTHO (U,V,W)                 74SXX (X,Y,Z)
  14. ;;;  465.25    80.87  1643.0      700.36   846.19  1789.80
  15. ;;;  594.00   837.50  1643.0      717.24   949.88  1790.34
  16. ;;; 1365.62  1166.25  1984.0      821.46   994.15  1791.48
  17. ;;; 1746.50  1549.00  3112.0      867.39  1047.58  1804.43
  18. ;;; 1772.00    79.25   381.0      887.31   845.86  1777.07
  19. ;;;  896.37  1685.50  2529.0      752.74  1065.75  1798.67
  20. ;;;
  21. ;;; I decomposed it into an affine solution for XY
  22. ;;; and a separate affine solution for Z.  Results:
  23. ;;;
  24. ;;;  X  =  .143904 U - .003389 V + 627.737
  25. ;;;  Y  =              .136935 V + 835.05
  26. ;;; and
  27. ;;;  Z  =  .009952 W + 1773.24
  28. ;;;
  29. ;;; These seem to be consistent with a couple quantities Howard
  30. ;;; could provide me.  For example, his elevations are in centimeters,
  31. ;;; thus Z = .01 W + offset is reasonable.  Also, the horizontal spacing
  32. ;;; of his pixels (our Y direction) is 280/2048 = .13672 meters, so
  33. ;;; our equation for Y = .136935 V + offset is reasonable. Furthermore,
  34. ;;; the dependence of X on V as well as U can be explained by the
  35. ;;; vertical warping that Howard applied to fix the epipolar alignment
  36. ;;; of the two images.
  37. ;;;
  38.  
  39.  
  40. ;;; Converting from Howard's raw ortho-terrain file to RCDE.
  41. ;;; Need to do this stuff only once
  42. #|
  43. (setf zimage (ic::make-image (list 2048 2048) :element-type '(unsigned-byte 16)))
  44. (ic::copy-raster-file-to-image "/nfs/jen/u1/TERRAIN/74x75/z_74x75.sun" zimage
  45.                    :right-to-left-p t)
  46. (ic::save-image zimage "/nfs/jen/u1/TERRAIN/74x75/74x75-terrain.g0")
  47. |#
  48.  
  49.  
  50. ;;; Setting up the terrain model into the ALV-UGV1 3d world
  51.  
  52. (defvar *74x75-terrain* nil  "Howard's terrain map for images 74sxx and 75nxx")
  53. (defvar *74x75-terrain-image* nil) 
  54. (defvar *74x75-terrain-shaded-relief* nil)
  55. (defvar *74x75-path* "/nfs/jen/u1/TERRAIN/74x75/")
  56.  
  57. #|
  58. (defvar *74x75-terrain-transform*
  59.   (make-4x4-coordinate-transform 
  60.        (make-and-fill-2d-array
  61.      '((0.143904  -.003389  0.0       627.737)
  62.        (0.0       0.136935  0.0       835.05)
  63.        (0.0        0.0      0.009952 1773.24)
  64.        (0.0        0.0      0.0         1.0)))))
  65. |#
  66.  
  67. (defvar *74x75-terrain-transform*
  68.   (make-4x4-coordinate-transform 
  69.        (make-and-fill-2d-array
  70.      '((0.143904  -.003389  0.0       623.737)
  71.        (0.0       0.136935  0.0       835.05)
  72.        (0.0        0.0      0.009952 1773.24)
  73.        (0.0        0.0      0.0         1.0)))))
  74.  
  75.  
  76. (defun merge-74x75-path (filename)
  77.   (format nil "~a~a" *74x75-path* filename))
  78.  
  79.  
  80. (setf *74x75-terrain-image* 
  81.       (ic::load-image (merge-74x75-path "74x75-terrain.g0")))
  82.  
  83. (setf (image-prop *74x75-terrain-image* :2d-world) nil)
  84.  
  85. (setf *74x75-terrain* 
  86.       (make-terrain-model *74x75-terrain-image*
  87.               *74x75-terrain-transform*))
  88.  
  89. ;;shadow the current terrain model
  90. (setf (property-list *alv-ugv1-3d-world*)
  91.       (append (list :terrain-model *74x75-terrain*)
  92.           (property-list *alv-ugv1-3d-world*)))
  93.  
  94. (setf *74x75-terrain-shaded-relief* 
  95.       (ic::image-auto-stretch
  96.         (ic::load-image (merge-74x75-path "74x75-shaded-relief.g0"))
  97.     :tail-factor 0.1))
  98.  
  99. (push-image 
  100.   *74x75-terrain-shaded-relief*
  101.   (ic::get-pane 
  102.     '(0 0)
  103.     (ic::pane-frame (view-window (car (view-list *alv-ugv1-3d-world*))))))
  104.  
  105.  
  106.  
  107.  
  108. #| from alv-ugv1.lisp in $CMEHOME/radius/alv-ugv1
  109.  
  110.   ;; ************************************ DEM SETUP ************************************
  111.   (setq *alv-ugv1-dem* (ic::load-image (merge-alv-ugv1-image-pathname "alv-ugv1-dem.g0" ) ))
  112.   (setf (image-prop *alv-ugv1-dem* :2d-world) nil) ; clean out crap in image-file
  113.   (setf (get-prop *alv-ugv1-3d-world* :terrain-model)
  114.         (build-tec-utm-terrain-model-internal
  115.          *alv-ugv1-dem* *alv-ugv1-local-utm-to-lvcs-transform*
  116.                                      (merge-alv-ugv1-pathname "headers/utm_dem.hdr")
  117.                                      "ALV-UGV1-UTM-DEM" ))
  118.   
  119.   ;; this looks best when images rotated for stereo
  120.   (setq *alv-ugv1-shaded-relief-dem* (ic::make-shaded-relief-image *alv-ugv1-dem* 1 1) )
  121.   ;;(setf (get-prop *alv-ugv1-shaded-relief-dem* :2d-world ) (2d-world *alv-ugv1-dem*))
  122.   ;;(add-image-to-3d-world *alv-ugv1-shaded-relief-dem* *alv-ugv1-3d-world*)
  123.   )
  124. |#
  125.  
  126.  
  127.  
  128.  
  129.