back_char
Description
back_char is a utility designed to characterize backscatter strength and grazing angle mosaics. It processes up to 10 pairs of backscatter and impinging angle mosaics (in JHC image format). By running a moving box filter over these images, it calculates and outputs several derived images that describe the angular dependence of backscatter:
- Slope: The slope of the linear fit to the angular dependence of backscatter (between 45 and 78 degrees).
- Midi: The backscatter strength at 67.5 degrees, assuming a linear slope.
- Standard Deviation: The mean standard deviation of backscatter (between 45 and 78 degrees).
- Lambertian Fit: The backscatter strength at vertical incidence, assuming a Lambertian scattering model (over the range of 45 and 78 degrees).
- Bounds: An image indicating the average value within the useful grazing angle range.
- Map: An image representing the total number of useful pixels (if
-mapis used).
All calculations are performed for backscatter measured over the grazing angle range of 45 to 76.8 degrees.
Usage
back_char [-box <size>] [-min_useful <count>] [-bounds <upper> <lower>] [-map] [-slope] [-midi] [-stdv] [-lamb]
Arguments
| Option | Description | Default |
|---|---|---|
-box <size> | Specifies the size of the square moving box filter (e.g., a value of 5 means a 5x5 box). | 5 |
-min_useful <count> | Sets the minimum number of “useful” pixels required within a box for calculations to be performed. If fewer pixels are available, output values for that box will be marked as invalid (e.g., 8 or 14). | (box_size*2)^2 * 2 |
-bounds <upper> <lower> | Defines the upper and lower grazing angle bounds (in degrees) for analysis. Values outside this range will be ignored. | 45.0 (upper), 12.0 (lower) |
-map | Instead of calculating derived parameters, generate a map indicating the total number of useful pixels within each box. Forces box_size to 1. | (None) |
-slope | Output an image representing the slope of the linear fit to backscatter vs. grazing angle. Output file: slope.comp. | (Output by default if no specific flags are given) |
-midi | Output an image representing the backscatter strength at 67.5 degrees. Output file: midi.comp. | (Output by default if no specific flags are given) |
-stdv | Output an image representing the mean standard deviation of backscatter. Output file: stdv.comp. | (Output by default if no specific flags are given) |
-lamb | Output an image representing the backscatter strength at vertical incidence (Lambertian fit). Output file: lamb.comp. | (Output by default if no specific flags are given) |
How It Works
- Input Loading:
- The tool loads up to 10 pairs of backscatter (
.mos) and grazing angle (.imping.mos) JHC image files into memory. Each file is assumed to have aJHC_headerat the beginning. - It extracts relevant header information such as image dimensions (
dx,dy).
- The tool loads up to 10 pairs of backscatter (
- Angle Range Conversion: The user-defined
upper_boundandlower_boundgrazing angles are converted into corresponding pixel ranges (min_range,max_range) for internal processing (mapping from degrees to 8-bit digital numbers). - Moving Box Filter: The core of the processing involves iterating a
box_sizexbox_sizewindow over the entire image (row by row, column by column). - Data Accumulation within Box: For each position of the box filter:
- It iterates through all 10 input backscatter/grazing angle image pairs.
- Within the current box, it examines each pixel. If a pixel’s grazing angle is within the
min_rangeandmax_rangeand its backscatter value is not an invalid value (15 or 255), it’s considered “useful”. - For useful pixels, it accumulates statistics into a
table_pointer[back_stbd][graz_stbd]array. tot_usefulcounts the total number of useful pixels within the box across all 10 input images.
- Derived Parameter Calculation (if
tot_useful > min_useful):- Average Backscatter per Grazing Angle (
aver): For each grazing angle bin within themin_rangetomax_range, it calculates the average backscatter value from thetable_pointer. - Slope: Performs a least-squares linear fit on the
avervalues against grazing angle to determine the slope of the angular dependence. - Midi: Calculates the expected backscatter value at 67.5 degrees grazing angle based on the
avervalues and a predefinedfit_slope. - Standard Deviation: Calculates the standard deviation of backscatter values for each grazing angle bin.
- Lambertian Fit: Calculates a “Lambertian” constant from the
avervalues, representing backscatter at vertical incidence assuming a Lambertian model. - Bounds: Calculates the average of
avervalues within the useful range.
- Average Backscatter per Grazing Angle (
- Output Generation:
- Map Mode (
-map): If this flag is set, the output image pixel for the current box representstot_useful. - Derived Images: Otherwise, the calculated
slope,midi,stdv,lamb, andboundsvalues are scaled and converted to 8-bit unsigned char and written to corresponding output image files (.comp). - If
tot_usefulis less thanmin_useful, the output pixel for that box is set to an invalid value (8 or 14).
- Map Mode (
- Loop and Finalization: The process continues until all image rows are processed. Initial and final
box_sizerows are filled with default invalid values. Output files are closed.