User's Guide

PERSPEC

Generate a three-dimensional image

Function:

Generates a three-dimensional image from elevation and reflectance images. It combines a single-band image containing elevation data and a single- or three-band reflectance image, constructing a three-dimensional image of the area. (If unfamiliar with the processing of PERSPEC, see User Note 4.)

Reference: B. Fishman and B. Schachter, "Computer Display of Height Fields," Computers and Graphics, Vol. 5, pp. 53-60, 1980.

Parameters:

IN1
First input image. A single-band image containing elevation data. The term "elevation" is used loosely. Although input to IN1 is primarily elevation data, it may be any image containing data to be used as height data or Z-value data in an X, Y, Z coordinate system. Window options may be specified. The allowable size of IN1 depends on the amount of memory available on the system at run time. IN1 is allowed to be any one of the four standard data type; if it is not INTEGER*2 before processing starts, it is converted to INTEGER*2.

IN2
Second input image. The single- or three-band image containing reflectance data. Window and band options may be specified. The allowable size of IN2 depends on the amount of memory available on the system at run time. The size of IN1 and IN2 must be equal. IN2 is allowed to be any one of the four standard data types.

OUT
Output image. The output data type is determined by ODTYPE. The output image size is determined by the parameter OUTWIND and has the same number of bands as IN2.

OUTWIND(--)
Output window specification. This is the size of the output image. If a null value is used, the output image size is the same as the input image size.

This parameter is used when a smaller output image is needed, while the detail of the larger input images is also needed to be kept. When the input images are windowed, some of the detail that lies outside of the window is lost.

This parameter may also be used when a wide field of view is needed. The wider the field of view, the more data that is compressed into the output image. Using a value for OUTWIND that is larger than the input image will prevent the compressing of output data into too small of image.

Specifying an output image that is nonsquare, may create unpredicable results. (See User Note 1.)

PIXSIZ(--)
Pixel size. The ground dimension of each pixel. This is the size of each elevation image pixel in elevation units (meters, feet). When PIXSIZ has a null value, the pixel size is retrieved from IN1. When retrieved from the input DDR, the pixel size must be the same in both the line and sample direction.

ROTFLG(YES)
Rotation flag. Flag indicating if output image is to be rotated 90 degrees. Processing time can be reduced if the image is not rotated until the final run when the user is certain the input parameters produce the desired output image.


  = YES:  Rotate 90 degrees
  = NO:   No rotation

VIEWLOC(0,256,200)
Viewer location. The Y, X, Z location on the input image (IN1) from which the perspective view is generated. The user must specify the line, sample, and height above the terrain of the viewing location. The height above the terrain is in units of the elevation image. (See Figure 1.) When windowing, the Y,X coordinates must be referenced according to the entire image.

If the Y, X location is within the IN1, the viewer's height is the sum of the Z value (VIEWLOC(3)) and the value of IN1 which is at location Y, X. (See Figure 4.) If the location of Y, X is not within the image of IN1, the viewer's height is the Z value (VIEWLOC(3)) only.

VIEWDIR(180.)
View direction. The direction the viewer is looking from the VIEWLOC position. The view direction, in degrees, is measured clockwise from north or the positive Y-axis. North is considered to be at the top of the output image. (See Figure 2.)

FOVIEW(20.0)
Field of view. The field of view measured in degrees. The greater the field of view, the more of the input image that is compressed into the output image. (See Figure 3.) The value for FOVIEW should be the field of view that is needed divided by two.

VERTSCAL(1.0)
Vertical scaling constant. A multiplicative constant applied to the values of IN1 to exaggerate relief.

HORIZLIN(256)
Horizon line. The location of the horizon line in the output image. The value specified is approximately equal to the number of lines measured from the bottom of the output image. (See User Note 5.)

SKYVAL(0,0,0)
Sky value. The value for the area in the output image defined to be sky. A value must be given for each band in the output image.

ODTYPE(SAME)
Output data type. The data type of the output image.


  = SAME: Same as IN2
  = BYTE: BYTE      (8-bit unsigned integer)  
  = I*2:  INTEGER*2 (16-bit signed integer)
  = I*4:  INTEGER*4 (32-bit signed integer)
  = R*4:  REAL*4    (32-bit signed real)

Example:

  1. LAS> perspec in1=tall.dem in2=bands3.ref out=out3d outwind = -- pixsiz = -- rotflg = yes viewloc=(0,256,200) viewdir=60.0 foview=20.0 vertscal=1.0 horizlin=108 skyval=(0,0,0) odtype=same

    The elevation image TALL.DEM and the reflectance image BANDS3.REF are processed to create the three-dimensional image OUT3D. The image in OUT3D would appear to be taken from a 60 degree angle, and the background or "sky" would be a value of 0. The output data type will be the same as the input reflectance band.

Description/Algorithm:

The image is examined in straight lines from the viewpoint location (VIEWLOC) into the field of view (FOVIEW) at an angle of VIEWDIR. Across these lines, the perspective image is produced by comparing each pixel in that line, using the following rule for hidden surface elimination:

      A reflectance point is displayed if--and only if--its
      transformed elevation point is greater than the largest
      point displayed on that line so far.

This process causes the image to be rotated counterclockwise 90 degrees. Using an algorithm presented in Digital Processing of Remotely Sensed Images, a bilinear smoothing is performed next. If specified by ROTFLG, the perspective image is rotated back so that the final output image is in the correct position.

Reference: Johannes G. Moik, Digital Processing of Remotely Sensed Images, National Aeronautics and Space Administration, Washington, D.C., 1980, p. 111.

Nonfatal Error Messages:

  1. [perspec-warn] Nonfatal error encountered

    A nonfatal error was encountered during processing. Processing is NOT terminated. The error message that is displayed immediately preceding this message is the specific error that was encountered.

Fatal Error Messages:

  1. [perspec-alloc] Error allocating dynamic memory

    An error was encountered while trying to allocate dynamic memory. Use smaller input images or see the System Manager.

  2. [perspec-fatal] Fatal error encountered

    A fatal error was encountered during processing. Processing is terminated. The error message that is displayed immediately preceding this message is the specific error that was encountered.

  3. [perspec-image] IN2 must be a single image

    Even though IN2 can have multiple bands, all the bands must be contained within one image. Use COPY to place all the bands into one image.

  4. [perspec-in1] IN1 must be a single-band image

    Rerun the program using one band of elevation data.

  5. [perspec-in2] IN2 must be a single- or three-band image

    Rerun the program using the correct number of image bands.

  6. [perspec-pdist] Projection distance in the line and sample directions are not equal

    The projection distance in the line and sample directions of the input images are not equal. Enter the correct pixel size in the parameter PIXSIZ.

  7. [perspec-size] Specified windows are not of equal sizes

    The image size (or window size, if specified) of the reflectance image(s) must be equal to the size (or window) of the elevation image.

  8. [perspec-valid] Projection distance of input images are not valid

    The projection distance of one of the input images is not valid. Either enter a value in the PIXSIZ parameter or place a valid projection distance in the input image DDR.

  9. [perspec-horizlin] HORIZLIN must be greater than zero

    Horizon line must be a positive number.

User Notes:

  1. Using PERSPEC to create a nonsquare output image may have unpredicable results. That is not to say that PERSPEC can never be used to create a nonsquare image, but the greater the difference between the number of output lines and the number of output samples, the more unpredicable PERSPEC becomes.

  2. Since PERSPEC is used to create images for viewing, the number of bands allowed in IN2 is either 1 for black and white viewing or 3 for red/green/blue color viewing.

  3. Due to the large amount of calculations performed in the algorithm, PERSPEC requires a large amount of processing time. It is suggested that the user run the program on single-band test subimages (created from ZOOM-REDUCE) without rotating the output image until the proper parameter values are determined and then run the program on the full input images.

  4. Since the user is generally unsure of what the output from the first run of PERSPEC will look like, care must be taken to understand and properly select the input values in order to avoid generating useless and confusing output. It is possible, for example, to select a viewpoint that (unknown to the user) is at the base of a cliff or sharp incline. If the elevation of the viewpoint (VIEWLOC(3)) is not sufficient to clear the surface directly in front of the viewpoint, a constant valued output may result; the first VIEWLOC selected should be from a point that will allow an unobstructed view, such as from the top of a hill or from a corner or bottom line of the image using a high elevation point (VIEWLOC(3)). This should provide a useful output scene which the user can then enhance by varying the input values on subsequent runs.

  5. The HORIZLIN parameter defines the line location of the output image's "horizon." This is where the terrain that is at the same elevation as the VIEWLOC will be located in the output image. This parameter is measured in lines from the bottom of the image. A guideline is to make this parameter about two-thirds the number of lines in the image.

    Decreasing the value of HORIZLIN will lower the actual image data within the frame of the output image, and increasing the value of HORIZLIN will raise the actual image data within the frame of the output image. (See Figure 4)

  6. If the input reflectance image is less than or equal to 768 by 768 by 1 band, the image is processed and rotated in one step; and, therefore, processing is significantly faster than an image that is larger than 768 by 768 by 1 band.

                                 z
                                 |    / y
                                 |   /
                                 |  /
                                 | /
                                 |/
                 x --------------+-----------------
                                /
                               /
                              /
    			 /
    			/
    
                       Figure 1.  VIEWLOC (Y,X,Z).
    
                         Y=line direction, 
                         X=sample direction, 
                         Z=height above terrain.
    

      
    1,1						      1,x
     -------------------------------------------------------
     |					               |
     |                         0			       |
     |            	           |			       |
     |	        	   |			       |
     |			   |			       |
     |			   |   VIEWLOC	 	       |
     |			   |  /		 	       |
     |			   | /		 	       |
     |			   |/		 	       |
     |   270 ------------------+--------------------- 90   |
     |			   |			       |
     |			   |			       |
     |			   |			       |
     |			   |			       |
     |			   |			       |
     |			   |			       |
     |			   |			       |
     |			   |			       |
     |			   |			       |
     |                        180  			       |
     |						       |
     -------------------------------------------------------
    y,1 							  y,x
                   Figure 2.  Measurement of VIEWDIR.
    

    
                        \\                  /
                         \\                /
                          \ <----40-----> /
                           \\            /
                            \\          /
                             \\        /
                              \\      /
                               \\    /
                                \\  /
    			     x,y
    
    		          FOVIEW = 20
    
                  Figure 3.  Field of view (FOVIEW).
    

    
    
    
    
            VIEWLOC = (0,256,200)
                                             /\\
          ................................../  \\
          |      .    (view direction)     /    \\
         Z =     .                        /      \\
         200     .                       /        \\
          |      .                      /          \\
          ........(height of VIEWLOC)  /            \\
                /\\                    /              \\
               /  \\                  /                \\
          ----/    \\----------------/                  \\
    
    			SIDE VIEW
    
    
    
            -----------------------------------------------
            |		                              |
            |                                  /\\         |
      ......|................................./..\\........|
      |     |        (HORIZLIN = 600)        /    \\       |
      |     |                               /      \\      |
    600     |                              /        \\     |
    Lines   |                             /          \\    |
      |     |                            /            \\   |
      |     |                           /              \\  |
      |     |                          /                \\ |
      |     |                         /                  \ |
            -----------------------------------------------      
    
             	    Figure 4.  Horizon line.