jplto8bit
Overview
jplto8bit converts a 1280-column OMG JHC_header 32-bit floating-point (.r4) airborne SAR or radar backscatter array into an 8-bit unsigned char (.8bit) array while normalizing cross-track slant-range angular response across a reference swath (scanlines 2100..3200, pixels 0..270).
Syntax & CLI Options
jplto8bit [-low <min>] [-middle <mid>] [-high <max>] [-nozero] <floatfile> <8bitfile>
| Option | Description | Default |
|---|---|---|
<floatfile> | Required. Input 32-bit float JHC_header file (data_type == 3). | None |
<8bitfile> | Required. Output 8-bit unsigned char JHC_header file (data_type = 1). | None |
-low <value> | Minimum float value mapped to digital number 0 (or 1 if -nozero). If both -low and -high are 0.0, auto-scans the file for min/max. | 0.0 (auto-detect) |
-high <value> | Maximum float value mapped to digital number 255. | 0.0 (auto-detect) |
-middle <value> | Midpoint float value mapped to digital number 128 for piecewise two-slope linear scaling. | (low + high) / 2.0 |
-nozero | Clamp non-zero input pixels that scale to 0 up to 1, preserving 0 strictly for nodata/background pixels. | Disabled |
How It Works
- Cross-Track Angular Normalization Table (
sum[0..1279]):- Seeks to scanline
2100(firstscan = 2100,lastscan = 3200, assumingdx = 1280) and averages the floating-point pixel intensities acrossfirstpixel = 0tolastpixel = 270. - Normalizes
sum[0..269]bysum[269]and setssum[270..1279] = 1.0.
- Seeks to scanline
- Range Determination: If
-lowand-highare both0.0, scans the input float array to find the minimum and maximum non-zero values and updatesJHChead.min_valueandJHChead.max_valuein both the output and input headers. - Normalization & Piecewise 8-bit Quantization:
- Divides each non-zero pixel
*pat columnxbysum[x]. - Scales values below
middlelinearly into[0, 128]and values abovemiddleinto[128, 255], clamping to[0, 255](or[1, 255]with-nozero).
- Divides each non-zero pixel
Examples
Normalize and convert a JPL SAR floating-point image to 8-bit:
jplto8bit -low 0.0 -middle 0.25 -high 1.0 -nozero jpl_sar.r4 jpl_sar.8bit