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 >
Wrap
Lisp/Scheme
|
1995-09-11
|
5KB
|
129 lines
(in-package 'cme)
;;; for reading in Howard's terrain map for the MMC building
;;; in Denver, Co. (made from images 74sxx and 75nxx). These
;;; images are in the ALV-UGV1 site model in the RCDE. This file
;;; assumes that site model has already been loaded.
;;;
;;; Bob Collins, Univ of Mass, Aug 12 1995.
;;;
;;; Note: The terrain image to world transformation matrix was determined
;;; empirically by choosing match points in Howard's ortho/z images then
;;; selecting corresponding points in the RCDE 74sxx image and noting the
;;; reported 3d world x,y,z points. The points were
;;; ORTHO (U,V,W) 74SXX (X,Y,Z)
;;; 465.25 80.87 1643.0 700.36 846.19 1789.80
;;; 594.00 837.50 1643.0 717.24 949.88 1790.34
;;; 1365.62 1166.25 1984.0 821.46 994.15 1791.48
;;; 1746.50 1549.00 3112.0 867.39 1047.58 1804.43
;;; 1772.00 79.25 381.0 887.31 845.86 1777.07
;;; 896.37 1685.50 2529.0 752.74 1065.75 1798.67
;;;
;;; I decomposed it into an affine solution for XY
;;; and a separate affine solution for Z. Results:
;;;
;;; X = .143904 U - .003389 V + 627.737
;;; Y = .136935 V + 835.05
;;; and
;;; Z = .009952 W + 1773.24
;;;
;;; These seem to be consistent with a couple quantities Howard
;;; could provide me. For example, his elevations are in centimeters,
;;; thus Z = .01 W + offset is reasonable. Also, the horizontal spacing
;;; of his pixels (our Y direction) is 280/2048 = .13672 meters, so
;;; our equation for Y = .136935 V + offset is reasonable. Furthermore,
;;; the dependence of X on V as well as U can be explained by the
;;; vertical warping that Howard applied to fix the epipolar alignment
;;; of the two images.
;;;
;;; Converting from Howard's raw ortho-terrain file to RCDE.
;;; Need to do this stuff only once
#|
(setf zimage (ic::make-image (list 2048 2048) :element-type '(unsigned-byte 16)))
(ic::copy-raster-file-to-image "/nfs/jen/u1/TERRAIN/74x75/z_74x75.sun" zimage
:right-to-left-p t)
(ic::save-image zimage "/nfs/jen/u1/TERRAIN/74x75/74x75-terrain.g0")
|#
;;; Setting up the terrain model into the ALV-UGV1 3d world
(defvar *74x75-terrain* nil "Howard's terrain map for images 74sxx and 75nxx")
(defvar *74x75-terrain-image* nil)
(defvar *74x75-terrain-shaded-relief* nil)
(defvar *74x75-path* "/nfs/jen/u1/TERRAIN/74x75/")
#|
(defvar *74x75-terrain-transform*
(make-4x4-coordinate-transform
(make-and-fill-2d-array
'((0.143904 -.003389 0.0 627.737)
(0.0 0.136935 0.0 835.05)
(0.0 0.0 0.009952 1773.24)
(0.0 0.0 0.0 1.0)))))
|#
(defvar *74x75-terrain-transform*
(make-4x4-coordinate-transform
(make-and-fill-2d-array
'((0.143904 -.003389 0.0 623.737)
(0.0 0.136935 0.0 835.05)
(0.0 0.0 0.009952 1773.24)
(0.0 0.0 0.0 1.0)))))
(defun merge-74x75-path (filename)
(format nil "~a~a" *74x75-path* filename))
(setf *74x75-terrain-image*
(ic::load-image (merge-74x75-path "74x75-terrain.g0")))
(setf (image-prop *74x75-terrain-image* :2d-world) nil)
(setf *74x75-terrain*
(make-terrain-model *74x75-terrain-image*
*74x75-terrain-transform*))
;;shadow the current terrain model
(setf (property-list *alv-ugv1-3d-world*)
(append (list :terrain-model *74x75-terrain*)
(property-list *alv-ugv1-3d-world*)))
(setf *74x75-terrain-shaded-relief*
(ic::image-auto-stretch
(ic::load-image (merge-74x75-path "74x75-shaded-relief.g0"))
:tail-factor 0.1))
(push-image
*74x75-terrain-shaded-relief*
(ic::get-pane
'(0 0)
(ic::pane-frame (view-window (car (view-list *alv-ugv1-3d-world*))))))
#| from alv-ugv1.lisp in $CMEHOME/radius/alv-ugv1
;; ************************************ DEM SETUP ************************************
(setq *alv-ugv1-dem* (ic::load-image (merge-alv-ugv1-image-pathname "alv-ugv1-dem.g0" ) ))
(setf (image-prop *alv-ugv1-dem* :2d-world) nil) ; clean out crap in image-file
(setf (get-prop *alv-ugv1-3d-world* :terrain-model)
(build-tec-utm-terrain-model-internal
*alv-ugv1-dem* *alv-ugv1-local-utm-to-lvcs-transform*
(merge-alv-ugv1-pathname "headers/utm_dem.hdr")
"ALV-UGV1-UTM-DEM" ))
;; this looks best when images rotated for stereo
(setq *alv-ugv1-shaded-relief-dem* (ic::make-shaded-relief-image *alv-ugv1-dem* 1 1) )
;;(setf (get-prop *alv-ugv1-shaded-relief-dem* :2d-world ) (2d-world *alv-ugv1-dem*))
;;(add-image-to-3d-world *alv-ugv1-shaded-relief-dem* *alv-ugv1-3d-world*)
)
|#