UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Using surface models to alter the geometry of real images Palmer, Michael Richard 1982

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata

Download

Media
831-UBC_1982_A6_7 P34.pdf [ 10.89MB ]
Metadata
JSON: 831-1.0051830.json
JSON-LD: 831-1.0051830-ld.json
RDF/XML (Pretty): 831-1.0051830-rdf.xml
RDF/JSON: 831-1.0051830-rdf.json
Turtle: 831-1.0051830-turtle.txt
N-Triples: 831-1.0051830-rdf-ntriples.txt
Original Record: 831-1.0051830-source.json
Full Text
831-1.0051830-fulltext.txt
Citation
831-1.0051830.ris

Full Text

USING SURFACE MODELS TO ALTER THE GEOMETRY OF REAL IMAGES by MICHAEL RICHARD PALMER B.Sc, The University of B r i t i s h Columbia, 1979 A THESIS SUBMITTED IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE in THE FACULTY OF GRADUATE STUDIES (Department of Computer Science) We accept th i s thesis as conforming to the required standard. THE UNIVERSITY OF BRITISH COLUMBIA June, 1982 (c) Michael Richard Palmer, 1982 In presenting t h i s thesis i n p a r t i a l f u l f i l m e n t of the requirements for an advanced degree at the University of B r i t i s h Columbia, I agree that the Library s h a l l make i t f r e e l y available for reference and study. I further agree that permission for extensive copying of t h i s thesis for scholarly purposes may be granted by the head of my department or by his or her representatives. I t i s understood that copying or publication of t h i s thesis for f i n a n c i a l gain s h a l l not be allowed without my written permission. Department of Computer Science  The University of B r i t i s h Columbia 1956 Main Mall Vancouver, Canada V6T 1Y3 DE-6 (3/81) i i A b s t r a c t Many a p p l i c a t i o n s o f image a n a l y s i s and image p r o c e s s i n g i n v o l v e t h e a l t e r a t i o n o f t h e g e o m e t r y o f r e a l i m a g e s . T h i s t h e s i s p r e s e n t s t h e t h e o r y and i m p l e m e n t a t i o n o f t h r e e t y p e s o f g e o m e t r i c a l l y a l t e r e d i m a g e r y : s y n t h e t i c o r t h o g r a p h i c s t e r e o p a i r s , s y n t h e t i c p e r s p e c t i v e s t e r e o p a i r s , and s y n t h e t i c a i r b o r n e s c a n n e r i m a g e r y . The r e a l image i s a l t e r e d as a f u n c t i o n o f a c o r r e s p o n d i n g s u r f a c e m o d e l . I n c l u d e d i s a d e t e r m i n a t i o n of s u r f a c e p o i n t s w h i c h a r e h i d d e n under t h e assumed i m a g i n g geometry and, i n t h e c a s e of r a d a r s y s t e m s , a d e t e r m i n a t i o n o f s u r f a c e p o i n t s w h i c h c o n t r i b u t e t o p i x e l l a y o v e r . In t h i s r e s e a r c h , a d i g i t a l t e r r a i n model d e t e r m i n e s th e u n d e r l y i n g s u r f a c e geometry of t h e r e a l image. i i i T a b l e o f C o n t e n t s A b s t r a c t i i T a b l e of C o n t e n t s i i i L i s t o f F i g u r e s v Acknowledgement v i 1.0 I n t r o d u c t i o n 1 1 .1 M o t i v a t i o n 2 1 .2 T e r m i n o l o g y 4 1 . 3 Scope 7 2.0 S y n t h e t i c O r t h o g r a p h i c S t e r e o 8 2.1 T h e o r y . 8 2.2 I m p l e m e n t a t i o n 13 3.0 S y n t h e t i c P e r s p e c t i v e S t e r e o 17 3.1 T h e o r y 17 3.2 I m p l e m e n t a t i o n 29 4.0 S y n t h e t i c A i r b o r n e S c a n n e r Imagery 35 4.1 T h e o r y 39 4.1.1 Radar C o n s i d e r a t i o n s 45 4.2 I m p l e m e n t a t i o n 51 5.0 C o n c l u s i o n 55 5.1 F u t u r e Work 56 i v B i b l i o g r a p h y 57 A p p e n d i x A 59 A p p e n d i x B 76 A p p e n d i x C 1 1 2 V L i s t of F i g u r e s F i g u r e 1. O r t h o g r a p h i c s t e r e o p a i r 9 F i g u r e 2. Geometry of an o r t h o g r a p h i c s t e r e o p a i r ... 11 F i g u r e 3 . P e r s p e c t i v e s t e r e o p a i r 18 F i g u r e 4. P e r s p e c t i v e s t e r e o v i s i b i l i t y map 20 F i g u r e 5. Geometry o f a v e r t i c a l a e r i a l p h o t o g r a p h .. 22 F i g u r e 6. T e r r a i n v i s i b i l i t y g e ometry ( p e r s p e c t i v e ) . 25 F i g u r e 7. T e r r a i n v i s i b i l i t y - p e r s p e c t i v e 27 F i g u r e 8. D i r e c t i o n o f r e l i e f d i s p l a c e m e n t 31 F i g u r e 9. A i r b o r n e s c a n n e r image 36 F i g u r e 10. A i r b o r n e s c a n n e r v i s i b i l i t y map 37 F i g u r e 11. A i r b o r n e s c a n n e r p i x e l l a y o v e r map 38 F i g u r e 12. O p e r a t i o n o f an a i r b o r n e s c a n n e r s y s t e m ... 40 F i g u r e 13. Geometry o f an a i r b o r n e s c a n n e r s y s t e m .... 42 F i g u r e 14. T e r r a i n v i s i b i l i t y - a i r b o r n e s c a n n e r 44 F i g u r e 15. Geometry o f a r a d a r i m a g i n g s y s t e m 46 F i g u r e 16. Geometry o f a s i d e - l o o k i n g r a d a r s y s t e m ... 48 F i g u r e 17. P i x e l l a y o v e r - r a d a r 50 v i Acknowledgement I w o u l d l i k e t o thank my s u p e r v i s o r , R o b e r t J . Woodham, f o r h i s c o n s t r u c t i v e c r i t i c i s m and g u i d a n c e t h r o u g h o u t t h i s r e s e a r c h . I would a l s o l i k e t o thank A l a n K. Mackworth f o r b e i n g t h e s e c o n d r e a d e r of t h i s t h e s i s and James J . L i t t l e f o r h i s work i n d e v e l o p i n g t h e DTM and r e c t i f i c a t i o n a l g o r i t h m s t h a t were t a k e n a d v a n t a g e of i n my r e s e a r c h . F i n a l l y , I would l i k e t o a g a i n thank Bob f o r h i s s u p p o r t , f i n a n c i a l and o t h e r w i s e , o f t h i s r e s e a r c h . 1 1 . 0 Introduct ion Synthetic images, created via the a l t e r a t i o n of the geometry of real images, find many uses in the f i e l d s of image analysis and image processing. For example, a synthetic stereo pair of images can be used in the evaluation of the accuracy of an image r e c t i f i c a t i o n algorithm [LITT80]. In addition, a synthetic stereo pair of images, can be used as an aid to photo interpretation. This thesis presents the theory, methods, and results, of creating three s p e c i f i c types of synthetic imagery from real images. The types of imagery produced are: (a) synthetic orthographic stereo pairs of an area represented by a real image and a corresponding surface model, (b) synthetic perspective stereo pairs of an area represented by a real image and a corresponding surface model, and (c) synthetic airborne scanner imagery of an area represented by a real image and a corresponding surface model (including considerations for both passive scanning systems and active radar systems). The synthesis i s performed by a l t e r i n g the geometry of the real image as a function of a corresponding surface model. The three algorithms to produce the three types of synthetic imagery are independent of each other and are therefore presented separately in t h i s thesis. 2 The m o t i v a t i o n f o r d e v e l o p i n g t h e s e t h r e e i n d e p e n d e n t a l g o r i t h m s i s now g i v e n . 1.1 Mot i v a t i o n The m o t i v a t i o n f o r e a c h t y p e of imagery c o n s i d e r e d i n t h i s r e s e a r c h i s summarized as f o l l o w s : (1) s y n t h e t i c o r t h o g r a p h i c s t e r e o (a) S t e r e o v i e w i n g i s b e n e f i c i a l . A p p l i c a t i o n s i n c l u d e : a i d i n g p h o t o i n t e r p r e t a t i o n . The i n t e r p r e t a t i o n of s u b t l e g r o u n d d e t a i l i s f a c i l i t a t e d when an image i s v i e w e d i n s t e r e o . e v a l u a t i n g t h e a c c u r a c y of image r e c t i f i c a t i o n [ L I T T 8 0 ] . A m i s m a t c h between t e r r a i n f e a t u r e s and g r o u n d c o v e r f e a t u r e s , a s seen i n s t e r e o , c an d e l i n e a t e e r r o r s i n image r e c t i f i c a t i o n , e v a l u a t i n g t h e a c c u r a c y o f t h e u n d e r l y i n g s u r f a c e m o d e l . A n o m a l i e s i n a s u r f a c e model a r e made a p p a r e n t once t h e model has been r e g i s t e r e d t o a r e a l image and u s e d i n t h e p r o d u c t i o n of a s t e r e o pa i r . (b) S y n t h e s i s o f an o r t h o g r a p h i c s t e r e o p a i r i s c o m p u t a t i o n a l l y s i m p l e s t . (2) s y n t h e t i c p e r s p e c t i v e s t e r e o 3 (a) Stereo viewing i s b e n e f i c i a l as detailed above. (b) Real o p t i c a l systems • perform a perspective transformation. Therefore, even though the production of synthetic perspective stereo is computationally more tedious, i t i s required to predict the geometry of real imaging systems. (3) synthetic airborne scanner imagery Airborne scanner imagery requires additional geometric considerations. Two types of geometric d i s t o r t i o n s e x i s t : systematic and nonsystematic. Systematic d i s t o r t i o n s are a function of the scanner i t s e l f (eg. mirror v e l o c i t y , scan skew, and panoramic d i s t o r t i o n s ) . Correction of systematic d i s t o r t i o n s i s deterministic [SABI78]. Nonsystematic d i s t o r t i o n s are either d i s t o r t i o n s due to parameters which vary (or are unknown) or d i s t o r t i o n s due to the p a r t i c u l a r scene in view. Correction of nonsystematic d i s t o r t i o n s i s not deterministic but can be f a c i l i t a t e d i f a surface model is available. The synthesis of airborne scanner geometry from a surface model predicts nonsystematic te r r a i n d i s t o r t i o n s and can include systematic d i s t o r t i o n s . Applications include: evaluating the accuracy of d i s t o r t i o n correction routines for real airborne scanner imagery, determining surface points which are hidden under a given scanner and l i n e of f l i g h t geometry, and 4 d e t e r m i n i n g , i n t h e c a s e o f r a d a r s y s t e m s , s u r f a c e p o i n t s w h i c h c o n t r i b u t e anomalous r e a d i n g s due t o p i x e l l a y o v e r . 1.2 T e r m i n o l o g y P r i o r t o p r e s e n t i n g t h e t e c h n i c a l d e t a i l s o f t h e r e s e a r c h , i t i s n e c e s s a r y t o d e f i n e / e x p l a i n some o f t h e t e r m i n o l o g y u s e d i n t h e p r e s e n t a t i o n o f t h e m a t e r i a l . A d i g i t a l image i s d e s c r i b e d as a s e r i e s of c e l l s or p i c t u r e e l e m e n t s ( p i x e l s ) a r r a n g e d i n r e g u l a r rows and c o l u m n s . The p o s i t i o n o f any p i x e l i s d e t e r m i n e d i n a two - d i m e n s i o n c a r t e s i a n c o o r d i n a t e s y s t e m w i t h t h e o r i g i n d e f i n e d a t t h e upper l e f t c o r n e r of t h e image. ( T h i s c o n v e n t i o n i s u s e d t h r o u g h o u t . ) The b r i g h t n e s s o f e a c h p i x e l i s g i v e n an e i g h t b i t n u m e r i c a l v a l u e . (A v a l u e of z e r o i s b l a c k and a v a l u e of 255 i s w h i t e . ) Images i m p l i c i t l y r e p r e s e n t a s c e n e as r e c o r d e d by a remote s e n s i n g i m a g i n g s y s t e m [ S A B I 7 8 ] , The p l a t f o r m i s t h e medium w h i c h c a r r i e s t h e remote s e n s i n g i m a g i n g s y s t e m . T h i s medium c a n r a n g e from l o w - f l y i n g a i r c r a f t t o s a t e l l i t e s . In t h i s r e s e a r c h , t h e i m a g e r y u s e d was f rom t h e L a n d s a t [ L I L L 7 9 ] s e r i e s of s a t e l l i t e s . The a n g u l a r f i e l d o f v i e w i s t h e t o t a l a n g l e s u b t e n d e d 5 by h y p o t h e t i c a l l i n e s f r o m t h e i m a g i n g s y s t e m t o t h e e x t r e m e o u t e r m a r g i n s of t h e s c e n e v i e w e d by t h e s y s t e m . The i n s t a n t a n e o u s f i e l d o f v i e w i s t h e s o l i d a n g l e t h r o u g h w h i c h t h e s y s t e m i s s e n s i t i v e when d e t e r m i n i n g t h e v a l u e of e a c h p i x e l . T h i s s o l i d a n g l e , t o g e t h e r w i t h o t h e r f l i g h t p a r a m e t e r s , d e t e r m i n e s t h e g r o u n d r e s o l u t i o n o f t h e i m a g i n g s y s t e m ( r e f e r t o f i g u r e 12) [ S A B I 7 8 ] . The o r t h o g r a p h i c p r o j e c t i o n of a s u r f a c e o n t o a p l a n e i s one i n w h i c h t h e s u r f a c e and t h e p r o j e c t i o n o f t h e s u r f a c e on t h e p l a n e , l i e on l i n e s p e r p e n d i c u l a r t o t h e p l a n e [NEWM73] ( i . e . , a l l r a y s from t h e o b j e c t t o t h e p l a n e a r e p a r a l l e l [WOOD80]). F o r a p e r s p e c t i v e p r o j e c t i o n , t h e r a y s c o n v e r g e a t a p o i n t t h a t i s a d i s t a n c e c a l l e d t h e f o c a l l e n g t h from t h e p l a n e . A l l o p t i c a l s y s t e m s p e r f o r m a p e r s p e c t i v e p r o j e c t i o n . F o r o b j e c t s t h a t a r e s m a l l , compared t o t h e i r d i s t a n c e f r o m t h e p l a n e , t h e p e r s p e c t i v e p r o j e c t i o n can be m o d e l l e d as an o r t h o g r a p h i c p r o j e c t i o n [WOOD80]. Images o b t a i n e d f r o m t h e L a n d s a t s e r i e s o f s a t e l l i t e s c a n be m o d e l l e d a s an o r t h o g r a p h i c p r o j e c t i o n . R a d i o m e t r y i s t h e q u a n t i t a t i v e measurement of e l e c t r o m a g n e t i c r a d i a n t e n e r g y [ R E E V 7 5 ] . T h i s measurement i s t h e b a s i s f o r remote s e n s i n g i m a g i n g s y s t e m s . The v a l u e o f a p i x e l i s a measurement o f t h e e n e r g y a r r i v i n g a t t h e s e n s o r f r o m t h e s o l i d a n g l e s u b t e n d e d by i t s i n s t a n t a n e o u s f i e l d o f v i e w . S t e r e o s c o p y i s t h e s c i e n c e t h a t d e a l s w i t h t h r e e -6 dimensional effects and how these effects are obtained [REEV75]. A stereo pair consists of two overlapping images that may be viewed stereoscopically [SABI78]. A stereo  model (or stereoscopic image) i s the three - dimensional impression obtained by viewing the l e f t and right images of a stereo pair by the l e f t and right eyes, respectively [SABI78]. Stereoscopic viewing i s aided by use of a stereoscope - a binocular o p t i c a l device. (The stereo pairs presented in t h i s thesis can be viewed with a stereoscope to obtain the appropriate three - dimensional effects.) Synthetic stereo images are a pair' of images that have been produced by the d i g i t a l processing of a single image and a corresponding surface model. Parallax is an object's change in position between the l e f t and right images of a stereo pair, r e l a t i v e to the two centres of the images, as a function of i t s r e l a t i v e height. Pixel layover occurs in radar imagery when two or more surface points are equi-distant from the radar device at the time of pixel a c q u i s i t i o n . Such surface points contribute to the same pixe l in the radar image thus creating false bright targets [REEV75]. A b i t map (or simply a map) determines points on the surface model that have a "special status". For example, points on the surface model that are not v i s i b l e in the altered image are "marked" on a v i s i b i l i t y b i t map. (The o r i g i n a l image can be overlayed by the corresponding b i t map so that the "marked" points are e a s i l y i d e n t i f i e d . ) 7 F o r a s t e r e o p a i r , e a c h image w i l l have a c o r r e s p o n d i n g v i s i b i l i t y b i t map. S i m i l a r i l y , a p i x e l l a y o v e r b i t map i s c r e a t e d f o r t h o s e p i x e l s t h a t c o n t r i b u t e t o l a y o v e r i n a s y n t h e s i z e d r a d a r image. 1.3 Scope C h a p t e r 2 of t h i s t h e s i s p r e s e n t s t h e t h e o r y and i m p l e m e n t a t i o n of s y n t h e s i z i n g o r t h o g r a p h i c s t e r e o p a i r s . The c o r r e s p o n d i n g d i s c u s s i o n o f s y n t h e t i c p e r s p e c t i v e s t e r e o p a i r s i s p r e s e n t e d i n C h a p t e r 3 . C h a p t e r 4 d e t a i l s t h e t h e o r y and i m p l e m e n t a t i o n o f s y n t h e t i c a i r b o r n e s c a n n e r i m a g e r y , i n c l u d i n g c o n s i d e r a t i o n s r e l a t e d t o a i r b o r n e r a d a r . C h a p t e r 5 p r e s e n t s c o n c l u s i o n s , a d i s c u s s i o n of t h e r e s e a r c h , and s u g g e s t i o n s f o r f u t u r e work. 8 2.0 S y n t h e t i c O r t h o g r a p h i c S t e r e o T h i s c h a p t e r d i s c u s s e s t h e s y n t h e s i s o f o r t h o g r a p h i c s t e r e o p a i r s from a s i n g l e o r t h o g r a p h i c image. The r e s u l t i n g s t e r e o p a i r . i s o b t a i n e d by i n t r o d u c i n g r e l i e f d i s p l a c e m e n t i n t o t h e o r i g i n a l image. The o r i g i n a l image i s r e g i s t e r e d t o a c o r r e s p o n d i n g d i g i t a l t e r r a i n model whose e l e v a t i o n i n f o r m a t i o n i s u s e d i n t h e c a l c u l a t i o n o f s t e r e o s c o p i c p a r a l l a x . F i g u r e 1 i s a s y n t h e t i c o r t h o g r a p h i c s t e r e o p a i r f r o m a p o r t i o n of a L a n d s a t - 1 image of t h e S t . Mary Lake r e g i o n o f s o u t h e a s t B r i t i s h C o l u m b i a ( f r a m e ID 11514 - 17153, band 7, imaged September 14, 1976). 2.1 T h e o r y O v e r l a p p i n g v e r t i c a l a e r i a l p h o t o g r a p h s can be v i e w e d s t e r e o s c o p i c a l l y b e c a u s e r e l i e f d i s p l a c e m e n t a r i s e s from a p e r s p e c t i v e p r o j e c t i o n of t h e u n d e r l y i n g t e r r a i n [ L I L L 7 9 ] , Images a r i s i n g from an o r t h o g r a p h i c p r o j e c t i o n do not show r e l i e f d i s p l a c e m e n t . N e v e r t h e l e s s , s t e r e o v i e w i n g c a n be a c c o m p l i s h e d i f t h e v i e w i n g d i r e c t i o n i s a l t e r e d between t h e l e f t image and t h e r i g h t image o f t h e s t e r e o p a i r . The a s s u m p t i o n of o r t h o g r a p h i c p r o j e c t i o n s i m p l i f i e s t h e p r o c e d u r e f o r s y n t h e s i z i n g s t e r e o p a i r s , a s w i l l now be shown. 9 F i g u r e 1. Orthographic st e r e o p a i r ( S t . Mary Lake region of southeast B r i t i s h Columbia). 10 F i r s t , c o n s i d e r a d i g i t a l r e p r e s e n t a t i o n o f t h e s u r f a c e r e l i e f . T h i s can be s p e c i f i e d e x p l i c i t l y as t h e f u n c t i o n z = f ( x , y ) where t h e x and y a x e s a r e i n a p l a n e t a n g e n t t o t h e e a r t h ' s s u r f a c e and t h e z a x i s i s v e r t i c a l l y up ( i . e . , t h e xy p l a n e forms a d i s c r e t e u n i f o r m s u r f a c e g r i d and t h e c o r r e s p o n d i n g z v a l u e s a r e e l e v a t i o n d a t u m ) . T h e s e t h r e e a x e s a r e m u t u a l l y o r t h o g o n a l . Such a f u n c t i o n i s r e f e r r e d t o as a d i g i t a l e l e v a t i o n model o r more commonly as a d i g i t a l t e r r a i n model (DTM) [ M I L L 5 8 ] . I t i s assumed t h a t f ( x , y ) i s a c o n t i n u o u s f u n c t i o n w i t h c o n t i n u o u s f i r s t and s e c o n d s p a t i a l d e r i v a t i v e s so t h a t t h e s u r f a c e may be c o n s i d e r e d t o be smooth. R e f e r r i n g t o f i g u r e 2, assume a v i e w e r t o be a t e l e v a t i o n H above t h e g r o u n d datum. L e t t h i s v i e w e r be l o o k i n g down w i t h h i s " e y e s " a l i g n e d a l o n g t h e x a x i s ( w i t h o r i g i n 0) and s e p a r a t e d by a d i s t a n c e of 2-d. F u r t h e r s u p p o s e t h e v i e w e r ' s gaze t o be f i x e d on t h e p o i n t ( X c , Y c ) on t h e g r o u n d datum, f o r m i n g an a n g l e of c o n v e r g e n c e of 29. From t h i s geometry i t i s c l e a r t h a t tan© = d / H (2.1) A r o t a t i o n t r a n s f o r m a t i o n a b o u t t h e y a x i s and a p a i r o f t r a n s l a t i o n s a l o n g t h e x a x i s , s i m i l a r t o t h o s e u s e d i n 11 Figure 2. Geometry of an orthographic stereo pa i r . 12 computer g r a p h i c s [NEWM79], can be a p p l i e d t o p r o d u c e e q u a t i o n s t o map t h e c o o r d i n a t e s o f t h e o r i g i n a l s u r f a c e (X,Y,Z) i n t o c o o r d i n a t e s f o r t h e l e f t eye c o o r d i n a t e s y s t e m ( X l , Y l , Z l ) and t h e r i g h t eye c o o r d i n a t e s y s t e m ( X r , Y r , Z r ) . ( N o t e : i n f i g u r e 2, f o r t h e p u r p o s e of i l l u s t r a t i o n , t h e l e f t and r i g h t eye c o o r d i n a t e s y s t e m s have been t r a n s l a t e d a l o n g t h e c o r r e s p o n d i n g z a x e s , t o w a r d s t h e " e y e s " of t h e v i e w e r . In r e a l i t y , t h e XI a x i s and t h e Xr a x i s i n t e r c e p t t h e x a x i s of t h e s u r f a c e model a t c o o r d i n a t e ( X c , Y c ) . ) One o b t a i n s : XI = Xc + (X - X c ) - c o s e + Z - s i n e (2.2) Y l = Y (2.3) Z l = Z-cose - (X - X c ) - s i n e (2.4) Xr = Xc + (X - X c ) - c o s e - Z - s i n e (2.5) Yr = Y (2.6) Zr = Z-cose + (X - X c ) - s i n e (2.7) T h e s e e q u a t i o n s y i e l d t h r e e p o i n t s o f i n t e r e s t : (a) i t i s e v i d e n t from e q u a t i o n s (2.3) and (2.6) t h a t t h e y c o o r d i n a t e i s n o t a l t e r e d . T h i s i l l u s t r a t e s t h e p r i m a r y a d v a n t a g e o f t h e o r t h o g r a p h i c p r o j e c t i o n , namely, t h a t p r o c e s s i n g c a n p r o c e e d a row a t a t i m e . (b) t h e d i f f e r e n c e i n x - p o s i t i o n between t h e l e f t eye c o o r d i n a t e s y s t e m and t h e r i g h t eye c o o r d i n a t e s y s t e m , (XI - X r ) , c a n be c a l c u l a t e d f r o m e q u a t i o n s (2.2) and (2.5) a s : 2 - Z - s i n e (2.8) As e x p e c t e d , t h i s i s a f u n c t i o n o f Z ( t h e e l e v a t i o n ) 13 and e ( t h e a n g l e o f c o n v e r g e n c e ) . F o r s m a l l e, sin© c a n be a p p r o x i m a t e d by t a n e . U s i n g e q u a t i o n (2.1) and l e t t i n g S = 2»d, t h e d i f f e r e n c e i n x - p o s i t i o n i s t h u s a p p r o x i m a t e d by 2-Z-(d/H) = Z-S/H (2.9) E q u a t i o n (2.9) has been u s e d i n a p p r o x i m a t e c a l c u l a t i o n s [ B A T S 7 6 ] . (c) when a s u r f a c e i s g i v e n a s t h e f u n c t i o n z = f ( x , y ) w i t h t h e v i e w e r l o o k i n g down t h e z a x i s , t h e v i s i b i l i t y p r o b l e m has been e x p l i c i t l y s o l v e d . However, when t h e v i e w i n g d i r e c t i o n i s a l t e r e d , a s r e q u i r e d h e r e , v i s i b i l i t y must be c o n s i d e r e d . E q u a t i o n s (2.4) and (2.7) d e t e r m i n e v i s i b i l i t y . I f more t h a n one (X,Z) maps i n t o a g i v e n X I , t h e n t h e (X,Z) p a i r w i t h t h e g r e a t e s t Z l i s t h e p o i n t t h a t i s v i s i b l e . T h i s c o m p l e t e s t h e g e o m e t r i c t h e o r y r e q u i r e d t o s y n t h e s i z e a s t e r e o p a i r . An a l g o r i t h m t o implement t h e t h e o r y i s g i v e n i n t h e f o l l o w i n g s e c t i o n . 2.2 I m p l e m e n t a t i o n The a l g o r i t h m t o s y n t h e s i z e an o r t h o g r a p h i c s t e r e o p a i r c r e a t e s two new images - t h e l e f t and r i g h t images of 14 t h e s t e r e o p a i r . The o r i g i n a l image must a l r e a d y be r e g i s t e r e d t o a c o r r e s p o n d i n g d i g i t a l t e r r a i n model ( i . e . , a o n e - t o - o n e c o r r e s p o n d e n c e has been e s t a b l i s h e d between t h e e l e m e n t s o f t h e DTM and t h e e l e m e n t s of t h e image) [ L I T T 8 0 ] , Thus, t h e n e c e s s a r y e l e v a t i o n i n f o r m a t i o n i s p r o v i d e d f o r e a c h p i x e l i n t h e image. The a l g o r i t h m i s d e s c r i b e d as f o l l o w s ( t h e s o u r c e code t o p r o d u c e th e o r t h o g r a p h i c s t e r e o p a i r i s p r e s e n t e d i n A p p e n d i x A ) : The a n g l e of c o n v e r g e n c e , 26, i s c o n s t a n t t h r o u g h o u t t h e p r o c e d u r e so t h a t t h e v a l u e s of sin© and c o s e a r e c a l c u l a t e d o n c e . The l i n e s o f t h e image and t h e r e g i s t e r e d l i n e s of t h e DTM a r e i n p u t a p a i r a t a t i m e ( i . e . , one image l i n e and t h e c o r r e s p o n d i n g DTM l i n e ) . F o r e a c h image and DTM l i n e p a i r , t h e c o r r e s p o n d i n g l i n e s of t h e l e f t image and r i g h t image a r e c r e a t e d u s i n g e q u a t i o n s (2.2) and (2.5) r e s p e c t i v e l y . F o r e a c h X p o s i t i o n i n t h e o r i g i n a l l i n e , an XI and an Xr a r e c a l c u l a t e d f o r t h e two new l i n e s . The p i x e l v a l u e c o r r e s p o n d i n g t o p o s i t i o n X of t h e o r i g i n a l image l i n e i s a s s i g n e d t o p o s i t i o n XI of t h e l e f t image l i n e and t o p o s i t i o n Xr of t h e r i g h t image l i n e . When t h i s d i s p l a c e m e n t i s i n t r o d u c e d , i t i s l i k e l y t h a t XI and Xr do n o t a l i g n e x a c t l y w i t h t h e u n i f o r m g r i d o f t h e image. A s i m p l e one d i m e n s i o n a l l i n e a r r e s a m p l i n g [ L I L L 7 9 ] i s p e r f o r m e d t o g e n e r a t e i n t e r m e d i a t e p i x e l v a l u e s . I t i s p o s s i b l e t h a t some d i s p l a c e d p i x e l s ( i . e . , t h o s e c o r r e s p o n d i n g t o XI and X r ) a r e n o t v i s i b l e i n t h e i r 15 r e s p e c t i v e new i m a g es. T h i s s i t u a t i o n i s d e t e c t e d and r e s o l v e d i n t h e f o l l o w i n g manner: F o r a g i v e n l i n e i n t h e o r i g i n a l image, t h e p i x e l s c l o s e s t t o Xc a r e c o n s i d e r e d f i r s t ; t h e ones f a r t h e s t away l a s t . E m p l o y i n g t h i s t e c h n i q u e , i f a p i x e l o f t h e l i n e i s mapped t o a p o s i t i o n t h a t i s a d i s t a n c e J f r o m Xc, t h e n a n o t h e r p i x e l of t h a t l i n e t h a t i s s u b s e q u e n t l y c o n s i d e r e d i s v i s i b l e i f and o n l y i f i t i s mapped t o a p o s i t i o n t h a t i s more t h a n a d i s t a n c e J f r o m Xc. I f t h e d i s t a n c e i s l e s s t h a n J , t h e p i x e l i s n o t v i s i b l e and hence i t can be i g n o r e d . T h i s p r o c e d u r e i s done s e p a r a t e l y f o r t h e l e f t and r i g h t image. A n o t h e r method t o t e s t t h e v i s i b i l i t y o f e a c h p i x e l i s t o e x p l i c i t l y c a l c u l a t e t h e c o r r e s p o n d i n g e l e v a t i o n u s i n g e q u a t i o n s (2.4) and ( 2 . 7 ) . T h i s a p p r o a c h has s e v e r a l p r a c t i c a l d r a w b a c k s . One s h o r t c o m i n g i s t h a t one XI ( o r X r ) r a r e l y e q u a l s a n o t h e r XI ( o r X r ) s i n c e t h e s e v a l u e s a r e r e a l numbers. T h i s f a c t l e a d s t o e x t r a c o m p u t a t i o n s t o i n t e r p o l a t e i n t e r m e d i a t e v a l u e s . A s e c o n d drawback i s t h e memory r e q u i r e d t o s t o r e an e x p l i c i t e l e v a t i o n v a l u e f o r e a c h p i x e l i n t h e new l i n e . F o r t h e s e r e a s o n s , t h e s i m p l e r method d e s c r i b e d above was c h o s e n . A n o t h e r common s i t u a t i o n a r i s e s when t h e c u r r e n t p i x e l i s d i s p l a c e d more t h a n one g r i d c e l l f r o m i t s p r e d e c e s s o r . Gaps a p p e a r i n t h e new l i n e b e c a u s e no p i x e l of t h e o r i g i n a l l i n e i s mapped o r r e s a m p l e d t o t h a t p o s i t i o n . In t h i s c a s e , gaps a r e f i l l e d by u s i n g l i n e a r i n t e r p o l a t i o n t o 16 c a l c u l a t e i n t e r m e d i a t e v a l u e s . Once t h e two new l i n e s have- been c o m p l e t e l y s y n t h e s i z e d ( d i s p l a c e d , r e s a m p l e d , and i n t e r p o l a t e d ) t h e y a r e o u t p u t t o t h e c o r r e s p o n d i n g image f i l e . The p r o c e s s i s r e p e a t e d f o r e a c h l i n e o f t h e o r i g i n a l image. T h i s a l g o r i t h m f o r s y n t h e s i z i n g o r t h o g r a p h i c s t e r e o p a i r s p r o d u c e s a v i s u a l l y p l e a s i n g r e s u l t . When f i g u r e 1 i s v i e w e d s t e r e o s c o p i c a l l y t h e r e a r e no u n n a t u r a l t e r r a i n f e a t u r e s ; t h e r a d i o m e t r y of t h e s t e r e o model a p p e a r s smooth. An e a r l i e r a l g o r i t h m t o a c h i e v e t h e same g o a l has been i m p l e m e n t e d by t h e U.S. G e o l o g i c a l S u r v e y [ B A T S 7 6 ] . T h i s p a r t i c u l a r a l g o r i t h m o n l y c r e a t e s one new image. The o r i g i n a l image i s u s e d as e i t h e r t h e l e f t or r i g h t image of t h e s t e r e o p a i r . The s y n t h e s i z e d image t h e n forms t h e mate t o t h e o r i g i n a l . The new image i s c r e a t e d u s i n g e q u a t i o n (2.8) o r (2.9) d e p e n d i n g on whether the c a l c u l a t i o n s a r e e x a c t or a p p r o x i m a t e . T h i s method p r o d u c e s s i m i l a r r e s u l t s as t h o s e o b t a i n e d u s i n g t h e method p r e s e n t e d h e r e . 17 3.0 S y n t h e t i c P e r s p e c t i v e S t e r e o T h i s c h a p t e r d i s c u s s e s t h e s y n t h e s i s of p e r s p e c t i v e s t e r e o p a i r s from a s i n g l e o r t h o g r a p h i c image. The s t e r e o p a i r i s g e n e r a t e d u s i n g a p e r s p e c t i v e p r o j e c t i o n of t h e u n d e r l y i n g t e r r a i n from two d i f f e r e n t v e r t i c a l v i e w i n g p o s i t i o n s . The t e r r a i n i s g i v e n a s a d i g i t a l t e r r a i n model t h a t has been r e g i s t e r e d t o t h e o r t h o g r a p h i c image. A p e r s p e c t i v e p r o j e c t i o n i n t r o d u c e s r e l i e f d i s p l a c e m e n t t o p o i n t s o f t h e o r t h o g r a p h i c image. T h i s d i s p l a c e m e n t i s d i r e c t e d r a d i a l l y f r o m t h e assumed n a d i r . Methods f o r d e t e r m i n i n g t e r r a i n v i s i b i l i t y a r e a l s o p r e s e n t e d i n t h i s c h a p t e r . F i g u r e 3 i s a p e r s p e c t i v e s t e r e o p a i r s y n t h e s i z e d f r o m t h e same p o r t i o n o f t h e L a n d s a t image o f S t . Mary Lake u s e d i n f i g u r e 1. F i g u r e 4 i s t h e c o r r e s p o n d i n g v i s i b i l i t y map o f t h e l e f t image. 3.1 T h e o r y O p t i c a l s y s t e m s , s u c h as c a m e r a s , p e r f o r m p e r s p e c t i v e p r o j e c t i o n s o f t h e u n d e r l y i n g t e r r a i n [ S A B I 7 8 ] , [ L I L L 7 9 ] . O v e r l a p p i n g v e r t i c a l a e r i a l p h o t o g r a p h s can be v i e w e d s t e r e o s c o p i c a l l y due t o t h e i r d i f f e r i n g p e r s p e c t i v e p r o j e c t i o n s o f t h e u n d e r l y i n g t e r r a i n . D i f f e r e n t p e r s p e c t i v e p r o j e c t i o n s a r i s e when t h e o p t i c a l . c e n t r e s o f th e image moves from one p o s i t i o n t o a n o t h e r a l o n g t h e l i n e F i g u r e 3. P e r s p e c t i v e s t e r e o p a i r ( S t . Mary L a k e r e g i o n o f s o u t h e a s t B r i t i s h C o l u m b i a ) . 19 o f f l i g h t . To s y n t h e s i z e a p e r s p e c t i v e s t e r e o p a i r f r o m a s i n g l e o r t h o g r a p h i c image, one must p r o v i d e d i f f e r e n t p e r s p e c t i v e s of t h e t e r r a i n d e p i c t e d by t h e o r t h o g r a p h i c image. The t h e o r y o f s y n t h e s i z i n g a p e r s p e c t i v e image i s p r e s e n t e d f i r s t ; t h a t o f p r o v i d i n g d i f f e r e n t p e r s p e c t i v e s s e c o n d . On a v e r t i c a l a e r i a l p h o t o g r a p h t h e p o s i t i o n o f e a c h t e r r a i n p o i n t i s d i s p l a c e d f r o m i t s o r t h o g r a p h i c p o s i t i o n . T h i s d i s p l a c e m e n t i s d i r e c t e d r a d i a l l y from t h e o p t i c a l c e n t r e of t h e a e r i a l p h o t o g r a p h . F o r t e r r a i n a bove t h e g r o u n d datum, d i s p l a c e m e n t i s r a d i a l l y o u t w a r d s . F o r t e r r a i n below t h e g r o u n d datum, d i s p l a c e m e n t i s r a d i a l l y i n w a r d s [REEV75]. An o r t h o g r a p h i c image can t h u s be t r a n s f o r m e d i n t o a p e r s p e c t i v e image by i n t r o d u c i n g r e l i e f d i s p l a c e m e n t t o p o i n t s o f t h e o r i g i n a l image. The g eometry of r e l i e f d i s p l a c e m e n t w i l l now be d i s c u s s e d i n more d e t a i l . C o n s i d e r i n g t h e d i g i t a l t e r r a i n model, f i g u r e 5 d i s p l a y s t h e geometry o f an a r b i t r a r y c r o s s s e c t i o n o f a v e r t i c a l a e r i a l p h o t o g r a p h y s y s t e m . T h i s c r o s s s e c t i o n i s n o t , i n g e n e r a l , a l i g n e d w i t h t h e x a x i s or t h e y a x i s . W i t h r e f e r e n c e t o f i g u r e 5 , assume a h y p o t h e t i c a l "camera", w i t h f o c a l l e n g t h f , t o be a t e l e v a t i o n H above t h e g r o u n d datum and t o be d i r e c t l y o v e r t h e c o o r d i n a t e ( X p , Y p ) . (The c o o r d i n a t e ( X p , Y p ) , t h e c e n t r e o f t h e v e r t i c a l a e r i a l p h o t o g r a p h , i s r e f e r r e d t o as t h e p r i n c i p a l  p o i n t . ) F u r t h e r suppose t h a t t h e t e r r a i n a t c o o r d i n a t e F i g u r e 4. P e r s p e c t i v e s t e r e o v i s i b i l i t y map. 21 (X,Y) i s a t e l e v a t i o n Z above t h e g r o u n d datum and t h a t t h e r a d i a l d i s t a n c e from (Xp,Yp) t o ( X r Y ) i s R. The r e l i e f d i s p l a c e m e n t f o r t h e t e r r a i n a t c o o r d i n a t e ( X , Y ) , as d i s p l a y e d i n f i g u r e 5, i s t h e n b' - b on p l a n e P, o r e q u i v a l e n t l y , a 1 - a on p l a n e P'. ( F o r s i m p l i c i t y , c a l c u l a t i o n s a r e p e r f o r m e d on p l a n e P'. P l a n e P i s t h e a c t u a l p l a n e of t h e f i l m , however, p l a n e P' and p l a n e P have i d e n t i c a l g e o m e t r i e s as shown i n f i g u r e 5. T h e r e f o r e , measurements made on e i t h e r p l a n e a r e e q u i v a l e n t [ S A B I 7 8 ] . ) The p o i n t a c o r r e s p o n d s t o t h e t r u e g r o u n d p o s i t i o n i n t h e o r t h o g r a p h i c image and t h e p o i n t a' i s t h e a c t u a l p o s i t i o n i n t h e v e r t i c a l a e r i a l p h o t o g r a p h . An e q u a t i o n f o r t h e amount of r e l i e f d i s p l a c e m e n t , a' - a, w i l l now be d e r i v e d . From t h e geometry o f f i g u r e 5, i t i s c l e a r t h a t t h e s i m i l a r t r i a n g l e s LAB and LaD y i e l d t h e r e l a t i o n s h i p a / f = R / H (3.1) S i m i l a r i l y , t h e t r i a n g l e s LA'C and La'D y i e l d t h e r e l a t i o n s h i p a' / f = R / (H - Z) (3.2) R e a r r a n g i n g e q u a t i o n s (3.1) and ( 3 . 2 ) , e q u a t i o n s f o r a and a' c a n be d e r i v e d : a = Rf / H (3.3) a' = Rf / (H - Z) (3.4) An e q u a t i o n f o r t h e r e l i e f d i s p l a c e m e n t , commonly r e f e r r e d F i g u r e 5. Geometry of a v e r t i c a l a e r i a l p h o t o g r a p h ( a d a p t e d from [ S A B I 7 8 ] , f i g u r e 2.9A). 23 t o as d, c a n t h u s be p r o d u c e d by s u b t r a c t i n g e q u a t i o n (3.3) from e q u a t i o n ( 3 . 4 ) . d = a' - a = (Rf / (H - Z ) ) - (Rf / H) (3.5) A l t e r n a t i v e l y , a s i s done f o r s t a n d a r d p h o t o g r a p h i c m a n i p u l a t i o n s , d can a l s o be d e r i v e d as f o l l o w s : From e q u a t i o n (3.3) and e q u a t i o n (3.4) Rf = aH = a ' ( H - Z) and t h u s d = a' - a = a ' ( Z / H) S u b s t i t u t i n g w i t h e q u a t i o n (3.4) y i e l d s d = (Rf / (H - Z ) ) • (Z / H) Note t h a t t h e r e l i e f d i s p l a c e m e n t , a s c a l c u l a t e d by e q u a t i o n ( 3 . 5 ) , i s p o s i t i v e f o r t e r r a i n above t h e g r o u n d datum (Z>0), z e r o f o r t e r r a i n on t h e g r o u n d datum (Z=0), and n e g a t i v e f o r t e r r a i n below t h e g r o u n d datum (Z<0). From e q u a t i o n ( 3 . 5 ) , i t can a l s o be seen t h a t t h e r e l i e f d i s p l a c e m e n t , d, i s a f u n c t i o n of f o u r v a r i a b l e s : (a) Z, t h e e l e v a t i o n of t h e t e r r a i n a bove t h e g r o u n d datum, (b) H, t h e e l e v a t i o n o f t h e h y p o t h e t i c a l "camera" above t h e g r o u n d datum, (c) f , t h e f o c a l l e n g t h o f t h e h y p o t h e t i c a l "camera", and (d) R, t h e h o r i z o n t a l r a d i a l d i s t a n c e from t h e p r i n c i p a l 24 p o i n t t o t h e t e r r a i n . T h us, a p e r s p e c t i v e image c a n be s y n t h e s i z e d by i n t r o d u c i n g r e l i e f d i s p l a c e m e n t ( a c c o r d i n g t o e q u a t i o n (3.5)) r e l a t i v e t o a h y p o t h e t i c a l p r i n c i p a l p o i n t . The c a l c u l a t i o n o f t e r r a i n v i s i b i l i t y f o r a p e r s p e c t i v e image i s a s f o l l o w s : R e f e r t o f i g u r e 6 . L e t a' be t h e r a d i a l d i s t a n c e on t h e p h o t o g r a p h p r i n t from t h e p r i n c i p a l p o i n t on t h e p r i n t t o t h e p o s i t i o n of t h e t e r r a i n a t c o o r d i n a t e (X,Y) on t h e p r i n t . The t e r r a i n a t c o o r d i n a t e (X,Y) i s t h e n v i s i b l e i f and o n l y i f a l l v i s i b l e t e r r a i n between i t s e l f and t h e p r i n c i p a l p o i n t has p o s i t i o n s on t h e p r i n t c l o s e r t o t h e p r i n c i p a l p o i n t ( i . e . , p o s i t i o n s l e s s t h a n r a d i a l d i s t a n c e a' f r o m t h e p r i n c i p a l p o i n t ) . I f t e r r a i n a t c o o r d i n a t e (X,Y) i s n o t v i s i b l e t h e n t e r r a i n between (X,Y) and (Xp,Y p ) , t h e p r i n c i p a l p o i n t , must b l o c k i t s v i s i b i l i t y t o t h e c a m e r a . The d e t e r m i n a t i o n of one p o i n t of t e r r a i n b l o c k i n g t h e v i s i b i l i t y o f o t h e r t e r r a i n c a n be a c h i e v e d i n t h e f o l l o w i n g manner: R e f e r a g a i n t o f i g u r e 6 . F u r t h e r s u p p o s e t h a t t e r r a i n a t c o o r d i n a t e (Xv,Yv) has e l e v a t i o n Zv above t h e g r o u n d datum, t h a t t h e r a d i a l d i s t a n c e from (Xv,Yv) t o (Xp,Yp) i s Rv, and t h a t i t i s v i s i b l e t o t h e camera w i t h a p o s i t i o n , on t h e p r i n t o f r a d i a l d i s t a n c e A' from t h e p r i n c i p a l p o i n t . Hence, t e r r a i n between (Xv,Yv) and (Xp,Yp) w i l l b l o c k t h e v i s i b i l i t y o f t h e t e r r a i n a t (X,Y) i f 25 F i g u r e 6 . T e r r a i n v i s i b i l i t y g e ometry ( p e r s p e c t i v e ) . 26 A 1 £ a" (3.6) However, i t i s c l e a r from t h e geometry o f f i g u r e 6 t h a t t h e s i m i l a r t r i a n g l e s LA'D and LBC y i e l d t h e r e l a t i o n s h i p A' / f = Rv / (H - Zv) (3.7) and s i m i l a r i l y , t h e t r i a n g l e s La'D and LbE y i e l d t h e r e l a t i o n s h i p a' / f = R / (H - Z) (3.8) R e a r r a n g i n g e q u a t i o n s (3.7) and ( 3 . 8 ) , e q u a t i o n s f o r A' and a' a r e d e r i v e d : A' = Rvf / (H - Zv) (3.9) a' = Rf / (H - Z) (3.10) T h e r e f o r e , s u b s t i t u t i n g i n t o f o r m u l a ( 3 . 6 ) , t e r r a i n between c o o r d i n a t e s (Xv,Yv) and (Xp,Yp) w i l l b l o c k t h e v i s i b i l i t y of t h e t e r r a i n a t c o o r d i n a t e (X,Y) i f Rvf / (H - Zv) £ Rf / (H - Z) (3.11) and h e n c e , i f Rv / (H - Zv) £ R / (H - Z) (3.12) F i g u r e 7 d e m o n s t r a t e s t h e b l o c k e d v i s i b i l i t y r u l e a s d e s c r i b e d by e q u a t i o n ( 3 . 6 ) . In f i g u r e 7 ( a ) , A' > a' and t h e r e f o r e , a c c o r d i n g t o e q u a t i o n ( 3 . 6 ) , t h e t e r r a i n between c o o r d i n a t e s (Xv,Yv) and (Xp,Yp) b l o c k s t h e v i s i b i l i t y of 27 (a) T e r r a i n a t (X,Y,Z) i s not v i s i b l e . Cx.v) (x,,y*) cxf,yr) (b) T e r r a i n a t (X,Y,Z) i s v i s i b l e . datum F i g u r e 7. T e r r a i n v i s i b i l i t y - p e r s p e c t i v e . 28 t h e t e r r a i n a t c o o r d i n a t e ( X , Y ) , as i s shown. F i g u r e 7(b) shows t h e o p p o s i t e , a' > A', and t h e v i s i b i l i t y o f t h e t e r r a i n a t c o o r d i n a t e (X,Y) i s not b l o c k e d by t h e t e r r a i n between c o o r d i n a t e s (Xv,Yv) and ( X p , Y p ) . The t h e o r y of p r o d u c i n g a p e r s p e c t i v e p r o j e c t i o n from an o r t h o g r a p h i c p r o j e c t i o n i s now c o m p l e t e . The r e m a i n d e r o f t h i s s e c t i o n d e a l s w i t h t h e p r o b l e m o f p r o v i d i n g d i f f e r e n t p e r s p e c t i v e v i e w s t o f o r m t h e r e q u i r e d s t e r e o p a i r . V a r y i n g p e r s p e c t i v e v i e w s c a n be a c c o m p l i s h e d by c h o o s i n g d i f f e r e n t p r i n c i p a l p o i n t s f o r t h e h y p o t h e t i c a l "camera". However, s i m p l e as t h i s may seem, c a u t i o n must be t a k e n s u c h t h a t t h e r e i s n e i t h e r t o o l i t t l e n o r t o o much o v e r l a p between t h e l e f t and r i g h t images o f t h e s t e r e o p a i r . F o r a f i x e d f and H, t h e amount of o v e r l a p and t h e amount of v e r t i c a l e x a g g e r a t i o n a r e d e t e r m i n e d by t h e d i s t a n c e between p r i n c i p a l p o i n t s . The c l o s e r t h e p r i n c i p a l p o i n t s , t h e more o v e r l a p and t h e l e s s v e r t i c a l e x a g g e r a t i o n ( i . e . , t h e weaker t h e s t e r e o s c o p i c e f f e c t ) [ S A B I 7 8 ] . Too l i t t l e o v e r l a p r e d u c e s t h e r e g i o n a v a i l a b l e f o r s t e r e o s c o p i c v i e w i n g . F i f t y - f i v e t o s i x t y - f i v e p e r c e n t o v e r l a p i s s u g g e s t e d a s an a p p r o p r i a t e d e g r e e of o v e r l a p [ L I L L 7 9 ] , [ S A B I 7 8 ] . The a l g o r i t h m i m p l e m e n t e d t o s y n t h e s i z e t h e p e r s p e c t i v e s t e r e o p a i r i s d i s c u s s e d i n t h e f o l l o w i n g s e c t i o n . 29 3.2 I m p l e m e n t a t i o n The a l g o r i t h m i m p l e m e n t e d t o s y n t h e s i z e a p e r s p e c t i v e s t e r e o p a i r c r e a t e s two p e r s p e c t i v e images - t h e l e f t and r i g h t images of t h e s t e r e o p a i r - p l u s two c o r r e s p o n d i n g v i s i b i l i t y maps. The o r i g i n a l , o r t h o g r a p h i c image must a l r e a d y be r e g i s t e r e d t o t h e c o r r e s p o n d i n g d i g i t a l t e r r a i n model ( i . e . , a o n e - t o - o n e c o r r e s p o n d a n c e has been e s t a b l i s h e d between t h e e l e m e n t s o f t h e DTM and t h e e l e m e n t s of t h e image) [ L I T T 8 0 ] . Thus, t h e n e c e s s a r y e l e v a t i o n i n f o r m a t i o n i s p r o v i d e d f o r e a c h p i x e l i n t h e o r t h o g r a p h i c image. The a l g o r i t h m d e v e l o p e d f o r t h i s r e s e a r c h i s d e s c r i b e d a s f o l l o w s ( t h e s o u r c e code t o p r o d u c e t h e p e r s p e c t i v e s t e r e o p a i r and t h e c o r r e s p o n d i n g v i s i b i l i t y maps i s p r e s e n t e d i n A p p e n d i x B ) : The l e f t and r i g h t p e r s p e c t i v e images a r e g e n e r a t e d i n d e p e n d e n t l y ; t h e a l g o r i t h m d e s c r i b e d below t o s y n t h e s i z e one p e r s p e c t i v e image i s r e p e a t e d t o c r e a t e t h e two images. The geometry of t h e "camera" ( i . e . , t h e e l e v a t i o n above t h e g r o u n d datum and t h e f o c a l l e n g t h - r e f e r t o f i g u r e 5) i s assumed t o be i d e n t i c a l f o r t h e l e f t and r i g h t p e r s p e c t i v e images; t h e o n l y v a r i a n c e i s geo m e t r y between t h e two images i s t h e l o c a t i o n o f t h e p r i n c i p a l p o i n t s w h i c h a r e u s e r i n p u t . The p r o c e d u r e t o s y n t h e s i z e one p e r s p e c t i v e image i s now d e s c r i b e d : The l i n e s of t h e o r t h o g r a p h i c image and t h e r e g i s t e r e d l i n e s of t h e DTM a r e i n p u t a p a i r a t a t i m e ( i . e . , one 30 image l i n e and the corresponding DTM l i n e ) . The l i n e containing the p r i n c i p a l point (the "centre l i n e " i s input f i r s t ; working outwards, the l i n e s at the edge of the image (and DTM) are input l a s t . The perspective projection i s thus created by displacing each X position of each DTM and image l i n e pair, r a d i a l l y outwards from the p r i n c i p a l point. For example, referr i n g to figure 8, position A is displaced towards A' and, s i m i l a r l y , position B i s displaced towards position B'. The amount of r e l i e f displacement introduced is calculated by equation (3.5). The introduction of displacement i s performed by f i r s t converting the cartesian coordinates, (X,Y), of a position in the o r i g i n a l image to polar coordinates, (R,e). The displaced polar coordinates are then (R+d,©), where d i s the r e l i e f displacement as calculated by equation (3.5). These new polar coordinates are then converted back to cartesian coordinates, (X',Y'). (The conversions from cartesian to polar coordinates and from polar to cartesian coordinates are both performed via software lookup tables.) The image p i x e l value corresponding to position (X,Y) of the o r i g i n a l image i s then assigned to position (X',Y') of the perspective image. When the r e l i e f displacement is introduced, i t i s l i k e l y that the (X',Y') coordinates do not a l i g n exactly with the uniform gr i d of the image. A nearest-neighbour resampling [LILL79] i s performed to generate intermediate p i x e l values. 31 F i g u r e 8. D i r e c t i o n of r e l i e f d i s p l a c e m e n t . 32 A common s i t u a t i o n i s t h a t a d i s p l a c e d p i x e l ( i . e . , one c o r r e s p o n d i n g t o p o s i t i o n ( X ' , Y * ) ) i s n o t v i s i b l e i n t h e p e r s p e c t i v e image. T h i s c o n d i t i o n i s d e t e c t e d and r e s o l v e d i n t h e f o l l o w i n g manner: F o r p i x e l s o f t h e o r t h o g r a p h i c image w i t h t h e same p o l a r a n g l e e, t h e p i x e l s c l o s e s t t o (Xp,Yp) a r e c o n s i d e r e d f i r s t ; t h e ones f a r t h e s t away l a s t . A p p l y i n g t h i s t e c h n i q u e , i f a p i x e l w i t h p o l a r c o o r d i n a t e (r , e ) i s d i s p l a c e d t o a p o s i t i o n ( i . e . , t o a p o l a r c o o r d i n a t e ( r ' , e ) ) t h a t i s a d i s t a n c e J from ( X p , Y p ) , t h e n a n o t h e r p i x e l ( w i t h p o l a r c o o r d i n a t e ( r B , e ) ) t h a t i s s u b s e q u e n t l y c o n s i d e r e d i s v i s i b l e i f and o n l y i f i t i s mapped t o a p o s i t i o n t h a t i s more t h a n a d i s t a n c e J f r o m ( X p , Y p ) . I f t h e d i s t a n c e i s l e s s t h a n J , t h e p i x e l i s n o t v i s i b l e and hence c a n be i g n o r e d . The v i s i b i l i t y map i s c r e a t e d u s i n g t h i s p r o c e d u r e . P i x e l s of t h e o r t h o g r a p h i c image t h a t a r e no t v i s i b l e i n t h e p e r s p e c t i v e image a r e "marked" on t h e map. In t h e above p r o c e d u r e , e q u a t i o n (3.12) i s u s e d t o d e t e r m i n e t h e r e l a t i v e p o s i t i o n s o f two p i x e l s (as a f u n c t i o n o f t h e i r d i s t a n c e s from ( X p , Y p ) ) . Due t o t h e image's u n i f o r m g r i d , i t i s r a r e t h a t one p i x e l ' s p o l a r a n g l e e q u a l s t h a t o f a n o t h e r p i x e l . T h i s p r o b l e m i s a l l e v i a t e d by l i n e a r l y i n t e r p o l a t i n g Rv and Zv f r o m t h e c o o r d i n a t e s o f two v i s i b l e d i s p l a c e d p i x e l s whose p o l a r a n g l e s encompass t h a t o f t h e p i x e l i n q u e s t i o n . A n o t h e r method t o c a l c u l a t e t h e v i s i b i l i t y o f e a c h 33 p i x e l involves the association of radius information with each p i x e l of the synthetic image. The radius of a pixe l in the orthographic image i s recorded as a function of the position of that pi x e l in the perspective image; i f two pixels are displaced to the same position, the one with the lesser radius is the v i s i b l e p i x e l . The pixels do not have to be displaced in any s p e c i f i c order when using this approach. This method i s computationally simpler than the method implemented. However, th i s a l t e r n a t i v e method requires d r a s t i c a l l y more memory to record the r a d i i information. For this reason, the f i r s t method described above was chosen. Another l i k e l y s ituation i s that gaps occur in the synthetic image - no pi x e l of the o r i g i n a l image is displaced or resampled to that p o s i t i o n . These gaps are f i l l e d by using a cubic convolution resampling of the brightness values of the synthetic image [ L I L L 7 9 ] to calculate the intermediate values. (Cubic convolution is used, as opposed to b i l i n e a r interpolation, to provide superior perceptual radiometric results at a small additional computational overhead.) The entire synthetic image is stored in memory u n t i l a l l DTM and orthographic l i n e pairs have been inputted and subsequently transformed. The complete image and the corresponding v i s i b i l i t y map are then output to the appropriate image f i l e and corresponding map f i l e . The algorithm implemented for synthesizing perspective 34 s t e r e o p a i r s p r o d u c e s a v i s u a l l y p l e a s i n g r e s u l t . V i e w i n g f i g u r e 3 s t e r e o s c o p i c a l l y p r o d u c e s no a b n o r m a l t e r r a i n f e a t u r e s ; t h e r a d i o m e t r y o f t h e s t e r e o model c r e a t e d a p p e a r s smooth. 35 4.0 S y n t h e t i c A i r b o r n e S c a n n e r Imagery T h i s c h a p t e r d i s c u s s e s t h e s y n t h e s i s o f an a i r b o r n e ' s c a n n e r image from an o r t h o g r a p h i c image. Methods f o r c a l c u l a t i n g t e r r a i n v i s i b i l i t y , a s v i e w e d by t h e s c a n n e r s y s t e m , and f o r c a l c u l a t i n g p i x e l l a y o v e r a r e a l s o p r e s e n t e d . The s y n t h e t i c image i s o b t a i n e d by s i m u l a t i n g an a i r b o r n e s c a n n e r s y s t e m , w i t h a g i v e n g e o m e t r y , p o s i t i o n e d on a s u i t a b l e p l a t f o r m , s c a n n i n g ( i . e . , s a m p l i n g o r i m a g i n g ) t h e t e r r a i n below i t . The t e r r a i n i s a p p r o x i m a t e d by a d i g i t a l t e r r a i n model t h a t i s r e g i s t e r e d t o t h e o r t h o g r a p h i c image. The e l e v a t i o n i n f o r m a t i o n i s u s e d t o i n t r o d u c e d i s p l a c e m e n t i n t o t h e o r i g i n a l image, a c c o r d i n g t o t h e geometry of t h e s c a n n i n g d e v i c e . T h i s i n f o r m a t i o n i s a l s o u s e d i n t h e v i s i b i l i t y and p i x e l l a y o v e r c a l c u l a t i o n s . F i g u r e 9 i s a s y n t h e t i c s i d e - l o o k i n g a i r b o r n e s c a n n e r image o f t h e S t . Mary Lake r e g i o n of s o u t h e a s t B r i t i s h C o l u m b i a . The o r t h o g r a p h i c image from w h i c h i t i s s y n t h e s i z e d i s t h e same p o r t i o n o f t h e L a n d s a t image u s e d e a r l i e r . F i g u r e s 10 and 11 a r e t h e c o r r e s p o n d i n g v i s i b i l i t y map and p i x e l l a y o v e r map, r e s p e c t i v e l y . 36 F i g u r e 9. A i r b o r n e s c a n n e r image ( S t . Mary L a k e r e g i o n o f s o u t h e a s t B r i t i s h C o l u m b i a ) . F i g u r e 10 . A i r b o r n e s c a n n e r v i s i b i l i t y map. 3 8 F i g u r e 11. A i r b o r n e s c a n n e r p i x e l l a y o v e r map. 39 4.1 Theory The t y p i c a l airborne scanner system (refer to figure 12) contains a rotating imaging assembly that moves the instantaneous f i e l d of view along scan l i n e s . Scan l i n e s run perpendicular to the f l i g h t path of the a i r c r a f t and extend the length (at ground level) of the angular f i e l d of view. An ideal scanner system samples electromagnetic radiation at fixed angular inter v a l s along the scan line? the coverage by the system along the scan l i n e i s complete. An image produced by an airborne scanner system consists of measurements of radiation for a series of scan l i n e s ; each scan l i n e on the ground i s represented by a l i n e on the image [LILL79]. This configuration of an airborne scanner system has two implications: (a) each scan l i n e i s imaged independently of a l l other scan l i n e s , and (b) a one-to-one correspondence exists between a pix e l of an image l i n e and a sampling (imaging) of an instantaneous f i e l d of view of the associated scan 1 ine. With these implications in mind, the geometric theory of imaging for an airborne scanner system i s now presented. (Rules for ca l c u l a t i n g t e r r a i n v i s i b i l i t y to the scanner and for determining-pixel layover are also presented.) 40 F i g u r e 12. O p e r a t i o n o f an a i r b o r n e s c a n n e r s y s t e m . ( A d a p t e d f r o m [ S A B I 6 9 ] , f i g u r e 2.) 41 F i r s t , c o n s i d e r a d i g i t a l t e r r a i n model as e x p l a i n e d i n s e c t i o n 2.2. Then, r e f e r r i n g t o f i g u r e 13, assume t h e a i r b o r n e s c a n n e r s y s t e m t o be a t e l e v a t i o n H above t h e g r o u n d datum and i t s f l i g h t p a t h t o be p a r a l l e l t o t h e y a x i s , d i r e c t l y o v e r t h e c o o r d i n a t e s ( X p , Y ) . F u r t h e r s u p p o s e t h a t t h e t e r r a i n a t c o o r d i n a t e s (X,Y) has e l e v a t i o n Z and i t i s imaged by t h e s y s t e m w i t h a R o t a t i n g Imaging A s s e m b l y (RIA) a n g l e of ©. T h i s a n g l e i s measured from t h e v e r t i c a l ( i . e . , t h e v e r t i c a l i s 0 d e g r e e s ) . C l e a r l y , from t h e g e o m e t r y d i s p l a y e d i n f i g u r e 13, tan© = (X - Xp) / (H - Z) (4.1) and h ence © = a r c t a n { (X - Xp) / (H - Z) } (4.2) E q u a t i o n (4.2) i s t h e i m a g i n g e q u a t i o n f o r t e r r a i n where X > Xp, as shown i n f i g u r e 13. In g e n e r a l : © = a r c t a n { abs{ X - Xp } / (H - Z) } (4.3) From e q u a t i o n ( 4 . 3 ) , i t can be seen t h a t t h e RIA a n g l e , ©, a t w h i c h t e r r a i n ( g r o u n d c o o r d i n a t e ( X , Y ) ) i s imaged a t i s a f u n c t i o n of t h r e e p a r a m e t e r s : (a) Z, t h e e l e v a t i o n o f t h e t e r r a i n above t h e g r o u n d datum, (b) H, t h e e l e v a t i o n o f t h e a i r b o r n e s c a n n e r s y s t e m above t h e g r o u n d datum, and ( c ) Xp, t h e f l i g h t p a t h o f t h e a i r b o r n e s c a n n e r s y s t e m . 42 F i g u r e 13. Geometry o f an a i r b o r n e s c a n n e r s y s t e m . 43 ( E q u i v a l e n t l y , t h i s t h i r d p a r a m e t e r may be r e f e r r e d t o as abs{ X - Xp }, t h e h o r i z o n t a l d i s t a n c e between t h e t e r r a i n and t h e f l i g h t p a t h . ) S i n c e t h e i m a g i n g e q u a t i o n ( 4 . 3 ) i s n o t a f u n c t i o n of t h e y c o o r d i n a t e o f t h e t e r r a i n , a s c a n l i n e i s imaged i n d e p e n d e n t l y of o t h e r s c a n l i n e s ; t h e c a l c u l a t i o n s t o s y n t h e s i z e an a i r b o r n e s c a n n e r image need n o t e x p l i c i t l y c o n s i d e r t h e y c o o r d i n a t e ( a s s u m i n g s c a n l i n e s t o be p a r a l l e l t o t h e x a x i s and hence t h e f l i g h t p a t h t o be p a r a l l e l t o t h e y a x i s ; i . e . , two p o i n t s of t e r r a i n imaged on t h e same s c a n l i n e w i l l have t h e same y c o o r d i n a t e ) . The c a l c u l a t i o n of t e r r a i n v i s i b i l i t y , f o r an a i r b o r n e s c a n n e r s y s t e m w i t h e q u a t i o n ( 4 . 3 ) a s i t s i m a g i n g e q u a t i o n , i s as f o l l o w s : R e f e r r i n g t o f i g u r e 13, t e r r a i n a t g r o u n d c o o r d i n a t e ( X , Y ) , imaged a t an RIA a n g l e e, i s v i s i b l e i f and o n l y i f a l l v i s i b l e t e r r a i n between i t s e l f and t h e f l i g h t p a t h ( g r o u n d c o o r d i n a t e (Xp,Y)) i s imaged a t an RIA a n g l e o f l e s s t h a n 6. F i g u r e 14 d e m o n s t r a t e s t h i s r u l e . In f i g u r e 1 4 ( a ) , ea < eb and Xb i s between Xa and t h e f l i g h t p a t h . T h e r e f o r e , by t h e p r e c e d i n g v i s i b i l i t y r u l e , t e r r a i n a t g r o u n d c o o r d i n a t e (Xa,Y) i s not v i s i b l e , a s i s shown. In f i g u r e 1 4 ( b ) , t h e r e i s no t e r r a i n between g r o u n d c o o r d i n a t e s (Xa,Y) and (Xp,Y) t h a t i s imaged a t an RIA a n g l e l a r g e r t h a n © a . Hence, t e r r a i n a t g r o u n d c o o r d i n a t e (Xa,Y) i s v i s i b l e . 44 (a) Terrain at (Xa,Y) i s not v i s i b l e . (b) Terrain at (Xa,Y) i s v i s i b l e . Figure 14. Terrain v i s i b i l i t y - airborne scanner. 45 4.1.1 Radar C o n s i d e r a t i o n s The geometry of an a i r b o r n e r a d a r i m a g i n g s y s t e m i s v e r y s i m i l a r t o t h a t d e f i n e d f o r t h e a i r b o r n e s c a n n e r s y s t e m ( r e f e r t o f i g u r e 1 3 ) . The d i f f e r e n c e i n t h e two g e o m e t r i e s i s t h e p o s i t i o n of t e r r a i n i n t h e image p r o d u c e d . F o r t h e a i r b o r n e s c a n n e r s y s t e m , t h e t e r r a i n p o s i t i o n i s a f u n c t i o n o f t h e RIA a n g l e . However, t h e p o s i t i o n of t e r r a i n i n a r a d a r image i s a f u n c t i o n of t h e t i m e r e q u i r e d f o r a p u l s e of microwave e n e r g y t o t r a v e l f r o m t h e r a d a r i m a g i n g s y s t e m , t o t h e t e r r a i n , and back t o t h e s y s t e m . 1 T h i s t i m e i s d i r e c t l y p r o p o r t i o n a l t o t h e d i s t a n c e , D, t h e r a d a r p u l s e t r a v e l l e d [ J E N S 7 7 ] . R e f e r r i n g t o f i g u r e 15, t h i s d i s t a n c e w i l l now be c a l c u l a t e d . As f o r t h e a i r b o r n e s c a n n e r s y s t e m , assume t h e r a d a r i m a g i n g s y s t e m t o be a t e l e v a t i o n H above t h e g r o u n d datum and i t s f l i g h t p a t h t o be p a r a l l e l t o t h e y a x i s , d i r e c t l y o v e r t h e c o o r d i n a t e ( X p , Y ) . F u r t h e r assume t h a t t h e t e r r a i n a t c o o r d i n a t e (X,Y) has e l e v a t i o n Z above t h e g r o u n d datum and t h a t t h e r a d a r p u l s e must t r a v e l a d i s t a n c e of 2«D ( i . e . , D i s t h e d i s t a n c e between t h e r a d a r s y s t e m and t h e t e r r a i n a t c o o r d i n a t e ( X , Y ) ) . C l e a r l y f r o m t h e g e o m e t r y shown i n f i g u r e 15, t h e d i s t a n c e D i s g i v e n by t h e f o l l o w i n g 1 F o r a more d e t a i l e d d e s c r i p t i o n o f r a d a r t e c h n o l o g y and r a d i o m e t r y , t h e r e a d e r i s d i r e c t e d t o [ J E N S 7 7 ] , [ L I L L 7 9 ] , [REEV75], and '[SABI78]. 46 F i g u r e 15. Geometry of a r a d a r imaging system. 47 e q u a t i o n : D = s q r t { (Xp - X ) 2 + (H - Z ) 2 } (4.4) T h e r e f o r e , t h e d i s t a n c e t h e r a d a r p u l s e must t r a v e l i s : * 2 • D = 2 • s q r t { (Xp - X ) 2 + (H - Z ) 2 } (4.5) E q u a t i o n (4.5) i s t h e i m a g i n g e q u a t i o n f o r an a i r b o r n e r a d a r i m a g i n g s y s t e m whose geometry i s d i s p l a y e d i n f i g u r e 15. T h i s e q u a t i o n f o r t h e d i s t a n c e t h e r a d a r p u l s e t r a v e l s a n d t h e e q u a t i o n f o r t h e RIA a n g l e ( e q u a t i o n ( 4 . 3 ) ) a r e f u n c t i o n s of t h e same p a r a m e t e r s - t h e e l e v a t i o n s o f b o t h t h e t e r r a i n and t h e a i r b o r n e s y s t e m as w e l l a s t h e x c o o r d i n a t e of t h e f l i g h t p a t h , Xp. As w i t h t h e a i r b o r n e s c a n n e r s y s t e m , t h e y c o o r d i n a t e i s n o t e x p l i c i t l y c o n s i d e r e d i n t h e i m a g i n g e q u a t i o n ; i . e . , a s c a n l i n e i s i n d e p e n d e n t o f o t h e r s c a n l i n e s when i t i s imaged by t h e a i r b o r n e r a d a r i m a g i n g s y s t e m . ( N o t e : t h e a n g u l a r f i e l d of v i e w a s shown i n f i g u r e 15 i s n o t t y p i c a l of a l l r a d a r i m a g i n g s y s t e m s . S i d e - l o o k i n g a i r b o r n e r a d a r [ J E N S 7 7 ] , f o r i n s t a n c e , has i t s f i e l d of view on one s i d e of t h e a i r c r a f t o n l y , h ence i t s name. T h i s f a c t , however, as i n t h e a i r b o r n e s c a n n e r s y s t e m c a s e , h a s l i t t l e o r no e f f e c t on t h e d e r i v a t i o n o f t h e i m a g i n g e q u a t i o n . R e f e r t o f i g u r e 16. ) By c o m p a r i n g t h e g e o m e t r i e s o f t h e a i r b o r n e s c a n n e r s y s t e m and t h e a i r b o r n e r a d a r i m a g i n g s y s t e m ( f i g u r e s 13 and 15 r e s p e c t i v e l y ) , i t i s e v i d e n t t h a t t e r r a i n i s e q u a l l y 48 F i g u r e 16. Geometry o f a s i d e - l o o k i n g r a d a r s y s t e m . 49 v i s i b l e , o r i n v i s i b l e , t o b o t h s y s t e m s ( a s s u m i n g e q u a l g e o m e t r i c p a r a m e t e r s - f l i g h t p a t h s and e l e v a t i o n s - f o r b o t h s y s t e m s ) . T h e r e f o r e , t e r r a i n v i s i b i l i t y f o r t h e r a d a r s y s t e m may be c a l c u l a t e d i n e x a c t l y t h e same manner as f o r th e s c a n n e r s y s t e m ( i . e . , by u s i n g e q u a t i o n ( 4 . 3 ) ) . P i x e l l a y o v e r f o r t h e r a d a r i m a g i n g s y s t e m i s a l s o e a s i l y c a l c u l a t e d . G i v e n two p o i n t s of t e r r a i n , b o t h v i s i b l e , ( r e f e r r i n g t o f i g u r e 17) a t g r o u n d c o o r d i n a t e s (Xa,Y) and ( X b , Y ) , assume t e r r a i n e l e v a t i o n s and p u l s e t r a v e l d i s t a n c e s of Za, 2-Da and Zb, 2«Db r e s p e c t i v e l y . P i x e l l a y o v e r t h e r e f o r e o c c u r s when Da = Db (4.6) o r , i n more d e t a i l , when s q r t { (Xp - X a ) 2 + (H - Z a ) 2 } = s q r t { (Xp - X b ) 2 + (H - Z b ) 2 } (4.7) W h i l e s y n t h e s i z i n g t h e a i r b o r n e s c a n n e r image, t h e v i s i b i l i t y and p i x e l l a y o v e r i n f o r m a t i o n f o r an a i r b o r n e r a d a r s y s t e m may a l s o be s y n t h e s i z e d . The v i s i b i l i t y i n f o r m a t i o n i s e q u i v a l e n t f o r t h e two s y s t e m s and t h e p i x e l l a y o v e r c a l c u l a t i o n d o e s n o t r e q u i r e more i n f o r m a t i o n t h a n t h a t n e c e s s a r y t o s y n t h e s i z e t h e s c a n n e r i m a g e r y . The methods d e s c r i b e d i n t h i s s e c t i o n f o r s y n t h e s i z i n g a i r b o r n e s c a n n e r images and f o r c a l c u l a t i o n o f t e r r a i n v i s i b i l i t y and p i x e l l a y o v e r a r e p u r e l y g e o m e t r i c a l i n n a t u r e . The a l g o r i t h m s i m p l e m e n t e d t o a c c o m p l i s h t h i s 50 airborne radar imaCjincj system * (XOO ( X O 0 (*P,V> i ground dlalum F i g u r e 17. P i x e l l a y o v e r - r a d a r . 51 s y n t h e s i s a r e d e t a i l e d i n t h e f o l l o w i n g s e c t i o n . 4.2 I m p l e m e n t a t i o n The a l g o r i t h m t o s y n t h e s i z e an a i r b o r n e s c a n n e r image c r e a t e s a new image p l u s c o r r e s p o n d i n g v i s i b i l i t y and p i x e l l a y o v e r maps ( p r o d u c t i o n o f t h e maps i s o p t i o n a l ) . The o r i g i n a l o r t h o g r a p h i c image must a l r e a d y be r e g i s t e r e d t o a c o r r e s p o n d i n g d i g i t a l t e r r a i n model ( i . e . , a o n e - t o - o n e c o r r e s p o n d e n c e has been e s t a b l i s h e d between t h e e l e m e n t s o f t h e DTM and t h e e l e m e n t s of t h e image) [ L I T T 8 0 ] . T h i s a s s o c i a t e s t h e n e c e s s a r y e l e v a t i o n i n f o r m a t i o n t o e a c h p i x e l o f t h e image. A s s u m i n g t h i s r e g i s t r a t i o n h as been s u c c e s s f u l l y p e r f o r m e d , t h e a l g o r i t h m i m p l e m e n t e d i s as f o l l o w s ( t h e s o u r c e c o d e t o p r o d u c e t h e s y n t h e t i c a i r b o r n e s c a n n e r i m a g e r y and t h e c o r r e s p o n d i n g v i s i b i l i t y and p i x e l l a y o v e r maps i s p r e s e n t e d i n A p p e n d i x C ) : The g r i d of a s y n t h e s i z e d image l i n e i s a f u n c t i o n of t h e RIA a n g l e ( r e f e r t o s e c t i o n 4.1) and t h e g r i d i n t e r v a l i s a f u n c t i o n of t h e a n g u l a r f i e l d of v i e w of t h e h y p o t h e t i c a l a i r b o r n e s c a n n e r s y s t e m . The l i n e s of t h e o r t h o g r a p h i c image and t h e r e g i s t e r e d l i n e s o f t h e DTM a r e i n p u t a p a i r a t a t i m e ( i . e . , one image l i n e and t h e c o r r e s p o n d i n g DTM l i n e ) . F o r e a c h image and DTM l i n e p a i r , t h e c o r r e s p o n d i n g l i n e o f t h e s c a n n e r image i s c r e a t e d u s i n g e q u a t i o n ( 4 . 3 ) ; f o r e a c h X p o s i t i o n 52 i n t h e o r i g i n a l l i n e , a © i s c a l c u l a t e d f o r t h e new l i n e . (The a r c t a n f u n c t i o n i s c a l c u l a t e d v i a a s o f t w a r e l o o k u p t a b l e . ) The image p i x e l v a l u e c o r r e s p o n d i n g t o p o s i t i o n X of t h e o r i g i n a l image l i n e i s a s s i g n e d t o p o s i t i o n © o f t h e s y n t h e s i z e d image l i n e . . W i t h t h i s t r a n s f o r m a t i o n , i t i s l i k e l y t h a t © does n o t a l i g n e x a c t l y w i t h t h e u n i f o r m g r i d o f t h e image. The s i t u a t i o n i s r e s o l v e d by p e r f o r m i n g a s i m p l e one d i m e n s i o n a l l i n e a r r e s a m p l i n g [ L I L L 7 9 ] t o p r o d u c e t h e i n t e r m e d i a t e p i x e l v a l u e s . A n o t h e r p o s s i b i l i t y i s t h a t a d i s p l a c e d p i x e l ( i . e . , one c o r r e s p o n d i n g t o p o s i t i o n ©) may not be v i s i b l e i n t h e new a i r b o r n e s c a n n e r image. T h i s c o n d i t i o n i s d e t e c t e d and r e s o l v e d i n t h e f o l l o w i n g manner: F o r a g i v e n l i n e i n t h e o r i g i n a l image, t h e p i x e l s c l o s e s t t o Xp a r e c o n s i d e r e d f i r s t ; t h e ones f a r t h e s t away l a s t . U s i n g t h i s method, i f a p i x e l o f t h e l i n e i s h y p o t h e t i c a l l y imaged a t t h e RIA a n g l e ©' , t h e n a n o t h e r p i x e l o f t h a t l i n e t h a t i s s u b s e q u e n t l y c o n s i d e r e d i s v i s i b l e i f and o n l y i f i t i s h y p o t h e t i c a l l y imaged a t an RIA a n g l e g r e a t e r t h a n ©'. I f t h e RIA a n g l e i s l e s s t h a n o r e q u a l t o ©', t h e p i x e l i s not v i s i b l e and hence can be i g n o r e d . T h i s p r o c e d u r e i s u s e d t o c a l c u l a t e t h e v i s i b i l i t y map. P i x e l s o f t h e o r i g i n a l image t h a t a r e n o t v i s i b l e i n t h e s y n t h e s i z e d image a r e "marked" on t h e map. I t i s a l s o l i k e l y t h a t a p i x e l i s d i s p l a c e d more t h a n one g r i d c e l l from i t s p r e d e c e s s o r . T h i s p r o d u c e s gaps i n t h e new l i n e a s no p i x e l o f t h e o r i g i n a l l i n e i s mapped or 53 r e s a m p l e d t o t h a t p o s i t i o n . In t h i s s i t u a t i o n , t h e gaps a r e f i l l e d by u s i n g l i n e a r i n t e r p o l a t i o n t o c a l c u l a t e t h e i n t e r m e d i a t e v a l u e s . P i x e l l a y o v e r can be c a l c u l a t e d by u s i n g e q u a t i o n ( 4 . 7 ) . However, t h e s q u a r e r o o t s on b o t h s i d e s of t h e e q u a t i o n a r e r e d u n d a n t ; i f e q u a t i o n (4.7) i s t r u e t h e n so i s (Xp - X a ) 2 + (H - Z a ) 2 = (Xp - X b ) 2 + (H - Z b ) 2 (4.8) The p i x e l l a y o v e r map i s t h e r e f o r e c a l c u l a t e d as f o l l o w s : F o r e a c h p i x e l of t h e o r i g i n a l l i n e t h a t i s v i s i b l e i n t h e s y n t h e s i z e d l i n e ( v i s i b i l i t y c a l c u l a t i o n s a r e p e r f o r m e d b e f o r e p i x e l l a y o v e r c a l c u l a t i o n s ) , t h e s q u a r e of D ( i . e . , t h e s q u a r e of o n e - h a l f of t h e r a d a r p u l s e d i s t a n c e ) i s c a l c u l a t e d f o r e a c h v i s i b l e p i x e l u s i n g e q u a t i o n ( 4 . 4 ) . T h e s e c a l c u l a t i o n s a r e p e r f o r m e d o n l y once f o r e a c h p i x e l . Then, e m p l o y i n g e q u a t i o n (4.8) and t h e v a l u e s j u s t c a l c u l a t e d , v i s i b l e p i x e l s a r e compared f o r " e q u a l " p u l s e d i s t a n c e . Due t o t h e d i s c r e t e n a t u r e of DTMs, t h i s e q u a l i t y w i l l s e l d o m , i f e v e r , o c c u r . T h i s s i t u a t i o n i s r e s o l v e d as f o l l o w s : I f t h e p u l s e d i s t a n c e of t h e v i s i b l e p i x e l i n q u e s t i o n f a l l s between t h e p u l s e d i s t a n c e s o f two o t h e r c o n s e c u t i v e v i s i b l e p i x e l s , t h e n t h e f o r m e r p i x e l as w e l l as t h e l a t t e r p i x e l whose p u l s e d i s t a n c e i s n e a r e r t h e p u l s e d i s t a n c e i n q u e s t i o n a r e b o t h c o n s i d e r e d " e q u a l " a s c a l c u l a t e d by e q u a t i o n ( 4 . 8 ) . I f two p i x e l s a r e " e q u a l " as c a l c u l a t e d 54 above, t h e n t h e y a r e b o t h "marked" on t h e p i x e l o v e r l a y map. I f two p i x e l s a r e n o t " e q u a l " i n p u l s e d i s t a n c e t h e n t h e map i s not "marked". The f i n a l map c o r r e s p o n d s t o t h e o r t h o g r a p h i c image. Once t h e new l i n e has been c o m p l e t e l y s y n t h e s i z e d , i n c l u d i n g r e s a m p l i n g and i n t e r p o l a t i o n , and t h e v i s i b i l i t y and p i x e l l a y o v e r c a l c u l a t i o n s a r e c o m p l e t e d , t h e s y n t h e s i z e d image l i n e and t h e a s s o c i a t e d map l i n e s a r e o u t p u t t o t h e c o r r e s p o n d i n g image f i l e and map f i l e s . The e n t i r e p r o c e s s i s r e p e a t e d f o r e a c h l i n e o f t h e o r i g i n a l image. As d i s p l a y e d i n f i g u r e 9, t h i s a l g o r i t h m p r o d u c e s a v i s u a l l y p l e a s i n g r e s u l t , however a c o m p a r i s o n t o an a c t u a l a i r b o r n e s c a n n e r image of t h e same g e o g r a p h i c a r e a was n o t p o s s i b l e . 55 5.0 C o n c l u s i o n T h i s t h e s i s has p r e s e n t e d t h r e e t e c h n i q u e s t o use a s u r f a c e model t o a l t e r t h e geometry o f a r e a l image. The t h r e e t e c h n i q u e s a r e : (a) s y n t h e s i z i n g o r t h o g r a p h i c s t e r e o p a i r s , (b) s y n t h e s i z i n g p e r s p e c t i v e s t e r e o p a i r s , and ( c ) s y n t h e s i z i n g a i r b o r n e s c a n n e r i m a g e r y . The s u r f a c e i s d e t e r m i n e d by a d i g i t a l t e r r a i n model (DTM). The DTM and t h e r e a l image a r e r e g i s t e r e d t o one a n o t h e r t h u s p r o v i d i n g t h e n e c e s s a r y geometry - r a d i o m e t r y c o r r e s p o n d a n c e . U s i n g t h e DTM, t h e geometry of t h e r e a l image i s a l t e r e d t o p r o d u c e a s y n t h e t i c image. The a l g o r i t h m s i m p l e m e n t e d f o r t h i s r e s e a r c h have been k e p t c o m p u t a t i o n a l l y s i m p l e . F o r example, t h e i m p l e m e n t a t i o n s f o r s y n t h e s i z i n g o r t h o g r a p h i c s t e r e o p a i r s and a i r b o r n e s c a n n e r i m a g e r y assume t h e f l i g h t p a t h of t h e h y p o t h e t i c a l s e n s i n g p l a t f o r m t o be p a r a l l e l t o t h e Y a x i s of t h e DTM. Such a c o n s t r a i n t can be c o n s i d e r e d u n r e a l i s t i c ( b u t can be a l l e v i a t e d by a p r i o r r o t a t i o n of t h e DTM as r e q u i r e d ) . However, t h e r e s u l t s o f t h e t h r e e i m p l e m e n t a t i o n s a p p e a r a c c u r a t e and, i n a l l c a s e s , p r o d u c e a v i s u a l l y p l e a s i n g r e s u l t . 56 5.1 F u t u r e Work As p r e v i o u s l y s t a t e d , t h e a l g o r i t h m s f o r t h i s r e s e a r c h a r e s i m p l e i n n a t u r e . T h e s e i m p l e m e n t a t i o n s c an e a s i l y be e x t e n d e d t o p r o d u c e more p r a c t i c a l r e s u l t s . F o r example, t h e f l i g h t p a t h of t h e h y p o t h e t i c a l s e n s i n g p l a t f o r m c o u l d be d e p i c t e d a s a f u n c t i o n o f x and y ( i . e . , p l a t f o r m p o s i t i o n = f ( x , y ) ) . A l t e r n a t i v e l y , t h e f l i g h t p a r a m e t e r s o f t h e p l a t f o r m ( r o l l , yaw, and p i t c h ) may a l s o be r e q u i r e d t o be s i m u l a t e d f o r c e r t a i n a n a l y s i s ( e g . , p l a t f o r m m o d e l l i n g ) . T h e s e i m p l e m e n t a t i o n s have p r o v i d e d a p o t e n t i a l l y u s e f u l t o o l . F u t u r e r e s e a r c h c a n now be d i r e c t e d t o w a r d s e x p l o i t i n g t h e s e t o o l s f o r a p p l i c a t i o n s i n c l u d i n g : p h o t o i n t e r p r e t a t i o n a i d s , e v a l u a t i o n of t h e a c c u r a c y of image r e c t i f i c a t i o n a l g o r i t h m s , and a n a l y s i s of d i s t o r t i o n c o r r e c t i o n r o u t i n e s f o r a i r b o r n e s c a n n e r i m a g e r y . 57 B i b l i o g r a p h y [BATS76] B a t s o n , R. M., K a t h l e e n Edwards, and E. M. E l i a s o n . " S y n t h e t i c S t e r e o and LANDSAT P i c t u r e s " , P h o t o q r a m m e t r i c E n g i n e e r i n g and Remote  S e n s i n g , V o l . 42, No. 10, O c t o b e r 1976. pp. 1279-1284. [BERN75] B e r n s t e i n , R a l p h , and D a l l a m G. F e r n e y h o u g h , J r . " D i g i t a l Image P r o c e s s i n g " , P h o t o g r a m m e t r i c  E n g i n e e r i n g and Remote S e n s i n g , V o l . 41, No. 12, December 1975. pp. 1465-1476. [DOYL78] D o y l e , F r e d e r i c k J . "The Next Decade o f S a t e l l i t e Remote S e n s i n g " , P h o t o g r a m m e t r i c  E n g i n e e r i n g and Remote S e n s i n g , V o l . 44, No. 2, F e b r u a r y 1978. pp. 155-164. [JENS77] J e n s o n , H., L. C. Graham, L. J . P o r c e l l o , and E. M. L e i t h . " S i d e - l o o k i n g A i r b o r n e Radar", S c i e n t i f i c A m e r i c a n , V o l . 237, 1977. pp. 84-95. [ J O L L 7 9 ] J o l l i f f e , B r u c e , and B a r y W. P o l l a c k . "UBC PASCAL - P a s c a l / U B C Programmer's G u i d e " , Computing C e n t r e , U n i v e r s i t y of B r i t i s h C o l u m b i a , September 1979. [ L I L L 7 9 ] L i l l e s a n d , Thomas M., and R a l p h W. K i e f e r . Remote S e n s i n g and Image I n t e r p r e t a t i o n . J o h n W i l e y & Sons I n c . , New Y o r k , 1979. pp. 77-85, 443-445, 488-527, 560-561, 577-578, 579-583. [ L I T T 8 0 ] L i t t l e , James J . " A u t o m a t i c R e c t i f i c a t i o n o f LANDSAT Images U s i n g F e a t u r e s D e r i v e d From D i g i t a l T e r r a i n M o d e l s " , T e c h n i c a l R e p o r t 80-10, Department o f Computer S c i e n c e , U n i v e r s i t y of B r i t i s h C o l u m b i a , December 1980. [MILL58] M i l l e r , C. L., and R. A. Laflamme. "The D i g i t a l T e r r a i n M odel - T h e o r y and A p p l i c a t i o n " , P h o t o g r a m m e t r i c E n g i n e e r i n g , V o l . 24, No. 3, June 1958. pp. 433-442. 58 [NEWM73] [NEWM79] [REEV75] [SABI69] [SABI78] [WOOD80] Newman, W i l l i a m M., and R o b e r t F. S p r o u l l . P r i n c i p l e s of I n t e r a c t i v e Computer G r a p h i c s , f i r s t e d i t i o n . M c G r a w - H i l l I n c . , New Y o r k , 1973. pp. 267-268. Newman, W i l l i a m M., and R o b e r t F. S p r o u l l . P r i n c i p l e s o f I n t e r a c t i v e Computer G r a p h i c s , s e c o n d e d i t i o n . M c G r a w - H i l l I n c . , New Y o r k , 1979. pp. 54-58, 333-336. Re e v e s , R o b e r t G., e d . Manual of Remote S e n s i n g . The A m e r i c a n S o c i e t y of Photogrammetry, F a l l s C h u r c h , V i r g i n i a , 1975. pp. 399-535, 915-916, 2062-2110. S a b i n s , F l o y d F. " T h e r m a l I n f r a r e d Imagery and i t s A p p l i c a t i o n t o S t r u c t u r a l M a pping i n S o u t h e r n C a l i f o r n i a " , G e o l o g i c a l S o c i e t y A m e r i c a B u l l e t i n , V o l . 80, 1969. pp. 397-404. S a b i n s , F l o y d F. Remote S e n s i n g P r i n c i p l e s and  I n t e r p r e t a t i o n , W. H. Freeman and Company, San F r a n c i s c o , 1978. pp. 25-29, 100-105, 177-231, 246-247, 405-414. Woodham, R o b e r t J . " P h o t o m e t r i c Method f o r D e t e r m i n i n g S u r f a c e O r i e n t a t i o n f r o m M u l t i p l e Images", O p t i c a l E n g i n e e r i n g , V o l . 19, No. 1, J a n u a r y / F e b r u a r y 1980. pp. 139-149. 59 A p p e n d i x A T h i s a p p e n d i x c o n t a i n s t h e s o u r c e code t h a t was u s e d t o p r o d u c e s y n t h e t i c o r t h o g r a p h i c s t e r e o p a i r s . T h i s s o u r c e i s w r i t t e n i s UBC PASCAL [ J O L L 7 9 ] , LISTING OF FILE L I F E : o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1 (* *) 2 (* *) 3 (* S Y N T H E T I C O R T H O G R A P H I C S T E R E O P A I R S *) 4 . (* *) 5 (* With Input of a DTM and a c o r r e s p o n d i n g r e g i s t e r e d Image, an *) 6' (* o r t h o g r a p h i c s t e r e o p a i r of that Image i s c r e a t e d . Resampling Is *) 7 (* done to remove q u a n t i z a t i o n e f f e c t s . *) 8 (* *) 10 11 c o n s t 12 LINE = 1; PIXEL = 2; 13 MAX_LINE_LEN = 255; 14 PROMPT = ' : ' ; 15 COMPRESSED = t r u e ; 16 INTEGRAL = t r u e ; 17 READ_REOD = t r u e ; 18 MIN_INTENSITY = 0; 19 MAX_INTENSITY = 255; 20 MAX_IMAGE_SIZE = 256; 21 INIT_VALUE = -1; 22 DEFAULT = -1; 23 DEG_T0_RAD = 0.0174532925; 24 25 26 type 27 MSG_TYPE = ( LINE_PROMPT, PIXEL_PROMPT, UNEXPECTED_BLANK, 28 UNEXPECTED_EOF, UNRECCMD, NULLNO, NON_INTEGRAL_VALUE, 29 UNIT_0_UNASSIGNED, INVALID_FILE, UNEXPECTED_INPUT_EOF, 30 INVALID_NO, EOF_NO, EOLN_MSG, NOT_IN_RANGE, 3 1 ENTER_GRID_SPACING, ENTER_CNTR_COL, 32 UNIT_1_UNASSIGNED, ENTER_ANG_CONV ); 33 INPUT_LINE = a r r a y (. 1..MAX_LINE_LEN+1 .) of char; 34 INT_LINE = a r r a y (. 0..MAX_LINE_LEN+2 .) of 1nt; 35 REAL_LINE = a r r a y (. 0..MAXLINELEN+2 .) of r e a l ; 36 37 38 VALUE_RANGE = ( POSITIVE, N0N_ZER0, INTENSITY, LINE_LENGTH, 39 IMAGE_SIZE, NONNEGATIVE, PERCENT ); 40 4 1 STR_3 = a r r a y (. 1..3 .) of char; 42 STR_4 = a r r a y (. 1..4 .) of char; 43 STR_6 = a r r a y (. 1..6 .) of char; 44 STR_8 = a r r a y (. 1..8 .) of char; 45 STR_44 » a r r a y (. 1..44 .) of char; 46 STR_50 = a r r a y (. 1..50 .) of c h a r ; 47 48 IMAGEFILE = f i l e of INPUTLINE; 49 DTMFILE = f i l e of a r r a y ( 1..(MAX_LINE_LEN+1)*2 ) of ch a r ; 50 51 52 ° 53 54 v a r 55 DIM : a r r a y ( 1..2 ) of Integer; 56 IMAGE_FILE, 57 LFILE, RFILE : IMAGEFILE: 58 DTM_FILE : DTMFILE; 61 * * * * * * * * * * * * * . . . . at at at at at UJ D D at T3 TJ TJ "C T3 TJ X! TJ TJ TJ at at TJ TJ TJ TJ TJ at at O £ £ U-at L. L, L, L. L. i_ C L. L. l_ at at L. L. c L. L. L. at at Z O CJ a * at CO <D IC (0 CO (0 co co (0 CO at at 10 co ro ro CO CO at at Q Z Z f-at 3 3 3 3 3 3 3 3 3 3 at at 3 . 3 OJ 3 3 3 at at £ t- t- Ul at L. L. (_ L L. L. f- c L. L_ at at L. L. — 1- L_ L- at at O u- u. in LU at 0 0 0 0 0 0 0 0 0 0 at at 0 c 0 0 0 0 0 at at U. * at «*- U- M- M- <*- »*- M- at at ro H- 0 44- 14- at at t—i at at at at OJ a at at C C c c _ l E at at at 4— at E at co ro CO ro tl 01 at at B at 0 . • at QJ at S- L. L t-D at •H at at OJ at c 0 Ul at at 4- 4-1 4-i * in at • - at at CO JQ a Z at 10 at £. C •• 1_ t-at > at UJ • - c at 10 at OJ o 4-4 at > at 0 0 1- 0 0 at 10 at Z *—* OJ at >. at — UJ _ J at in at <4- «4- QJ <4-at at 4-4 D) at 10 at 0 or 1 at at Dl at 01 at _ i L. OJ at at 0 UJ 1 1- at OJ at OJ CM at at 1 OJ at OJ at £1 Zi D UJ z at r at 4-* CO at *•> at t- O) ^ - c at at - J < -1 >—| at 4-4 at ~ C 0) at at OJ • . at +J at < UJ H-l at at •4- c at M- at a 44 UJ at at > or Li. at >. at L QJ at 0 at z c - J Ul at •4- at in 1 LU at at Q) . . . . Dl • at at • - 1-4 •4- 4-4 Z L. at 0 at in - J • 4 o 4—K at at D ) ^ 4—V a> CM at 10 at • - u. OJ Ul at at LU < UJ < at TJ at QJ Z 4^  " , — at OJ at Ul _ l 01 tM at to at or or _l s ST at QJ at 44 UJ LU Ul c at t_ at Ul o 1 OJ •-. at c at CL o 4—1 . 4 4—1 co at 10 at C Z _ l Z •4-LU at 3 at u. Z o • - UJ • - < K in at 0 at £ . 4 UJ u. LU OJ at 3 at 4—t 4-4 z at TJ at Z i—i z Z — £ z C at at O L. £ z at at - J • • - J 3 at 0! at 4-4 - J w UJ L. Z t-t . . at at CJ d> z 4—1 0 at 10 at • • l U J 1 at O at _J ID: TM OJ 4-1 _l o UJ at 0 at Dl 4—1 O _! Ul 0 at 0) at 1 - 2 1- I at 0 at 1 —' 1- M DJ-J 1 I-J in •• •• Z at c at OJ 4— I-I JO at c at « ZD t-i Z2 1— at i. at (- < 1/1 in OJ 1 1 « at 3 at Ul ro 1- 4-4 at —- at Q. _ l CL C2 at £L at z UJ 44 t-< or UJ t- - J at u at Z c Ul OJ z u. at at •- Z 1 z z £ at at 4-1 cr c z UJ 1- O UJ or 1 at at 4-1 •4-O UJ •—t 1 at 3 at UJ 4-1 t- 4—1 LU • • at OJ at UJ -—- 4—1 or in < z < i- at OJ at - J z _) Ul D at 0 at Z Z3 _ l a L. at at a. £ t- 3 at J : at 1 < 4—t O o at 1- at i-< •• CL OJ at at > • • 4-4 _l in o. at +4 at K or U- < LU UJ at at 1 Z . 4 •• 0) at at UJ h- Z at at zo 1 1 £ or Z at z at lor >- i _ in — 0) at at z >- 1 4—1 UJ L. 1-4 at i- at a. Ul £ 4—I 1 I" at < at 1- K ro (0 -F at 0 at 4-1 u CJ CJ CO at 0 at z zz> 1- Q - J at or at r> in •• UJ jr CN at c at «*- at _ J < in . . UJ < > at «*- at 4—1 _ l Q l_ < 1 at t- at o- 1 £ o t. — at at 4-4 u . £ - Z i - in at at < ro UJ 1- at or at Z O or < at 10 at CO -i CJ in ~ or at to at > C > or z> at O at •H £ K Z at c at C L. OJ - J « UJ UJ t- at c at CO a. at LL. at cj in U-at 0 at • - CO co L. —1 u . £ Z in at 0 at or > z at at 1 at •4- at in > > O 1—4 at at i— UJ at L_ at —• D 1L UJ at +4 at z in •• L. L. w - J at at in Ul Z at 0 at or ui £ ro Z at ro at o *—' £ ro <0 or 1 at co at C! UJ at »*- at K £ CJ > at t. at 4-4 LU x > > O Ul z at !_ at i - z z _ J at at in < 4—4 in at ro at in 1- w or CJ t—1 at CO at co < 1—t 1 CJ at 10 at Z -~ X at 4— at z < O •- or < or at 4— at > or - J Ul z at c at w u . Ul »-« L at o at UJ UJ _ J in UJ K Ul £ i - at V at . • 1 W at 0 at in | £ u. ai at OJ at CJ £ o £ _1 « | « in at OJ at z £ < or at at I- 1- < Ul •F at 13 at < . . , - , a 1 a Z £ 1 1 at TJ at _ l £ t- £ 1- at +4 at £ -I Z or 10 at at J 1/1 O or h- £ M UJ LU Ul at at o ZO D 1—1 in at ro at 13 u . a UJ at O at a UJ l |UJ Z < I K 1- t- at Q at Ul Z 1  1 at L. at -I « 1 1 o - O - J at Or at in _ i i - (— i—i in in in i-H *—4 at or at 1 1 D o o at co at _ J U- 4- i— r CJ Z • at < at M M U l Z or Ul > >- Or or at < at 1- 1- < < < at at < J LU UJ •H < U I O % s at a u. o I-H Q. or in in 3 at S at UJ Ul UJ Ul at o at CJ Q CJ in L. a. 15 1 at Or at at or at CJ O or or or at QJ at 0 in or or at O at 0! OJ 01 OJ OJ 0) OJ OJ OJ 01 at o at at O at OJ OJ 01 OJ | U J yj at LL at L, L. i- L. L. L. (_ t- L, L. at u . at c c c c c at at t_ L. L L UJ Q > t - at at 3 3 3 3 3 3 3 3 3 3 at at 0 0 0 0 0 at at 3 3 3 3 LL -< z z at at •0 T> TJ T) TJ TJ TJ TJ TJ TJ at at at at TJ TJ TJ TJ 1—1 a o LU at at OJ OJ OJ OJ OJ 0) OJ OJ OJ OJ at at +-• 4-4 •f at at QJ OJ QJ QJ _ l C5 o O at at O (J 0 O O 0 O (J 0 0 at at 0 0 0 0 o at at 0 O CJ 0 at at 0 0 0 0 0 0 0 0 0 0 at at c c c c c at at 0 0 0 0 UJ at at L, L. L, c L t- L L. i . L, at at 3 3 3 3 3 at at {_ f- t- I-_ J at at a o. a a 0. a a a a a at at M- *4- 1- at at a a o. a *—I at at at at at at LL. at at at at at at OF * * * * * * * * 4> * + * * * + <5 Z coO'-cNroTfLnici>ooc'JO l jTJU)tJ?tiJtj?tj7tjjti>tJjJfi}tiJI> ^ c N r o ^ i j ^ i j j h - c x j a O ^ c N r ^ T f i n u j r - e o c o O — cNm i ^ t ^ t ^ i ^ i ^ i ^ t ~ t ^ t ^ c i ) o o a j c o e o c o o 3 o o c o t j o c o c j j r o LISTING OF FILE L I F E : o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1 17 118 (* ############################0^^ *) 1 19 (* *) 120 (* I n t r o d u c e d i s p l a c m e n t Into the o r i g i n a l Image to c r e a t e two new *) 121 (* images - the l e f t and r i g h t images of the s t e r e o p a i r . The amount *) 122 (* of di s p l a c m e n t i n t r o d u c e d at a p a r t i c u l a r p i x e l i s a f u n c t i o n of *) 123 (* the r e l a t i v e e l e v a t i o n at that p i x e l , the l o c a t i o n of the hypo- *) 124 (* t h e t i c a l s c a n n i n g d e v i c e , and the angle of convergence of tha t *) 125 (* d e v i c e . A one di m e n s i o n a l b i l i n e a r r e s a m p l i n g p r o c e s s i s performed *) 126 (* t o c r e a t e the new images. •) 127 (* *) 129 p r o c e d u r e DISPLACE; 130 131 v ar 132 DLINE, ILINE, 133 LLINE, RLINE : INT_LINE; 134 LFACT, RFACT : REAL_LINE; 135 I, J , X, XDIFF : i n t e g e r ; 136 COS_THETA. SINTHETA, 137 XLPREV, XRPREV, 138 Z, XR, XL : r e a l ; 139 140 141 beg 1n 142 143 C0S_THETA := cos( CONVERGENCE ); 144 SIN_THETA := s i n ( CONVERGENCE ); 145 146 DLINE := READ_DTM_LINE ( DTM_FILE, not READ_REOD ); 147 ILINE := READ_IMAGE_LINE( IMAGE_FILE, not READ_REOD ); 148 149 f o r I := 1 to DIM(LINE) do 150 begi n 151 152 f o r <J : = 1 to DIM(PIXEL) do 153 b e g i n 154 155 LFACT(J) := 0.0; 156 RFACT(d ) := 0.0; 157 LLINE(d) := MININTENSITY; 158 RLINE(d) := MIN_INTENSITY; 159 160 end (* f o r d * ) ; 16 1 162 163 XLPREV := CENTERCOL + SIN_THETA * DLINE(CENTER_COL) / GRID_SPAC; 164 XRPREV := CENTER_COL - SIN_THETA * DLINE(CENTER_COL) / GRID_SPAC; 165 166 f o r X := (CENTERCOL- 1) downto 1 do 167 b e g i n 168 169 XDIFF := X - CENTER_COL; 170 Z := DLINE(X) / GRID_SPAC; 171 XL := CENTER_COL + C0S_THETA * XDIFF + 172 SIN_THETA * Z; 173 XR := CENTER_COL + C0S_THETA * XDIFF -174 SIN_THETA * Z; LISTING OF FILE L I F E : o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 175 176 i f (XL > O) and (XL < (DIM(PIXEL)+1)) and (XL < XLPREV) then 177 b e g i n 178 RESAMPLE( XL, ILINE(X), LLINE, LFACT ); 179 XLPREV := XL: 180 end (* If (XL > 0) ... * ) ; 181 182 1f (XR > O) and (XR < (DIM(PIXEL)+1)) and (XR < XRPREV) then 183 b e g i n 184 RESAMPLE( XR, ILINE(X), RLINE, RFACT ); 185. XRPREV := XR; 186 end (* i f (XR > 0) ... * ) ; 187 188 189 end (* f o r X * ) ; 190 . 191 192 XLPREV := CENTER_COL - C0S_THETA + SINTHETA * DLINE(CENTER_COL-1) / GRID_SPAC; 193 XRPREV := CENTER_COL - C0S_THETA - SINTHETA * DLINE(CENTER_COL-1) / GRID_SPAC: 194 195 f o r X := CENTER_COL to DIM(PIXEL) do 196 b e g i n 197 198 XDIFF := X - CENTER_COL; 199 Z := DLINE(X) / GRID_SPAC; 200 XL := CENTER_COL + C0S_THETA * XDIFF + 201 SIN_THETA * Z; 202 XR := CENTER_COL + C0S_THETA * XDIFF -203 SIN_THETA * Z; 204 205 i f (XL > 0) and (XL < (DIM(PIXEL)+1)) and (XL > XLPREV) then 206 b e g i n 207 RESAMPLE( XL, ILINE(X), LLINE, LFACT ); 208 XLPREV := XL; 209 end (* i f (XL > 0) . . . *) ; 210 211 i f (XR > O) and (XR < (DIM(PIXEL)+1)) and (XR > XRPREV) then 212 b e g i n 213 RESAMPLE( XR, ILINE(X), RLINE, RFACT ); 214 XRPREV := XR; 215 end (* i f (XR > 0) ... * ) ; 216 217 218 end (* f o r X * ) ; 219 220 221 INTERPOLATE( LLINE, LFACT ); 222 INTERPOLATE( RLINE, RFACT ); 223 224 WRITE_IMAGE_LINE( LFILE, LLINE, 1 ); 225 WRITE_IMAGE_LINE( RFILE, RLINE, 1 ): 226 227 i f I < DIM(PIXEL) then 228. b e g i n 229 DLINE := READ_DTM_LINE ( DTM_FILE, READ_REQD ); 230 ILINE := READ_IMAGE_LINE( IMAGE_FILE, READREOD ); 231 end (* i f I < DIM(PIXEL) *) 232 LISTING OF FILE L I F E : o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 233 end (* f o r I * ) ; 234 235 236 end (* DISPLACE * ) ; 237 238 239 240 (* *) 24 1 (* *) 242 (* Set up and a t t a c h the f i l e s n e c e s s a r y f o r the system. U n i t 0 i s the *) 243 (* assumed input f o r the o r i g i n a l DTM. If i t i s not a s s i g n e d on the MTS *) 244 (* RUN command, the f i l e name w i l l be prompted f o r . U n i t 1 i s assumed *) 245 (* inp u t f o r the o r i g i n a l r e g i s t e r e d image. I t s f i l e name w i l l a l s o be *) 246 <• prompted f o r i f not a s s i g n e d . The f i l e a s s i g n e d to *) 247 (* to u n i t 10 w i l l be used f o r the output of the l e f t s y n t h e t i c image and I*) 248 (* the f i l e a s s i g n e d to u n i t 11 w i l l be used f o r the output of the r i g h t *) 249 (* s y n t h e t i c image. If these u n i t s a r e not a t t a c h e d , they w i l l d e f a u l t *) 250 (• to MTS temporary f i l e s -LEFT* and -RIGHT* r e s p e c t i v e l y . *) 251 (* *) 252 (* *) 253 p r o c e d u r e FILES; 254 255 v a r 256 • DTMFNAME, IMGFNAME : INPUT_LINE; 257 258 259 beg i n 260 261 262 • DTMFNAME := ' '; 263 DEFAULT FNAME( 'DEFAULT 0=*DUMMY*;' ); 264 GET_FNAME( 'QUERY FDNAME 0;', 0, DTMFNAME ); 265 266 i f DTMFNAME = '*DUMMY*' then 267 b e g i n 268 269 PRINT MSG( UNIT 0 UNASSIGNED, " , 0 ); 270 DTMFNAME := READ STRING; 271 . w h i l e DTMFNAME = ' ' do 272 beg 1 n 273 PRINT MSG( INVALID FILE, '', 0 ); 274 DTMFNAME := READ STRING; 275 i f DTMFNAME = 'CANCEL' or DTMFNAME = 'HALT' then 276 hal t; 277 end (• w h i l e DTMFNAME = ' ' * ) ; 278 279 end (* If DTMFNAME = '*DUMMY*' * ) ; 280 281 282 IMGFNAME := ' '; 283 DEFAULT FNAME( 'DEFAULT 1=*DUMMY*;' ); 284 GET_FNAME( 'QUERY FDNAME 1;', 0, IMGFNAME ); 285 286 If IMGFNAME = '*DUMMY *' then 287 beg i n 288 289 PRINT MSG( UNIT 1 UNASSIGNED, '', 0 ); 290 IMGFNAME := READ_STRING; LISTING OF FILE L I F E : o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 291. w h i l e IMGFNAME = ' ' do 292 b e g i n 293 PRINT_MSG( INVALIO_FILE, " . 0 ): 294 IMGFNAME := READ_STRING; 295 If IMGFNAME = 'CANCEL' or IMGFNAME = 'HALT' then 296 h a l t ; 297 end (* w h i l e IMGFNAME = ' ' * ) ; 298 299 end (* If IMGFNAME = ' *DUMMY*' * ) ; 300 301 302 DEFAULT_FNAME( 'DEFAULT 10=-LEFT/C ; ' ); 303 DEFAULT_FNAME( 'DEFAULT 1 1 = -RIGHT0; ' ); 304 r e s e t ( DTM_FILE, DTMFNAME ); 305 r e s e t ( IMAGE_FILE, IMGFNAME ); 306 rewr1te( LFILE, 10 ); 307 r e w r i t e * RF ILE, 11 ); 308 309 310 end (* FILES * ) ; 31 1 312 313 314 (* *) 315 (* *) 316 (* Prompt f o r and get the dimensions of the DTM. *) 317 (* *) 319 p r o c e d u r e GET_DIMENSIONS; 320 321 b e g i n 322 323 PRINT_MSG( LINE_PROMPT, ' ', O ); 324 DIM(LINE) := tr u n c ( GET_NUM( IMAGE_SIZE, INTEGRAL ) ); 325 326 PRINT_MSG( PIXEL_PROMPT, ' ', 0 ); 327 DIM(PIXEL) := tr u n c ( GET_NUM( IMAGE_SIZE, INTEGRAL ) ); 328 329 end (* GET_DIMENSIONS * ) ; 330 331 332 334 • (* *) 335 (* Read and r e t u r n the end of an Input l i n e . I f COMPRESS Is t r u e then *) 336 (* remove m u l t i p l e embedded b l a n k s , o t h e r w i s e r e t u r n the a c t u a l Input *) 337 (* l i n e . The l e n g t h of the Input l i n e Is a l s o r e t u r n e d . *) 338 (* *) 339. (* ri#ffff#ffff^ff«ffff#ffffffffffffff»ffff««Hffffff»«»l¥^«^^^^ff»ff«»^ff>/»ff»ff/fffff/fffffffffff««ff/ff/ff/fff/f//ff *) 340 f u n c t i o n GET_EOLN( var STR:INPUT_LINE; COMPRESS:boolean ) : Integer; 341 <3> 342 v a r 343 I : i n t e g e r ; 344 LAST_CHAR_BLANK : boolean; 345 CHR : char; 346 347 348 b e g i n LISTING OF FILE L I F E : o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID = L I FE 349' I := 0; 350 LAST_CHAR_BLANK := f a l s e ; 351 352 w h i l e - e o f ( INPUT ) and - e o l n ( INPUT ) do 353 b e g i n 354 read( CHR ); 355 If CHR -"= ' ' or not COMPRESS then 35G begl n 357 1f LAST_CHAR_BLANK and I>0 then 358 b e g i n 359 I : = I + 1 ; 360 STR(I) := ' ' 361 end; 362 I : = I + 1 ; 363 STR(I) := CHR; 364 LAST_CHAR_BLANK : = f a l s e 365 end; 366 e l se 367 LAST_CHAR_BLANK := t r u e 368 end; 369 370 If not COMPRESS and I>0 then 37 1 GET_EOLN := I - 1; 372 e l se 373 GET_E0LN := I 374 375 end (* GET_E0LN * ) ; 376 377 378 379 380 (* 381 (* 382 (* Retu r n the numerical v a l u e of a s t r i n g 1n the Input stream. I f 383 (* INTEGRAL_VALUE 1s t r u e then the s t r i n g must r e p r e s e n t an Integer, 384 (* o t h e r w i s e a r e a l number. The numerical v a l u e must a l s o be In the 385 (* range s p e c i f i e d by RANGE. 386 (* 387 (* 388 f u n c t i o n GET NUM( RANGE : VALUE RANGE; 389 INTEGRAL_VALUE : boolean ) : r e a l ; 390 391 v a r STR : INPUT_LINE; 392 VALID : boolean; 393 VALU : r e a l ; 394 I, d, MULT : i n t e g e r ; 395 396 b e g i n 397 re p e a t 398 VALID := t r u e ; 399 read( STR ); 400 i f eof( INPUT ) then (* CHECK FOR EOF *) 401 beg 1 n 402 VALID := f a l s e ; 403 PRINT_MSG( EOFNO, ' ', 0 ) 404 • end; 405 e l se 406 beg 1 n LISTING OF FILE L I F E : o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID = LIFE 407 VALU := 0.0: (* GET INTEGRAL PART *) 408 I : = 1 ; 409 MULT := 1 ; 4 10 w h i l e I <= MAX_LINE_LEN and STR(I) = ' ' do 411 I : = I + 1 ; 412 i f STR(I) = '+' or STR(I) = '-' then 413 beg 1n 414 i f STR(I) = '-' then 415 MULT := -1; 416 I : = I + 1 4 17- end; 4 18 w h i l e STR(I) i n (. '0'..'9' .) do 4 19 b e g i n 420 VALU := 10.0 * VALU + ord( STR(I) ) - o r d ( ' O ' ) ; 421 I := I + 1 422 end; 423 i f STR(I) = '.' then 424 b e g i n (* GET FRACTIONAL PART *) 425 J := 10; 426 I := I + 1; 427 w h i l e STR(I) i n (. '0'..'9' .) do 428 b e g i n 429 VALU := VALU + ( ( o r d ( S T R ( I ) ) - o r d ( ' 0 ' ) ) / 0 ) ; 430 I := I + 1; 431 J := d * 10 4 32 end 433 end; 434 i f STR(I) -•= ' ' or ( eoln(INPUT) and I = MAX_LINE_LEN+1 ) then 435 b e g i n (* INVALID NUMBER *) 436 VALID := f a l s e ; 437 i f STR(I) ->= ' ' then 438. PRINT_MSG( INVALID_NO, STR(I), 1 ) 439 e l s e 440 i f RANGE i n (. PERCENT .) then 441 b e g i n 442 VALID := tr u e ; 443 MULT := 1; 444. VALU := DEFAULT; 445 end (* If RANGE i n * ) ; 446 e l s e 447 PRINT_MSG( NULLNO. ' ', O T 448 end 449 e l s e i f INTEGRAL_VALUE and trunc(VALU) -•» VALU then 450 b e g i n 451 VALID := f a l s e ; 452 PRINT_MSG( NON_INTEGRAL_VALUE, " , 0 ) 453 end 454 e l s e i f STR(I) = ' ' and ( STR(I-1)='-' or STR(I-1)='+' ) then 455 b e g i n 456 VALID := f a l s e ; ^ 457 PRINT_MSG( UNEXPECTEDBLANK, " . 0 ) 1^ 458 end 459 e l s e i f (RANGE = POSITIVE and (MULT < 0 or VALU = 0.0)) or 460 (RANGE = IMAGESIZE and (MULT < O or 461 VALU < 1 or VALU > MAX_IMAGE_SIZE)) or 462 (RANGE = LINE_LENGTH and (MULT < 0 or 463 VALU < 1 or VALU > DIM(PIXEL))) or 464 (RANGE = INTENSITY and (MULT < O or LISTING OF FILE L I F E r o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 465 VALU < MIN INTENSITY or 466 VALU > MAX INTENSITY)) or 467 (RANGE = NON NEGATIVE and MULT < 0) or 468 (RANGE = PERCENT and (MULT < 0 or 469 VALU < 0 or VALU > 100)) or 470 (RANGE = NON_ZERO and VALU = 0.0) then 471 b e g i n 472 VALID := f a l s e ; 473 PRINT_MSG( NOT_IN_RANGE, " , 0 ) 474 end; 475 end; 476 u n t i l VALID; 477 GET NUM := VALU * MULT 478 end (* GET_NUM * ) ; 479 480 481 482 (* *) 483 (* *) 484 (* I n t e r p o l a t e a l l u n d e f i n e d p i x e l v a l u e s between the f i r s t d e f i n e d *) 485 (* p i x e l of the Image l i n e - ILINE - and the l a s t d e f i n e d p i x e l of the *) 486 (* Image l i n e . The new v a l u e s a re c a l c u l a t e d as a f u n c t i o n of the *) 487 (* v a l u e s of the n e a r e s t d e f i n e d p i x e l s ( I . e . the ones on e i t h e r s i d e *) 488 (* of the u n d e f i n e d p i x e l ). *) 489 (* *) 490 (* *) 491 p r o c e d u r e INTERPOLATE( var ILINE : INT_LINE; var FACT : REAL_LINE ); 492 493 var 494 X, XX, XEND, START, 495 STOP, INCREMENT, I : i n t e g e r ; 496 497 498 begi n 499 500 X : = 1 ; 501 w h i l e FACT(X) = 0 and X < DIM(PIXEL) do 502 1ncr( X ); 503 504 XEND := DIM(PIXEL); 505 w h i l e FACT(XEND) = 0 and XEND >= 1 do 506 decr( XEND ); 507 508 1ncr( X ); 509 r e p e a t 510 51 1 If FACT(X) = O then 512 b e g i n 513 514 I := ILINE(X-I); 515 START := X; 516 wh1le FACT(X) = 0 do 517 1ncr( X ); 518 STOP := X - 1; 519 INCREMENT := round( (ILINE(X) - ILINE(START- 1)) / (X - START 520 f o r XX := START to STOP do 521 b e g i n 522 I := I + INCREMENT; co LISTING OF FILE L I F E : o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 523 ILINE(XX) := round( (I + ILINE(XX) * FACT(XX)) / 524 ( 1 . 0 + FACT(XX) ) ); 525 end (* f o r XX * ) ; 526 527 end (* If FACT(X) < 1 * ) ; 528 1ncr( X ); 529 530 unt11 X >= XEND; 531 532 533 end (* INTERPOLATE * ) ; 534 535 536. 537 • (* 538 (* 539 (* P r i n t the message s p e c i f i e d by MSG to the output stream. The 540 (* parameters STRING and SIZE may be Involved 1n the d e t a i l s of 54 1 (* t h a t message. 542 . (* 543 (* 544 p r o c e d u r e PRINT MSG( MSG : MSG TYPE; STRING : INPUT LINE; 545 SIZE : Integer ); 546 547 c o n s t 548 MSG_PROMPT = ' : ' ; 549 550 var 551 I , J 1nteger; 552 STR : INPUT_LINE; 553 554 555 beg 1 n 556 557 SET_PREFIX( MSG_PROMPT, 1 ); 558 559 If MSG In (. LINE PROMPT, UNIT 0 UNASSIGNED, 560 UNIT_1_UNASSIGNED, ENTER_GRID_SPACING .) then 561 w r 1 t e l n ; 562 563 c a s e MSG of 564 UNEXPECTED_EOF 565 wr1te1n(' Unexpected EOF -- Ignored'); 566 UNREC_CMD 567 b e g i n 568 wr1te1n(' I n v a l i d command -- Input l i n e 1gnored'); 569 If -eo1n( INPUT ) then 570 I := GET_EOLN( STR, COMPRESSED ) 571 end; 572 EOLN_MSG 573 begl n 574 I := GET EOLN( STR, COMPRESSED ); 575 1f I 0 then 576 b e g i n 577 w r f t e ( ' I n v a l i d c h a r a c t e r ( s ) : "') 578 WRITE_STRING( STR, I ); 579 wr1te1n('" -- Ignored') 580 end cn LISTING OF FILE L I F E : o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID = L I FE 581 end; 582 LINE_PROMPT 583 w r i t e l n ( ' S E n t e r number of l i n e s of DTM and IMAGE ( I n t e g e r (1-256})'); 584 PIXEL_PROMPT 585 w r 1 t e l n ( ' S E n t e r number of p i x e l s per l i n e ( I n t e g e r {1-256})'); 586 EOF_NO 587 w r i t e l n ( ' S U n e x p e c t e d EOF, En t e r number'); 588 NULL_NO 589 wr1te!n( 'SNot e x p e c t i n g n u l l l i n e -- Ignored; E n t e r number' ); 590 NON_INTEGRAL_VALUE: 591 w r 1 t e l n ( ' R N o n - I n t e g r a l v a l u e . Re-enter number'); 592 UNEXPECTED_BLANK: 593 wr i t e l n('(^Unexpected blank. Re-enter number'); 594 N0T_IN_RANGE 595 w r i t e l n ( ' S O u t of range, Re-enter number'); 596 UNIT_0_UNASSIGNED: 597 wr1te1n(' L o g i c a l u n i t 0 has not been a s s i g n e d . ' , 598 EOL, '& Enter FDname of l o c a t i o n of DTM ' ) ; 599. UNIT_1_UNASSIGNED: 600. w r i t e l n ( ' L o g i c a l u n i t 1 has not been a s s i g n e d . ' , 601 EOL, '& Enter FDname of l o c a t i o n of IMAGE ' ) ; 602 INVALID_FILE 603 w r i t e l n ( ' I n v a l i d FDname. Enter a g a i n o r ' , EOL, 604 'SEnter "CANCEL" to te r m i n a t e program'); 605 UNEXPECTED_INPUT_EOF: 606 w r i t e l n ( ' Unexpected EOF encountered on i n p u t ' , 607 ' -- DTM s i z e updated'); 608 INVALID_NO 609 b e g i n 610 w r 1 t e l n ( ' S l n v a l i d c h a r a c t e r , "', STRING(I), '", Re-enter number'); 611 I := GET_E0LN( STR, COMPRESSED ) 612 end; 613 ENTER_GRID_SPACING: 614 w r 1 t e l n ( ' S E n t e r DTM g r i d s p a c i n g ( p o s i t i v e R e a l ) ' ) ; 615 ENTER_CNTR_COL 616 w r 1 t e l n ( ' S E n t e r c e n t r e column f o r p r o j e c t i o n ( I n t e g e r {1-', 617 DIM(PIXEL):0,'})'); 618 ENTER_ANG_CONV 619 w r i t e l n ( ' S E n t e r a n g l e of convergence ( i n p o s i t i v e d e g r e e s ) ' ) ; 620 621 end (* c a s e * ) ; 622 y 623 1f MSG i n (. LINE_PROMPT, PIXEL_PROMPT, INVALID_NO, 624 NON_INTEGRAL_VALUE, UNEXPECTED_BLANK, N0T_IN_RANGE, 625 UNIT_0_UNASSIGNED, UNIT_1_UNASSIGNED, INVALID_FILE, 626 ENTER_GRID_SPACING, ENTER_CNTR_COL, ENTER_ANG_CONV, 627 E0F_N0, NULL_N0 .) then 628 r e a d l n ; 629 630 SET_PREFIX( PROMPT, 1 ) 631 632 ° 633 end (* PRINT_MSG * ) ; 634 635 636 638 (* *) 71 co 01 2 •3 in CM O UJ 3 E -J O. t-« C o Pj. — 14. I £ 44 [_ K C QJ CO QJ 0) 1/1 QJ Q) Q) 4 J - I- C - D.~ «*-QJ O 0) J : r +4 c 44 — C £ 0 1. O QJ L B « -«*- C **-0 3 0) — jO C F CO OJ 01 44 Q. O w-o (0 IT — 44 C JD Q) 3 SZ in C E TJ QJ L. CO 3 0 OJ O" M- — L. QJ OJ HI > X L. — co a c 44 — I_ QJ JO OJ oj J : a 3 44 a) i- J : m 44 E 44 QJ L. 44 tO O 44 > *4- «*- J_ JD L. 01 O OJ > 0 O Q. C 3 LU O 44 a OJ u I tn Di Q — • c < 3 i- — UJ L QJ E or QJ «- 3 £ <*- in <t- 44 3 tn —i O JO CO z at — 4t * c % CO % QJ % — * o at o at JO at at •• % D % O % UJ % or % I % Q % < % UJ * or at .. % LU % _J * 4-1 * U . % £ % l -% % LU t _J ui at ~ Z L-at u. 4-1 QI at I J a at £ I OJ at i— 1—44 at o z C at 4i — at t_ at co •• •• at > at at w at UJ at 2 at >-i at _J at I at £ at f— at D at I at o at < at UJ at or UJ at Z at c w at o -in at — L. at 44 co at O > at c at 3 at «-at at OJ OJ JO •+ IE in CM * — CM + + CM CM # * r — . —« *" 4—1 _, W V N4—1 ^> & a 0 LU UJ TJ -J - J > 4—1 U. u. _ l 1 1 UJ X H- t - UJ i—< O D z CL 4-1 4—V '—-S-4 _l c £ 44 OJ U l 4-1 c c II - J O -— 44 4—( U . 0 II UJ o 2 O £ UJ t - 4-4^. - J or D (—1 1 1 II • w £ o LU 1-< 44 2 o U l 01 1—1 4—t 1 or Dl - J o L < <4~ 0 U l **- or E D D < TJ c 0) at at at at at ui at _j 44 at i- 3 E at u. Q. L. at ICO at ui — H-at CJ at < 44 t. at £ C 01 at 4-i QJ D) at tn 0J at OJ OJ 44 at — £_ c at — C L -at s-at 0) O at 0) r. 44 at I 44 c % 44 — at C at E o L. at o 0) at L. tn <4-at u- c «-at 0 3 at Qi — JO at c 44 at — to OJ at — i. jr at QJ 44 at ra a at O u-at c o at — 44 at C E at TJ 0) i-at to 3 O at OJ a M- • at L. QJ 4— at tn > QJ at C A L X at 0) 3 co — at r B C Q at 44 — at QJ JO L at QJ XI 0) at 3 44 oi Q. at J. r at 44 E 44 Q) at s_ 44 at tn o 44 > at »*- i_ jo at 1-01 at Q 0) > 0) at O Q. C C at ui O O at . or 0) c_> at I tn Dl at o — • C at < 3 L. — at LU L. OJ E at or QJ K- 3 at Si tn at <t- 44 3 tn at 1-4 o jO co at at c co * 0) at 0 at O at JO at at •• at at D at O at UJ at or at I ' at o at < at UJ at or at at at UJ at _j at 4-at u_ at ui at CJ at < at E at 4-1 at at •• at at uj at _j at H at u. at | at UJ uj at CJ 2 i -at < 4-< Qi at E _) Dl at 4-. | oi at K 4 4 at t. z C at co 4-H — at > at •• •• at w at uj at Z at 4-4 at _j at | at ui at CJ at < at £ at 4-, at I at o at < at UJ at or ui * Z at c 4-4 at O - J i i at — i. at 44 to at o > at c at 3 at «-at at O 4-1 TJ u. J O m ui < Z X £ •-• 4-4 n —J CL UJ w w II C _ l £ 44 Q) HH 4-4 C J t U . CJ — U l •F I z U l O II 4-4 Q O 44 _ l O < I UJ £ — ^ UJ or 4-1 4-c c5 I I w < O w - . UJ £ < 44 2 4-4 UJ 01 4-4 4-1 | or D> JO L. < C «- O U l — — «- or Dl QJ D < £ < TJ C OJ at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at * * * 4f « « * * » « » * » * iC S 2 IT IC? "S If? SS'i toO>Q^™n*iiiibt~BO>OrcinTi\r>iOt~cD o> O ^ CMCo^iAtjj^comO-'-cMn^.jViDr- co OJ o *- CM cn in ID 3 sssssssssssssss LISTING OF FILE L I F E : o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID = LIFE 697 (* Read a s t r i n g from the Input stream removing a l l l e a d i n g b l a n k s . *) 698 (* The s t r i n g 1s then r e t u r n e d . *) 699 • (* *) 700 (* *) 701 f u n c t i o n READ_STRING : INPUT_LINE; 702 703 v a r 704 I Integer; 705 STR : INPUTLINE; 706 707 708 b e g i n 709 710 STR := ' '; 711 I := 0; 712' r e p e a t 713 1ncr( I ); 714 read( STR(I) ); 7 15 1f STR(I) = ' ' and I = 1 then 716 I := 0; 717 u n t i l eof(INPUT) or eoln(INPUT) or (I -= 0 and STR(I) = ' ') 7 18 or I = MAX_LINE_LEN; 719 720 READ_STRING := STR; 721 722 723 end (* READ_STRING * ) ; 724 725 726 727 728 (* *) 729 (* *) 730 (* Resample u s i n g a simple one dimensional b i l i n e a r scheme. The d a t a *) 731 (* t o be resampled Is i n t e n s i t y I at x - l o c a t l o n X. The r e s u l t s a r e *) 732 (* I n s e r t e d In the Image l i n e ILINE. *) 733 (* *) 734 (* fftiff^«ff#fffftiffffff«^«ff^»«V»Mff^^ff^»ff»^»^V/fff/f^ff^»ff^ff^ff»«M»»^ri»¥»ff^»Vff^rV//>/////»fff/ *) 735 p r o c e d u r e RESAMPLE( X : r e a l ; I : Integer; var ILINE : INT_LINE; 736 var FACT : REAL_LINE ); 737 738 var 739 LO, HI : Integer; 740 L0_FACT, HI_FACT, 741 L0_I, HI_I ; r e a l ; 742 743 744 b e g i n 745 746 LO := t r u n c ( X ); 747 HI : = LO + 1; 748 LO_FACT := HI - X; 749 HI_FACT := X - LO; 750 751 1f (LO > 0) and (LO_FACT <> 0) then 752 b e g i n 753 754 L O J := ILINE(LO) * FACT(LO) + I * LO_FACT; LISTING OF FILE L I F E : o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 755 FACT(LO) := FACT(LO) + LOFACT; 756 ILINE(LO) := round( LO_I / FACT(LO) ); 757 758 end (* 1f (LO > O) ... * ) ; 759 . 760 1f (HI <= DIM(PIXEL)) and ( H I F A C T <> 0) then 761 b e g i n 762 763 HI I 764 FACT(HI) 765 ILINE(HI) ILINE(HI) * FACT(HI) + I * HI_FACT; FACT(HI) + H I F A C T ; round( HI I / FACT(HI) ); 766 767 end (* If (HI <= DIM(PIXEL)) ... * ) ; 768 769 770 end (* RESAMPLE * ) : 771 772 773 775 (* *) 776 (* I n i t i a l i z e the system by s e t t i n g up the f i l e s , g e t t i n g the dimensions *) 777 (* of the DTM, and r e a d i n g the n e c e s s a r y system parameters. *) 778 (* *) 779 (* *) 780 p r o c e d u r e SYS_INIT; 781 782 v a r 783 I, J Integer; 784 785 786 b e g i n 787 788 SET_PREFIX( PROMPT, 1 ); 789 FILES; 790 GET_DIMENSIONS; 791 792 PRINT_MSG( ENTER_GRID_SPACING, '', 0 ); 793 GRID_SPAC := GET_NUM( POSITIVE, not INTEGRAL ); 794 795 PRINT_MSG( ENTER_CNTR_COL, '', 0 ); 796 CENTER_COL := t r u n c ( GET_NUM( LINE_LENGTH, INTEGRAL ) ); 797 798 PRINT_MSG( ENTER_ANG_CONV, '', 0 ); 799 CONVERGENCE := GET_NUM( NONNEGATIVE, not INTEGRAL ) * 800 DEG_TO_RAD; 801 802 803 end (* SYSTEMINITIALIZATION * ) ; 804 805 806 808 (* *) 809 (* If a system e r r o r o c c u r s , output the message MESSAGE and h a l t the *) 810 (* e x e c u t i o n of the system. *) 811 (* *) 812 (* #################H############ff#####ffft###############################H# *) LO LISTING OF FILE L I F E : o r t h o . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 813 p r o c e d u r e SYSTEM_ERROR( MESSAGE : STR_50 ); 814 815 b e g i n 816 817 w r l t e l n C ===> SYSTEM ERROR ===> '.MESSAGE ); 818 h a l t ; 819 820 821 end (* SYSTEMERROR * ) ; 822 823 824 825 826 (* *) 827 (* *) 828 (* W r i t e the l i n e LINE to the f i l e IMAGE s t a r t i n g at p i x e l START. *) 829 (* I t Is assumed that each p i x e l has a v a l u e between 0 and 255. *) 830 (* *) 832 p r o c e d u r e WRITE_IMAGE_LINE( var IMAGE : IMAGEFILE; 833 LINE : INT_LINE; START : Integer ); 834 835 v a r 836 I : Integer; 837 838 839 b e g i n 840 84 1 IMAGED := ' . '; 842.. 843 f o r I := 1 to (START-1) do 844 IMAGEP(I) := ch a r ( MIN_INTENSITY ); 845 846 f o r I := START to DIM( PIXEL ) do 847 IMAGEP(I) := char( LINE(I) ); 848 849 put( IMAGE ); 850 851 852 end (* WRITE_IMAGE_LINE * ) ; 853 854 855 856. (* fY«ff»^ffM#ff«»«i¥ff«^^^»^ffffffffff^ffVM«»^^^ffffffMri^ffff^ffff»l»//»^ff^ff»ff»»»»ryff//ff/f^»¥//##// *) 857 (* *) 858 (* W r i t e the s t r i n g STR to the p r e s e n t output stream. The s t r i n g Is of *) 859 (* l e n g t h SIZE. If the l e n g t h (s l e s s than one, the o p e r a t i o n does not *) 860 (* take p l a c e . *) 861 (* *) 862 (* »H¥VHHH»liHHIiMHIIMMMHHHMMV»MI4HIIMMM#¥HMMItH»MMIi»HH^H^MMH¥M^^VMII^^H»¥»» HMHMII *) 863 p r o c e d u r e WRITE_STRING( STR : INPUTLINE; SIZE : Integer ); 864 865 v a r 866 I : Integer; 867 868 869 b e g i n 870 LISTING OF FILE L I F E : o r t h o . S t e r . s 12:54 P.M. <JUNE 12, 1982 ID = LIF E 871 1f SIZE > 0 then 872 f o r I := 1 to SIZE do 873 wr1te( STR(I) ) 874 875 876 end (* WRITE_STRING * ) ; 877 878 879 880 (* 881 (* 882 (* I n i t i a l i z e the system and then proceed to d i s p l a c e the o r i g i n a l 883 (* Image as a f u n c t i o n of I t s r e l a t i v e h e i g h t (as s p e c i f i e d by the DTM). 884 (* 885. (* 886 b e g i n (* MAIN ROUTINE *) 887 888 SYS INIT; 889 DISPLACE; 890 891 892 end (* MAIN ROUTINE * ) . -J 76 Appendix B This appendix contains the source code that was used to produce synthetic perspective stereo p a i r s . This source i s written i s UBC PASCAL [JOLL79], I D = L I F E L I S T I N G OF F I L E L I F E : p e r s p . s t e r . s 1 2 : 5 4 P . M . J U N E 1 2 . 1982 R S P E 1 (* 2 (* 3 (* 4 (* 5 (* € (* 7 (* 8 (* 9 ( • 1 0 (* 1 1 12 13 14 1 5 ' 1G 17 18 19 2 0 21 2 2 2 3 24 2 5 2 6 27 2 8 2 9 3 0 31 3 2 3 3 34 3 5 3 6 3 7 3 8 3 9 4 0 41 4 2 4 3 44 4 3 46 4 7 48 4 9 5 0 ' 51 5 2 5 3 54 5 5 5 6 5 7 5 8 P E C T I V E I M A G E V I S I B I L I T Y M A P With Input of a DTM and a c o r r e s p o n d i n g r e g i s t e r e d Image, a s t e r e o p a i r of p e r s p e c t i v e Images of the D T M , a c c o r d i n g to the I n t e n s i t y v a l u e s of the Inputted Image, a r e c r e a t e d as well as two c o r r e s p o n d i n g v i s i b i l i t y maps f o r the D T M . c o n s t L I N E 0 C T 1 0 C T _ 3 0 C T 5 0 C T 7 RDS X L E F T DTM * ) * ) * ) * ) * ) + ) + ) * ) * ) * ) 1 P I X E L • = 2 ; 1 OCT 2 -= 2 ; 3 OCT 4 • = 4 ; 5 OCT 6 • = 6 ; 7 OCT 8 • = 8 ; 1 THT = 2 ; 1 Y 2 ; 1 RIGHT = = 2 ; 1 IMGE = 5 2 ; M A X _ L I N E _ L E N PROMPT COMPRESSED I N T E G R A L READ_REQD R E S E T _ R E O D M I N _ I N T E N S I T Y M A X _ I N T E N S I T Y M A X _ I M A G E _ S I Z E M A X _ H 0 R Z N _ S I Z E WORDS_PER_ENTRY B Y T E S _ P E R _ W O R D U N D E F I N E D D E F A U L T DEG TO RAD = 2 5 5 ; = t r u e : = t r u e ; = t r u e ; = t r u e ; • 0 ; = 2 5 5 ; = 2 5 6 ; = max( 3 6 0 , M A X _ I M A G E _ S I Z E + 1 ) ; = 1; = 4 ; = - 1 ; = - 1 ; = 0 . 0 1 7 4 5 3 2 9 2 5 ; type MSG T Y P E L I N E _ P R O M P T , P I X E L _ P R O M P T , U N E X P E C T E D _ B L A N K , U N E X P E C T E D _ E O F , U N R E C _ C M D , N U L L _ N O , N O N _ I N T E G R A L _ V A L U E , U N I T _ 0 _ U N A S S I G N E D , I N V A L I D _ F I L E , U N E X P E C T E D _ I N P U T _ E O F , I N V A L I D _ N O , E 0 F _ N 0 , E O L N _ M S G , N O T _ I N _ R A N G E , E N T E R _ E L E V A T I O N , E N T E R _ C E N T E R _ X _ C O O R D , E N T E R _ G R I D _ S P A C I N G , E N T E R _ F O C A L _ L E N G T H , E N T E R _ P R I N T _ S I Z E , P R I N T _ P R I N T _ S I Z E , U N I T 1 U N A S S I G N E D , ENTER CENTER Y COORD ) ; I N P U T L I N E - a r r a y ( . 1 . .MAX L I N E LEN+1 • ) of char; INT L I N E = a r r a y ( . 0 . .MAX" L I N E LEN+2 . ) of i n t ; R E A L L I N E = a r r a y ( . 0 . . MAX " L I N E LEN+2 . ) of r e a l ; S H 0 R T _ L I N E = a r r a y ( . 0 . .MAX L I N E L E N + 2 . ) of s h o r t ; I N T ARRAY = a r r a y ( . 0 . .MAX L I N E LEN+2 • ) of INT L I N E ; S H 0 R T _ A R R A Y = a r r a y ( . 0 . .MAX _ L I N E _ L E N + 2 . ) of S H O R T _ L I N E H 0 R Z N _ L I N E = a r r a y ( . 0 . MAX _ H O R Z N _ S I Z E . ) of s h o r t ; LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 59 GO VALUE_RANGE = ( POSITIVE, NON_ZERO, INTENSITY, LINE_LENGTH, 61 IMAGE_SIZE, NON_NEGATIVE, PERCENT, LINES ); 62 PIXEL_RANGE = 1..MAX_IMAGE_SIZE; 63 MAPSET = s e t of PIXEL_RANGE; 64 65 STR_3 = a r r a y (. 1..3 .) of char; 66 STR_4 = a r r a y (. 1..4 .) of char; 67 STR_6 = a r r a y (. 1..6 .) of char; 68 STR_8 = a r r a y (. 1..8 .) of char; 69 STR_44 = a r r a y (. 1..44 .) of char; 70 STR_50 = a r r a y (. 1..50 .) of char; 71 72 IMAGEFILE = f i l e Of INPUT_LINE; 73 DTMFILE = f i l e of a r r a y ( 1..(MAX_LINE_LEN+1)*2 ) of char; 74 MAPFILE = f i l e of MAPSET; 75 76 POINTER = 9 s h o r t ; 77 P0LAR_C00RD = a r r a y ( . 1..2 .) of s h o r t ; 78 XY_C00RD = a r r a y ( . 1..2 .) of s h o r t ; 79 80 81 82 83 v a r 84 FULL_IMAGE_SI ZE , 85 HALF_IMAGE_SIZE : Integer; 86 MAX_HALF : 1nt; 87 PRINT_SIZE, 88 FOCAL_LENGTH, 89 H, GRID_SPAC : s h o r t ; 90. DIM : a r r a y ( . 1..2 .) of Integer; 91 CENTER : a r r a y ( . LEFT..RIGHT, X..Y .) of 1nt; 92 XY_L00KUP : a r r a y ( . 0..360, X..Y .) of s h o r t ; 93 L FILE, RFILE, 94 IMAGE_FILE : IMAGEFILE; 95 DTM_FILE : DTMFILE; 96' LMFILE, RMFILE : MAPFILE; 97 THETA_L00KUP, 98 RADIUS_L00KUP : POINTER; 99 IMAGE : INT_ARRAY; 100 101 102 103. 104 (* *) 105 (* *) 106 (* FORWARD d e c l a r a t i o n s f o r the Procedures of the system *) 107 (* *) 108 (* *) 109 p r o c e d u r e CIRCULAR_DISPLACE( Y_C00RD, X_CENTER, Y_CENTER, 110 START, STOP : Integer; 111 var IMAGE : INT_ARRAY; 112 var CURR_I LINE , CL)RR_DL INE , 113 PREVDLINE : INT_LINE; 114 var MAP_LINE : MAPSET; 115 var HORIRAD, HORI_ALT : HORZN_LINE ); 116 forward; LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 117 p r o c e d u r e CUBICCONVOLUTION( var IMAGE : INT_ARRAY; 118 X. Y : Integer ); forward; 119 p r o c e d u r e DISPLACE( var IMAGE : INTARRAY; 120 var MFILE : MAPFILE; 121 X_CENTER. Y_CENTER : Integer ); forward; 122 p r o c e d u r e DISPLCE_CENTER_LINE( X_CENTER, Y_CENTER : Integer; 123 var IMAGE : INTARRAY; 124 var ILINE, DLINE : INT_LINE; 125 var MLINE : MAPSET; 12G var H0RI_RAD, HORI_ALT : HORZNLINE ); 127 forward; 128. p r o c e d u r e EXPANDING_DISPLACE( YCOORD, 129 X_CENTER, Y_CENTER : Integer; 130 var IMAGE : INT_ARRAY; 131 var ILINE, DLINE : INT_LINE; 132 var MLINE : MAPSET; 133 var HORI_RAD, HORI_ALT : HORZN_LINE ); 134 forward; 135 p r o c e d u r e EXPNDNG_HORIZON_UPDATE( Y, X_CENTER, 136 PREV_START, PREV_STOP, 137 PREV_Y : Integer; 138 var HORI_RAD, HORI_ALT : HORZNLINE ); 139 forward; 140 p r o c e d u r e FILES; forward; 141 p r o c e d u r e GET_DIMENSIONS; forward; 142 p r o c e d u r e HORIZON_UPDATE( CURR_POLAR, PREV_POLAR : POLAR_C0ORD; 143 CURR_ALT, PREV_ALT : 1nt; 144 var HORI_RAD, HORI_ALT : HORZN_LINE ); forward; 145 p r o c e d u r e INTERPOLATE( var IMAGE : INT_ARRAY ); forward; 146 p r o c e d u r e INSERT_PIXEL( var IMAGE : INT_ARRAY; 147 • Y, X : s h o r t ; 148 INTEN : Integer ); forward; 149 p r o c e d u r e 0CT_1_TRANSF0RM( var X, Y, OCT : Integer ); forward; 150 p r o c e d u r e POLAR_INIT( SIZE : Integer ); forward; 151 p r o c e d u r e PRINT_MSG( MSG : MSG_TYPE; STRING : INPUT_LINE; 152 SIZE Integer ); forward; 153 p r o c e d u r e PUT_ARRAY( ARR : POINTER; X, V : Integer; 154 VALU : s h o r t ); forward; 155 p r o c e d u r e SYS_INIT; forward; 156 p r o c e d u r e SYSTEM_ERROR( MESSAGE : STR_50 ); forward; 157 p r o c e d u r e WRITE_IMAGE_LINE( var IMAGE : IMAGEFILE: 158 LINE : INT_LINE; 159 START : Integer ); forward; 160 p r o c e d u r e WRITE_MAP_LINE( var MAP : MAPFILE; 161 LINE : MAPSET; 162 LINE_NO : Integer ); forward; 163 p r o c e d u r e WRITE_STRING( STR : INPUT_LINE; SIZE : Integer ); forward; 164 p r o c e d u r e WRT_IMAGE( var IMAGE_FILE : IMAGEFILE; 165 var IMAGE : INT_ARRAY ); forward; 166 p r o c e d u r e XY_INIT; forward; 167 - J 168 « 169. (* »MliM»»N»MMMMMIiMHMMHMHMII»HIIHH^HM^^HH^^¥MHHHMM»HMM^MII^^HMHIIMMMMHVIlMlf¥MHM» *) 170 (* *) 171 (* FORWARD d e c l a r a t i o n s f o r the F u n c t i o n s of the system *) 172 (* *) 173' (* #»ffff^/f//«,Vffffff^/r^ffffffffff/f^M^«ff/r«#^»ffff^^^ff^fffffffffffffi«^«ff//»^fffi///r»»t>«//##^»ff«»««« *) 174 f u n c t i o n ALLOCATE_SPACE( SIZE : Integer ) : POINTER; forward; 80 * * * * * •- •-at Ul O D X TJ •o X) TJ t> TJ TJ TJ TJ TJ * at O E S u. [_ L. L. L. C L. L l_ J- L. at Z O CJ a. to to (0 (0 (0 to (0 (0 to to (0 * at D Z Z K 3 3 4—« 3 3 OJ 3 3 3 3 3 3 at at E 1- 1 - UJ L L, L_ L. 4 - L. L. C L L 1- I. at at CJ U. U- in UJ 0 0 c O O 0 O O to 0 O 0 0 at at - - -u. 44- *4- (0 44- <4- O 44- 44- OJ <4- 14- 14- 44- at at 4-t OJ jO 4— at at C C C c _ l . . 4—* r - 0 c at E at to to to co It 4 4 C 0 0 (0 at OJ at L. L. L. L. a 1- (0 0 U l jO OJ • - at 4 4 at 4 4 4 4 4 4 4 4 0 OJ JO •- D Z 1— O at to at i_ c_ - - i_ !_ z - o o 1-4 0 or at >. at 0 O t. 0 0 to 0 or ui _J 0 O at tn at 44- *4- QJ »4- *4-0 O or D n O at at 01 •• JO Ul O 1 • - 1- O 0 at OJ at OJ 4 -CM 3 O D UJ Z UJ 1 at C at 4 4 CO .. _ l l< _i 4 1 or >- at 44 at — c 01 < or ui *—t 1 X at at — - C L. in 0) in > 1 < or _i u. •• UJ I-UJ 4 4 at at > JO at at t-OJ OJ OJ 4 01 UJ _ J o •- C5 in t_ at at 0 1 ^ ^ QJ CM m a: < o. UJ < UJ 0 at TJ at OJ z 4 4 4 4 a or _ l E C or at OJ at 4 4 UJ UJ UJ c C E CJ - • 4 - tO . 4 tn + 4 at in at C Z - J Z — UJ — o UJ u. UJ OJ UJ !_ at 3 at - 4 - 4 - 4 4-t Z CJ C i- — • E Z . - •— i. Z 0 at at - J •- -J 3 0) z I— 4-1 0 OJ 4-, at to at •• |UI 1 "3 . • O) 4-4 i- D _J UJ O DJ-J CM ID at 0) at 1- Z K I >• Ul OJ 4— 0J 1-1 a 0) 1 O at c at « 3 t-i 3 1— Z 44 (0 Dl •• 1- 4 4 h- < at — at a _ i a CJ c Ul OJ a) Z u- •• c z or at 4 4 at • - Z IZ z E X _J O L. 4 4 UJ 1 < at 3 at Ul 4-1 I— 4-1 UJ 1 Z C _J UJ 0 - 4 - at 0 at Z 3 _) 0. • -1— < -4- 1-4 CJ 0 • * 4— UJ at L. at 4-1 .. a •• or 3 or U- < Ul ui 0. I at at —J Z 4 -^ - U l O- 1 •• 1 E or O Z < I- at z at lor 4-t L. If) 1- Z UJ E 4-4 4-1 or at < at f- t- (0 Z - i 3 >- I- O _ i - at or at 3 t/J •• UJ JZ CM t-H _ l D t- < UJ 1 - in at t- at a 1 E 0 *— o •• < - to ul z h- CM 3 at or at Z 0 or < 0. > X i. > or 4-1 3 H 4-t at O at -1 E 1- Z or to _ J 0. —1 O at u. at CJ l/l u. •• t- ^ > w z < < at at 1 3 in E UJ • 4-4 or at £_ at w O «- UJ or UJ or w Z a - at 0 at or ui E to z or <_ a D UJ —> > . . -— • at M - at 1— E CJ > < (0 z u. Z _ J 1- 4 - E at at t/j < •—~ to > < tO 4-1 1 O -1 or at 10 at Z — X or Z -1 UJ w z < O at c at V U . U I 4—t L. < 1 I CJ UJ 4-4 IX at 0 at m | E u_ 01 < z or E < z or w in at —- at i - 1- < Ul 4 4 or - J E 1- h- E 4—1 1- UJ Z at 4 4 at S -1 z or in or o 3 l o _ J l/> _J < at to at 13 u- CL < Ul Z or 1 " l 1 im or at 1- at -1 < 1 1 Q. 1 1 1 < o O O O 4-1 i- at to at J l L h h-tn K 1- K _ l < < < < tn 1 at 4 at < UJ UJ UJ L. UJ UJ U l O ul UJ Ul Ul 4-H > at 0 at CJ O CJ in 0) O CB CS 0. or or or OI > X at OJ at a at 0 at 0) QJ QJ QJ c c c C C c c c c c at at L (- i - L-UJ O 0 0 O O 0 0 0 0 0 at at 3 3 3 3 u. •4- at at TJ TJ TJ T5 4-H 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 at at OJ QJ QJ OJ _ l 0 0 0 0 0 0 0 0 0 0 at at 0 0 0 O c c c c c c c c c c at at 0 0 0 0 UJ 3 3 3 3 3 3 3 3 3 3 at at L. J- C J_ _ J 44- at at a a a a t-4 at at U . at at 4—V * * * * * * at at at at at - at at C at 0) at at 0 at 4 4 at at —- at CO at at 4 4 at 0 at at 10 at 0 at at 0 at 4 - •— at at 0 at 4— at at 4— at co at at at - at at 01 at U l 4— at at c at IM 3 at at •4— at 4—t 44- at at 4 4 at in 10 at at L. at 10 at at to at • OJ at at 4 4 % .. u at at to at or O 0 at at at UJ a 3 at at c at 1- 0 in at at t- at Z 3 c at at 3 at 4- . 1 3 at at 4 4 at O or at at QJ at 0. U l at at f. at a £ at at at •• 1 UJ at at TJ at in CJ at at c at U l < at at CO at 4— a. at at at 1- > in at at >. at Qj CO 1 at at 1- at O l U l at at 0 at QJ * 1- at at E at 4 4 < at at QJ at c >- CJ at at E at — 4 - or 0 at at at or 1- - J 4- at at <!- at •• UJ Z _l 4—N at at 0 at 1- UJ < * at at at UJ Z 1 t at at 10 at N 4-4 or at at TJ at 4-4 O UJ c or U l at at t- at in CL 0. 4-4 4- CJ at at 0 at 1 O . < at at 3 at w in a at at at UJ D C 11 in at at UJ at cj or or 0) w •• 1 at at M at < O K r or UJ at at 4-4 at 0. 3 a 4 4 0 U l 4- . at at in at in or cj < at at at 1 — or < CJ at at M- at UJ O O - m a. 0 at at 0 at K C lin _ l at at at < w E 1 - J at at OJ at CJ QJ II U l U l < at at 0 at 0 O t- t- at at CO at _J co or in < at at a at _ i Q. t- > O at at to at < to a in 0 •—^ at at at or 4 4 _j at at QJ at C 1- C QJ >4- - J at at 4 4 at 0 CL •4- 0) — < at at to at — c 0) TJ at at 0 at 4 4 CG OJ C at at 0 at 0 > JO 01 at at 4— at c at at 4— at 3 at at < at n- at at at at at at at # * * # cr z in 4-4 _i tn i p i ^ c o c D O ^ c M t > o > T i ^ i j 3 f ^ c o w O " - c M r o ^ i T ) t r r ^ [^ i^^t^^co^cOOOCOCDODtJDCOCOCJjC^ 4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-CNCNCMCMlNCMCNCMCMCMCMCMCMCMC^ LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 IO=LIFE 233 (* 234 (* D i s p l a c e the p i x e l s of CURR_ILINE and c a l c u l a t e t e r r a i n v i s i b i l i t y 235 (* u t i l i z i n g the c i r c u l a r h o r i z o n , H0RI_RAD and H0RI_ALT. The p i x e l ' s XY 236 (* ( c a r t e s i a n ) c o o r d i n a t e s a r e f i r s t t ransformed to p o l a r c o o r d i n a t e s 237 (* and then the d i s p l a c e m e n t Is Introduced. The new p o l a r c o o r d i n a t e s 238 (* a r e then c o n v e r t e d to XY c o o r d i n a t e s and the d i s p l a c e d p i x e l Is 239 . (* I n s e r t e d 1n the p e r s p e c t i v e Image at those c o o r d i n a t e s . 240 (* 241 (* 242 p r o c e d u r e CIRCULAR DISPLACE( Y COORD, X CENTER, Y CENTER, 243 START, STOP : Integer; 244 var IMAGE : INT ARRAY; 245 var CURR ILINE, CURR DLINE, 246 PREV DLINE : INT LINE; 247 var MAP LINE : MAPSET; 248 var HORI_RAD, HORI ALT : HORZN_LINE ); 249 250 var 251 HI, LO, I, J : Integer; 252 D, 253 LO FACT, HI FACT, 254 H1, H2, R1, R2, RF : s h o r t ; 255 SWTCH :. boolean; 256 PREV POLAR, 257 CURR POLAR : POLAR COORD; 258 XY : XY^COORD; 259 260 261 b e g i n 262 263 If START > STOP then 264 be g i n 265 I := START; 266 START := STOP; 267 STOP := I; 268 SWTCH := t r u e : 269 end (* If START > STOP * ) ; 270 e l se 271 SWTCH := f a l s e ; 272 273 f o r I := START to STOP do 274 begin 275 276 1f SWTCH then 277 J := STOP + START - I; 278 e l se 279 J : = I ; 280 281 CURR POLAR := POLAR TRANSFORM( J , Y COORD ); 282. If Y COORD > 0 then 283 PREV_POLAR := POLAR_TRANSFORM( J , Y_C00RD-1 ); 284 el se 285 PREV_POLAR := POLAR_TRANSFORM( J , YCOORD+ 1 ); 286 287 LO := t r u n c ( CURR POLAR(THT) ); 288 HI := LO + 1 ; 289 LO FACT := HI - CURR POLAR(THT); 290 HI FACT := 1 - LO FACT; LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12. 1982 ID=LIFE 291 292 HI := CURR_DLINE(J+X_CENTER); 293 RF := CURR_POLAR(RDS) * FOCAL_LENGTH; 294 D := RF / (H - H1) - RF / H; 295 R1 := CURR_POLAR(RDS) + D * (H / FOCALLENGTH); 296 H2 := LO_FACT * HORI_ALT(LO) + H I F A C T * HORI ALT(HI); 297 R2 := LO_FACT * HORI_RAO(LO) + HI_FACT * HORI_RAD(HI ); 298 299 If not VISIBLE( H1, H2, R1, R2 ) then 300 MAP_LINE := MAP_LINE + (. (MAX_IMAGE_SIZE-(J+X_CENTER) ) . ) ; 301 e l s e 302 b e g i n 303 304 XY := XY_TRANSFORM( R1. CURR_POLAR(THT) ); 305 XY(X) := XY(X) + X_CENTER; 306 XY(Y) := XY(Y) + Y_CENTER; 307 1f (XY(X) > max( O. X_CENTER-HALF_IMAGE_SIZE )) and 308 (XY(Y) > max( O. Y_CENTER-HALF_IMAGE_SIZE )) and 309 (XY(X) <= m1n( DIM(PIXEL), X_CENTER+HALF_IMAGE_SIZE )) and 310 (XY(Y) <= m1n( DIM(LINE ), Y_CENTER+HALF_IMAGE_SIZE )) then 311 INSERT_PIXEL( IMAGE, XY(Y), XY(X), 312 CURR_ILINE(J+X_CENTER) ); 313 e l s e 314 MAP_LINE := MAP_LINE + (. (MAX_IMAGE_SIZE-(d+X_CENTER)) . ) ; 315 316 end (* e l s e VISIBLE * ) ; 317 318 HORIZON_UPOATE( CURRPOLAR, PREV_POLAR, 319 CURR_DLINE(J+X_CENTER), 320 PREV_DLINE(J+X_CENTER), 321 HORIRAD, HORI_ALT ); 322 323 end (* f o r I * ) ; 324 325 326 end (* CIRCULAR_DISPLACE * ) ; 327 328 329 331 (* *) 332 (* Per f o r m a c u b i c c o n v o l u t i o n at l o c a t i o n (X,Y) of the Image IMAGE *) 333 (* t o d e f i n e t h a t p i x e l . *) 334 (* *) 335 (* HHttHHHHHHHHHHHHHHHHHHHHHHHHHttHHHtttiHHHHHHHBHHHHHtiHHHHHHHHHHHttHHHHHHtiHHHH +) 336 p r o c e d u r e CUBIC_CONVOLUTION( var IMAGE : INTARRAY; X, Y : Integer ); 337 338 var 339 I, d, TOTAL, NUM : Integer; 340 co 34V to 342 b e g i n 343 344 TOTAL := 0; 345 NUM := O; 346 347 f o r I := X-1 to X+1 do 348 f o r J := Y-1 to Y+1 do LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 349 1f IMAGE(I,J) <> UNDEFINED then 350 b e g i n 351 TOTAL := TOTAL + IMAGE(I.J); 352 1ncr( NUM ); 353 end (* 1f IMAGE(I.J) <> UNDEFINED * ) ; 354 If NUM = 0 then 355 IMAGE(X,Y) := MIN_INTENSITY; 356 e l s e 357 IMAGE(X,Y) := round( TOTAL / NUM ); 358 359 360 end (* CUBIC_CONVOLUTION * ) ; 361 362 363 364 (* »MMHHMHMMHHIIMH»HHHIIII»HHM^»HV#HM»HVHM»ti«MHM^M»^HM»Htl»liM»^MUHH»lt»#HH»Hlltili *) 365 (* *) 366 (* D i s p l a c e the elements of the o r t h o g r a p h i c Image by I n t r o d u c i n g *) 367 (* r e l i e f d i s p l a c e m e n t to a l l p i x e l s of that Image. ( T h i s 1s *) 368 (* a c c o m p l i s h e d by t h r e e r o u t i n e s : DISPLCE_CENTER_LINE which d i s p l a c e s *) 369 (* the c e n t e r Image l i n e ( I . e . the l i n e c o n t a i n i n g the p r i n c i p l e p o i n t ; *) 370 (* CIRCULAR_DISPLACE f o r p i x e l s whose c a r t e s i a n c o o r d i n a t e s are such *) 371 (* t h a t abs(X) >= a b s ( Y ) , assuming the p r i n c i p l e p o i n t to be the o r i g i n ; *) 372 (* and EXPANDING_DISPLACE f o r a l l o t h e r p i x e l s I.e. p i x e l s w i t h *) 373 (* abs(X) < abs( Y ) . ) *) 374 (* *) 375' ' (* *) 376 p r o c e d u r e DISPLACE( var IMAGE : INT_ARRAY; 377 var MFILE : MAPFILE; 378 X_CENTER, Y_CENTER : Integer ); 379 380 c o n s t 381. CURR = 0; PREV = 1 ; 382 383 v a r 384 I, J : Integer; 385 DLINE : a r r a y ( . CURR..PREV .) of INT_LINE; 386 ILINE_CURR : INT_LINE; < 387 MLINE_CURR : MAPSET; 388 EXPD_HORI_RAD, 389 EXPD_HORI_ALT, 390 CIRC_HORI_RAD, 391. CIRC_HORI_ALT : HORZNLINE; 392 393 394 b e g i n 395 396 f o r I := 0 to MAX_LINE_LEN+2 do 397 f o r J := O to MAX_LINE_LEN+2 do 398 IMAGE(I.J) := UNDEFINED; 00 399 U) 400 f o r I := 0 to MAX_HORZN_SIZE do 401 b e g i n 402 EXPD_HORI_RAD(I) := 0; 403' EXPD_HORI_ALT(I) := 0: 404 CIRC_H0RI_RAD(I) := 0; 405 CIRC_HORI_ALT(I) := 0; 406 end (* f o r I * ) ; LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID = LIFE 407 408 f o r I := Y_CENTER+1 to DIM(LINE) do 409 b e g i n 410 411 DLINE(PREV) := DLINE(CURR); 412 DLINE(CURR) := READ_LINE( DTM, DIM(LINE )-I + 1, RESET_REOD ); 413 ILINE_CURR := READ_LINE( IMGE, DIM(LINE)-I+1, RESET_REOD ); 414 MLINE_CURR := (. . ) ; 4 1 5 . 416 If (Y_CENTER-I) >= (-X_CENTER+1) then 417- CIRCULAR_DISPLACE( I-Y_CENTER, X_CENTER, Y_CENTER, 418 Y_CENTER-I, -X_CENTER+1, IMAGE, 419 ILINE_CURR, DLINE(CURR), DLINE(PREV) , 420 MLINE_CURR, CIRC_HORI_RAD, CIRC_HORI_ALT ); 421 If (I-Y_CENTER) <= (DIM(PIXEL)-X_CENTER) then 422 CIRCULAR_DISPLACE( I -Y_CENTER, X_CENTER, Y_CENTER, 423 I-Y_CENTER, DIM(PIXEL)-X_CENTER, IMAGE, 424 ILINE_CURR, DLINE(CURR), DLINE(PREV), 425 MLINE_CURR, CIRC_HORI_RAD, CIRCJHORIALT ); 426 EXPANDING_DISPLACE( I-Y_CENTER. X CENTER, Y_CENTER, 427. IMAGE, ILINE_CURR, DLINE(CURR), 428 MLINE_CURR, EXPD_HORI_RAD, EXPD_HORIALT ); 429 430 WRITE_MAP_LINE( MFILE, MLINE_CURR, DIM(LINE)-I+1 ); 431 432 end (* f o r I * ) ; 433 434 435 f o r I := 0 to MAX_HORZN_SIZE do 436 b e g i n 437 EXPD_HORI_RAD(I) := 0: 438 EXPD_HORI_ALT(I) := 0: 439 end (* f o r I * ) ; 440 441 DLINE(CURR) := READ_LINE( DTM, 0IM(LINE)-Y_CENTER+1, RESET_REOD ); 442 ILINE_CURR := READ_LINE( IMGE, OIM(LINE)-Y_CENTER*1, RESET_REOD ); 443 f o r I := Y_CENTER-1 downto 1 do 444 . b e g i n 445 446 DLINE(PREV) := DLINE(CURR); 447 DLINE(CURR) := READ_LINE( DTM, DIM(LINE)-I+1, not RESET_REOD ); 448 ILINECURR := READ_LINE( IMGE, DIM(LINE)-I+1, not RESET_REOD ); 449 MLINE_CURR := (. . ) ; 450 451 i f (I -Y_CENTER) >= (-X_CENTER+1) then 452 CIRCULAR_DISPLACE( I-Y_CENTER, X_CENTER, Y_CENTER, 453 I-Y_CENTER, -X_CENTER+1, IMAGE, 454 ILINE_CURR, DLINE(CURR), DLINE(PREV ) , 455 ML INE_CURR, CIRC_HORI_RAD, CIRC_HORI_ALT ); 456 If (Y_CENTER-I) <= (DIM(PIXEL)-XCENTER) then 457 CIRCULAR_DISPLACE( I-Y_CENTER, X_CENTER, Y_CENTER, 458 Y_CENTER-I, DIM(PIXEL)-X_CENTER, IMAGE, 459 ILINECURR. DLINE(CURR), DLINE(PREV), 460: MLINE_CURR, CIRC_HORIRAD, CIRCHORI_ALT ); 461 EXPANDING_DISPLACE( I-Y_CENT ER, X_CENTER, Y_CENTER, 462 IMAGE, ILINE_CURR, DLINE(CURR) , 463 MLINE_CURR, EXPD_HORI_RAD, EXPD_HORI_ALT ); 464 LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 465 WRITE_MAP_LINE( MFILE, MLINE_CURR, DIM(LINE)-1+1 ); 466 467 end (•* f o r I * ) ; 468 469 DLINE(CURR) := READ_LINE( DTM, DIM(LINE)-YCENTER+1, RESET_REOD ); 470 ILINE_CURR := READ_LINE( IMGE. DIM(LINE)-Y_CENTER+1, RESET_REOD ); 471 MLINE_CURR := (. . ) ; 472 CIRC_HORI_RAD(0) := 0: 473- GIRC_H0RI_ALT(O) := 0; 474 CIRC_HORI_RAD(180) := 0; 475 . CIRC_HORI_ALT(180) := O; 476 477 DISPLCE_CENTER_LINE( X_CENTER, Y_CENTER, IMAGE, 478. ILINE_CURR, DLINE(CURR), MLINE_CURR, 479 CIRC_HORI_RAD, CIRC_HORI_ALT ); 480 WRITE_MAP_LINE( MFILE, ML INE_CURR, DIM(LINE)-Y_CENTER+1 ); 481 482 483 end (* DISPLACE * ) ; 484 485 486 487 (* 00##,y######*####0###,y#,y,y####^^ *) 488 (* *) 489 (* D i s p l a c e the c e n t e r l i n e of the Image ( I . e . the l i n e c o n t a i n i n g the *) 490 (* p r i n c i p l e p o i n t ) u t i l i z i n g the c i r c u l a r h o r i z o n , HORI_RAD and *) 491 (* HORI_ALT, to c a l c u l a t e t e r r a i n v i s i b i l i t y . *) 492 (* . •) 493 (* *) 494. p r o c e d u r e DISPLCE_CENTER_LINE( X_CENTER, Y_CENTER : Integer; 495 var IMAGE : INT_ARRAY; 496 var ILINE, DLINE : INT_LINE; 497 var MLINE : MAPSET; 498 var HORI_RAD, HORI_ALT : HORZN_LINE ); 499 500 v ar 501 I : Integer; 502 RAD, RF, D : s h o r t ; 503 504 505 b e g i n 506 -507 f o r I := X_CENTER-1 downto 1 do 508 b e g i n 509 510 RAD := abs( I - X_CENTER ): 511 RF := RAD * FOCAL_LENGTH; 512 D := RF / (H - DLINE(I)) - RF / H; 513 RAD := RAD + D * (H / FOCAL_LENGTH); 514 1f VISIBLE( DLINE(I), HORI_ALT(180), 515 RAD, HORI_RAD(180) ) then 516 b e g i n 517 HORI_RAO(180) := RAD; 518 HORI_ALT(180) := DLINE(I); 519 1f X_CENTER - RAD > max( O, X_CENTER-HALF_IMAGE_SIZE ) then 520 INSERT_PIXEL( IMAGE, Y_CENTER, X_CENTER-RAD, I L I N E ( I ) ); 521 e l s e 522. MLINE := MLINE + (. (MAX_IMAGE_SIZE-I) . ) ; LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 523 end (* 1f RAO > HORI_RAD(180) and ... * ) ; 524 el se 525 MLINE := MLINE + (. (MAX_IMAGE_SIZE-I) . ) ; 526 527 end (* f o r I * ) ; 528 529 INSERT_PIXEL( IMAGE, Y_CENTER, XCENTER, I LINE(X_CENTER) ); 530 531 . f o r I := X_CENTER+1 to DIM(PIXEL) do 532 beg 1 n 533 534 RAD := abs( I - X CENTER ); 535 RF := RAD * FOCAL LENGTH; 536 D := RF / (H - DLINE(I)) - RF / H; 537 RAD := RAD + D * (H / FOCAL LENGTH); 538 1f VISIBLE( DLINE(I), HORI ALT(0), 539 RAD, HORI_RAD(0) ) then 540 beg 1 n 541 HORI RAD(O) := RAD; 542 HORI ALT(O) := DLINE(I); 543 1f X CENTER + RAD <= m1n( DIM(PIXEL), X CENTER+HALF IMAGE SIZE 544 INSERT PIXEL( IMAGE, Y CENTER, X CENTER+RAD, ILI N E ( I ) ); 545 e 1 se 546 MLINE := MLINE + (. (MAX IMAGE SIZE-I) . ) ; 547 end (* If RAD > H0RI_RAD(O) and ... * ) ; 548 e l se 549 MLINE := MLINE + (. (MAX_IMAGE_SIZE-I) . ) ; 550 551 end (* f o r I * ) ; 552 553 554 555 end (* DISPLCE_CENTER_LINE * ) ; 556 557 558 559 (* *) 560 (* *) 561 (* D i s p l a c e the p i x e l s of ILINE u t i l i z i n g the l i n e a r expanding *) 562 (* h o r i z o n , HORI_RAD and HORI_ALT, to c a l c u l a t e t e r r a i n v i s i b i l i t y . *) 563 (* T h i s h o r i z o n must be expanded p r i o r to these c a l c u l a t i o n s and t h i s *) 564 (* e x p a n s i o n 1s acc o m p l i s h e d by EXPNONG_HORIZON_UPDATE. The Image *) 565 (* p i x e l ' s XY ( c a r t e s i a n ) c o o r d i n a t e s a re f i r s t t r a n s f ormed to p o l a r *) 566 . (* c o o r d i n a t e s and then the di s p l a c e m e n t 1s Introduced. The new p o l a r *) 567 (* c o o r d i n a t e s a re then c o n v e r t e d to XY c o o r d i n a t e s and the d i s p l a c e d •) 568 (* p i x e l 1s I n s e r t e d In the p e r s p e c t i v e Image at these new c o o r d i n a t e s . *) 569 (* *) 570 (* *) 571 p r o c e d u r e EXPANDING DISPLACE( Y COORD, 572 X CENTER, Y CENTER : Integer; 573 var IMAGE : INT ARRAY; 574 var ILINE, DLINE : INT LINE; 575 var MLINE : MAPSET; 576 var HORIRAD, HORI_ALT : HORZN_LINE ); 577 578 var 579 I, PREV Y, PREV START, 580 PREV_STOP : Integer; 00 (Tl LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 581 H1, R1, RF, D : s h o r t ; 582 POLAR : P0LAR_C0ORD; 583 XY : XY_COORD; 584 585. 586 b e g i n 587 588 1f Y_COORD > O then 589 PREV_Y := Y_COORD - 1; 590 e l s e 591 PREV_Y := Y_COORD + 1; 592 593 PREV_START := max( -abs( PREV_Y ), -X_CENTER+1 ); 594 PREV_STOP := min( +abs( PREV_Y ), DIM(PIXEL)-X_CENTER ); 595 596 EXPNDNG_HORIZON_UPOATE( Y_COORD, X_CENTER, PREV_START, PREV_STOP, 597 PREV_Y, HORI_RAD, HORI_ALT ); 598 599 f o r I := PREV_START to PREv_STOP do 600 b e g i n 601 602 POLAR := POLAR_TRANSFORM( I, Y_COORD ); 603 H1 := DLINE(I+X_CENTER); 604 RF := POLAR(RDS) * FOCALM-ENGTH; 605 D := RF / (H - H1) - RF / H; 606 R1 := POLAR(RDS) + D * (H / FOCAL_LENGTH); 607 1f not VISIBLE( HI, HORI_ALT(I+X_CENTER), 608 R1, HORI_RAD(I+X_CENTER) ) then 609 MLINE := MLINE + (. (MAX_IMAGE_SIZE-(I+XCENTER)) . ) ; 610 e l s e 611 b e g i n 612 613 XY : = XY_TRANSFORM( R1, POLAR(THT) ); 614 XY(X) := XY(X) + X_CENTER; 615 XY(Y) := XY(Y) + Y_CENTER; 616 If (XY(X) > max( O, X_CENTER-HALF_IMAGE_SIZE )) and 617 (XY(Y) > max( 0, Y_CENTER-HALF_IMAGE_SIZE )) and 618 (XY(X) <= m1n( DIM(PIXEL), X_CENTER+HALF_IMAGE_SIZE )) and 619 (XY(Y) <= n>1n( DIM(LINE ), Y_CENTER+HALF_IMAGE_SIZE )) then 620 b e g i n 621 INSERT_PIXEL( IMAGE, XY(Y), XY(X), ILINE(I+X_CENTER) ); 622 HORI_ALT(I+X_CENTER) := H1; 623 HORI_RAD(I+X_CENTER) := R1; 624 end (* 1f (XY(X) > 0) ... * ) ; 625 e l s e 626 MLINE := MLINE + (. (MAX_IMAGE_SIZE-(I+X_CENTER)) . ) ; 627 628 end (* e l s e VISIBLE * ) ; 629 630 end (* f o r I * ) ; 00 631 - j 632 633 end (* EXPANDING_DISPLACE * ) ; 634 635 636 637 (* HttHHHttHHHtiHHHHttHttHHHHttH#HHHHHHHtlHHH#HliHttHttttHHttttHHttHHHHHHHHHHHHHHHHtttiHHIt *) 638 (* *) LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 639 (* Update the l i n e a r expanding h o r i z o n , HORI_RAD and HORI_ALT, by 640. (* p r o j e c t i n g 1t from a h o r i z o n of N elements to a h o r i z o n of (N+2) 64 1 (* elements. 642 (* 643 (* 644 p r o c e d u r e EXPNDNG HORIZON UPDATE( Y, X CENTER, 645 PREV START. PREV STOP, 646 PREV Y : Integer; 647 var HORI_RAD, HORIALT : HORZNLINE ); 648 649 var 650 LO, HI, X, START, STOP : Integer; 651 LO FACT, HI FACT, 652 LO ALT, HI ALT, 653 LO RAD, HI RAD, NEW X : s h o r t ; 654 NEW HORI ALT, 655 NEW_HORI_RAD, FACTOR : HORZN_LINE; 656 657 658 b e g i n 659 660 START := max( -abs( Y ). -X CENTER*1 ); 661 STOP := m1n( +abs( Y ), DIM(PIXEL)-X_CENTER ); 662 663 f o r X := START+X_CENTER-1 to STOP+X_CENTER+1 do 664 b e g i n 665 NEW HORI ALT(X) := 0; 666 NEW HORI RAD(X) := 0; 667 FACTOR(X) := 0; 668 end (* f o r X * ) ; 669 670 If PREV_Y ->= 0 then 671 beg 1 n 672 673 f o r X := PREVSTART to PREV_STOP do 674 beg 1 n 675 676 If Y > 0 then 677 NEW_X := X + X / PREV_Y; 678 e l se 679 NEW X := X - X / PREV Y; 680 LO := tr u n c ( NEW X ) ; 681 1f NEW X < 0 then 682 HI := LO - 1; 683 e l se 684 HI := LO + 1 ; 685 LO FACT := abs( HI - NEW X ); 686 HI_FACT := 1 - LO_FACT; 687 688 1f LO_FACT -•= 0 then 689 beg 1 n 690 691 LO := LO + X CENTER; 692 LO ALT := NEW HORI ALT(LO) * FACTOR(LO) + 693 HORI ALT(X+X CENTER) * LO FACT; 694 LO RAD := NEW HORI RAD(LO) * FACTOR(LO) + 695 HORI RAD(X+X CENTER) * LO FACT; 696 FACTOR(LO) := FACTOR(LO) + LO FACT; LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 697 NEW_HORI_ALT(LO) := LO_ALT / FACTOR(LO); 698 NEW_HORI_RAD(LO) := LO_RAD / FACTOR(LO); 699 700 end (* I f LO_FACT -•= O * ) ; 701 702 If HI_FACT ->= O then 703 b e g i n 704 705 HI := HI + X_CENTER; 706 HI_ALT := NEW_HORIALT(HI) * FACTOR(HI) + 707 HORI_ALT(X+X_CENTER) * HI_FACT; 708 HI_RAD := NEW_HORI_RAD(HI) * FACTOR(HI ) + 709 HORI_RAD(X+X_CENTER) * HI_FACT; 710 FACTOR(HI) := FACTOR(HI) + HI_FACT: 711 • NE W_HO RI_A L T(HI) := H I A L T / FACTOR(HI); 712 NEW_HORI_RAD(HI) := HI_RAD / FACTOR(HI); 713 714 end (* If H I F A C T -•= 0 * ) ; 715 716 end (* f o r X * ) ; 717 718 f o r X := START+X_CENTER to STOP+X_CENTER do 719 I f FACTOR(X) = 0 then 720 b e g i n 721 NEW_HORI_ALT(X) := (NEW_HORI_ALT(X+1) - NEW_HORI_ALT(X-1)) / 722 2.0s + NEW_H0RI_ALT(X-1); 723 NEW_HORI_RAD(X) := (NEW_HORI_RAD(X+1) - NEW_HORI_RAD(X- 1)) / 724. 2.0s + NEW_H0RI_RAD(X-1); 725 end (* f o r X * ) ; 726 727 HORI_ALT := NEW_HORI_ALT: 728 HORI_RAD := NEW_HORI_RAD; 729 730 end (* I f PREV_Y ->= O * ) ; 731 732 ; 733 end (* EXPNDNGHORIZON_UPDATE * ) ; 734 735 736 737 (* ^HMM»M^»ffff^»HH»««HM^IIH^MH»H»Hff^VIIMHIt«flHHH«^HMH«ff»HHM«H^^ilHH^^H^HffffMM^MIi *) 738. (* *) 739 (* Set up and a t t a c h the f i l e s n e c e s s a r y f o r the system. U n i t O 1s the *) 740 (* assumed Input f o r the o r i g i n a l DTM. If It Is not a s s i g n e d on the MTS *) 74 1 (* RUN command, the f i l e name w i l l be prompted f o r . U n i t 1 Is assumed *) 742 (* Input f o r the o r i g i n a l r e g i s t e r e d Image. I t s f i l e name w i l l a l s o be *) 743 (* prompted f o r If not a s s i g n e d . The f i l e a s s i g n e d to u n i t 10 w i l l be *) 744 (* used f o r the output of the l e f t p e r s p e c t i v e Image; u n i t 11 f o r the *) 745 (* output of the r i g h t p e r s p e c t i v e Image. The f i l e a s s i g n e d to *) 746 (* u n i t 12 w i l l be used f o r the output of the l e f t v i s i b i l i t y map of the *) 747 (* DTM; u n i t 13 f o r the output of the r i g h t v i s i b i l i t y map of the *) 748 (* DTM. I f these u n i t s a re not a t t a c h e d , they w i l l d e f a u l t to MTS *) 749 (* temporary f i l e s -LEFT*. -RIGHT*, -LMAP/C, and -RMAP0 r e s p e c t i v e l y . *) 750 (* *) 751 (* »HMMIIHV»H»H»MHHMHIIUUM»MMVIlMHMM»MMUMIIHMIIMMIIM»HH»HMMMHIfMHMMHMHHHHHHHIIIIHI4ll *) 752 p r o c e d u r e FILES; 753 754 var LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. OUNE 12, 1982 ID=LIFE 755 DTMFNAME, IMGFNAME : INPUT_LINE; 756 757 758 b e g i n 759 760 761 DTMFNAME := ' '; 762 DEFAULT_FNAME( 'DEFAULT 0=*DUMMY*;' ); 763 GET_FNAME( 'OUERY FDNAME O:', O, DTMFNAME ); 764 765 If DTMFNAME = ' *DUMMY*' then 766 b e g i n 767 768 PRINT_MSG( UNIT_C_UNASSIGNED , '', O ); 769 DTMFNAME := READ_STRING; 770 w h i l e DTMFNAME = ' ' do 771 b e g i n 772 PRINT_MSG( INVALID_FILE. " . 0 ): 773 DTMFNAME := READ_STRING; 774 If DTMFNAME = 'CANCEL' or DTMFNAME = 'HALT' then 775 h a l t ; 776 end (* w h i l e DTMFNAME = ' ' * ) ; 777 778 end (* If DTMFNAME = '*DUMMY*' * ) ; 779 780 781 IMGFNAME := ' '; 782 DEFAULT_FNAME( 'DEFAULT 1=*DUMMY*;' ); 783. GET_FNAME( 'OUERY FDNAME 1;', O. IMGFNAME ); 784 785. . If IMGFNAME = ' *DUMMY*' then 786 b e g i n 787 788 PRINT_MSG( UNIT_1_UNASSIGNED, " , 0 ); 789 IMGFNAME := READ_STRING; 790 w h i l e IMGFNAME = ' ' do 791 b e g i n 792 PRINT_MSG( INVALID_FILE, '', 0 ); 793 IMGFNAME := READ_STRING; 794 If IMGFNAME = 'CANCEL' or IMGFNAME = 'HALT' then 795 h a l t ; 796 end (* w h i l e IMGFNAME = ' ' * ) ; 797 798 end (* 1f IMGFNAME = '*DUMMY*' • ) ; 799 800 801 DEFAULT_FNAME( 'DEFAULT 10=-LEFT/V;' ); 802 DEFAULT_FNAME( 'DEFAULT 11= - RIGHT//;' ); 803 DEFAULT_FNAME( 'DEFAULT 12 = -LMAP*; ' ); 804 OEFAULT_FNAME( 'DEFAULT 13 = -RMAP/C;' ); 805 >^ 806 r e s e t ( DTM_FILE, DTMFNAME ); ° 807 r e s e t ( IMAGE_FILE, IMGFNAME ); 808 rewrite!, LFILE, 10 ); 809 rewr1te( RFILE, 11 ); 810 rewr1te( LMFILE, 12 ); 811 rewr1te( RMFILE, 13 ); 812 * * * * * * * * * * * * * * * * * % at at at at at at at at at at at UJ at at u. at at 4»v at at _1 at at . . >• 11 at at 44 .—. Q at at J_ + t-H at at 0 at at z L. CM at at (0 0 * at at L. \ at at •• I- Q I N at at 0) or CO at at -~ O 4 " CD at at 44 3 4 - at at L a i + at at 0) — or - at at Ol L U X CM at at 0J O l w 4 - at at 44 n 1 at at c J 3 in * UJ at at — 3 UJ z at at in i - x at at •• > w at at . - CD at at > = w + at at >-at at - < + > £ at at x or or at at or — K-a at % . . < Z at at or • • 1 & UJ at at UJ or t- or 1 in at at t- UJ L U cr cr at -— at Z i - CS < UJ CM at > at « Z - a. 4 — at - at o i—i v - ' I at X at Q. o C x- in at at a « O D at or at •• L. or * at or at - TJ O • - at < at or (0 3 •—- at at or or > * at at < or w K- < 10 at 0 at o or O. or at at ^ C or UJ or C in at OJ at >- OJ or i - II < 01 UJ at 15 at < £ UJ Z 1 _i at •— at or 44 | « 1-to *-* at at or £ O UJ u. at > at < x ui a < CS a at at 1 i- or 10 at OJ at t- A in II or J- * at z at UJ > •• < « <D w at +4 at O > in 1 w a at at or or l -at 0) at C i - c Ul UJ at > at O a. •V — O. CS u. TJ at 01 at — [_ Ol TJ C at at 44 (0 0) C _J a> at L. at O > JO CD at 44 at C UJ at 01 at 3 _ l at or at K-t—1 at at u. at at u. * # # * * CJ z at at at at .. at at at at L. at at at at 0J at at at 44 at 01 at at at 01 3 at QJ at * at a at 44 at at at 44 c at c at at at at —-at at • • at 01 at at at at 3 — at at at at C CO at at at at 44 3 at .—-at at at 44 at at at _J _J at 10 0 at c at at < < at 4— CO at CO at at or or at at OJ at at CS CS at in 01 at —• at at UJ U l at in z • at 0 at at I- h - at U l 44 TJ at 0 at at z Z at or 01 at D at at at a c c at at at at E L. t- at in at at • - at D 3 3 at in at at U l UJ at U 44 44 at UJ at at M I M at OJ 01 at or at £ at t—j at tt- C L. at 0 . at at in in at t—i at E at D at 1 1 at QJ O at D at at U l UJ at to V) at CJ at 0) at .. cs CJ at QJ at at Z at -^ < < at C 3 CO at at 44 at E E at c at Ul at at O « o >- at — QJ 10 at Z at **- at at Z — at »—i at O at - w » M^  at 44 44 at _1 at at - E - E at 3 O 0) at 1 at 10 at Z> Z) at a c at K at C at - z - Z at c - t- at Z> at 0 at 1 1 -— at 4- 10 — at CL at at 1- - K at jr at z at 10 at - UJ t- U l at c C 44 at at c at 1- CS O. CS at to CO 3 at at QJ at a E in at - O. at or at E at E --4 O ~ Z at J2 C at i -at at O O or u o at 0 -r- at in at TJ at in or c o. c »-t at TJ at at at Z a. 3 1 3 in at TJ QJ QJ at L. at QJ at CJ 1 c _J L . Z at c TJ r at to at Z at i-i UJ 44 U l 44 UJ at 0) TJ 44 at > at +4 at in z X E at QJ at at at Z l-t It *-t II i-t at QJ D u- at — at 44 at u i a •• D at z E O at Z at QJ at £ 1 at 44 OJ at _ i at 01 at * H V-4 > -.—• K at JZ at o at at D CS CS - J UJ at c 01 44 at UJ at TJ at 1 in u i in u i CS at - O) at 1 at C at K E Z E X at 3 a c at *— at co at UJ 1 - 1- at 44 — 01 at U l at at CJ h- _ l I - O. « at 0) 44 f— at C5 at L at Z w Z w w at t- »— at at 0 at QJ >-i E >-< E at 3 0J at C at M- at i_ C or >-t or f t at TJ E Z at 0 at at 3 0 . Q o. o at C h- at f - L. at 44 at TJ Ol TJ at CO OJ at 44 CO at a at QJ QJ C at > • at 0 > at E at O Z QJ at TJ O OJ at c at O at O at CO E C at 3 at S- at i. at OJ 0) - at 4 -at a at O. at or c — at at at at at at at at at * * * * * * * * * * * 4t C 0 C 0 C 0 C 0 C D C D C D C D C 0 C 0 C 0 C D C O C O C D C D C O C 0 LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 871 I Integer; 872 LAST_CHAR_BLANK : boolean; 873 CHR : char; 874. 875 876 beg 1 n 877 878 I : = 0; 879 LAST_CHAR_BLANK := f a l s e ; 880 881 w h i l e ->eof( INPUT ) and ->eoln( INPUT ) do 882 be g i n 883 read( CHR ); 884 If CHR ->= ' ' o r not COMPRESS then 885 beg 1 n 886 If LAST_CHAR_BLANK and I>0 then 887 begl n 888 I := I + 1; 889 STR(I) := ' ' 890 end; 891 I : = I + 1 ; 892 STR( I ) := CHR; 893 LAST_CHAR_BLANK := f a l s e ; 894 end; 895 e l se 896 LAST_CHAR_BLANK := t r u e ; 897 end; 898 899 If not COMPRESS and I>0 then 900 GET_EOLN := I - 1; 901 e l se 902 GET_E0LN := I 903 904 905 end (* GETEOLN * ) ; 906 907 908 909 910 (* 91 1 (* 912 '• (* Re t u r n the numerical v a l u e of a s t r i n g In the Input stream. If 913 (* INTEGRAL_VALUE 1s t r u e then the s t r i n g must r e p r e s e n t an Integer, 914 (* o t h e r w i s e a r e a l number. The numerical v a l u e must a l s o be 1n the 915 (* range s p e c i f i e d by RANGE. 916 (* 917 (* 918 f u n c t i o n GET NUM( RANGE : VALUE RANGE; 919 INTEGRAL_VALUE : boolean ) : r e a l ; 920 . 92 1 var 922 STR :. INPUT_LINE; 923 VALID : boolean; 924 VALU : r e a l ; 925 I, J , MULT : Integer; 926 927 928. b e g i n LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 929 r e p e a t 930 VALID := t r u e ; 931 read( STR ); 932 If e o f ( INPUT ) then (* CHECK FOR EOF *) 933 b e g i n 934 VALID := f a l s e ; 935 PRINT_MSG( EOF_NO, ' ', 0 ) 936 end; 937 e l s e 938. b e g i n 939 VALU := 0.0; (* GET INTEGRAL PART *) 940 I := 1 ; 94 1 MULT := 1; 942 w h i l e I <= MAX_LINE_LEN and STR(I) = ' ' do 943. I := I + 1; 944 1f STR(I) = '+' or STR(I) = '-' then 945 b e g i n 946 1f STR(I) = '-' then 947 MULT := -1; 948 I : = I + 1 949 end; 950 w h i l e STR(I) In (. '0'..'9' .) do 951 b e g i n 952 VALU := 10.0 * VALU + ord( STR(I) ) - o r d ( ' O ' ) ; 953 I := I + 1 954 end; 955 1f STR(I ) = ' . ' then 956 b e g i n (* GET FRACTIONAL PART *) 957 J := 10; 958 . I : = I + 1 ; 959 w h i l e STR(I) 1n (. '0'..'9' ) do 960 b e g i n 961 VALU := VALU + ( ( o r d ( S T R ( I ) ) - o r d ( ' 0 ' ) ) / J ) ; 962 I := I + 1; 963 J := J * 10 964 end; 965' end; 966 If STR(I) ' ' or ( eoln(INPUT) and I = MAX_LINE_LEN+1 ) then 967 b e g i n (* INVALID NUMBER *) 968 VALID := f a l s e ; 969 i f STR(I) ->= ' '. then 970 PRINT_MSG( INVALID_NO, STR(I), 1 ) 971 e l s e 972. i f RANGE i n (. PERCENT .) then 973 b e g i n 974 VALID := t r u e ; 975 MULT := 1; 976 VALU := DEFAULT; 977 end (* i f RANGE i n * ) ; 978 e l s e ^ 979 PRINT_MSG( NULLNO, ' ', O ) CO 980 end 981 e l s e 1f INTEGRAL_VALUE and trunc(VALU) VALU then 982 b e g i n 983 VALID := f a l s e ; 984 i PRINT_MSG( NON_INTEGRAL_VALUE, '', 0 ) 985 end 986 e l s e i f STR(I) = ' ' and ( STR(I-1)='-' or STR(I-1)='+' ) then LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 987 b e g i n 988 VALID := f a 1se; 989 PRINT_ MSG( UNEXPECTED_BLANK, '', 0 ) 990 end; 991 e l s e If (RANGE = POSITIVE and (MULT < 0 or VALU = O O ) ) or 992 (RANGE = IMAGE SIZE and (MULT < 0 or 993 VALU < 1 or VALU > MAX IMAGE SIZ E ) ) or 994 (RANGE = LINES and (MULT < 0 or • 995 VALU < 1 or VALU > DIM(LINE))) or 996 (RANGE = LINE LENGTH and (MULT < 0 or 997 VALU < 1 or VALU > DIM(PIXEL))) or 998 (RANGE = INTENSITY and (MULT < 0 or 999 VALU < MIN INTENSITY or 1000 VALU > MAX INTENSITY)) or 1001 (RANGE = NON NEGATIVE and MULT < O) or 1002 (RANGE = PERCENT and (MULT < 0 or 1003 VALU < 0 or VALU > 100)) or 1004 (RANGE = NON ZERO and VALU = 0.0) then 1005 beg 1 n 1006 VALID := f a l s e ; 1007 PRINT_ MSG( NOT_IN_RANGE, " , O ) 1008 end; 1009 end: 1010 u n t i l VALID; 101 1 GET NUM := VALU * MULT 1012 . 1013 1014 end (* GETNUM * ) ; 1015 1016 1017 1018 (* *) 1019 (• *) 1020 (* Update the c i r c u l a r h o r i z o n , HORI_RAD and HORIALT, by u p d a t i n g the *) 1021 (* I n f o r m a t i o n In the h o r i z o n between the CURRent THeTa and the *) 1022 (* PREVIOUS THeTa. *) 1023 (* *) 1024 (* *) 1025 p r o c e d u r e H0RIZON_UPDATE( CURR POLAR, PREV POLAR : P0LAR_CO0RD; 1026 CURR ALT, PREV ALT : Int; 1027 var HORI_RAD, HORI_ALT : HORZN_LINE ); 1028 1029 var 1030 START ALT, 1031 STOP ALT Int; 1032 I, START, STOP : 1nteger; 1033 ALT, RAD, RF, D : s h o r t ; 1034 START POLAR, 1035 STOP_POLAR POLAR_COORD; 1036 1037 1038 b e g i n 1039 1040 If CURR POLAR(THT) > 270 and PREV POLAR(THT) = 0 then 104 1 PREV_POLAR(THT) : = 360; 1042 1043 If CURR_POLAR(THT) < PREV_POLAR(THT) then 1044 beg 1 n LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1045 1046 START := t r u n c ( CURR_POLAR(THT) ); 1047 STOP := t r u n c ( PREV_POLAR(THT) ); 1048 1f START <> CURR_POLAR(THT) then 1049 1ncr( START ); 1050 START_POLAR := CURR_POLAR; 1051 ST0P_POLAR := PREVPOLAR; 1052 START_ALT := CURRALT; 1053. STOP_ALT := PREV_ALT; 1054 1055 end (* i f CURR_POLAR(THT) < PREV_POLAR(THT) * ) ; 1056 e l s e 1057 b e g i n 1058 1059 START := t r u n c ( PREV_POLAR(THT) ); 1060 STOP := t r u n c ( CURR_POLAR(THT) ); 1061 i f STOP <> CURR_POLAR(THT) then 1062 d e c r ( STOP ); 1063 START_POLAR := PREV_POLAR; 1064 STOP_POLAR := CURR_POLAR; 1065 START_ALT := PREV_ALT; 1066 STOP_ALT := CURR_ALT; 1067 1068 end (* e l s e CURR_POLAR(THT) >= PREVPOLAR(THT) * ) ; 1069 1070 f o r I := START to STOP do 107 1 b e g i n 1072 1073 ALT :* (START_ALT * (STOP_POLAR(THT) - I) + 1074 STOP_ALT * (I - START_POLAR(THT)) ) / 1075 (STOPPOLAR(THT) - START_POLAR(THT)); 1076 1077 RAD := (START_POLAR(RDS) * (STOP_POLAR(THT) - I) + 107B STOP_POLAR(RDS) * (I - START_POLAR(THT)) ) / 1079 (STOP_POLAR(THT) - START_POLAR(THT)); 1080 1081 RF := RAD * FOCAL_LENGTH; 1082 0 :» RF / (H - ALT) - RF / H; 1083 RAD :» RAO + D * (H / FOCAL_LENGTH); 1084 1085 If VISIBLE( ALT, H O R I A L T ( I ) , RAD, HORI_RAD(I) ) then 1086 b e g i n 1087- HORI_RAD(I) := RAD; 1088 HORI_ALT(I) := ALT; 1089 end (* i f RAD > HORI_RAD(I) and ... * ) ; 1090 1091 end (* f o r I * ) ; 1092 1093 1094 end (* HORIZONUPDATE * ) ; VO 1095 Ol 1096 1097 1098 (* H»M»MVMM^HIIMMHHHMHMMH»MHMHHIIHHMMMMNHMMMnM»ltMHMHHHMMMMMMMMMHUMMMMM»MMMMil *) 1099 (* •) 1100 (* I n s e r t the p i x e l w i t h i n t e n s i t y INTEN i n t o the IMAGE at p o s i t i o n *) 110.1 (* (X.Y). *) 1102 (* *) LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1 103 1 104 1 105 1 106 1107 1 108 1 109 1 1 10 1111 1112. 1 1 13 1 1 14 1115 1 1 16 1117 1 1 18 1 1 19 1 120 1121 1 122 1 123 1 124 1 125 1 126 1 127 1 128 1 129 1 130 1131 1 132 1 133 1 134" 1 135 1 136 1 137 1 138 1 139 1 140 1141 1 142 1 143. 1 144 1 145 1 146 1 147 1 148 1 149 1 150 1 151 1 152 1 153 1 154 1 155 1 156 1 157 1 158 1 159 1 160 p r o c e d u r e INSERT_PIXEL( var IMAGE : INT_ARRAY; Y, X : s h o r t ; INTEN : Integer; ); var X_INT, Y_INT : Integer; (* Perform the a c t u a l I n s e r t i o n . *) pro c e d u r e PERFORM_INSERT( Y, X, I : Integer ); b e g i n If IMAGE(Y,X) = UNDEFINED then I MAGE(Y,X ) := I; e l se IMAGE(Y,X) := round( (I + IMAGE(Y,X ) ) / 2 ); end (* PERFORM_INSERT * ) ; b e g i n X_INT := t r u n c ( X ); Y_INT := t r u n c ( Y ); PERFORM_INSERT( Y_INT, X_INT. INTEN ); If Y = Y_INT then b e g i n i f X <> X_INT then PERFORM_INSERT( Y_INT, X_INT+1, INTEN ); end; e l se If X = X_INT then PERFORM_INSERT( YINT+1, X_INT, INTEN ); e 1 se b e g i n PERFORM_INSERT( Y_INT, X_INT+1, INTEN ) PERFORM_INSERT( Y_INT+1, X I N T , INTEN ) PERFORM_INSERT( Y_INT+1, X_INT+1, INTEN ) end; end (* INSERT_PIXEL * ) ; <* *) (* For u n d e f i n e d p i x e l s of the Image a r r a y IMAGE, perform a c u b i c *) (* c o n v o l u t i o n to d e f i n e them. *) <* *) n r n r o H u r o T M T P D D n l A T C t f w-ai* T U A C C H I T A O D A V A . p r o c e d u r e INTERPOLATE* var IMAGE : INT_ARRAY ); var X_CENT, Y_CENT, X, Y, X_MAX, Y_MAX : Integer; DEFINED FOUND : boolean; LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1161 1162 (* Perform a c u b i c c o n v o l u t i o n 1f u n d e f i n e d *) 1163 (* and 1n the I n t e r i o r of the Image. *) 1164 p r o c e d u r e PERFORM_INTER( X, Y : Integer ); 1165 1166 b e g i n 1167 1168 1f IMAGE(X,Y) <> UNDEFINED then 1169. DE FINED_FOUND := tr u e ; 1170 e l s e 1171 If DEFINED_FOUND then 1172 CUBIC_CONVOLUTION( IMAGE, X, Y ): 1173 e l s e 1174 IMAGE(X,Y) := MIN_INTENSITY; 1 175 1176 end (• PERFORM_INTER * ) ; 1 177-1 178 1 179 1180 b e g i n 1181 1 182 X_MAX := DIM(LINE ); 1183 Y_MAX := DIM(PIXEL); 1184 X_CENT := t r u n c ( (X_MAX+1) / 2 ); 1185 Y_CENT := t r u n c ( (Y_MAX+1) / 2 ); 1 186 1187 f o r X := 1 to X_CENT do 1188 b e g i n 1 189 1190 DEFINED_FOUND := f a l s e ; 1191 f o r Y := 1 to min( X, Y_CENT ) do 1192 PERFORM_INTER( X, Y ); 1 193 1194 DEFINED_FOUND := f a l s e ; 1195 f o r Y := Y_MAX downto max( Y_MAX-X+1, Y_CENT ) do 1196 PERFORM_INTER( X, Y ); 1 197 1198 end (* f o r X * ) ; 1 199 1200 f o r X := X_CENT+1 to X_MAX do 1201 beg i n 1202 1203 DEFINED_FOUND := f a l s e ; 1204 f o r Y := 1 to m1n( XMAX-X+1, YCENT ) do 1205. PERFORM_INTER( X, Y ); 1206 1207 DEFINED_FOUND := f a l s e : 1208 f o r Y := Y_MAX downto max( Y_MAX-X_MAX+X, Y_CENT ) 1209 PERFORM_INTER( X, Y ); 1210 1211 end (* f o r X * ) ; 1212 12 13 f o r Y := 1 to Y_CENT do 1214 beg i n 1215 1216 DEFINED_FOUND := f a l s e ; 1217 f o r X := 1 to m1n( Y, X_CENT ) do 1218 PERFORM_INTER( X, Y ); LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12. 1982 ID=LIFE 1219 1220 DEFINED FOUND := f a l s e ; 1221 f o r X := X MAX downto max( X MAX-Y+1, X_CENT ) do 1222 PERFORM_INTER( X, Y ); 1223 1224 end (* f o r Y * ) ; 1225 1226 f o r Y := Y_CENT+1 to Y_MAX do 1227 begin 1228 1229 DEFINED FOUND := f a l s e ; 1230 f o r X := 1 to m1n( Y MAX-Y+1, X CENT ) do 1231 PERFORM_INTER( X, Y ); 1232 1233 DEFINED FOUND := f a l s e : 1234 f o r X := X MAX downto max( X MAX-Y MAX+Y, X CENT ) do 1235 PERFORM_INTER( X, Y ); 1236 1237 end (* f o r Y * ) ; 1238 1239 1240 124 1 end (* INTERPOLATE * ) ; 1242 1243 1244 1245 (* 1246 (* 1247. (* C a l c u l a t e which o c t a n t of a c i r c l e the c a r t e s i a n c o o r d i n a t e s (X,Y) 1248 (* r e s i d e i n . The f i r s t o c t a n t i s where X>0, Y>0, and X>=Y, assuming 1249 . (* the p r i n c i p l e p o i n t to be the o r i g i n . Move c o u n t e r c l o c k w i s e t o 1250 (* the second o c t a n t . 1251 (* 1252 (* 1253 • p r o c e d u r e 0CT_1_TRANSF0RM( var X, Y, OCT : i n t e g e r ); 1254 1255 v a r 1256 X_TEMP : Integer; 1257 1258 1259 b e g i n 1260 1261 If X > 0 then 1262 i f Y >= 0 then 1263 . i f abs( Y ) > abs( X ) then 1264 OCT := OCT 2; 1265 e l s e (* abs( Y ) <= abs( X ) *) 1266 OCT := OCT 1 ; 1267 e l s e (* Y < 0 *) 1268 i f abs( Y ) >- abs( X ) then 1269 OCT := OCT 7; 1270 e l s e (* abs( Y ) < abs( X ) *) 127 1 OCT := 0CT_8; 127 2 1273 e l s e i f X < 0 then 1274 If Y > 0 then 1275 i f abs( Y ) >= abs( X ) then 1276 OCT := OCT 3; CO LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1277 e l s e (* abs( Y ) < abs( X ) *) 1278 OCT := 0CT_4; 1279 • e l s e 1f Y < 0 then 1280 tf abs( Y ) > abs( X ) then 1281 OCT := OCT 6; 1282 e l s e (* abs( Y ) < = abs( X ) *) 1283 OCT := OCT 5; 1284 e l s e (* Y = 0 *) 1285 OCT := 0CT_5; 1286 1287 e l s e (* X = 0 *) 1288 1f Y > 0 then 1289 OCT := 0 C T 3 ; 1290 e l s e If Y < 0 then 1291 OCT := OCT 7; 1292 e l s e (* Y = O *) 1293 OCT := 0CT_1; 1294 1295 1296 c a s e OCT of 1297. 1298 0CT_1, 0CT_4, 0CT_5, 0 C T 8 : 1299 beg 1 n 1300 X := abs( X ); 1301 Y := abs( Y ); 1302 end (* 0CT_1, .. . * ) ; 1303 1304 0CT_2, 0CT_3, 0CT_6, 0CT_7 : 1305 begl n 1306 X TEMP := X; 1307 X := abs( Y ); 1308 Y := abs( X TEMP ); 1309 end (* 0CT_2, .. • * ) ; 1310 1311 end (* case OCT of *) ; 1312 1313 ' 1314 end (* 0CT_1_TRANSF0RM *) ; 1315 1316 1317 1318 C 1319 (* 1320 . (* I n i t i a l i z e the lookup t a b l e s to t r a n s f o r m c a r t e s i a n c o o r d i n a t e s 1321 (* Into p o l a r c o o r d i n a t e s . 1322 (* 1323 (* 1324 p r o c e d u r e POLAR_INIT( SIZE : Integer ); 1325 1326 var 1327 X, Y : Integer 1328 1329 1330 beg 1 n 1331 1332 RADIUS LOOKUP := ALLOCATE SPACE( round( SIZE * (SIZE + 1) / 2 ) 1333 THETA_LOOKUP := ALLOCATE_ SPACE( round( SIZE * (SIZE + 1) / 2 ) 1334 VO LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1335 f o r X := O to SIZE-1 do 1336 f o r Y := O to X do 1337 b e g i n 1338 1339 PUT_ARRAY( RADIUS_LOOKUP, X, Y, r o u n d t o s h o r t ( s q r t ( s qr( X ) + s q r ( Y ) ) ) ); 1340 1f X = 0 then 1341 PUT_ARRAY( THETALOOKUP, X, Y, UNDEFINED ); 1342 e l s e 1343 PUT_ARRAY( THETA_L00KUP, X, Y, s h o r t ( a r c t a n ( Y/X ) ) ); 1344 1345 end (* f o r Y * ) ; 1346 1347 1348 end (* POLAR_INIT * ) ; 1349 1350 1351 1352 (* tftf/^/y*****^***^^*/'/?******^ *) 1353 (* *) 1354 (* V i a lookup t a b l e s , t r a n s f o r m the c a r t e s i a n c o o r d i n a t e s (X.Y) Into *) 1355 (* p o l a r c o o r d i n a t e s . Return the p o l a r form. *) 1356 (* *) 1357 . (* *) 1358 f u n c t i o n POLAR_TRANSFORM( X, Y : Integer ) : P0LAR_C00RD; 1359. 1360 var 1361 OCT : Integer; 1362 0CT_1_THETA : s h o r t ; 1363 POLAR : P0LARC00RD; 1364 1365 1366 b e g i n 1367 1368 0CT_1_TRANSF0RM( X. Y, OCT ); 1369 1370 P0LAR( RDS ) := GET_ARRAY( RADIUS_LOOKUP, X, Y ); 1371 1372 0CT_1_THETA := r o u n d t o s h o r t ( GET_ARRAY( THETA_LOOKUP, X, Y ) / DEG_TO_RAD ); 1373 c a s e OCT of 1374 1375 0CT_1 1376 POLAR( THT ) := 0CT_1_THETA; 1377 0CT_2 1378 POLAR( THT ) := 90 - 0CT_1_THETA; 1379 0CT_3 1380 POLAR( THT ) := 90 + 0CT_1_THETA; 1381 0CT_4 1382 POLAR( THT ) := 180 - 0CT_1_THETA; 1383 0CT_5 1384 P0LAR( THT ) := 180 + 0CT_1_THETA; 1385 0CT_6 O 1386 P0LAR( THT ) := 270 - 0CT_1_THETA; 1387 0CT_7 1388 P0LAR( THT ) := 270 + 0CT_1_THETA; 1389 0CT_8 : 1390 P0LAR( THT ) := 360 - 0CT_1_THETA; 1391 1392 . end (* case OCT of * ) ; LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1393 1394 POLAR_TRANSFORM := POLAR; 1395 139G 1397 end (* POLAR_TRANSFORM * ) ; 1398' 1399 1400 1401 (* HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHtiHHHBHHtlltltHlttllt-llli *) 1402 (* *) 1403 (* P r i n t the message s p e c i f i e d by MSG to the output stream. The *) 1404 (* parameters STRING and SIZE may be Involved 1n the d e t a i l s of *) 1405 (* t h a t message. *) 1406 (* *) 1408 p r o c e d u r e PRINT_MSG( MSG : MSG_TYPE; STRING : INPUT_LINE; 1409 SIZE : Integer ); 1410 1411 c o n s t 1412 . MSG_PROMPT = ' : ' ; 14 13 14 14 v a r 14 15 I , J 1nteger; 1416 STR : INPUT_LINE; 14 17 1418 14 19. b e g i n 1420 1421 SET_PREFIX( MSGPROMPT, 1 ); 1422 1423 If MSG 1n (. LINE_PROMPT, UNIT_0_UNASSIGNED, INVALID_FILE, 1424 ENTER_CENTER_X_COORD, ENTER_GRID_SPACING, 1425 ENTER_PRINT_SIZE, 1426 UNIT_1_UNASSIGNED, ENTER_ELEVATION .) then 1427 w r l t e l n ; 1428 1429 c a s e MSG of 1430 UNEXPECTED_EOF 1431 w r 1 t e l n ( ' Unexpected EOF -- Ignored'); 1432 UNREC_CMD 1433 b e g i n 1434 w r 1 t e l n ( ' I n v a l i d command -- Input l i n e I g n o r e d ' ) ; 1435 1f - e o l n ( INPUT ) then 1436 I := GET_EOLN( STR, COMPRESSED ) 1437- end; 1438 EOLN_MSG 1439 b e g i n 1440 I := GET_EOLN( STR, COMPRESSED ); 1441 If I O then 1442 b e g i n Q 1443 wr1te(' I n v a l i d c h a r a c t e r ( s) : " ' ) ; l_i 1444 WRITE_STRING( STR, I ); 1445 wr1te1n('" -- Ignored') 1446 end 1447 end; 1448 LINE_PROMPT 1449 wr1te1n('SEnter number of l i n e s of DTM and IMAGE ( I n t e g e r ( 1 - 2 5 6 ) ) : ' ) : 1450 PIXEL_PROMPT : LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1451 w r 1 t e l n ( ' S E n t e r number of p i x e l s per l i n e ( I n t e g e r {1-256} ) 1452. E0F_N0 : 1453 wr1teln('SUnexpected EOF, Enter number:'); 1454 NULL_N0 1455 wr1te1n( 'SNot e x p e c t i n g n u l l l i n e -- Ignored; E n t e r number:' ): 145G. NON_INTEGRAL_VALUE: 1457 wr1teln('SNon-1ntegra1 v a l u e . Re-enter number:'); 1458 UNEXPECTED_BLANK: 1459 wr1teln('SUnexpected blank, Re-enter number:'); 1460 NOT_IN_RANGE 1461 wr1teln('SOut of range. Re-enter number:'); 1462 UNIT_0_UNASSIGNED: 1463 w r 1 t e l n ( ' L o g i c a l u n i t 0 has not been a s s i g n e d . ' . 1464 EOL, '8 Enter FDname of l o c a t i o n of DTM : ' ) ; 1465 UNIT_1_UNASSIGNED: 1466 w r 1 t e l n ( ' L o g i c a l u n i t 1 has not been a s s i g n e d . ' . 1467 EOL, 'S Enter FDname of l o c a t i o n of IMAGE : ' ) ; 1468 INVALID_FILE : 1469 w r 1 t e l n ( ' I n v a l i d FDname. Enter a g a i n o r ' , EOL, 1470 'SEnter "CANCEL" to t e r m i n a t e program:'); 1471 UNEXPECTED_INPUT_EOF: 1472 ' w r 1 t e l n ( ' Unexpected EOF encountered on Input', 1473 ' -- DTM s i z e updated'); 1474 INVALID__NO : 1475 b e g i n 1476 w r 1 t e l n ( ' S l n v a l 1 d c h a r a c t e r , "', STRING(l), '", Re-enter number 1477 I := GET_E0LN( STR, COMPRESSED ) 1478 . end; 1479 ENTER_CENTER_X_COORD: 1480 b e g i n 1481 w r i t e (' Enter the c o o r d i n a t e s of the', 1482 ' p r i n c i p a l ' , EOL, ' p o i n t of the ' ) ; 1483 WRITE_STRING( STRING, SIZE ): 1484 w r l t e l n f ' Image:', EOL, 1485 '8 X ( p i x e l - INTEGER {1-', DIM(PIXEL):0, ' ) ) : ' ) ; 1486 end; 1487 ENTER CENTER Y COORD: 1488 w r 1 t e l n ( ' S Y ( l i n e - INTEGER {1-', DIM(LINE ):0, ' ) ) : ' ) ; 1489 ENTER_GRID_SPACING: 1490 w r 1 t e l n ( ' S E n t e r DTM g r i d s p a c i n g (1n DTM u n i t s ) : ' ) ; 1491 ENTER_ELEVATION : 1492 w r 1 t e l n ( ' S E n t e r e l e v a t i o n of Imaging d e v i c e (1n DTM u n i t s ) : ' ) ; 1493 ENTER_FOCAL_LENGTH: 1494 w r 1 t e l n ( ' S E n t e r f o c a l l e n g t h of Imaging d e v i c e (1n DTM u n i t s ) : ' ); 1495 ENTER_PRINT_SIZE: 1496 wr1tel n ( ' S E n t e r p r i n t s i z e of Imaging d e v i c e (1n DTM u n i t s ) : ' ) ; 1497 PRINT_PRINT_SIZE: 1498' w r l t e l n ( ' P r i n t s i z e , 1n DTM p i x e l s . Is a p p r o x i m a t e l y ', 1499 SIZE:0,' X ',SIZE:0,' p i x e l s . ' ); 1500 1 5 0 1 : end (* case * ) ; 1502 1503 1f MSG 1n (. LINE PROMPT, PIXEL PROMPT, INVALID NO, 1504 NON INTEGRAL VALUE, UNEXPECTED BLANK, NOT_IN_RANGE, 1505 UNIT O UNASSIGNED, UNIT 1 UNASSIGNED, INVALIDF ILE, 1506 ENTER ELEVATION, ENTER CENTER X COORD, 1507 ENTER GRID SPACING, ENTER FOCAL LENGTH, 1508 ENTER CENTER Y COORD, ENTER PRINT SIZE, LISTING OF FILE L I F E r p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1509 EOF_NO, NULL_NO .) then 15 10 r e a d l n ; 151 1 1512 SET_PREFIX( PROMPT, 1 ) 1513 1514 1515- end (* PRINTMSG * ) ; 1516 1517 1518 1519 (* 1520 (* 1521 (* I n s e r t the v a l u e VALU Into ARR(X.Y). 1522 (* 1523 (* 1524. p r o c e d u r e PUT_ARRAY( ARR : POINTER; X, Y : Integer; VALU : s h o r t ); 1525 1526, va r 1527 PTR : POINTER; 1528 1529 1530 b e g l n 1531 1532. 1f Y > X then 1533 SYSTEM ERROR( ' In "PUT ARRAY"; S u b s c r i p t e r r o r ' ); 1534 PTR := POINTER( a d r o f ( ARRiP ) + (BYTES PER WORD * 1535 WORDS_PER_ENTRY * ( X * ( X + 1 ) / 2 + Y ) ) ); 1536 PTR9> := VALU; 1537 1538 1539 end (* PUT_ARRAY * ) ; 1540. 154 1 1542 1543 (* 1544 C 1545 (* If READ_REOD Is t r u e then read 1n a l i n e from the f i l e DTM_FILE, 1546 (* o t h e r w i s e perform the subsequent o p e r a t i o n s on the p r e s e n t Input 1547 (* b u f f e r . Convert the b i n a r y form of the b u f f e r Into Integer form 1548 (* assuming two by t e s per p i x e l . 1549 (* 1550 (* 1551 f u n c t i o n READ_DTM_LINE( var DTMFILE : DTMFILE; READ_REOD : b o o l e a n ) 1552 1553. va r 1554 LINE : INT_LINE; 1555 I : i n t e g e r ; 1556 1557 1558 b e g i n 1559 1560 i f READ REOD then 1561 get( DTM FILE ); 1562 f o r I := 1 to DIM(PIXEL) do 1563 LINE(I) := 1nt( DTM F I L E * ( ( I - 1 )*2 + 1 ) ) * 256 + 1564 1nt( DTM FILE@((I-1)*2 + 2) ); 1565 READ DTM LINE := LINE; 1566 LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1567. 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 161 1 1612 1613 1614 16 15 1616 1617 1618 1619 1620 1621 1622 1623 1624 end (* READ_DTM_LINE * ) ; <• *) (* I f READ_REQD Is t r u e then r e a d 1n a l i n e from the f i l e IMAGE_FILE, *) (* o t h e r w i s e perform the subsequent o p e r a t i o n s on the p r e s e n t Input *) (* b u f f e r . Convert the b i n a r y form of the b u f f e r Into Integer form *) (* assuming one byt e per p i x e l . *) (* *) f u n c t i o n READ_IMAGE_LINE( v ar IMAGE_FILE : IMAGEFILE; READREQD : bo o l e a n ) : INT_LINE; va r LINE : I N T L I N E ; I : Integer; b e g i n 1f READ_REOO then get( IMAGE_FILE ): f o r I := 1 to DIM(PIXEL) do LINE(I) := 1nt( IMAGE_FILE@(I) ); READ IMAGE_LINE := LINE; end (* READ_IMAGE_LINE * ) ; (* *) (* Read the LINE_NOth l i n e of e i t h e r the DTM_FILE o r the IMAGE_FILE *) (* depending on the v a l u e of TYP. The reads a r e performed by e i t h e r *) (* READ DTM LINE or READ IMAGE LINE. The r e s u l t 1s r e t u r n e d In INT_LINE. *) C " " *) ( * ########A'/?##/S'#########^ #/!'#A#^  * ) f u n c t i o n READ_LINE( TYP, LINE_NO : Integer; RESETREOD : boo l e a n ) : INT_LINE; va r I Integer; b e g i n I—' c a s e TYP of ° DTM beg 1 n 1f RESET_REOD then beg 1 n r e s e t ( DTM_FILE ); f o r I := 1 to LINE NO-1 do LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1625 get( DTM FILE ); 1626 . READ LINE := READ DTM LINE( DTM FILE, 1627 not READ REOD ); 1628 end (* 1f RESET_REOD * ) : 1629 e 1 se 1630 READ LINE := READ DTM LINE( DTM FILE, 1631 READ_REOD ); 1632 end (* DTM * ): 1633 1634 1635 IMGE 1636 beg 1 n 1637 If RESET_REOD then 1638 beg 1 n 1639 r e s e t , IMAGE FILE ): 1640 f o r I := 1 to LINE NO-1 do 164 1 get( IMAGE FILE ); 1642 READ LINE := READ IMAGE LINE( IMAGE FILE, 1643. not READ REOD ); 1644 end (* 1f RESET_REOD * ) ; 1645 e l se 1646 READ LINE := READ IMAGE LINE( IMAGE FILE, 1647 . READ REOD ); 1648 end (* IMGE * ) ; 1649 1650 end (* case TYP of * ) ; 1651 1652 1653 end (* READ_LINE * ) : 1654 1655 1656 . 1657 (* 1658 (* 1659 (* Read a s t r i n g from the Input stream removing a l l l e a d i n g b l a n k s . 1660 (* The s t r i n g Is then r e t u r n e d . 1661 (* 1662 (* 1663 f u n c t i o n READ_STRING : INPUT_LINE; 1664 1665' var 1666 I Integer; 1667 STR : INPUT_LINE; 1668 1669 1670 b e g i n 1671.' 1672 STR := ' '; 1673 I : = 0; 1674 rep e a t 1675 )ncr( I ); 1676 read( STR(I) ); 1677 If STR(I) = ' ' and I = 1 then 1678 I : = O; 1679 u n t i l eof(INPUT) or eoln(INPUT) or (I -•= 0 and STR(I) = ' ') 1680 or I = MAX_LINE_LEN; 1681 1682 READ_STRING := STR; LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1G83 1684 1685 1686 1687 1688 1689 1690 . (* 1691 (* 1692 (* 1693 (* 1694 (* 1695 (* 1696 1697 1698 1699 1700 1701 1702 1703 • 1704 1705 1706 1707 1708 1709 1710 1711' 1712 1713. 1714 1715 1716 1717 1718' 1719 1720 1721. 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 end READ STRING *) I n i t i a l i z e the system by s e t t i n g up the f i l e s , g e t t i n g the dimensions *) of the DTM, and r e a d i n g the n e c e s s a r y system parameters. p r o c e d u r e SYS_INIT; MAX_LEFT, MAX_RIGHT I , J 1nt: 1nteger; b e g l n SET_PREFIX( PROMPT, 1 ); FILES; GET_DIMENSIONS; PRINT_MSG( ENTER_GRID_SPACING, " , 0 ); GRID_SPAC := r o u n d t o s h o r t ( GET_NUM( POSITIVE, NOT INTEGRAL ) ); PRINT_MSG( ENTER_ELEVAT ION, " , 0 ); H := r o u n d t o s h o r t ( GET_NUM( POSITIVE, NOT INTEGRAL ) ); PRINT_MSG( ENTER_FOCAL_LENGTH, " , 0 ); FOCAL_LENGTH := r o u n d t o s h o r t ( GET_NUM( NON_NEGATIVE, NOT INTEGRAL ) ); PRINT_MSG( ENTER_PRINT_SIZE. " , 0 ); PRINT_SIZE := ro u n d t o s h o r t ( GET_NUM( POSITIVE, NOT INTEGRAL ) ); FULL_IMAGE_SIZE := round( PRINT_SIZE * H / (FOCAL_LENGTH * GRID_SPAC) ); HALF_IMAGE_SIZE := round( PRINT_SIZE * H / (2 * FOCAL_LENGTH * GRID_SPAC) ); PRINT_MSG( PRINT_PRINT_SIZE, " , FULL_IMAGE_SIZE ); PRINT_MSG( ENTER_CENTER_X_COORD, ' l e f t ', 5 ); CENTER(LEFT ,X) := trunc( GET_NUM( LINE_LENGTH, INTEGRAL ) ); PRINT_MSG( ENTER_CENTER_Y_COORD, '', 0 ); CENTER(LEFT ,Y) := t r u n c ( GET_NUM( LINES, INTEGRAL ) ); PRINT_MSG( ENTER_CENTER_X_COORD, T i g h t ' , 5 ); CENTER(RIGHT.X) := tr u n c ( GET_NUM( LINE_LENGTH, INTEGRAL ) ): PRINT_MSG( ENTER_CENTER_Y_COORD, '', 0 ); CENTER(RIGHT,Y) := trunc( GET_NUM( LINES, INTEGRAL ) ); O MAX_LEFT := max( CENTER(LE FT ,X), max( CENTER(LEFT max( DIM(PIXEL) - CENTER(LEFT ,X), DIM(LINE ) - CENTER(LEFT ,Y) ) ) ); Y), LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1741 MAX RIGHT := max( CENTER(RIGHT,X), max( CENTER(RIGHT,Y), 1742 max( DIM(PIXEL) - CENTER(RIGHT,X), 1743 DlM(LINE ) - CENTER(RIGHT,Y) ) ) ); 1744 ' MAX_HALF := max( MAX_LEFT, MAX_RIGHT ) + 1; 1745 1746 POLAR INIT( MAX HALF ); 1747 XY_INIT; 1748 1749 1750 end (* SYSTEM_INITIALIZATION * ) ; 1751. 1752 1753 1754 <* *) 1755. (* + .) 1756 (* If a system e r r o r o c c u r s , output the message MESSAGE and h a l t the *) 1757 (* e x e c u t i o n of the system. *) 1758 (* *) 1759 (* *) 1760 p r o c e d u r e SYSTEM_ERROR( MESSAGE : STR_50 ): 1761 . 1762 beg 1 n 1763 ' 1764 w r l t e l n C ===> SYSTEM ERROR ===> '.MESSAGE ); 1765 h a l t ; 1766 1767: 1768 end (* SYSTEMERROR +); 1769 1770 1771 1772 . (* *) 1773 (* *) 1774 (* Ret u r n t r u e If t e r r a i n at r a d i u s RAD 1 from the p r i n c i p l e p o i n t ( w i t h *) 1775 (* e l e v a t i o n ALT1) has I t s v i s i b i l i t y to the imaging system b l o c k e d by *) 1776 (* t e r r a i n a t r a d i u s RAD2 from the p r i n c i p l e p o i n t ( w i t h e l e v a t i o n *) 1777 (* ALT2). Otherwise r e t u r n f a l s e . *) 1778 (* *) 1779 (* *) 1780 f u n c t i o n VISIBLE( ALT 1 , ALT2, RAD 1, RAD2 : sho r t ) : boolean; 178 1 1782 1783 1784 b e g i n 1785 1786 If (RAD 1 <= RA02) or 1787 ((RAD2 / (H - ALT2) ) >= (RAD 1 / (H - ALT 1 ) ) ) then 1788 VISIBLE := f a l s e ; 1789 . e l se 1790 VISIBLE := t r u e ; 1791. 1792 1793 end (* VISIBLE * ) ; 1794 1795 1796 1797 (* *) 1798 (* *) o LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1799 1800 1801 1802 1803 1804 1805 1806 1807 , 1808. 1809 1810 1811. 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 . 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 184 1 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 (* W r i t e the l i n e LINE to the f i l e IMAGE s t a r t i n g at p i x e l START. *) (* I t 1s assumed th a t each p i x e l has a v a l u e between 0 and 255. *) (* *) p r o c e d u r e WRITE_IMAGE_LINE( var IMAGE : IMAGEFILE: LINE : INT LINE; START : Integer ); I : Integer; b e g i n IMAGED := ' '; f o r I := 1 to (START-1) do IMAGER I) := c h a r ( MIN_INTENSITY ); f o r I := START to DIM(PIXEL) do IMAGE<s(I) := char( LINE(I) ); f o r I := (DIM(PIXEL)+1) to MAX_IMAGE_SIZE do IMAGE@(I) := c h a r ( MININTENSITY ); put ( IMAGE ); end WRITE IMAGE LINE •): {* *) (* W r i t e the map l i n e LINE to the f i l e MAPFILE at MTS l i n e *) (* number LINE NO. . *) (* " *) p r o c e d u r e WRITE_MAP_LINE( var MAP : MAPFILE; LINE : MAPSET; LINE_NO : Integer ); b e g i n p o s i t i o n * MAP, LINE_NO * 1000 ); w r l t e l n ( MAP, LINE ); end WRITE MAP LINE '); (* (* W r i t e the s t r i n g STR to the p r e s e n t output stream. The s t r i n g Is of (* l e n g t h SIZE. If the l e n g t h 1s l e s s than one, the o p e r a t i o n does not (* take p l a c e . O CO LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1857 p r o c e d u r e WRITE_STRING( STR : INPUT_LINE; SIZE : Integer ); 1858 1859 var 1860- I Integer; 1861 1862 1863 b e g i n 1864 1865 If SIZE > O then 1866 f o r I := 1 to SIZE do 1867 wr1te( STR(I) ) 1868 1869 1870 end (* WRITE_STRING * ) ; 1871' 1872 1873 1874 (* *) 1875 (* . *) 1876 (* W r i t e the Image a r r a y IMAGE to the Image f i l e IMAGE_FILE. The *) 1877 (* u t i l i t y f u n c t i o n WRITE_IMAGE_LINE Is u t i l i z e d to perform the w r i t e s . *) 1878 (* *) 1879 . (* ^««^ff^»^ff»»ff^»ff«ffffffffff«ffffffffff»ff^ff»«ff//ffffVffffff»»^ffff^#ff«ff»^«ffryffffff»ff//ffff»ffM^/r>f/f *) 1880 p r o c e d u r e WRT_IMAGE( var IMAGE_FILE : IMAGEFILE; 1881 var IMAGE : INT_ARRAY ); 1882 1883 v a r 1884 I Integer; 1885 1886 1887 b e g i n 1888 1889 r e w r i t e * IMAGE_FILE ); 1890 f o r I := DIM(LINE) downto 1 do 1891 WRITE_IMAGE_LINE( IMAGE_FILE, IMAGE(I), 1 ); 1892 1893 1894 end (* WRT_IMAGE * ) ; 1895 1896 1897 1898 (* *###iy##########/y#####/('########^ *) 1899 (* *) 1900 (* I n i t i a l i z e the lookup t a b l e s to c o n v e r t from p o l a r c o o r d i n a t e s *) 1901 (* t o c a r t e s i a n c o o r d i n a t e s . *) 1902 (* *) 1904 p r o c e d u r e XY_INIT; 1905' M 1906 var O 1907 DEG : i n t ; VO 1908 1909 1910 b e g i n 1911 1912 f o r DEG := 0 to 360 do 1913 beg!n> 1914 110 « « * # # * * * * # + * D D at at at < < at at at or a * at at £ at 1 1 at at at 1 - at o o at at at O at 1 - 1 - at < at at at UJ 1 1 at 1 - at at - 0) at U . cs cs at UJ at at to sz at UJ LU at X at 0 at C 4 4 at _ l o a at 1— at 01 at at 11 at - at 0. at 01 > at D * * at to at D 1 0 at - JO at 1—1 at 3 at 0: at t. at C5 CS at *-1 at 0 1 0 at 0 TJ at yj LU at O at 0 4 4 at OJ at a a at < • at cj 01 at OJ — at at 0: E at 1 JZ * + * at r. «- at CM at at >- 4 4 at 4 4 4- at co 1 0 c at 0 at x . ^-v at 0 at CO 0 - at to «- at t— O O at 01 0) at O ( 0 at 01 at •• to or or at 0 a at at 4 4 c at Ol D O at to 1 0 at * W W at to to at ~ - tu O O at r— at CM V 4 4 at C -- at .— CJ CJ at a 1 0 at 4— L. L. at — 1 0 at 4 4 at 1 0 fO at 0 0 at TJ tl) at c OJ 1-4 - » at •r- . at UJ x: r at t_ 4 4 at 0 r < ~» < at "0 at Z to to at O L. at JT +4 1 - I- at 4 4 at 0 O at 0 to at to s UJ < U l < at 0 J : at 4 4 4 4 at 0 0 at O £ X H X 1 - at 4 4 O) at TJ TJ at at •• cc or 1— U l 1— UJ at -— at C C at L. OJ at • - CO 0 IX IX at TJ 0) at 3 3 at to r at < 0 U . O 1 - « 1 - at 01 JZ at £ 0 O at — 4 4 at t- or A 1/1 - J I 1 at 01 at L. L. at 0 at UJ 0 z w 1 w O at 0 0) at a at a c at X O . . < < CL CL _J at 0 > at II 11 at L- at t- • - CJ 4-s 4— i- or * 3 < 3 at L. — at at 0) 3 at 4 4 1 UJ 1— j r K j r 1 at a 4 4 at LO at jr 4 4 at . c 5- < I 1 LO O U l O at to at at 4 4 fl) at i/i X 1 - + 1 - > 3 O I O < at c - at CM X > at or at 3 UJ Ix 0 H J l - J | - « at 01 OJ at —• at E at 1-1 I « = TJ O 1 1 IUJ at £. L. at - • * at L. • at O K < I < > -1 > X at 4 4 at + cs cs • - at 0 to at < • 1 - C > or x x x i- £ at to at Uj uj CS at M- OJ at 0: < w UJ L. 1-4 >- or at TJ 4 4 at 0 0 UJ * at to 4 4 at 1 - 0 I 0 - 0 • •—^  X O at C — at UJ 0 at c to at w IXI C t- W 4 4 u. at to at Z 0. a at to c at £ I 3 1 O or II II LO at at 3 3 L. *— at L. — at or 1 - t- D O X Z at E 0 at K 1 0 0 »—< at 4 4 TJ at 0 1 4 4 _ l v or < at tu at 3 0 0 **- z at L. at u. t—1 or 11 £ or at 4 4 c at O t- 0 0 at • 0 at LO X II II < U l • • 0 or K at 1 0 0 at or ai _ l _J * 1 at 1 0 0 at Z 1 - 1 or O 1 at > - at 1 1 w > at OJ 0 at < UJ £ 0 D u. >- at to 4 4 at Z 1 0 >- > X at 1— at or < < < X LU or O in X at 0 at X X at J3 C at h- 1— 1 - 1 - *— 1— O CJ Z at OJ c at < a TJ at to ( 0 at I UJ LU UJ Itn O • < at x: 3 at £ 1 0 C # at 4 4 4 - at >- I Q I I O > CJ > or # at 4 4 M- at t— OJ • at 1 0 at x I- or 1 - K _J in X w at at a> at a OJ at IO 1 1 L_ 1 at 01 to at * a at 3 -H at C O O C O « n - 0 >- at N at • . at j * L. at 0 - J O X 4 - J I X at 4 - to at UJ TJ at 0 to at 4 - t- Ol TJ at — to at U . C at 0 0 at 4 4 to OJ C at to at »"4 OJ at •— .at 0 > JO 01 at 4 - OJ at C _J at 0 at c at +4 01 at -— at to 4 4 at 3 at 4 " CO at 0) UJ at C at n- at C E at 01 - 1 at > — at at H 4 — at D at at at at U . at at at at z z u i o or u i CS < £ -I LU UJ CS —I - < f« LU £ Ll-CS - 4 - J < £ ~ w ^ < UJ UJ _ l CS CJ o < < CL £ _J or • - . CL U l I LO I- l -H - Z or a «-• 3 t/i intxiivwOTO ' -cMr j^ijotjji^tt'cnO »—• * - 4 - 4 - ^ ^ c N C M C M c > i c M C M C M C M C M C M C o r o o n t n o n n n r j T i T r ^ —J c o c i J C E c n o ^ C / j o ^ c j j c n c ^ LISTING OF FILE L I F E : p e r s p . s t e r . s 12:54 P.M. JUNE 12. 1982 ID=LIFE 1973 1974 DISPLACE( IMAGE, RMFILE, CENTER(RIGHT,X), CENTER(RIGHT,Y) ); 1975 INTERPOLATE! IMAGE ); 1976 WRT_IMAGE ( RF I LE, IMAGE ); 1977 1978 end (* MAIN ROUTINE * ) . 112 A p p e n d i x C T h i s a p p e n d i x c o n t a i n s t h e s o u r c e code t h a t was u s e d t o p r o d u c e s y n t h e t i c a i r b o r n e s c a n n e r i m a g e r y . T h i s s o u r c e i s w r i t t e n i s UBC PASCAL [ J O L L 7 9 ] . LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1 (* HHHHHHHHHHHHHHHHHHHHHHHHHHHHHtitiHHHHHtiHHHHHHtiHHHHHHHtlHHHItHHHtiHttHHHHHHHHH *) 2 (* *) 3 (* A I R B O R N E S C A N N E R I M A G E *) 4 (* *) 5 (* With Input of a DTM and a c o r r e s p o n d i n g r e g i s t e r e d Image, a *) 6 (* scanne r Image of the DTM, a c c o r d i n g to the I n t e n s i t y v a l u e s of the *) 7 (* I n p u t t e d Image, i s c r e a t e d as well as a v i s i b i l i t y map f o r the *) 8 (* DTM (as seen from a h y p o t h e t i c a l a i r b o r n e scanner d e v i c e ) and a *) 9 (* p i x e l l a y o v e r map (as sensed by a h y p o t h e t i c a l radar Imaging *) 10 (* d e v i c e ) . *) 11 (* *) 12 (* *) 13 14 c o n s t 15 LINE = 1: PIXEL = 2; 16 MAX_LINE_LEN = 255; 17 PROMPT = ':'; 18 COMPRESSED = t r u e ; 19. INTEGRAL = t r u e ; 20 READ_RE0D = t r u e ; 21 RIGHT_HALF = t r u e ; 22 LEFT_HALF = f a l s e ; 23 MIN_INTENSITY = 0; 24 MAX_INTENSITY = 255; 25 MAX_IMAGE_SIZE = 256; 26 MIN_SCAN_ANGLE = 0 ; 27 MAX_SCAN_ANGLE = 89; 28 UNDEFINED = -1 ; 29 DEFAULT = -1; 30 DEG_T0_RAD = 0.0174532925; 31 0UT_0F_RANGE = -(m a x l n t - 1 ) ; 32 33 34. type 35 MSG_TYPE = ( LINE_PROMPT, PIXEL_PROMPT, UNEXPECTED_BLANK, 36 UNEXPECTED_EOF. UNREC_CMD, NULL_N0, NON_INTEGRAL_VALUE, 37 UNIT_0_UNASSIGNED, INVALID_FILE, UNEXPECTED_INPUT_EOF, 38 INVALID_NO, E0F_N0, E0LN_MSG, NOT_IN_RANGE, 39 . ENTER_ELEVATION, ENTER_NADIR_COORD, 40 MAP_DESIRED, ASSUMING_NO, ENT E R_GRID_SPACING, 41 ENTER_DEPRESSION_ANGLE, SIDEL00K_TRANSF0RM, 42 UNIT_1_UNASSIGNED, ENTER_SCAN_ANGLE ); 43 44 INPUT_LINE = a r r a y ( . 1..MAX_LINE_LEN+1 .) of char; 45. INT_LINE = a r r a y ( . 0..MAX_LINE_LEN+2 .) of 1nt; 46 REAL_LINE = a r r a y ( . 0..MAX_LINE_LEN+2 .) of r e a l ; 47 SHORT_LINE = a r r a y ( . 0. .MAX_LINE_LEN+2 .) of s h o r t ; 48 49 INT_ARRAY = a r r a y ( . 0..MAX_LINE_LEN+2 .) of INT_LINE; 50 SH0RT_ARRAY = a r r a y ( . 0..MAX_LINE_LEN+2 .) of SHORT_LINE; \Z 51. LO 52 53 VALUE_RANGE = ( POSITIVE, NONZERO, INTENSITY, LINE_LENGTH, 54 IMAGE_SIZE, NONNEGATIVE, PERCENT, LINES. 55 SCAN_RANGE ); 56 PIXEL_RANGE = 1..MAX_IMAGE_SIZE; 57 MAPSET = s e t of PIXEL_RANGE; 58 LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 59 STR 3 a r r a y (. 1..3 .) of char: 60 STR 4 a r r a y (. 1. .4 .) of char; 61 STR 6 a r r a y (. 1..6 .) of char; 62 STR 8 a r r a y (. 1. .8 .) of char; 63 STR 44 a r r a y (. 1. .44 . ) of char; 64 STR_50 a r r a y (. 1..50 .) of char; 65 . 66 IMAGEFILE f i l e of INPUT LINE; 67 DTMFILE f i l e of a r r a y ( 1.. (MAX_LINE_LEN+1)*2 ) of ch a r ; 68 MAPFILE f i l e of MAPSET; 69 70 71 72 73 v a r 74 IMAGE CENTER, 75 • NADIR COORD, 76 MAX ANGLE 1nteger; 77 MAX DEP ANGLE 78 MIN DEP ANGLE 79 GRID SPAC, 80 SCAN ANGLE, 81 INTERVAL, 82 ELEVATION s h o r t ; 83 SIDE LOOK, 84 VISIBILITY MAP, 83 PIXEL LAYOVER _MAP boolean; 86 DIM a r r a y ( . 1.. 2 . ) of 1nteger; 87 TAN LOOKUP a r r a y ( . 0.. MAX_SCAN_ANGLE .) of s h o r t ; 88 IMAGE FILE, IFILE IMAGEFILE; 89 DTM FILE DTMFILE; 90 Q 1 VMFILE, PLMFILE MAPFILE; y i . 92 93 94 95 (* 96 (* 97 (* FORWARD d e c l a r a t i o n s f o r the Procedures of the system 98 (* 99 (* 100 p r o c e d u r e BUFFER INSERT( INTENSITY Integer; 101 DEGREE : s h o r t ; 102 var ILINE : INT LINE; 103 var FLINE : SHORT_LINE; 104 RIGHT_HALF : b o o l e a n ); forward; 105 p r o c e d u r e FILES; forward; 106 p r o c e d u r e GET DIMENSIONS; forward; 107 p r o c e d u r e INTERPOLATE ( var ILINE : INT LINE; 108 var FACT SHORT LINE ); forward; 109 p r o c e d u r e PRINT MSG( MSG : MSG TYPE; STRING : INPUT_LINE; 1 10 SIZE : Integer ); forward; 1 1 1 p r o c e d u r e SCANNER TRANSFORM; forward; 1 12 p r o c e d u r e SIDE LOOK TRANSFORM; forward: 1 13 p r o c e d u r e SYS INIT; forward; 1 14 p r o c e d u r e SYSTEM ERROR( MESSAGE : STR 50 ); forward; 1 15 p r o c e d u r e TAN INIT( SIZE : Integer ); f orward: 1 16 p r o c e d u r e WRITE_ IMAGE_LINE( var IMAGE : IMAGEFILE; * ) * ) * ) * ) * ) LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 117 LINE : INT_LINE; 118 START : Integer ); forward; 119 p r o c e d u r e WRITE_MAP_LINE( v a r MAP : MAPFILE; 120 LINE : MAPSET ); forward; 121 p r o c e d u r e WRITE_STRING( STR : INPUT_LINE; SIZE : Integer ); forward; 122 123 125 (* . *) 126 (* FORWARD d e c l a r a t i o n s f o r the F u n c t i o n s of the system *) 127 (* *) 129 f u n c t i o n ATAN( ARG : s h o r t ) : s h o r t ; forward; 130 f u n c t i o n CALC_INTERVAL( MAXANGLE : Integer ) : s h o r t ; forward; 131 f u n c t i o n CALC_PIXEL_LAYOVER( DLINE:INT_LINE; VMLINE:MAPSET ) 132 : MAPSET; forward; 133 f u n c t i o n GET_EOLN( var STR : INPUTLINE; COMPRESS : boolean) 134 Integer; forward; 135 f u n c t i o n GET_NUM( RANGE : VALUERANGE; INTEGRAL_VALUE : boo l e a n ) 136. r e a l : forward: 137 f u n c t i o n GET_REPLY : boolean; forward; 138 f u n c t i o n READ_DTM_LINE( var DTM_FILE : DTMFILE; READ_REOD : boo l e a n ) 139 : INT_LINE; forward; 140 f u n c t i o n READ_IMAGE_LINE( var IMAGE_FILE : IMAGEFILE; 14^ READ_REOD : boolean ) : INT_LINE; forward; 142 f u n c t i o n READ_STRING : INPUT_LINE; • forward; 143 144/ 146 (* *) 147 (* D e c l a r a t i o n s f o r FORTRAN r o u t i n e s used by the system *) 148. (* *) 149 (* ##0#######/!'###/y/l'##/y#####;!'/y#^  *) 150 p r o c e d u r e CALL_MTS( STR : INPUT_LINE; I : Integer ); f o r t r a n 'CMDNOE': f o r t r a n 'FTNCMD' 1nteger; f o r t r a n 'FTNCMD' 151 p r o c e d u r e DEFAULT_FNAME( CMD_STR : INPUT_LINE ); 152 p r o c e d u r e GET_FNAME( CMD_STR : INPUT_LINE: LEN 153 var FNAME : INPUT_LINE ); 154 p r o c e d u r e SET_PREFIX( NEW : char; LENGTH : Integer ); f o r t r a n 'SETPFX'; 155 156 157 158 159 161 (* *) 162 (* R e t u r n the a r c t a n g e n t of argument ARG. T h i s Is accomplished by *) 163 (* u t i l i z i n g the tangent lookup t a b l e TAN_LOOKUP. *) 164 (* *) 165 (* ff^»ff«ff«^ffff»ff^fflV»ffffff^ff«ffff//^ff»ff«ffl¥»>r«ffff«»ff>y^M»l¥«ffri^»«»#«ff//«ff«^ff«fflVff»>/^ff»» *) 166 f u n c t i o n ATAN( ARG : s h o r t ) : s h o r t ; 167 168 var 169. LO_DEG, HIDEG, DEG : Integer; 170 L0_TAN, HI_TAN, 171 L0_FACT, HI_FACT : s h o r t ; 172 173 ' 174 b e g i n LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 175 176 If ARG < O then 177 SYSTEM_ERROR( 'In "ATAN"; I n v a l i d argument' ); 178 179 DEG := -1: 180 r e p e a t 181 1ncr( DEG ); 182 u n t i l (DEG > MAX_ANGLE) or (TAN_LOOKUP(DEG) >= ARG) 183 184 1f DEG > MAX_ANGLE then 185 ATAN := OUT_OF_RANGE; 186 e l s e 187 1f DEG = O then 188 ATAN := O; 189 e l s e 190 b e g i n 191 192 LO_DEG := DEG - 1; 193 HI DEG := DEG; 194 LOTAN := TAN_LOOKUP(LO_OEG) ; 195 HI_TAN := TANLOOKUP(HI_DEG); 196 LO_FACT := (HI_TAN - ARG) / (HI_TAN - LO_TAN); 197 HI_FACT := 1 - LO_FACT; 198 ATAN := LO_FACT * LO_DEG + HI_FACT * HI_DEG; 193 200 end (* e l s e DEG <= MAX_ANGLE * ) ; 201 202 203 end (* ATAN * ) ; 204 205 206 207 (* #/y###jy#>/#^ ####*#/y///y#/y/y/'#/'/yA'/v#/y## *) 208 (* *) 209 (* I n s e r t Into the output b u f f e r a p i x e l w i th v a l u e INTENSITY th a t Is *) 210 (* sensed by the h y p o t h e t i c a l a i r b o r n e scanner d e v i c e at a n g l e DEGREE *) 211. (+ of the scanner sweep. *) 212 (* *) 213 (* /fff¥^ff^#»iy/f^ffffff»»«»«^»»^ffffffff#rV»^ff»^ffff»¥ffffff»#^ff»«V«ff/fffVf/ffff»»/f//«»^ff/tff»#»»// *) 214- p r o c e d u r e BUFFER_INSERT( INTENSITY : Integer; 215 DEGREE : s h o r t ; 216 var I LINE : INT_LINE; 217 var FLINE : SHORT_LINE; 218 RIGHT_HALF : boolean ); 219 220 v a r 221 L0_INDEX. HIINDEX : Integer; 222 LO_INTEN, HI_INTEN, 223 L0_FACT, H I F A C T : s h o r t ; 224 \_, 225 ' C* 226 b e g i n 227 228 LO_INDEX := t r u n c ( DEGREE / INTERVAL ); 229 If (LO_INDEX * INTERVAL < O) or (LOINDEX * INTERVAL > MAX_ANGLE) then 230 SYSTEM_ERROR( 'In "BUFFER_INSERT"; I n v a l i d angle s p e c i f i e d ' ); 231 232- HI_INDEX := LO_INDEX + 1; LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 233. LO FACT := HI INDEX - DEGREE / INTERVAL; 234 HI_FACT := 1 - LO_FACT; 235. 23G 1f RIGHT_HALF then 237 beg 1 n 238 LO INDEX := IMAGE CENTER + LO INDEX; 239 HI INDEX := IMAGE CENTER + HI INDEX; 240 end (* If RIGHT HALF * ) ; 241 e l s e (* LEFT_HALF *) 242 be g i n 243 LO INDEX := IMAGE CENTER - LO INDEX; 244 HI INDEX := IMAGE CENTER - HI INDEX; 245 end (* e l s e l.EFT_HALF * ) ; 246 247 1f LO_FACT -•= 0 then 248 b e g i n 249 250 LO INTEN := ILINEfLO INDEX) * FLINE(LO INDEX) + 251 INTENSITY * LO FACT; 252 FLINE(LO INDEX) := FLINE(LO INDEX) + LO FACT; 253 ILINE(LO_INDEX) := round( LOINTEN / FLINE(LO_INDEX) ); 254 255 end (* 1f LO_FACT -•= 0 * ) ; 256 257 If HI_FACT ->= 0 then 258 b e g i n 259 260 HI INTEN := ILINE(HI INDEX) * FLINE(HI INDEX) + 26 1 INTENSITY + HI FACT; 262 FLINE(HI INDEX) := FLINE(HI INDEX) + HI FACT; 263 ILINE(HI_INDEX) := round( HI_INTEN / FLINE(HI_INDEX) ); 264 265 end (* i f HI_FACT 0 * ) ; 266 267 268 end (* BUFFER_INSERT * ) ; 269 270 271 272 . (* 273 (* 274 (* Based on the maximum scan angle of the h y p o t h e t i c a l a i r b o r n e scanner 275 (* d e v i c e , c a l c u l a t e the " o p t i m a l " I n t e r v a l ( I n degrees) between 276 (* p i x e l s of the output b u f f e r . 277 (* 278 (* 279 f u n c t i o n CALC_INTERVAL( MAX_ANGLE : Integer ) : s h o r t : 280 281 c o n s t 282 ANGLE_000 = MIN SCAN ANGLE; (* Minimum a n g l e p e r m i t t e d *) 283 ANGLE 010 = 10; (* Max a n g l e f o r .10 I n t e r v a l s *) 284 ANGLE 025.= 30; (* Max a n g l e f o r .25 I n t e r v a l s *) 285 ANGLE 050 = 60; (* Max a n g l e f o r .50 I n t e r v a l s *) 286 ANGLE_100 = MAX_SCAN_ANGLE; (* Max a n g l e f o r 1.0 I n t e r v a l s *) 287 288 289 beg 1 n 290 LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12. 1982 ID=LIFE 291 1f (MAX ANGLE >= ANGLE 000) and (MAX_ANGLE <= ANGLE_010) then 292 CALC INTERVAL := 0.10s; 293 e l s e If (MAX ANGLE > ANGLE 010) and (MAX_ANGLE <= ANGLE_025) then 294 CALC INTERVAL := 0.25s; 295 e l s e 1f (MAX ANGLE > ANGLE 025) and (MAX ANGLE <= ANGLE_050) then 296 CALC INTERVAL := 0.50s; 297 e l s e i f (MAX ANGLE > ANGLE 050) and (MAX ANGLE <= ANGLE_100) then 298 CALC_INTERVAL := 1.00s; 299 e l se 300 SYSTEM_ERROR( 'In "CALC_INTERVAL"; I n v a l i d a n g l e s p e c i f i e d ' ); 301 302 303 end (* CALC_INTERVAL * ) ; 304 305 306 307 (* 308 (* *) 309 (* C a l c u l a t e any p i x e l l a y o v e r s ( I . e . p i x e l s of same d i s t a n c e from the *) 310 (* r a d a r Imaging d e v i c e ) 1n the DTM l i n e DLINE. Return a map 11ne *) 311 (* I n d i c a t i n g where such p i x e l s are l o c a t e d In DLINE. *) 312 (* *) 313 (* 314 f u n c t i o n CALC_PIXEL_LAYOVER( DLINE : INT_LINE; VMLINE : MAPSET ) : MAPSET 315. 316 var 317 I, J , K, MAP COORD : Integer; 318 PIXEL LAYOVER : boolean; 319 DISTANCE : SHORT LINE; 320 PLMLINE : MAPSET; 321 . 322 . 323 b e g i n 324 325 f o r I := 1 to DIM(PIXEL) do 326 If (MAX IMAGE SIZE - I) In VMLINE then 327 DISTANCE(I) := UNDEFINED; 328 e l se 329 DISTANCE(I) := sqr( (NADIR COORD - I) * GRID SPAC ) + 330 sqr( ELEVATION - DLINE(I) ); 331 332. PLMLINE := (. . ) ; 333 f o r I := 1 to DIM(PIXEL) do 334 begl n 335 336 MAP COORD := MAX IMAGE SIZE - I; 337 If (MAP_COORD n o t l n VMLINE) then 338 beg 1 n 339.. 340 PIXEL LAYOVER := f a l s e ; 341 f o r J := 1+1 to DIM(PIXEL)-1 do 342 If DISTANCE(J) <> UNDEFINED then 343 . beg 1 n 344 345 K : = J + 1 ; 346 w h i l e (K <= DIM(PIXED) and 347 (DI STANCE(K) = UNDEFINED) do 348 l n c r ( K ); LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 349 If (K <= DIM(PIXEL)) and 350 (DISTANCE(I) <= max( DlSTANCE(J), DlSTANCE(K) )) and 351 (DISTANCE(I) >= min( DlSTANCE(J), DlSTANCE(K) )) then 352 b e g i n 353 PIXEL_LAYOVER := t r u e ; 354 1f abs( DISTANCE(I) - DI STANCE(d) ) > 355 abs( DISTANCE(I) - DISTANCE(K) ) then 356 PLMLINE := PLMLINE + (. (MAX_IMAGE_SIZE-K) . ) ; 357 e l s e 358 PLMLINE := PLMLINE + (. (MAX_IMAGE_SIZE-J) . ) ; 359 end (* If (K <= DIM(PIXEL)) ... * ) ; 360 end (* If DISTANCE(J) <> UNDEFINED * ) ; 361 If PIXEL_LAYOVER then 362 PLMLINE := PLMLINE + (. MAP_COORD . ) ; 363 364 end (* If (MAP_COORD n o t l n VMLINE) * ) : 365. 366 end (* f o r I * ) : 367 368 369 CALC_PIXEL_LAYOVER := PLMLINE: 370 37 1. 372 end (* CALC_PIXEL_LAYOVER * ) ; 373 374 . 375 376 (* HHHH####HH#HHH»HH#HHIl'H*HHIIM#H#NHHHIIHHIIII#*HHIIH#H»ttHHHHHHHH#IIH##H#»H»H»»tl *) 377 (* *) 378 (* Set up and a t t a c h the f i l e s n e c e s s a r y f o r the system. U n i t O Is the *) 379 (* assumed Input f o r the o r i g i n a l DTM. If It Is not a s s i g n e d on the MTS *) 380 (* RUN command, the f i l e name w i l l be prompted f o r . U n i t 1 1s assumed *) 381 (* Input f o r the o r i g i n a l r e g i s t e r e d Image. I t s f i l e name w i l l a l s o be *) 382 (* prompted f o r 1f not a s s i g n e d . The f i l e a s s i g n e d to u n i t 10 w i l l be *) 383 (* used f o r the output of the scanner image. The f i l e a s s i g n e d t o u n i t *) 384 (* 12 w i l l be used f o r the output of the v i s i b i l i t y map of the DTM, If *) 385 (* r e q u e s t e d . The f i l e a s s i g n e d to u n i t 13 w i l l be used f o r output of *) 386 (* the p i x e l l a y o v e r map of the DTM, i f requ e s t e d . If these u n i t s a r e *) 387 (* not a t t a c h e d , they w i l l d e f a u l t to MTS temporary f i l e s -IMAGE*, *) 388 (* -VMAP/f, and -PLMAPiC r e s p e c t i v e l y . *) 389 (* *) 390 (* HHHttHHHHHBttltHHHHHtiHHHHHHHHHHttflHHHHIIHHHHHHHHHttHHIIHHHtiHHHHIiHHHHIIHHHHHHtlHH *) 391 p r o c e d u r e FILES; 392 393 v a r 394 DTMFNAME, IMGFNAME : INPUT_LINE; 395 . 396 397 b e g i n 398 £ 399 400 DTMFNAME : = ' ' ; 401 DEFAULT_FNAME( 'DEFAULT 0=*DUMMY*; ' ); 402 GET_FNAME( 'QUERY FDNAME O;', 0, DTMFNAME ); 403 404 If DTMFNAME = ' *DUMMY*' then 405 b e g i n 406 LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 407 PRINT_MSG( UNIT_0_UNASSIGNED, " , 0 ); 408 DTMFNAME : = READSTRING; 409 while DTMFNAME = ' ' do 410 b e g i n 411 PRINT_MSG( INVALID_FILE, " , 0 ); 412 DTMFNAME := READ_STRING; 413 If DTMFNAME = 'CANCEL' or DTMFNAME = 'HALT' then 4 14 ha 11; 415 end (* w h i l e DTMFNAME = ' ' * ) : 416 4 17 end (* I f DTMFNAME = '*DUMMY*' * ) ; 4 18 419 420 IMGFNAME := ' '; 421 DEFAULT_FNAME( 'DEFAULT 1=*DUMMY*;' ); 422 GET_FNAME( 'QUERY FDNAME 1;', O, IMGFNAME ); 423 424 I f IMGFNAME = '*DUMMY*' then 4 25 b e g i n 426 427 PRINT_MSG( UNIT_1_UNASSIGNED, '', 0 ); 428 IMGFNAME : = READ_STRING; 429 w h i l e IMGFNAME = ' ' do 430 b e g i n 431 PRINT_MSG( INVALID_FILE, " , 0 ): 432 IMGFNAME := READ_STRING; 433 If IMGFNAME = 'CANCEL' or IMGFNAME = 'HALT' then 434 h a l t ; 435 end (* w h i l e IMGFNAME = ' ' * ) ; 436 437 end (* I f IMGFNAME = '*DUMMY*' * ) ; 438 439. 440 If VISIBILITYMAP then 441 b e g i n 442 DEFAULT_FNAME( 'DEFAULT 12=-VMAP#;' ); 443 rewr1te( VMFILE, 12 ); 444 end (* 1f VISIBILITY_MAP * ) ; 445 . 446 If PIXELLAYOVERMAP then 447 b e g i n 448 DE F AULT_FNAME ( 'DEFAULT 13 = -PLMAP/V ; ' ); 449 rewr1te( PLMFILE, 13 ); 450 end (* I f PIXEL_LAYOVER_MAP * ) ; 451 452 DEFAULT_FNAME( 'DEFAULT 10=-IMAGE*;' ); 453 r e s e t ( DTM_FILE, DTMFNAME ); 454 r e s e t ( IMAGE_FILE, IMGFNAME ); 455 rewr1te( I F I L E , 10 ); ,_, 456 to 457 O 458. end (* FILES * ) ; 459 460. 461 462' (* *) 463 • (* +) 464 (* Prompt f o r and get the dimensions of the DTM. *) LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 465 (* *) 467 p r o c e d u r e GET_DIMENSIONS; 468 469 b e g i n 4 70 47 1 PRINT_MSG( LINE_PROMPT, ' ', 0 ); 472 DIM(LINE) := t r u n c ( GET_NUM( IMAGESIZE, INTEGRAL ) ); 473 474 PRINT_MSG( PIXEL_PROMPT, ' ', 0 ); 475 DIM(PIXEL) := t r u n c ( GET_NUM( IMAGE_SIZE, INTEGRAL ) ); 476 477! end (* GET_DIMENSIONS * ) : 478 479 480 481 (* M^ffff»fyff»ffffffff«ffffffff»fffftfff»«^«/f>yffffff»ffff»l¥^ff/r»»»»/i^ff»ffriffff/f»»^»ff//##»//ff/>#«ff«//ff// *) 482 (* *) 483 (* Read and r e t u r n the end of an Input l i n e . I f COMPRESS 1s t r u e then *) 484 (* remove m u l t i p l e embedded b l a n k s , o t h e r w i s e r e t u r n the a c t u a l Input *) 485 (* l i n e . The l e n g t h of the Input l i n e 1s a l s o r e t u r n e d . *) 486 (* *) 487 (* / f ^ * * * * * * * * * * * * * * * * * * * * * * * * * ^ *') 488 f u n c t i o n GET_E0LN( var STR:INPUT_LINE; COMPRESS:boolean ) : Integer; 489 490 v ar 491 I 1nteger; 492' LAST_CHAR_BLANK : boolean; 493 CHR : char; 494 495 496 b e g i n 497. I : = 0; 498 LAST_CHAR_BLANK := f a l s e ; 499 500 w h i l e ->eof( INPUT ) and -<eoln( INPUT ) do 501 b e g i n 502 read( CHR ); 503 If CHR ->= ' ' or not COMPRESS then 504 b e g i n 505 If LAST_CHAR_BLANK and I>0 then 506 b e g i n 507 •." . I : = I + 1 ; 508 STR(I) := ' ' 509 end; . 510 I := I + 1 ; 511 STR(I ) :* CHR; 512 LAST_CHAR_BLANK := f a l s e ; 513 end: 514 e l s e £j 515 LAS T_CH A R_B L A NK := t r u e ; I_J 516 end; 517 518 If not COMPRESS and I>0 then 519 GET_E0LN := I - 1; 520 e l s e 521 GET_E0LN := I 522 LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 523' end (* GETEOLN * ) : 524 525 526 527 529. (* *) 530 (* Re t u r n the numerical v a l u e of a s t r i n g In the Input stream. I f *) 531 (* INTEGRAL_VALUE Is tru e then the s t r i n g must r e p r e s e n t an Integer, *) 532 . (* o t h e r w i s e a r e a l number. The numerical v a l u e must a l s o be In the *) 533 (* range s p e c i f i e d by RANGE. *) 534 (* *) 535 (* ####################################################################### *) 536 f u n c t i o n GET_NUM( RANGE : VALUE_RANGE; 537 INTEGRAL_VALUE : boolean ) : r e a l ; 538 539 v a r 540 STR : INPUT_LINE; 541 VALID : boolean; 542 VALU : r e a l ; 543 I, d, MULT : Integer; 544. 545 546' b e g i n 547 r e p e a t 548 VALID := t r u e ; 549 read( STR ); 550 1f eof( INPUT ) then (* CHECK FOR EOF *) 551 b e g l n 552 VALID := f a l s e ; 553 PRINT_MSG( EOF_NO, ' ', 0 ) 554 end: 555 e l s e 556 b e g i n 557 VALU := 0.0; (* GET INTEGRAL PART *) 558 I := 1; 559 MULT := 1; 560 w h i l e I <= MAX_LINE_LEN and STR(I) = ' ' do 561 I : = I + 1 ; 562 If STR(I) = '+' or STR(I) = '-' then 563 b e g i n 564 1f STR(I) = '-' then 565 . MULT := -1; 566 I := I + 1 567 end; 568 w h i l e STR(I) In (. '0'..'9' .) do 569 b e g i n 570 VALU := 10.0 * VALU + ord( STR(I) ) - o r d ( ' O ' ) : 57 1 I := I + 1 ,_, 572 end; M 573 If STR(I ) = ' . ' then to 574 b e g i n (* GET FRACTIONAL PART *) 575 J := 10; 576 I := I + 1; 577 w h i l e STR(I) In (. '0'..'9' .) do 578 b e g i n 579 VALU := VALU + ( ( o r d ( S T R ( I ) ) - o r d ( ' 0 ' ) ) / J ) ; 580 I : = I + 1; LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID'LIFE 581, J := J * 10 582 end: 583 end; 584 1f STR(I) -<= ' ' or ( eoln(INPUT) and I = MAX_LINE_LEN+1 ) then 585 b e g i n (* INVALID NUMBER *) 586 VALID := f a l s e ; 587 If STR(I) -•= ' ' then 588 PRINT_MSG( INVALID_NO, ST R ( I ) . 1 ) 589 e l s e 590 1f RANGE In (. PERCENT .) then 591 b e g i n 592 VALID := t r u e ; 593 MULT := 1; 594 VALU := DEFAULT; 595 end (* 1f RANGE In * ) ; 596 e l s e 597 PRINT_MSG( NULL_NO, ' ', 0 ) 598 end; 599 e l s e If INTEGRAL_VALUE and trunc(VALU) -•= VALU then 600 b e g i n 601 VALID := f a l s e ; 602 PRINT_MSG( NON_INTEGRAL_VALUE, '', 0 ) 603 end; 604 e l s e If STR(I) = ' ' and ( STR(I-1)='-' or STR(I-1)='+' ) then 605 b e g i n 606 VALID := f a l s e ; 607 PRINT_MSG( UNEXPECTED_BLANK, " , 0 ) 608 end; 609 e l s e 1f (RANGE = POSITIVE and (MULT < 0 or VALU = O.O)) or 610 (RANGE = IMAGE_SIZE and (MULT < 0 or 611. VALU < 1 or VALU > MAX_IMAGE_SIZE)) or 612 (RANGE = LINES and (MULT < 0 or 613 . VALU < 1 or VALU > DIM(LINE))) or 614 (RANGE = LINE_LENGTH and (MULT < 0 or 615 VALU < 1 or VALU > DIM(PIXEL))) or 616 (RANGE = INTENSITY and (MULT < 0 or 617 VALU < MIN_INTENSITY or 618 VALU > MAX_INTENSITY)) or 619 (RANGE = SCAN_RANGE and (MULT < 0 or 620 VALU < MIN_SCAN_ANGLE or 621 VALU > (2 * MAX_SCAN_ANGLE))) or 622 (RANGE = NON_NEGATIVE and MULT < O) or 623 (RANGE = PERCENT and (MULT < 0 or 624 VALU < 0 or VALU > 100)) or 625 (RANGE = NON_ZERO and VALU = 0.0) then 626 b e g i n 627 VALID := f a l s e ; 628 PRINT_MSG( NOT_IN_RANGE, " , 0 ) 629 end; 630 end; (-• 631 u n t i l VALID; NJ 632. w 633 GET_NUM := VALU * MULT 634 635 636 end (* GET_NUM * ) ; 637 638 LISTING OF FILE LI FE : scarier . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 639 640 (* #############t/######ff########################0#######################H# *) 64 1 (* *) 642.' (* Read In a r e q u e s t e d r e p l y ( v i a GET_EOLN). If f i r s t l e t t e r of r e p l y *) 643 (* Is 'Y' or 'y' then r e t u r n t r u e , o t h e r w i s e r e t u r n f a l s e . *) 644 (* *) 645 (* *) 646 f u n c t i o n GET_REPLY : boolean; 647 648 c o n s t 649 YES_1 = 'Y'; YES_2 = 'y'; 650 N0_1 = 'N'; N0_2 = 'n'; 651' 652 v a r 653 STR : INPUT_LINE; 654 I : i n t e g e r ; 655 656 657 b e g i n 658 659 I := GET_EOLN( STR, COMPRESSED ); 660 If (STR(1) ->= YES_1) and (STR(1) - i = YES_2) and 661 (STR(1) -•= N0_1) and (STR(1) N 0 2 ) . then 662 PRINT_MSG( ASSUMING_NO, '', O ); 663 GET_REPLY := (STR(1) = YES_1) or (STR(1) = YES_2); 664 665 666 end (* GET_REPLY * ) ; 667 668 669 671 (* *) 672 (* I n t e r p o l a t e a l l u n d e f i n e d p i x e l v a l u e s between the f i r s t d e f i n e d *) 673 (* p i x e l o f the Image l i n e - ILINE - and the l a s t d e f i n e d p i x e l of the *) 674 (* Image l i n e . The new v a l u e s a r e c a l c u l a t e d as a f u n c t i o n of the *) 675 (* v a l u e s of the n e a r e s t d e f i n e d p i x e l s ( I . e . the ones on e i t h e r s i d e *) 676 (* of the u n d e f i n e d p i x e l ) . *) 677. (* *) 678 '. (* HMH»MHMMM»»»HMMH^H»HHHMHMHHIiMHMMMMMHMHflMM»HHM^tlMHH»HHItM^HHH¥MHMHHM^HHHM *) 679 p r o c e d u r e INTERPOLATE( var ILINE : INT_LINE; 680 var FACT : SHORT_LINE ); 681 682. v ar 683 X, XX, XEND. START, 684 STOP, INCREMENT, I : Integer; 685 686 . 687 b e g i n 688 l _ j 689 X := 1; to 690 w h i l e FACT(X) = 0 and X < (MAX_LINE_LEN+2) do ** 691 1ncr( X ); 692 693 XEND := MAX_LINE_LEN + 2; 694 w h i l e FACT(XEND) = 0 and XEND >= 1 do 695 decr( XEND ); 696 LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 697 . 1ncr( X ); 698 w h i l e X < XEND do 699 . b e g i n 700 701 , 1f FACT(X) = 0 then 702 beg 1 n 703 . 704 I := ILINE(X-I); 705 START := X; 706 whl1e FACT(X ) = 0 do 707 , 1ncr( X ): 708 STOP := X - 1; 709 INCREMENT := round( (ILINE(X) - ILINE(START-1)) / (X -710 f o r XX := START to STOP do 71 1 b e g i n 712 I := I + INCREMENT; 713 ILINE(XX) := round( (I + ILINE(XX) * FACT(XX)) / 714 ( 1 . 0 + FACT(XX)) ); 715 end (* f o r XX * ) ; 716 717 end (* If FACT(X) < 1 * ) ; 718 1 ncr ( X ); 719. 720 end (* w h i l e X < XEND * ) ; 721 722 723 end (* INTERPOLATE * ) ; 724 725. 726 727 (* HHttttHtiUtiHHtiHHHItttHtiHtilttiHtiHHHIIHHHHtttiHHttHHHttHHtiHHHHHHttHIIHHttHtlHHHBIIHIIIIHIItltItt *) 728 (* *) 729 (* P r i n t the message s p e c i f i e d by MSG to the output stream. The *) 730 (* parameters STRING and SIZE may be Involved In the d e t a i l s of *) 731 (* t h a t message. *) 732 (* *) 733 (* *) 734 p r o c e d u r e PRINT MSG( MSG : MSG TYPE: STRING : INPUT_LINE; 735 SIZE : Integer ); 736 737 c o n s t 738 MSG_PR0MPT = ' : ' ; 739 740 v a r 741 I , J : Integer; 742 STR : INPUT_LINE; 743 744 . 745 beg 1 n 746 747 SET_PREFIX( MSG_PROMPT, 1 ); 748 749 1f MSG 1n ( . LINE PROMPT, UNIT 0 UNASSIGNED, MAP DESIRED, 750 ENTER GRID SPACING. 751 ENTER NADIR COORD, ENTER SCAN ANGLE, 752 ENTER DEPRESSION ANGLE, SIDELOOK TRANSFORM, 753 UNIT 1 UNASSIGNED, ENTER ELEVATION .) then 754. wr 1 te1n; to LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID^LIFE 755 756 case MSG of 757 UNEXPECTED_EOF 758 w r 1 t e l n ( ' Unexpected EOF -- Ignored'); 759 UNREC_CMD 760 b e g i n 761 w r t t e 1 n ( ' I n v a l i d command Input l i n e Ignored'); 762 If -ieoln( INPUT ) then 763 I := GET_EOLN( STR, COMPRESSED ) 764 ' end; 765 EOLN_MSG 766 b e g i n 767 I := GET_EOLN( STR, COMPRESSED ); 768 If I ->= 0 then 769 b e g i n 770 wr1te(' I n v a l i d c h a r a c t e r ( s ) : " ' ) ; 771 WRITE_STRING( STR, I ); 772 w r 1 t e l n ( ' " -- Ignored') 773 end 774 end; 775 LINE_PROMPT 776 w r 1 t e l n ( ' S E n t e r number of l i n e s of DTM and IMAGE ( I n t e g e r {1-256})'); 777 . PIXEL_PROMPT 778 wr1te1n('SEnter number of p i x e l s per l i n e ( I n t e g e r {1-256})'); 779 E0F_N0 780 wr1teln('SUnexpected EOF, Enter number'); 781. NULL_N0 782. w r l t e l n ( 'SNot e x p e c t i n g n u l l l i n e -- Ignored; E n t e r number' ); 783 NON_INTEGRAL_VALUE: 784 w r 1 t e l n ( ' S N o n - I n t e g r a l v a l u e . Re-enter number'); 785 UNEXPECTED_BLANK: 786 w r l t e l n ( ' S U n e x p e c t e d blank. Re-enter number'); 787 NOT_IN_RANGE : • 788 wr1teln('SOut of range. Re-enter number'); 789 UNIT_0_UNASSIGNED: 790 w r 1 t e l n ( ' L o g i c a l u n i t 0 has not been a s s i g n e d . ' , 791 EOL, 'S En t e r FDname of l o c a t i o n of DTM ' ) ; 792 UNIT_1_UNASSIGNED: 793 w r l t e l n ( ' L o g i c a l u n i t 1 has not been a s s i g n e d . ' , 794 EOL, 'S Enter FDname of l o c a t i o n of IMAGE ' ) ; 795 INVALID_FILE 796 w r 1 t e l n ( ' I n v a l i d FDname. Enter a g a i n o r ' , EOL, 797. 'SEnter "CANCEL" to te r m i n a t e program'); 798 UNEXPECTED_INPUT_EOF: 799 w r 1 t e l n ( ' Unexpected EOF encountered on Input', 800 ' -- DTM s i z e updated'); 801 INVALID_NO 802 b e g i n 803 w r 1 t e l n ( ' S I n v a l I d c h a r a c t e r , "', STRING(1), '", Re-enter number'); 804 I : = GET_E0LN( STR, COMPRESSED ) r-> 805 end; ^ 806 ASSUMING_NO 807 wr1te1n(' Assuming "NO".'); 808 MAP_DESIRED 809 b e g i n 810 wrlte('SDo you want a ' ) ; 811 WRITE_STRING( STRING. SIZE ); 812 w r 1 t e l n ( ' map c r e a t e d ? {y/n}'); LISTING OF FILE L I F E : S c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 813 end; 814 SIDELOOK_TRANSFORM: 815 w r i t e l n ( ' 8 D o you want a s i d e - l o o k i n g transform? {y/n}' ); 816 ENTER_DEPRESSION_ANGLE: 817 begi n 818 w r i t e ( ' Enter the ' ) ; 819 WRITE_STRING( STRING, SIZE ); 820 w r 1 t e l n ( ' d e p r e s s i o n a n g l e , from the h o r i z o n t a l , ' . EOL. 821 '8 of the s e n s i n g system (degrees {', 822 MIN_SCAN_ANGLE:0, '-',MAX_SCAN_ANGLE :0, ' ) ) ' ): 823 end; 824 ENTER_NADIR_COORD: 825 w r i t e l n ( ' Enter the X ( p i x e l ) c o o r d i n a t e of the n a d i r ' 826 EOL, '8 of the a i r b o r n e scanner system ( I n t e g e r <1-' . 827 DIM(PIXEL):0, ' > ) ' ) ; 828 ENTER_SCAN_ANGLE: 829 w r 1 t e l n ( ' 8 E n t e r the scan a n g l e of the a i r b o r n e scanner system (degrees 830 ' MIN SCAN ANGLE:0,'-',(2*MAX SCAN ANGLE):O.'))' ); 831 ENTER_GRID_SPACING: 832 w r i t e l n ( ' 8 E n t e r DTM g r i d s p a c i n g ( i n DTM u n i t s ) ' ) ; 833. ENTER ELEVATION : 834 wr1te1n('SEnter e l e v a t i o n of a i r b o r n e scanner system ( I n DTM u n i t s ) ' ) ; 835 836 end (* case * ) ; 837 838 i f MSG i n (. LINE PROMPT, PIXEL PROMPT, INVALID NO, 839 NON INTEGRAL VALUE, UNEXPECTED BLANK, NOT IN RANGE, 840 UNIT 0 UNASSIGNED, UNIT 1 UNASSIGNED, INVALID FILE, 841 ENTER ELEVATION, ENTER NADIR COORD, 842 ENTER SCAN ANGLE, MAP DESIRED, ENTER GRID SPACING, 843 ENTER DEPRESSION ANGLE, SIDELOOK TRANSFORM, 844, EOF_NO, NULL_NO .) then 845 r e a d l n ; 846 847 SET_PREFIX( PROMPT, 1 ) 848 849 850 end (* PRINT_MSG * ) : 851 852 853 854 (* *) 855 (* *) 856 (* If READ_REOD Is t r u e then r e a d i n a l i n e from the f i l e DTM_FILE, *) 857 (* o t h e r w i s e perform the subsequent o p e r a t i o n s on the p r e s e n t input *) 858 (* b u f f e r . Convert the b i n a r y form of the b u f f e r Into i n t e g e r form •) 859 (* assuming two by t e s per p i x e l . *) 860 (* *) 861 (* *) 862 f u n c t i o n READ_DTM_LINE( var DTMFILE : DTMFILE; READ_REOD : b o o l e a n ) : I N T L I N E ; 863 864 var 865 LINE : INT_LINE; 866 I : Integer; 867 868 869 beg 1 n 870 to - J 128 # * # # * IB LO CN oo O) 4-CN CM + + z CN CM -3 * •3 . — y i— E w •—-4^ >—4 CL fe & 0 UJ UJ •0 -1 1 LO t—t 4-1 4-4 u_ U_ CN - J 1 1 * 4- UJ E E X 1- 1- LU « D D Z Ul •- a O H z /—» * V— • w _) —H c _ l dl L U H C C II 1 - J O — i — E 10 44 1-L_ 0 I' LU D 10 o z 1 — O £ 4-4 O > UJ i— —- _J < or D I-H 1 UJ L. 1 II w E or as D >—- • • ui K-c < •H Z Q 10 UJ Q| H I H 1 + 0 or Ol - J O 10 L. < (*- 0 UJ LU •— 44- or U. TJ 4-4 c _J OJ UJ _l 1—1 Li. U. o CS z 4-t 1-V I ' -4-CM ro LD CO i ^ CO 01 4-H t t- r- r- r- i> i> i> r-_ l 00 co co co CO co co co co % * at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at — 44-at at at at at at at at at at at at at at at _ l +4 4-H 3 E L L a L . IC O U l u-CS < +4 L. E c ai i—i ai Ol to 01 OJ 01 44 —- .1. c •4- a -i-ai 0 01 x: J: c 44 -4-c £ 0 L. O ai c to »*-u~ c u-0 3 01 -4-XI c •H 4- co 01 4— L . x: 01 +4 (0 a O M-c 0 -»— +4 c E TJ QJ L . CO 3 o 01 a «-L . a> p— to >. 0) c a L_ X 01 3 co •4-JC to c a 44 —-01 XI c 01 JT ai 3 44 0) Q. L- r +- E +4 01 t_ 44 to 0 J X >.  - L_ X) L . 01 o 01 > OJ o a c c UJ 0 0 or 0) CJ to Ol D — c < 3 I_ — UJ L. OJ E or a> 41- 3 x: 44- to «t- 44 3 to 4—1 0 XI CO * * « c • to * OJ at O at O at X) at at •• at at o at o at ui at or at I at o at < at LU at or at at • -at ui at _i at i-i at u. at UJ at CS at < at E at t-t at at •• at at UJ at _ i at M at u. CS < E at at at at at at at at t-at co at > at at w at UJ at Z at I-I at _ i at I at LU at CS at < at E at »-. at I at 0 at < at UJ at or at at C at O at — at - H at o at c at 3 at n -at at UJ • -Z !-I-I QJ - J Ol I 01 t - -H z c O) 01 XI * * # * * * at at at at at at at at at at at at at to at at at at c at at to at at 4— at at X) at at at at O) at at c at at — at at TJ at at CO at at 01 at at «— at at at at . — at at 4— at at (0 at at at at Dl at at C at • - at — - at at > at at 0 at at E at N H at 01 at W at [_ at U l & at at Z UJ at E at • • 4-H —1 at CO at I 1 O M at 01 at U l 01 1 TJ u at L . at Z 0)K 1 * at 44 at 4-H OJ Z3 4-4 UJ . , at to at _ l 44 a -j CS ui at at 1 c z ui < Z LU at +4 at 1- — 4-4 • - X E — Z at 3 TJ at 23 4-V 4-4 4-H -J 4-H at Q. OJ at a. a _ l at C C at z U l w w II 1 at — IL at 1—1 C - J E F •• U l at 3 at 01 4-H 4-4 C CS at 01 V at JC U . Q — U l < at x: OJ at 1 z E at 44 L. at cs U l O II 4 1 at at z Q CS 44 •• _ J 1 at E c at 4-H O < 1 o at O OJ at or 111 S ' ^ U l < at i - r at t-Or 44 4-4 cs U l at 44- 44 at i/> 1 II W < or at at 1 Q • • U l E at Ol 10 at o < 44 Z 4-4 at c — at < II U l 0) 4-H 4-H | 4  at • 4 - at U l or Ol - J O — - at U O) at or L. < at 44 C at or or it- O UJ at to — at c t- C i-14- or at C_ at 0 4-4 00 - 4 - LO TJ at CO 44 at - 4 - !_ O) c at 10 at 44 10 OJ as at TJ at o > XI at CO OJ at c at as L. at 3 at or i - at t4-at at at at * * * * * * CMCNCNCNCNCMCMCNCN LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 929 r e p e a t 930 1ncr( I ); 931 read( STR(I) ); 932 1f STR(I) = ' ' and I = 1 then 933 I := O; 934 u n t i l eof(INPUT) or eoln(INPUT) or (I -•= 0 and STR(I) = ' ') 935 or I = MAX_LINE_LEN; 936 937 READ_STRING := STR; 938 939 940 end (* READ_STRING * ) ; 941 942 943 944-946 (* *) 947 (* T r a n s f o r m the o r t h o g r a p h i c Image, l i n e by l i n e . Into a scanner Image *) 948 (* ( g e o m e t r i c a l l y , not radlometr1ca11y) as seen by a h y p o t h e t i c a l *) 949- (* a i r b o r n e scanner system. C a l c u l a t e a c o r r e s p o n d i n g v i s i b i l i t y map *) 950 (* and a p i x e l l a y o v e r map s i m u l t a n e o u s l y . If e i t h e r Is r e q u e s t e d . *) 951 (* *) 953 p r o c e d u r e SCANNER_TRANSFORM; 954 955 v a r 956. I, J , RADIUS : Integer; 957 ANGLE, 958 PREV_TAN, CURR_TAN : s h o r t ; 959 VISIBLE : boolean; 960 DLINE, ILINE, 961 SCANNER_ILINE : INT_LINE; 962 SCANNER_FLINE : SH0RT_LINE; 963 VMLINE, PLMLINE : MAPSET; 964 965 966 b e g i n 967 968. ILINE := READ_IMAGE_LINE( IMAGE_FILE, not READ_RE0D ); 969. . DLINE := READ_DTM_LINE ( DTMFILE, not READ_RE0D ); 970 971 f o r I := 1 to DIM(LINE) do 972- b e g i n 973 974 VMLINE := (. . ) ; 975 f o r J := 0 to MAXLINELEN+2 do 976 b e g i n 977 SCANNER_ILINE(J) := MIN_INTENSITY; 978 SC ANNER_F LI NE ( J ) := 0; r-> 979 end (* f o r J * ) ; 980 ^° 981 SCANNERILINE(IMAGE_CENTER) := ILINE(NADIRCOORD); 982 SCANNER_F LINE(IMAGE_CENTER) := 1 .OS ; 983 984 985 PREV_TAN := 0.0s; 986 f o r J := NADIR COORD-1 downto 1 do LISTING OF 987 988 989 990 991 992 993. 994 995 . 996 997 998 999 1000 1001 1002 1003 1004. 1005 1006: 1007 1008 1009 1010.-101 1. 1012 1013 1014: 1015 1016 1017 1018' 1019 1020" 1021 • 1022 1023 ' 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 FILE LIFE:Scaner.v1s.s 12:54 P.M. JUNE 12, 1982 ID=LIFE beg 1 n VISIBLE := t r u e ; RADIUS := abs( NADIR_COORD - J ); CURR_TAN := RADIUS * GRIDSPAC / (ELEVATION - D L I N E ( J ) ) ; 1f CURR_TAN > PREV_TAN then begl n ANGLE := ATAN( CURR_TAN ); 1f (ANGLE -•= OUT_OF_RANGE) and (ANGLE <= SCAN_ANGLE) then BUFFER_INSERT( I L I N E ( J ) , ANGLE, SCANNERILINE, SCANNER_FLINE, LEFT_HALF ); e l se VMLINE := VMLINE + (. (MAX_IMAGE_SIZE-J) . ) ; PREV_TAN := CURR_TAN; end (* If CURR_TAN > PREV_TAN * ) ; e l se VMLINE := VMLINE + (. (MAX_IMAGE_SIZE-J) . ) ; end (* f o r d * ) ; PREV_TAN := 0.0s; f o r J := NADIR_C00RD+1 to DIM(PIXEL) do beg 1 n VISIBLE := t r u e ; RADIUS := abs( NADIR_C00RD - J ); CURR_TAN := RADIUS * GRID_SPAC / (ELEVATION - D L I N E ( J ) ) ; 1f CURR_TAN > PREV_TAN then b e g i n ANGLE := ATAN( CURR_TAN ); If (ANGLE -•= OUT_OF_RANGE) and (ANGLE <= SCAN_ANGLE) then BUFFER_INSERT( I L I N E ( J ) , ANGLE, SCANNER_ILINE. SCANNER_FLINE, RIGHT_HALF ); e l se VMLINE := VMLINE + (. (MAX_IMAGE_SIZE-J) . ) ; PREV_TAN := CURR_TAN; end (* 1f CURR_TAN > PREV_TAN * ) ; e l se VMLINE := VMLINE + (. (MAX_IMAGE_SIZE-J) . ) ; end (* f o r J * ) ; SCANNER_F LINE(IMAGE_CENTER) := O.Os; INTERPOLATE( SCANNER ILINE, SCANNER FLINE ): M WRITE_IMAGE_LINE( IFILE, SCANNER_ILINE, 1 ); ° 1f VISIBILITY_MAP then WRITE_MAP_LINE( VMFILE, VMLINE ); If PIXEL_LAYOVER_MAP then b e g i n LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID = LIFE 1045 PLMLINE := CALC_PIXEL_LAYOVER( DLINE, VMLINE ); 104G WRITE_MAP_LINE( PLMFILE, PLMLINE ); 1047- end (* 1f PIXEL_LAYOVER_MAP * ) ; 1048 1049 If I < DIM(LINE) then 1050 b e g i n 1051 ILINE := READIMAGE_LINE( IMAGE_FILE, READREOD ); 1052 DLINE := READ_DTM_LINE ( DTM_FILE, READREOD ); 1053 end (* If I < DIM(LINE) * ) ; 1054, 1055 1056 end (* f o r I * ) : 1057 1058 1059 end (* SCANNER_TRANSFORM * ) ; 1060 1061 . 1062 • 1063 1064 (* ##0/S'##/y/y0#/y#####/!'#iy########^ ^ *) 1065 (* *) 1066 (* T r a n s f o r m the o r t h o g r a p h i c Image, l i n e by l i n e , Into a s1de-1ook1ng *) 1067 (* scanner Image - as Is the type of Image produced by a SLAR system - *) 1068 (* ( g e o m e t r i c a l l y , not radlometr1ca11y) as seen by a h y p o t h e t i c a l *) 1069 (* a i r b o r n e s e n s i n g system. C a l c u l a t e a c o r r e s p o n d i n g v i s i b i l i t y map *) 1070 (* and a p i x e l l a y o v e r map s i m u l t a n e o u s l y , i f e i t h e r i s r e q u e s t e d . *) 107 1 • (* *) 1072. (* H##HHHHHHHHHHHHH#HHHH##HHHHHHH»H#HHHH##HH#Htt#ttHH#HHH##HHHItfiHNHHHHHHHHHH *) 1073 p r o c e d u r e SIDE_LOOK_TRANSFORM; 1074 : 1075 v a r 1076 I. J , RADIUS : Integer; 1077 ANGLE, 1078 PREV_TAN, CURR_TAN : s h o r t ; 1079' VISIBLE : boolean; 1080 DLINE, ILINE, 1081 . SL_ILINE : INTJ.INE; 1082 SL_FLINE : SHORT_LINE; 1083 VMLINE, PLMLINE : MAPSET; 1084 1085 1086 b e g i n 1087 1088 ILINE := READ_IMAGE_LINE( IMAGE_FILE, not READREOD ); 1089' DLINE := READ_DTM_LINE ( DTM_FILE, not READREOD ); 1090 1091 f o r I := 1 to DIM(LINE) do 1092 b e g i n 1093 1094 VMLINE : = ( . . ) ; U) 1095 f o r d : = O to MAX_LINE_LEN+2 do I—' 1096 b e g i n 1097 SL_ILINE(d) := MIN_INTENSITY; 1098 . SL_FLINE(d) := O; 1099 end (* f o r d * ) ; 1 100 1101 PREV_TAN := O.Os; 1102 f o r d := 1 to DIM(PIXEL) do LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12. 1982 ID=LIFE 1 103 1 104 1 105 1 106 1 107 1 108 1 109 1 1 10 1111 1112 1113 1114 1115' 1 1 16 1117 1 1 18 1119 1 120 112 1 1 122 1 123 1 124 1 125 1 126 1 127 1 128 1 129 1 130 1131 1 132 1 133. 1 134 1 135 1 136 1 137 1 138 1 139 1 140 114 1 1 142. 1 143 1 144 1 145 1 146 1 147 1 148 1 149 1 150 1151 1 152 1 153 1 154 1 155 1 156 1 157 1 158 1 159 1 160 b e g i n VISIBLE := t r u e ; RADIUS := abs( NADIR_COORD - J ); CURR_TAN := RADIUS * GRID_SPAC / (ELEVATION - D L I N E ( J ) ) ; If CURR_TAN > PREV_TAN then beg 1 n ANGLE := AT.AN( CURR_T AN ); If (ANGLE -•= OUT_0F_RANGE) and (ANGLE <= (90-MIN_DEP_ANGLE)) and (ANGLE >= (90-MAX_DEP_ANGLE)) then BUFFER_INSERT( I L I N E ( J ) . (ANGLE-(90-MAX_DEP_ANGLE )) , SL_ILINE, SL_FLINE, RIGHT_HALF ); e l se VMLINE := VMLINE + (. (MAX_IMAGE_SIZE-J) . ) ; PREV_TAN := CURR_TAN; end (* If CURR_TAN > PREV_TAN * ) ; e l se VMLINE := VMLINE + (. (MAXIMAGESIZE-J) . ) ; end (* f o r J * ) ; INTERPOLATE( SL_ILINE, SL_FLINE ); WRITE_IMAGE_LINE( IFILE. SL_ILINE, 1 ): I f VISIBILITY_MAP then WRITE_MAP_LINE( VMFILE, VMLINE ); 1f PIXEL_LAYOVER_MAP then beg 1 n PLMLINE := CALC_PIXEL_LAYOVER( DLINE, VMLINE ); WRITE_MAP_LINE( PLMFILE, PLMLINE ); end (* If PIXEL_LAYOVER_MAP * ) ; 1f I < DIM(LINE) then b e g i n ILINE := READ_IMAGE_LINE( IMAGE_FILE, READREOD ); DLINE := READ_DTM_LINE ( DTM_FILE, READ_REOD ); end (* I f I < DIM(LINE) * ) ; end (* f o r I * ) ; end (* SIDE LOOK TRANSFORM * ) ; (* *) (* I n i t i a l i z e the system by s e t t i n g up the f i l e s , g e t t i n g the dimensions *) (* of the DTM, and r e a d i n g the n e c e s s a r y system parameters. *) (* *) LO LISTING OF FILE L I F E : s c a n s r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1 161 1 162 1 163 1 164 1 165 1 166 1 167 1 168 1 169 1 170 1 171 1 172 1 173 1 174 1 175 1 176 1 177 1 178 1 179 1 180 1181 1 182 1 183 1 184 1 185 1 186 1 187 1 188 1 189 1 190 1 191 1 192 1 193 1 194 1 195 1 196 1 197 1 198 1 199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 121 1 1212 12 13 12 14 1215 1216 1217 , 1218 p r o c e d u r e SYS_INIT; v a r CENTRAL_ANGLE : r e a l ; I, J Integer; b e g l n SET_PREFIX( PROMPT, 1 ); GET_DIMENSIONS; PRINT_MSG( ENTER_GRID_SPACING, " , 0 ); GRID_SPAC := r o u n d t o s h o r t ( GET_NUM( POSITIVE, PRINT_MSG( ENTER_ELEVATION, " , O ); ELEVATION := r o u n d t o s h o r t ( GET NUM( POSITIVE, NOT INTEGRAL ) NOT INTEGRAL ) ); ); PRINT_MSG( SIDELOOK_TRANSFORM, " , O ); SIDE_LOOK := GETREPLY; 1f SIDE_L00K then b e g i n PRINT_MSG( ENTER_DEPRESSION_ANGLE, 'maximum', 7 ); MAX_DEP_ANGLE := r o u n d t o s h o r t ( GET_NUM( SCAN_RANGE, NOT INTEGRAL ) ): PRINT_MSG( ENTER_DEPRESSION_ANGLE, 'minimum'. 7 ); MIN_DEP_ANGLE := r o u n d t o s h o r t ( GET_NUM( SCAN_RANGE, NOT INTEGRAL ) ); CENTRAL ANGLE NADIR_COORD MAX_ANGLE IMAGE CENTER = (90 - MAX_DEP_ANGLE + ((MAX_DEP_ANGLE -MIN_DEP_ANGLE) * 0.80s)) * DEG_TO_RAD; tru n c ( DIM(PIXEL)/2 ) -round( tan( CENTRAL_ANGLE )*ELEVATION/GRID_SPAC ); 90 - t r u n c ( MIN_DEP_ANGLE ) + 1; O; end (* If SIDE_LOOK * ) ; e l se be g i n PRINT_MSG( ENTER_SCAN_ANGLE, " , 0 ); SCAN_ANGLE := r o u n d t o s h o r t ( GET_NUM( SCAN_RANGE, NOT INTEGRAL ) / 2 ); PRINT_MSG( ENTER_NADIR_COORD, " , 0 ); NADIRCOORD := t r u n c ( GET_NUM( LINE_LENGTH, INTEGRAL ) ); MAX_ANGLE := tr u n c ( SCAN_ANGLE + 1 ): IMAGE_CENTER := tr u n c ( MAX_IMAGE_SIZE/2 ); end (* e l s e not SIDEJ.OOK * ) ; 1f MAXANGLE > MAX_SCAN_ANGLE then MAX ANGLE := MAX SCAN ANGLE; LO LO LISTING OF FILE L I F E : s c a n e r . v 1 s . s 12:54 P.M. JUNE 12, 1982 ID=LIFE 1219 1220. 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231. 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261. 1262 1263 1264 1265 1266 1267 1268 1269 1270. 1271 1272 1273 1274 1275 1276 TAN_INIT( MAX_ANGLE ); If SIDE_LOOK then INTERVAL := CALC_INTERVAL( round( (MAX_DEP_ANGLE-MIN_DEP_ANGLE)/2 ) ); e l se INTERVAL ':= CALC_I NTERVAL ( MAX_ANGLE ); PRINT_MSG( MAP_DESIRED, ' v i s i b i l i t y ', 13 ); VISIBILITYMAP := GET_REPLY; PRINT_MSG( MAP_DESIRED, ' p i x e l l a y o v e r ' , 13 ); PIXEL_LAYOVER_MAP := GET_REPLY; FILES; end (* SYSTEM_INITIALIZATION * ) ; (* *) (* If a system e r r o r o c c u r s , output the message MESSAGE and h a l t the *) (* e x e c u t i o n of the system. *) (* *) pr o c e d u r e SYSTEM_ERROR( MESSAGE : S T R 5 0 ); b e g i n w r 1 t e l n ( ' ===> SYSTEM ERROR ===> '.MESSAGE ); h a l t ; end (* SYSTEM_ERROR * ) ; (* *) (* I n i t i a l i z e the tangent lookup t a b l e , TAN_LOOKUP. *) (* *) pr o c e d u r e TAN_INIT( SIZE : Integer ); var OEG Integer; l - 1 b e g i n £ 1f SIZE > MAX_SCAN_ANGLE then SYSTEM_ERROR( 'In "TAN_INIT"; I n v a l i d s i z e s p e c i f i e d ' ); f o r OEG := O to SIZE do 1f DEG = 90 then TAN LOOKUP(DEG) := UNDEFINED; 135 * * * * * * CO O) z -3 £ o. in O < or O LU o O LU o £ TJ c 3 0 C5 LU Q C L Z> o o z < OJ t-z TJ c 01 % at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at at or • < in i - in LO CM - TJ OJ c x ro Q L O •K C (0 OJ QJ Dl 3 C 4 4 — 01 *• £ L. 10 01 ** 3 1/1 — to LU > C5 < to £ 4 - 10 to 0) £ u- 01 X 01 — £ a £ O CJ 44 to QJ UJ Z -H •-< to _ l £ OJ C TJ — 0) - E 3 QJ 10 £ 10 44 to 0J 10 [_ 44 3 -i L. 01 Dl ai at at at at at at at at at at at at at at at at at at at at at UJ C at _ i 4-at ft at u. •• at UJ at CJ H at < o: at £ < at M K at LO at •• at at UJ UJ at a Z at < 1-4 at £ _J at « | at t-* L H at to i at > at at w at UJ UJ at Z Z at i-i M at _ i _ i at I at UJ at u at < at £ at I - . O TJ L . 01 Dl 0J l/l Z O I TJ Z UJ • O I « £ 4-1 t- L. or to < £ t- (J in at at at at at at at at at at at at at at at at at at I CJ < C £ Ol 01 JD O or - 4 I— I-I S & II U l II UJ • • O •• CJ < < < 3 CL o < £ or 3 TJ C 0) * * * * * .—.,—. * * * * * * * * at at at at at at at at at 44-at at at 0 at •: at at at at at to at at at — at at at at at at D) at at f—. at C at at at at at t- at L-at at LU at 44 at at l / l at to at at CL at at at < at QJ at at £ at £ at at at 1-at at at at at at at at LU at E at at z at (0 at at 4-4 at 01 at at - J at L. at at at 44 at at 4 - at to at at U l at at < at _J at +4 at £ at 4-4 at 3 at at U- at a at 01 at C L at 44 at — at < at 3 at — at £ at O at 44- at at at at at 44 at Q at at C at to at CL at QJ at E at < at to at at £ at 01 at QJ at * at L . at £ at L . at CL at +4 at to at at at > LU at OJ at 0 at z at £ at 44 at -—- 4-4 at 44 at at LU U l _ l at at ui at z z 1 at 0 at z at 4—1 CL at 44 at 1—4 at _ l _ l < at at - J at 1 £ at et at at C L • I at t-at 0J at < C L UJ at 10 at c at £ . < 1- at at at 1 £ 4-4 at D) at 4— at UJ a at c at at 1- S—' 3 at •4-at a at 4-4 C at L. at to at or r— at 44 at E at 3 0J * at (0 at at 44 - - at at OJ at QJ 4 - at QJ at £ at L. C i_ at £ at at 3 - 3 at 44 at at TJ D) TJ at at 01 at 0) 01 c at 01 at +4 at O a OJ at 44 at -4- at 0 at -4-at [_ at L. at S_ at 3 at 0. at 3 at at at at at at * * * * * * * * z to f " - o c n 0 4 - c N O ^ i j o t i 3 r ^ r o t 4 } 0 * - f N 4-4 r ^ r ^ r ^ t D c o t o t o t o t o c o c o t o t o c n o j r o -J C N C > I C > I C 4 I C > I C \ C N C 4 I C 4 J C M C M C \ r > I C N C > I C 4 l C > I C > I C N C > I C M LISTING OF FILE L I F E : s c a n e r . v i s . s 12:54 P.M. JUNE 12, 1982 ID = LIFE 1335 (* l e n g t h SIZE. If the l e n g t h Is l e s s than one, the o p e r a t i o n does not *) 1336 (* take p l a c e . *) 1337 (* *) 1338 (* •) 1339 p r o c e d u r e WRITE_STRING( STR : INPUT_LINE; SIZE : Integer ); 1340 . 1341 var 1342 I : Integer; 1343 1344 1345 b e g i n 1346 1347 If SIZE > 0 then 1348 f o r I := 1 to SIZE do 1349 wr1te( STR(I) ) 1350 1351 1352 end (* WRITE_STRING * ) ; 1353 1354 1355 1356 (* *) 1357 (* *) 1358 (* I n i t i a l i z e the system and then proceed to t r a n s f o r m the o r i g i n a l *) 1359 (* Image Into a g e o m e t r i c a l l y c o r r e c t radar Image. *) 1360 (* *) 136 1 (* *) 1362 b e g i n (* MAIN ROUTINE *) 1363 1364 SYS INIT; 1365 ' 1f SIDE LOOK then 1366 SIDE_LOOK_TRANSFORM 1367 e 1 se 1368 SCANNER_TRANSFORM; 1369 1370. end (* MAIN ROUTINE * ) . LO 

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
http://iiif.library.ubc.ca/presentation/dsp.831.1-0051830/manifest

Comment

Related Items