Create a shaded terrain image or modify an image for sun illumination
Creates a shaded terrain image by applying the effect of sun illumination on an input elevation image. Color composite images may also be modified according to the input elevation image.
- IN
- Input image. The input image may be BYTE, INTEGER*2, INTEGER*4, or REAL*4 data. It must be a single-band image of at least 3 lines x 3 samples. Window and/or band options may be specified.
- OUT
- Output image. The output image will be a single-band image that is the same size as the input image. The output data type will be BYTE or REAL*4, depending on the value of ODTYPE. Values in the BYTE image are clipped accordingly. Values in the REAL image lie in the range of 0 - 1 and are not clipped.
- ODTYPE(BYTE)
- Output data type.
= BYTE: BYTE (8-bit unsigned integer) (0 through 255) = R*4: REAL*4 (32-bit signed real) (System dependent)
- CONVMETH(ONE)
- Method of calculation.
= ONE: 1 x 3 convolution. = THREE: 3 x 3 convolution.
- PIXSIZ(30.0,30.0)
- Ground dimensions of pixel. The pixel sizes in the line and sample direction, measured in the same units as the data in the input elevation image.
- INSF(1.0)
- Input scale factor. Each pixel in the input elevation image is multiplied by INSF.
- OUTSF(1.0)
- Output scale factor. This sun intensity factor scales each output angle calculated from IN.
- OFFSET(0.0)
- Offset value. This ambient light factor is added to each output angle calculated from IN.
- SUNANG(30.0)
- Sun angle. SUNANG specifies the angle of the sun measured up from the horizon. This angle is measured in decimal degrees and ranges from 0.0 to 90.0.
- AZIANG(90.0)
- Azimuth angle. This angle is measured clockwise from north in decimal degrees from 0.0 to 360.0.
- EXPVAL(1.0)
- Exponent value. EXPVAL is applied to each pixel of the output image.
- MASKVAL(0.0)
- Mask value. The pixel value that is used to designate masked areas or areas of bad data. Pixels with this value will be changed to the value of the currently processed pixel.
- IN
- Input images. IN(1) contains elevation data. It must be a single-band BYTE, INTEGER*2, INTEGER*4, or REAL*4 image of at least 3 lines x 3 samples. Window and/or band options may be specified. IN(2) contains composite data. It may be a multiband BYTE, INTEGER*2, INTEGER*4, or REAL*4 image of at least 3 lines x 3 samples. Window and/or band options may be specified. IN(1) and IN(2) must specify images of the same size.
- OUT
- Output image. The output image will be a single or multi-band image with the same number of bands as the input image in IN(2). The output data type will be BYTE or REAL*4, depending on the data type of the input image IN(2). Values in the BYTE image are clipped accordingly.
- CONVMETH(ONE)
- Method of calculation.
= ONE: 1 x 3 convolution. = THREE: 3 x 3 convolution.
- PIXSIZ(30.0,30.0)
- Ground dimensions of pixel. The pixel sizes in the line and sample direction, measured in the same units as the data in the input elevation image.
- INSF(1.0)
- Input scale factor. Each pixel in the input elevation image is multiplied by INSF.
- OUTSF(1.0)
- Output scale factor. This sun intensity factor scales each output angle calculated from IN(1).
- OFFSET(0.0)
- Offset value. This ambient light factors are added to each output angle calculated from IN(1).
- SUNANG(30.0,30.0)
- Sun angles. The sun elevation angles applied to IN(1) before and after modification. The angles of the sun measured up from the horizon. These angles are measured in decimal degrees and range from 0.0 to 90.0. If the input exponent value is at its default value of 0.0 then the input sun angle will not be used.
- AZIANG(90.0,90.0)
- Azimuth angles. The azimuth angles applied to IN(1) before and after modification. These angles are measured clockwise from north in decimal degrees from 0.0 to 360.0. If the input exponent value is at its default value of 0.0 then the input azimuth angle will not be used.
- EXPVAL(1.0,0.0)
- Exponent values. The exponent factors applied to the output angle calculated from IN(1) before and after modification.
- MASKVAL(0.0)
- Mask value. The pixel value that is used to designate masked areas or areas of bad data. Pixels with this value will be changed to the value of the currently processed pixel.
Using a 1 x 3 convolution approach, a REAL*4 shaded terrain image called OUTPUT.DAT will be created from the input image ELEV.DAT. The line and sample pixel sizes for the input image are 25.0 and 25.0, respectively. The chosen mask value is 1.0. The scale factor to be applied to ELEV.DAT is 2. A sun angle of 45.0 degrees, an azimuth angle of 60.0 degrees, a sun intensity factor of 3.0, and the defaulted ambient light factor of zero will be used in the shading calculations.
Using a 3 x 3 convolution approach and all default values for the appropriate parameters, a modified multi-band composite image will be created from the input image ELEV.DAT.
There are two options available to PICSHADE: CREATE and MODIFY. The general concepts of each option are the same; the main difference is in the calculation of the final output data.The input elevation image is processed pixel by pixel, centering each pixel in a 3 x 3 matrix consisting of the surrounding pixel values in the original input image. If any of the surrounding pixels equal the value in MASKVAL, they are set to the value of the center pixel.
Two unit vectors are used in the calculation of the output angle (alpha). One unit vector depicting the local surface normal is calculated using the gradient.
v1 = A(1)i + A(2)j + A(3)k where A(1) = DX / SQRT [(DX)**2 + (DY)**2 + 1] A(2) = DY / SQRT [(DX)**2 + (DY)**2 + 1] A(3) = 1 / SQRT [(DX)**2 + (DY)**2 + 1]The directional derivatives DX and DY can be calculated by two methods--(1) a one-by-three convolution or (2) a three-by-three convolution.
If the one-by-three method is chosen: DX = (INSF / (2*PIXSIZ)) [ -1 0 1 ] | -1 | DY = (INSF / (2*PIXSIZ)) | 0 | | 1 | If the three-by-three convolution method is chosen: | -1 0 1 | DX = (INSF / (6*PIXSIZ)) | -1 0 1 | | -1 0 1 | | 1 1 1 | DY = (INSF / (6*PIXSIZ)) | 0 0 0 | | -1 -1 -1 |Two unit vectors depicting the sun direction before and after modification are calculated for the input image (IN and IN(1)) using the corresponding sun elevation angle and azimuth angle.
v2 = B(1)i + B(2)j + B(3)k where B(1) = sin(AZIANG) * cos(SUNANG) B(2) = cos(AZIANG) * cos(SUNANG) B(3) = sin(SUNANG)The cosine of the angle between the sun direction and the surface normal (alpha) is expressed by:
alpha = A(1)*B(1) + A(2)*B(2) + A(3)*B(3).If alpha is negative, the angle is reset to zero.
Should the subcommand -CREATE be chosen, the output is calculated using the intensity scaling factor, the exponent factor, and the ambient light factor.
output = OUTSF*(alpha)**EXPVAL + OFFSETIf the subcommand -MODIFY is chosen, the final calculation of the output data includes two similar sets of values corresponding to the input image (IN(1)).
(OUTSF*(alpha1)**EXPVAL[0]) + OFFSET output = pixel * ------------------------------------ (alpha2)**EXPVAL[1]where pixel is the input pixel value (from IN(2)), alpha1 is the output angle for IN(1) before modification, and alpha2 is the output angle for IN(1) after modification. Should the denominator be zero, the output value would be reset to the initial input pixel value. Values in the BYTE output image are multiplied by 255 and clipped between 0 and 255 as necessary. Values in the REAL*4 image lie in the range of 0 through 1 and are not clipped.
The input image IN must be a single-band image. The user should make the appropriate changes in the input image specifications and rerun the program.
In order for the image to be processed correctly, the image must be at least 3 lines x 3 samples. The output data is calculated by processing 3 x 3 matrix samples from the original input image until all of the input image has been processed. The user should replace IN with an appropriate image specification and rerun the program.
IN(2) should be data related to the input image IN(1). (For example, IN(2) might be composite data while IN(1) is elevation data.) The two input images should have the same dimensions. The user should adjust the size of IN(2) according to IN(1) and rerun the program.
The input image IN(1) must be a single-band image. The user should make the appropriate changes for IN(1) and rerun the program.
In order for the image to be processed correctly, the image must be at least 3 lines x 3 samples. The output data is calculated by processing 3 x 3 matrix samples from the original input image until all of the input image has been processed. The user should replace IN with an appropriate image and rerun the program.
The image in IN(2) is a combination of images with different size windows. The user should enter appropriate image specifications so that the resulting windows are of the same size and rerun the program.