Help for SOS

PURPOSE:

	Removes camera shading from images by assuming a linear transfer
 curve, with coefficients for each pixel in image space. Shading correction
 coefficients for each pixel are generated by "sosgen". These coefficients
 are applied by "sos" to remove camera shading from individual frames. These
 programs are intended for use with the Viking Orbiter VIS system.

	There have been modifications made to "sos". Two of them are directed
 at controlling the contrast of the output picture by introducing scale and
 auto-stretch parameters. The rest of the changes apply only to Viking Orbiter
 frames and involved parameters to override information in the VO label and a
 modification to subtract the dark current from frames for which the D.C.
 offset has been turned off. All parameters are optional and may be specified
 in any order.

OPERATION:

	Shading correction coefficients are generated by "sosgen" using
 calibration data consisting of a sequence of flat-field frames taken at
 increasing levels of illumination. Only frames taken at exposures within
 the linear portion of the light-transfer curve should be used (see IOM
 324-IPL/71-843 by J. B. Seidman and A. A. Schwartz, "First Order Photometric
 Correction," 9 June 1971).

	A modification has been made to subract the dark current from all
 Viking Orbiter frames taken with the D.C. offset turned off before applying
 the shading correction transformation (reference c). This is accomplished
 by subtracting a constant K from all samples in the input frame. The values
 for K are given in Table 1. (The parameter DC is specified.)

		_______________________________________________
		|	|	     |	OFFSET VALUE(K)       |
		|  S/C	| CAMERA S/N |------------------------|
		|  	|	     | 	HIGH GAIN | LOW GAIN  |
		|-------|------------|------------|-----------|
		|	|	     |		  |	      |
		| VO-1A |      7     |     90	  |	45    |
		|_______|____________|____________|___________|
		|	|	     |		  |	      |
		| VO-1B |      4     |     50	  |	25    |
		|_______|____________|____________|___________|
		|	|	     |		  |	      |
		| VO-2A |      8     |     62	  |	31    |
		|_______|____________|____________|___________|
		|	|	     |		  |	      |
		| VO-2B |      6     |     62	  |	31    |
		|_______|____________|____________|___________|

	The basic reason for adjusting the picture contrast within the program 
 rather than during a subsequent job step is to reduce the contouring which
 occurs when an underexposed frame is severely stretched. This contouring is
 primarily caused by the bit truncation error which results when brightness
 information is recorded over a narrow DN range. The scale and ASTRETCH options
 are designed to broaden the DN range of the output picture. What follows is
 a brief description of the shading correction algorithm (see referenc a) and
 how it is modified by the SCALE and ASTRETCH options.

 	Camera induced shading is removed from a picture by first determining
 the light transfer funciton (assumed to be linear) relating image DN
 (x sub ij) to ovject scene luminance (l sub ij). The inverse light tranfer
 function may be approximated as follows:

		l   = m* x  + b*
		 ij    ij ij   ij

	Each pixel in the image is restored to its original object scene
 luminance, and the result scaled as follows:

		y   = s (m* x   + b* )				(1)
		 ij    o  ij ij    ij
 where
		y   = corrected output DN
		 ij

		     mean object scene luminance
		s  = ---------------------------
		 o         mean image DN

	The shading coefficients are generated by the VICAR program "sos"GEN
 and stored in a calibration file as ordered pairs (m' sub ij,b' sub ij), where
 
	m'  = 4096m* s		and	b'  = 16m* s
	 ij        ij o			 ij      ij o

	The shading correction actually performed by "sos" thus involves the 
 following steps:
			y   = ((m'  * x  )/intercept + b' ) / 16
			 ij      ij    ij         ij

 where intercept is 256 for HI gain images and 128 from LO gain images.

	Dropping the subscripts:
			y = ((m'*x)/intercept + b')/16		(2)

	Truncation errors are introduced at the two division steps (all
 calculations are performed using integer variables). When the SCALE parameter
 S is used, equation 2 is modified as follows:

		y  = S' * (m*x + intercept *b)
		 s
	where
		S' = S/4096

	When the ASTRETCH option is used, equation 2 is modified as follows:
 First, a histogram is generated by performing the foillowing transformation
 over a sub-sampling o the input picture:

		y' = (m' * x) / intercept + b'

RESTRICTIONS:

	"sos" is currently restricted to byte pictures of smaple size no larger
 than 1204. Because of the format of the generated coefficients, the allowable
 range of values are |m  | < 8 and |b  | < 2048.
		     | ij|	   | ij|

HISTORY:

  WRITTEN BY:  G.M.Yagi,  19 Oct. 1979

  CONVERTED TO VAX BY: C.C.Avis,  10 June 84

08 MAY 95   ...AMS...    (CRI) Made portable for UNIX
10 JUL 91   ...CCA...    Modified to use new VOLABV2
19 AUG 88   ...HBM...    Fixed intercept for LO gain images
10 JUN 84   ...CCA...    CONVERT TO VAX
10 APR 81   ...GMY...    FIX ASTRTCH OPTION FOR LOW GAIN
19 OCT 79   ...GMY...    INITIAL RELEASE


PARAMETERS:


INP

STRING-Input file name.

OUT

STRING-Output file name.

DBUG

KEYWORD-Debugging statements for programmers use.

PHIST

KEYWORD-Prints histogram.

NOISE

KEYWORD-

MODE

KEYWORD-

CAMERA

INTEGER-Camera serial number.

FILTER

INTEGER-Filter position.

GAIN

INTEGER-Gain state.

OFFSET

INTEGER-Dark current offset on or off.

DC

INTEGER-Dark current offset.

LPERC

REAL-Percentage of output samples to be saturated to 0 DN.

HPERC

REAL-Percentage of output samples to be saturated to 255 DN.

LINC

INTEGER-Line increment.

SINC

INTEGER-Sample increment.

IHIST

KEYWORD-

EXCLUDE

INTEGER-

STRETCH

INTEGER-Causes a linear stretch to be performed.

SCALE

REAL-Each element in the output picture will be multiplied by the constant term S.

SKALE

REAL-

TNOISE

INTEGER-test noise value

See Examples:


Cognizant Programmer: