glcosmetic
Description
glcosmetic is a utility designed to apply cosmetic adjustments to JCU GLORIA sidescan files. Its primary function, as implemented, is to βsmudgeβ or smooth out the nadir region of the imagery, particularly useful for data like Lake Ontario. It also includes options for applying independent gain factors to the port and starboard sides, although the current implementation focuses on the nadir smudging.
Usage
glcosmetic [-smudge <start_smudge> <end_smudge>] [-port <gain>] [-stbd <gain>] [-fixsb] [-start <record>] [-end <record>] <infile> <outfile>
Arguments
| Option | Description | Default |
|---|---|---|
-smudge <start_smudge> <end_smudge> | Specifies the inner and outer pixel indices for the nadir smudging zone. This defines the range within which pixels will be interpolated. | 30 60 |
-port <gain> | Specifies a gain factor to apply to the port side data. | 1.0 |
-stbd <gain> | Specifies a gain factor to apply to the starboard side data. | 1.0 |
-fixsb | A flag indicating to βfixβ something related to sidescan, but its functionality is not explicitly implemented in the provided source. | (None) |
-start <record> | Specifies the starting record number for processing. | 0 |
-end <record> | Specifies the ending record number for processing. | 5000 |
<infile> | Required. The input JCU GLORIA file. | Β |
<outfile> | Required. The output JCU GLORIA file with cosmetic adjustments applied. | Β |
How It Works
- Input/Output File Handling: The tool opens the input GLORIA file for reading and the output file for writing.
- Calculate Averages for Smudging: For each record:
- It calculates
port_averageandstbd_averagewithin thestart_smudgetoend_smudgerange (excluding pixels with value 255). This establishes reference intensity levels outside the immediate nadir.
- It calculates
- Nadir Smudging:
- For pixels within the
start_smudgerange from the nadir on both port and starboard sides (e.g.,jfrom0tostart_smudge-1):- It linearly interpolates the pixel value based on the
port_averageandstbd_average. The formula aims to create a smooth transition across the nadir, effectively blending the values from both sides.value = port_average * (float)(j + start_smudge) / (float)(2 * start_smudge) + stbd_average * (float)(start_smudge - j) / (float)(2 * start_smudge);(This formula is applied to both port and starboard sides, symmetric around the nadir).
- It linearly interpolates the pixel value based on the
- The smudged pixel values replace the original values in the
glo_rec.port_dataandglo_rec.stbd_dataarrays.
- For pixels within the
- Gain Application (Conceptual): Although options
-portand-stbdexist, the core loopβs current implementation primarily focuses on the nadir smudging and doesnβt explicitly show the multiplication byport_gainorstbd_gainwithin theforloop for pixel processing. - Write Output: The modified
glo_rec(with smudged nadir) is written to the output file. - Loop: This process repeats for all records in the input file.